Skip to content

Add tests for canceling beforeunload#4800

Merged
domenic merged 3 commits intomasterfrom
fix-beforeunload
Feb 15, 2017
Merged

Add tests for canceling beforeunload#4800
domenic merged 3 commits intomasterfrom
fix-beforeunload

Conversation

@domenic
Copy link
Copy Markdown
Member

@domenic domenic commented Feb 11, 2017

Follows whatwg/html#2353.

@wpt-pr-bot
Copy link
Copy Markdown
Collaborator

@ghost
Copy link
Copy Markdown

ghost commented Feb 11, 2017

Chrome (unstable channel)

Testing web-platform-tests at revision dab6bb8a06664e8a27222105cad67939971ec229
Using browser at version 58.0.3004.3 dev
Starting 10 test iterations
All results were stable

All results

2 tests ran
/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling.html
Subtest Results
TIMEOUT
/html/webappapis/scripting/events/event-handler-processing-algorithm.html
Subtest Results
OK
mouseover listener returning true cancels event FAIL
click listener returning false cancels event PASS
blur listener returning false cancels event PASS
mouseover listener returning false doesn't cancel event FAIL
dblclick listener returning false cancels event PASS

@ghost
Copy link
Copy Markdown

ghost commented Feb 11, 2017

Firefox (nightly channel)

Testing web-platform-tests at revision dab6bb8a06664e8a27222105cad67939971ec229
Using browser at version BuildID 20170123125947; SourceStamp 36486fdc3813ef7943ae5b07b4128866d1938a6c
Starting 10 test iterations
All results were stable

All results

2 tests ran
/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling.html
Subtest Results
OK
Returning undefined with a real iframe unloading; setting returnValue to foo PASS
Returning true with a real iframe unloading; setting returnValue to foo PASS
Returning null with a real iframe unloading; setting returnValue to foo PASS
Returning undefined with a real iframe unloading PASS
Returning 0 with a real iframe unloading; setting returnValue to foo PASS
Returning with a real iframe unloading; setting returnValue to foo PASS
Returning null with a real iframe unloading PASS
Returning a string must not cancel the event: CustomEvent, non-cancelable PASS
Returning 0 with a real iframe unloading PASS
Returning with a real iframe unloading PASS
Returning false with a real iframe unloading PASS
Returning a string must not cancel the event: CustomEvent, cancelable PASS
Returning false with a real iframe unloading; setting returnValue to foo PASS
Returning true with a real iframe unloading PASS
/html/webappapis/scripting/events/event-handler-processing-algorithm.html
Subtest Results
OK
mouseover listener returning true cancels event PASS
click listener returning false cancels event PASS
blur listener returning false cancels event PASS
mouseover listener returning false doesn't cancel event PASS
dblclick listener returning false cancels event PASS

}
];

for (const testCase of testCases) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're trying to avoid using for const of since it's such a new construct.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works fine in all stable shipped browsers, so I've been using it in all my recent tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not supported in Servo yet; I thought I saw @annevk say something about it recently, but I can't find evidence of that now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I hope Servo catches up to Firefox's JS engine soon.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I don't recall saying anything about it. I'm personally on board with using new ECMAScript features as they tend to simplify writing tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're stuck on an older version until we get automated Rust to C++ bindings sorted out, which is an ongoing process.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdm do you feel it's reasonable like @Ms2ger to hold WPT PRs up over that though or is it fine if those tests fail in Servo until binding issues are sorted?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they're merged as-is and Servo needs the test coverage, we'll modify them. It would be nice to skip that step though!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's reasonable to expect all browser developers know what the limitations of Servo are. However for people who do know it feels like it isn't really in the spirit of the exercise to intentionally use features that are known to be problematic but have no substantial benefits.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, I don't know what Servo does and doesn't support. I wrote some tests as I normally do, using features that I feel have substantial benefits (your personal value judgment notwithstanding), and then was sidetracked by this discussion, where people started telling me things about Servo that I don't really intend to keep around in my mental map of the browser landscape.

@domenic
Copy link
Copy Markdown
Member Author

domenic commented Feb 14, 2017

Spec patch is merged.

assert_equals(ev.defaultPrevented, false);
t.done();
}, "beforeunload listener returning non-null doesn't cancel event");
// beforeunload is tested in beforeunload-canceling.html
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a clearer reference since it's not in the same directory. LGTM with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants