Skip to content

Commit

Permalink
Resync imported/w3c/web-platform-tests/html/webappapis WPT tests from…
Browse files Browse the repository at this point in the history
… upstream

https://bugs.webkit.org/show_bug.cgi?id=203298

Reviewed by Youenn Fablet.

Resync imported/w3c/web-platform-tests/html/webappapis WPT tests from upstream 32ffb13f7f7fce355bf.

* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window-expected.txt:
* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js:
(async_test.t.window.handlers.afterOpen.t.step_func_done):
(async_test.t.window.handlers.afterOpenAsync.t.step_func_done):
* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/location-set-and-document-open-expected.txt: Added.
* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/location-set-and-document-open.html: Added.
* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/w3c-import.log:
* web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.serviceworker-expected.txt: Added.
* web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.serviceworker.html: Added.
* web-platform-tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/disallow-crossorigin.html:
* web-platform-tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/support/promise-access-control.py:
(main):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
[email protected] committed Oct 23, 2019
1 parent 3109031 commit b6ab4b8
Show file tree
Hide file tree
Showing 12 changed files with 157 additions and 20 deletions.
22 changes: 22 additions & 0 deletions LayoutTests/imported/w3c/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
2019-10-23 Chris Dumez <[email protected]>

Resync imported/w3c/web-platform-tests/html/webappapis WPT tests from upstream
https://bugs.webkit.org/show_bug.cgi?id=203298

Reviewed by Youenn Fablet.

Resync imported/w3c/web-platform-tests/html/webappapis WPT tests from upstream 32ffb13f7f7fce355bf.

* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window-expected.txt:
* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js:
(async_test.t.window.handlers.afterOpen.t.step_func_done):
(async_test.t.window.handlers.afterOpenAsync.t.step_func_done):
* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/location-set-and-document-open-expected.txt: Added.
* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/location-set-and-document-open.html: Added.
* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/w3c-import.log:
* web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.serviceworker-expected.txt: Added.
* web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.serviceworker.html: Added.
* web-platform-tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/disallow-crossorigin.html:
* web-platform-tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/support/promise-access-control.py:
(main):

2019-10-22 Simon Fraser <[email protected]>

wpt/css/css-images/gradient/color-stops-parsing.html fails
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

PASS document.open() after parser is aborted
PASS async document.open() after parser is aborted
FAIL document.open() after parser is aborted assert_false: child document should not be empty expected false got true
FAIL async document.open() after parser is aborted assert_false: child document should not be empty expected false got true

Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
// document.open() bails out early if there is an **active parser** with
// non-zero script nesting level. window.stop() aborts the current parser and
// makes it no longer active, and should allow document.open() to work.
// For more details, see https://bugzilla.mozilla.org/show_bug.cgi?id=1475000.
// document.open() bails out early if there is an active parser with non-zero
// script nesting level or if a load was aborted while there was an active
// parser. window.stop() aborts the current parser, so once it has been called
// while a parser is active, document.open() will no longer do anything to that
// document,

window.handlers = {};

async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
frame.src = "resources/aborted-parser-frame.html";
window.handlers.afterOpen = t.step_func_done(() => {
const openCalled = frame.contentDocument.childNodes.length === 0;
frame.remove();
assert_true(openCalled, "child document should be empty");
assert_false(openCalled, "child document should not be empty");
assert_equals(frame.contentDocument.querySelector("p").textContent,
"Text", "Should still have our paragraph");
});
}, "document.open() after parser is aborted");

// Note: This test should pass even if window.close() is not there, as
// document.open() is not executed synchronously in an inline script.
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
frame.src = "resources/aborted-parser-async-frame.html";
window.handlers.afterOpenAsync = t.step_func_done(() => {
const openCalled = frame.contentDocument.childNodes.length === 0;
frame.remove();
assert_true(openCalled, "child document should be empty");
assert_false(openCalled, "child document should not be empty");
assert_equals(frame.contentDocument.querySelector("p").textContent,
"Text", "Should still have our paragraph");
});
}, "async document.open() after parser is aborted");
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


PASS Location sets should cancel current navigation and prevent later document.open() from doing anything

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!doctype html>
<meta charset=utf-8>
<title></title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<body>
<script>
var t = async_test("Location sets should cancel current navigation and prevent later document.open() from doing anything");

var finishTest = t.step_func_done(function() {
assert_equals(frames[0].document.body.textContent, "PASS",
"Should not have FAIL in our textContent");
});

t.step(function() {
var i = document.createElement("iframe");
i.srcdoc = `
<script>
var blob = new Blob(["PASS"], { type: "text/html" });
var url = URL.createObjectURL(blob);
location.href = url;
frameElement.onload = parent.finishTest;
document.open();
document.write("FAIL");
document.close();
<\/script>`;
document.body.appendChild(i);
});

</script>
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ List of files:
/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/history-state.window.js
/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/history.window.js
/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/ignore-opens-during-unload.window.js
/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/location-set-and-document-open.html
/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js
/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-observer.window.js
/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/no-new-global.window.js
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

FAIL [[CanBlock]] in a ServiceWorkerGlobalScope Can't find variable: SharedArrayBuffer

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,82 @@
<script>
'use strict';

setup({
allow_uncaught_exception: true
});

(function() {
var resolveLoaded;
var loadedPromise = new Promise(function(resolve) { resolveLoaded = resolve; });

async_test(function(t) {
addEventListener('unhandledrejection', t.unreached_func('unhandledrejection event should never be triggered'));
addEventListener('rejectionhandled', t.unreached_func('rejectionhandled event should never be triggered'));
promise_test(function(t) {
var unreachedUnhandled = t.unreached_func('unhandledrejection event should never be triggered');
var unreachedHandled = t.unreached_func('rejectionhandled event should never be triggered');

addEventListener('unhandledrejection', unreachedUnhandled);
addEventListener('rejectionhandled', unreachedHandled);
ensureCleanup(t, unreachedUnhandled, unreachedHandled);

return loadedPromise.then(t.step_func(function() {
return new Promise(function(resolve) {
t.step_timeout(function() {
resolve();
}, 1000);
});
}));
}, 'Promise rejection event should be muted for cross-origin non-CORS script');

promise_test(function(t) {
var unreachedUnhandled = t.unreached_func('unhandledrejection event should never be triggered');
var unreachedHandled = t.unreached_func('rejectionhandled event should never be triggered');

loadedPromise.then(t.step_func(function() {
addEventListener('unhandledrejection', unreachedUnhandled);
addEventListener('rejectionhandled', unreachedHandled);
ensureCleanup(t, unreachedUnhandled, unreachedHandled);

return new Promise(function(resolve) {
handleRejectedPromise(new Promise(function(resolve, reject) { reject(42); }));
t.step_timeout(function() {
t.done();
resolve();
}, 1000);
});
}, 'Promise rejection should be muted if the rejected promise is handled in cross-origin non-CORS script');

promise_test(function(t) {
var promise = new Promise(function(resolve, reject) { reject(42); });
var resolveReceived;
var eventPromise = new Promise(function(resolve) { resolveReceived = resolve; });
var unhandled = t.step_func(function(e) {
if (e.promise === promise) {
handleRejectedPromise(promise);
resolveReceived();
}
});
var unreachedHandled = t.unreached_func('rejectionhandled event should never be triggered');

addEventListener('unhandledrejection', unhandled);
addEventListener('rejectionhandled', unreachedHandled);
ensureCleanup(t, unhandled, unreachedHandled);

return eventPromise.then(t.step_func(function() {
return new Promise(function(resolve) {
t.step_timeout(function() {
resolve();
}, 1000);
});
}));
}, 'Promise rejection event should be muted for cross-origin non-CORS script');
}, 'Promise rejection should be muted if the rejected promise is handled in unhandledrejection event handler in cross-origin non-CORS script');

function ensureCleanup(t, unhandled, handled) {
t.add_cleanup(function() {
if (unhandled) {
removeEventListener('unhandledrejection', unhandled);
}
if (handled) {
removeEventListener('rejectionhandled', handled);
}
});
}

var scriptEl = document.createElement('script');
scriptEl.src = CROSSDOMAIN + 'support/promise-access-control.py?allow=false';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ def main(request, response):
if allow != "false":
headers.append(("Access-Control-Allow-Origin", "*"))

body = "new Promise(function(resolve, reject) { reject(42); })"
body = """
function handleRejectedPromise(promise) {
promise.catch(() => {});
}
(function() {
new Promise(function(resolve, reject) { reject(42); });
})();
"""

return headers, body
1 change: 1 addition & 0 deletions LayoutTests/platform/mac-wk1/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-i
imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes.any.serviceworker.html [ Skip ]
imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-store-cursors.any.serviceworker.html [ Skip ]
imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-store.any.serviceworker.html [ Skip ]
imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.serviceworker.html [ Skip ]

# Quota check missing in WK1
http/tests/IndexedDB/storage-limit.https.html [ Skip ]
Expand Down
3 changes: 2 additions & 1 deletion LayoutTests/platform/win/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -3821,6 +3821,7 @@ imported/w3c/web-platform-tests/fetch/api/request/destination [ Skip ]
imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy [ Skip ]
imported/w3c/web-platform-tests/server-timing/service_worker_idl.html [ Skip ]
imported/w3c/web-platform-tests/service-workers [ Skip ]
imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.serviceworker.html [ Skip ]

# No header filtering for WK1
http/wpt/loading/redirect-headers.html [ Skip ]
Expand Down Expand Up @@ -4491,4 +4492,4 @@ webkit.org/b/202951 fast/canvas/drawImage-animated-gif-draws-first-frame-and-no-

webkit.org/b/202952 http/tests/security/navigate-when-restoring-cached-page.html [ Timeout ]

webkit.org/b/202953 http/tests/websocket/tests/hybi/non-document-mixed-content-blocked-https-with-embedded-http-with-embedded-https.https.html [ Timeout ]
webkit.org/b/202953 http/tests/websocket/tests/hybi/non-document-mixed-content-blocked-https-with-embedded-http-with-embedded-https.https.html [ Timeout ]

0 comments on commit b6ab4b8

Please sign in to comment.