-
Notifications
You must be signed in to change notification settings - Fork 3.6k
HTML: document.open() and tasks #10818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1680ac5
HTML: document.open() and tasks
annevk 88a49f2
add a postMessage test
annevk d376ffd
More tests
TimothyGu 04cd24d
Pass linting
TimothyGu cc73057
Use /common/blank.html
TimothyGu a8c861e
experiment with promise rejection: ignore uncaught exceptions
TimothyGu 89a8677
Fix Safari
TimothyGu e9d76e4
Better fix
TimothyGu 1f8ecd0
Remove 005
TimothyGu 8b7bd3c
address some comments
TimothyGu fcf210e
More comments
TimothyGu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
address some comments
- Loading branch information
commit 8b7bd3c825d5e4f790edb060117dc26488768880
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,22 +10,25 @@ | |
| // second actually calls document.open() to test if the method call removes | ||
| // that specific task from the queue. | ||
|
|
||
| // This is necessary to allow the promise rejection test below. | ||
| setup({ | ||
| allow_uncaught_exception: true | ||
| }); | ||
|
|
||
| function taskTest(description, testBody) { | ||
| async_test(t => { | ||
| const frame = document.body.appendChild(document.createElement("iframe")); | ||
| // The empty HTML seems to be necessary to cajole Chrome into firing a load | ||
| // event, which is necessary to make sure the frame's document doesn't have | ||
| // a parser associated with it. | ||
| // The empty HTML seems to be necessary to cajole Chrome and Safari into | ||
| // firing a load event asynchronously, which is necessary to make sure the | ||
| // frame's document doesn't have a parser associated with it. | ||
| // See: https://bugs.chromium.org/p/chromium/issues/detail?id=875354 | ||
| frame.src = "/common/blank.html"; | ||
| t.add_cleanup(() => frame.remove()); | ||
| frame.onload = t.step_func(() => { | ||
| // Make sure there is no parser. Firefox seems to have an additional | ||
| // non-spec-compliant readiness state "uninitialized", so test for the | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you file/link to a bug for this? |
||
| // two known valid readiness states instead. | ||
| // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1191683 | ||
| assert_in_array(frame.contentDocument.readyState, ["interactive", "complete"]); | ||
| testBody(t, frame, doc => {}); | ||
| }); | ||
|
|
@@ -49,14 +52,8 @@ function taskTest(description, testBody) { | |
| } | ||
|
|
||
| taskTest("timeout", (t, frame, open) => { | ||
| let happened = false; | ||
| // Work around the lint script, since we can't use step_timeout here. | ||
| frame.contentWindow['setTimeout'](() => happened = true, 100); | ||
| frame.contentWindow.setTimeout(t.step_func_done(), 100); | ||
| open(frame.contentDocument); | ||
| t.step_timeout(() => { | ||
| assert_true(happened); | ||
| t.done(); | ||
| }, 200); | ||
| }); | ||
|
|
||
| taskTest("window message", (t, frame, open) => { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point to the reason this is needed? (the promise rejection test below)
Reason being that this can also mask other problems with the test, so usage should be well motivated. (and is)