Title: [253760] trunk
Revision
253760
Author
[email protected]
Date
2019-12-19 09:55:36 -0800 (Thu, 19 Dec 2019)

Log Message

Resync web-platform-tests/beacon tests from upstream
https://bugs.webkit.org/show_bug.cgi?id=205417

Reviewed by Youenn Fablet.

Resync web-platform-tests/beacon tests from upstream 33de70caf7f076e.

* web-platform-tests/beacon/*: Updated.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,5 +1,16 @@
 2019-12-19  Chris Dumez  <[email protected]>
 
+        Resync web-platform-tests/beacon tests from upstream
+        https://bugs.webkit.org/show_bug.cgi?id=205417
+
+        Reviewed by Youenn Fablet.
+
+        Resync web-platform-tests/beacon tests from upstream 33de70caf7f076e.
+
+        * web-platform-tests/beacon/*: Updated.
+
+2019-12-19  Chris Dumez  <[email protected]>
+
         imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-installed.https.html is flaky
         https://bugs.webkit.org/show_bug.cgi?id=205408
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/META.yml (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/META.yml	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/META.yml	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1,3 @@
+spec: https://w3c.github.io/beacon/
+suggested_reviewers:
+  - igrigorik

Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/OWNERS (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/OWNERS	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/OWNERS	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,2 +0,0 @@
-@toddreifsteck
-@igrigorik

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-common.sub.js (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-common.sub.js	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-common.sub.js	2019-12-19 17:55:36 UTC (rev 253760)
@@ -138,33 +138,23 @@
 // Schedules async_test's for each of the test cases, treating them as a single session,
 // and wires up the continueAfterSendingBeacon() and waitForResults() calls.
 // The method looks for several "extension" functions in the global scope:
-//   - self.buildId: if present, can change the display name of a test.
 //   - self.buildBaseUrl: if present, can change the base URL of a beacon target URL (this
 //     is the scheme, hostname, and port).
 //   - self.buildTargetUrl: if present, can modify a beacon target URL (for example wrap it).
 // Parameters:
 //     testCases: An array of test cases.
-function runTests(testCases) {
-    var session = initSession(testCases);
+//     sendData [optional]: A function that sends the beacon.
+function runTests(testCases, sendData = self.sendData) {
+    const session = initSession(testCases);
 
     testCases.forEach(function(testCase, testIndex) {
         // Make a copy of the test case as we'll be storing some metadata on it,
         // such as which session it belongs to.
-        var testCaseCopy = Object.assign({ session: session }, testCase);
+        const testCaseCopy = Object.assign({ session: session }, testCase);
 
-        // Extension point: generate the test id.
-        var testId = testCase.id;
-        if (self.buildId) {
-            testId = self.buildId(testId);
-        }
-        testCaseCopy.origId = testCaseCopy.id;
-        testCaseCopy.id = testId;
         testCaseCopy.index = testIndex;
 
-        session.add(testCaseCopy);
-
-        // Schedule the sendbeacon in an async test.
-        async_test(function(test) {
+        async_test((test) => {
             // Save the testharness.js 'test' object, so that we only have one object
             // to pass around.
             testCaseCopy.test = test;
@@ -174,7 +164,7 @@
             if (self.buildBaseUrl) {
                 baseUrl = self.buildBaseUrl(baseUrl);
             }
-            var targetUrl = `${baseUrl}/beacon/resources/beacon.py?cmd=store&sid=${session.id}&tid=${testId}&tidx=${testIndex}`;
+            var targetUrl = `${baseUrl}/beacon/resources/beacon.py?cmd=store&sid=${session.id}&tid=${testCaseCopy.id}&tidx=${testIndex}`;
             if (self.buildTargetUrl) {
                 targetUrl = self.buildTargetUrl(targetUrl);
             }
@@ -181,15 +171,8 @@
             // Attach the URL to the test object for debugging purposes.
             testCaseCopy.url = ""
 
-            // Extension point: send the beacon immediately, or defer.
-            var sendFunc = test.step_func(function sendImmediately(testCase) {
-                var sendResult = sendData(testCase);
-                continueAfterSendingBeacon(sendResult, testCase);
-            });
-            if (self.sendFunc) {
-                sendFunc = test.step_func(self.sendFunc);
-            }
-            sendFunc(testCaseCopy);
+            assert_true(sendData(testCaseCopy), 'sendBeacon should succeed');
+            waitForResult(testCaseCopy).then(() => test.done(), test.step_func((e) => {throw e;}));
         }, `Verify 'navigator.sendbeacon()' successfully sends for variant: ${testCaseCopy.id}`);
     });
 }
@@ -201,161 +184,54 @@
 // the test.
 // Returns the result of the 'sendbeacon()' function call, true or false.
 function sendData(testCase) {
-    var sent = false;
-    if (testCase.data) {
-        sent = self.navigator.sendBeacon(testCase.url, testCase.data);
-    } else {
-        sent = self.navigator.sendBeacon(testCase.url)
-    }
-    return sent;
+    return self.navigator.sendBeacon(testCase.url, testCase.data);
 }
 
-// Continues a single test after the beacon has been sent for that test.
-// Will trigger waitForResults() for the session if this is the last test
-// in the session to send its beacon.
-// Assumption: will be called on the test's step_func so that assert's do
-// not have to be wrapped.
-function continueAfterSendingBeacon(sendResult, testCase) {
-    var session = testCase.session;
+// Poll the server for the test result.
+async function waitForResult(testCase) {
+    const session = testCase.session;
+    const index = testCase.index;
+    const url = ""
+    for (let i = 0; i < 30; ++i) {
+        const response = await fetch(url);
+        const text = await response.text();
+        const results = JSON.parse(text);
 
-    // Recaclulate the sent vs. total counts.
-    if (sendResult) {
-        session.sentCount++;
-    } else {
-        session.totalCount--;
+        if (results.length === 0) {
+          await new Promise(resolve => step_timeout(resolve, 100));
+          continue;
+        }
+        assert_equals(results.length, 1, `bad response: '${text}'`);;
+        // null JSON values parse as null, not undefined
+        assert_equals(results[0].error, null, "'sendbeacon' data must not fail validation");
+        return;
     }
-
-    // If this was the last test in the session to send its beacon, start polling for results.
-    // Note that we start polling even if just one test in the session sends successfully,
-    // so that if any of the others fail, we still get results from the tests that did send.
-    if (session.sentCount == session.totalCount) {
-        // Exit the current test's execution context in order to run the poll
-        // loop from the harness context.
-        step_timeout(waitForResults.bind(this, session), 0);
-    }
-
-    // Now fail this test if the beacon did not send. It will be excluded from the poll
-    // loop because of the calculation adjustment above.
-    assert_true(sendResult, "'sendbeacon' function call must succeed");
+    assert_true(false, 'timeout');
 }
 
-// Kicks off an asynchronous monitor to poll the server for test results. As we
-// verify that the server has received and validated a beacon, we will complete
-// its testharness test.
-function waitForResults(session) {
-    // Poll for status until all of the results come in.
-    fetch(`resources/beacon.py?cmd=stat&sid=${session.id}&tidx_min=0&tidx_max=${session.totalCount-1}`).then(
-        function(response) {
-            // Parse as text(), not json(), so that we can log the raw response if
-            // it's invalid.
-            response.text().then(function(rawResponse) {
-                // Check that we got a response we expect and know how to handle.
-                var results;
-                var failure;
-                try {
-                    results = JSON.parse(rawResponse);
-
-                    if (results.length === undefined) {
-                        failure = `bad validation response schema: rawResponse='${rawResponse}'`;
-                    }
-                } catch (e) {
-                    failure = `bad validation response: rawResponse='${rawResponse}', got parse error '${e}'`;
-                }
-
-                if (failure) {
-                    // At this point we can't deterministically get results for all of the
-                    // tests in the session, so fail the entire session.
-                    failSession(session, failure);
-                    return;
-                }
-
-                // The 'stat' call will return an array of zero or more results
-                // of sendbeacon() calls that the server has received and validated.
-                results.forEach(function(result) {
-                    var testCase = session.testCaseLookup[result.id];
-
-                    // While stash.take on the server is supposed to honor read-once, since we're
-                    // polling so frequently it is possible that we will receive the same test result
-                    // more than once.
-                    if (!testCase.done) {
-                        testCase.done = true;
-                        session.doneCount++;
-                    }
-
-                    // Validate that the sendbeacon() was actually sent to the server.
-                    var test = testCase.test;
-                    test.step(function() {
-                        // null JSON values parse as null, not undefined
-                        assert_equals(result.error, null, "'sendbeacon' data must not fail validation");
-                    });
-
-                    test.done();
-                });
-
-                // Continue polling until all of the results come in.
-                if (session.doneCount < session.sentCount) {
-                    // testharness.js frowns upon the use of explicit timeouts, but there is no way
-                    // around the need to poll for these tests, and there is no use spamming the server
-                    // with requestAnimationFrame() just to avoid the use of step_timeout.
-                    step_timeout(waitForResults.bind(this, session), 100);
-                }
-            }).catch(function(error) {
-                failSession(session, `unexpected error reading response, error='${error}'`);
-            });
-        }
-    );
-}
-
-// Fails all of the tests in the session, meant to be called when an infrastructural
-// issue prevents us from deterministically completing the individual tests.
-function failSession(session, reason) {
-    session.testCases.forEach(function(testCase) {
-        var test = testCase.test;
-        test.unreached_func(reason)();
-    });
-}
-
 // Creates an iframe on the document's body and runs the sample tests from the iframe.
 // The iframe is navigated immediately after it sends the data, and the window verifies
 // that the data is still successfully sent.
-//    funcName: "beacon" to send the data via navigator.sendBeacon(),
-//              "fetch" to send the data via fetch() with the keepalive flag.
-function runSendInIframeAndNavigateTests(funcName) {
+function runSendInIframeAndNavigateTests() {
     var iframe = document.createElement("iframe");
     iframe.id = "iframe";
     iframe._onload_ = function() {
-        var tests = Array();
-
         // Clear our onload handler to prevent re-running the tests as we navigate away.
-        this._onload_ = null;
-
-        // Implement the self.buildId extension to identify the parameterized
-        // test in the report.
-        self.buildId = function(baseId) {
-            return `${baseId}-${funcName}-NAVIGATE`;
-        };
-
-        window._onmessage_ = function(e) {
-            // The iframe will execute sendData() for us and return the result.
-            var testCase = tests[e.data];
-            continueAfterSendingBeacon(true /* sendResult */, testCase);
-        };
-
-        // Implement the self.sendFunc extension to send the beacon indirectly,
-        // from an iFrame that we can then navigate.
-        self.sendFunc = function(testCase) {
-            var iframeWindow = document.getElementById("iframe").contentWindow;
-            // We run into problems passing the testCase over the document boundary,
-            // because of structured cloning constraints. Instead we'll send over the
-            // test case id, and the iFrame can load the static test case by including
-            // beacon-common.js.
-            tests[testCase.origId] = testCase;
-            iframeWindow.postMessage([testCase.origId, testCase.url, funcName], "*");
-        };
-
-        runTests(sampleTests);
+        iframe._onload_ = null;
+        function sendData(testCase) {
+            return iframe.contentWindow.navigator.sendBeacon(testCase.url, testCase.data);
+        }
+        const tests = [];
+        for (const test of sampleTests) {
+            const copy = Object.assign({}, test);
+            copy.id = `${test.id}-NAVIGATE`;
+            tests.push(copy);
+        }
+        runTests(tests, sendData);
+        // Now navigate ourselves.
+        iframe.contentWindow.location = "http://{{host}}:{{ports[http][0]}}/";
     };
 
-    iframe.src = ""
+    iframe.srcdoc = '<html></html>';
     document.body.appendChild(iframe);
 }

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.sub.window-expected.txt (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.sub.window-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.sub.window-expected.txt	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1,23 @@
+
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-CORS-ALLOW 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-CORS-ALLOW 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-CORS-ALLOW 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-CORS-ALLOW 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-CORS-ALLOW 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-CORS-ALLOW 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-CORS-ALLOW 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-CORS-ALLOW 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-CORS-ALLOW 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-CORS-ALLOW 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-CORS-FORBID 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-CORS-FORBID 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-CORS-FORBID 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-CORS-FORBID 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-CORS-FORBID 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-CORS-FORBID 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-CORS-FORBID 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-CORS-FORBID 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-CORS-FORBID 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-CORS-FORBID 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallCORSContentTypeText-PREFLIGHT-ALLOW 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.sub.window.html (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.sub.window.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.sub.window.html	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.sub.window.js (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.sub.window.js	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.sub.window.js	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,3 +1,4 @@
+// META: timeout=long
 // META: script=/common/utils.js
 // META: script=beacon-common.sub.js
 
@@ -7,16 +8,10 @@
 // the beacon handler will return CORS headers. This test ensures that the
 // sendBeacon() succeeds in either case.
 [true, false].forEach(function(allowCors) {
-    // Implement the self.buildId extension to identify the parameterized
-    // test in the report.
-    self.buildId = function(baseId) {
-        return `${baseId}-${allowCors ? "CORS-ALLOW" : "CORS-FORBID"}`;
-    };
-
     // Implement the self.buildBaseUrl and self.buildTargetUrl extensions
     // to change the target URL to use a cross-origin domain name.
     self.buildBaseUrl = function(baseUrl) {
-        return "http://{{domains[www]}}:{{ports[http][0]}}";
+        return "http://{{hosts[alt][]}}:{{ports[http][0]}}";
     };
     // Implement the self.buildTargetUrl extension to append a directive
     // to the handler, that it should return CORS headers, if 'allowCors'
@@ -35,7 +30,13 @@
         return allowCors ? `${targetUrl}&origin=http://{{host}}:{{ports[http][0]}}&credentials=true` : targetUrl;
     }
 
-    runTests(sampleTests);
+    const tests = [];
+    for (const test of sampleTests) {
+        const copy = Object.assign({}, test);
+        copy.id = `${test.id}-${allowCors ? "CORS-ALLOW" : "CORS-FORBID"}`;
+        tests.push(copy);
+    }
+    runTests(tests);
 });
 
 // Now test a cross-origin request that doesn't use a safelisted Content-Type and ensure
@@ -43,16 +44,10 @@
 // header is used there should be a preflight/options request and we should only succeed
 // send the payload if the proper CORS headers are used.
 {
-    // Implement the self.buildId extension to identify the parameterized
-    // test in the report.
-    self.buildId = function (baseId) {
-        return `${baseId}-PREFLIGHT-ALLOW`;
-    };
-
     // Implement the self.buildBaseUrl and self.buildTargetUrl extensions
     // to change the target URL to use a cross-origin domain name.
     self.buildBaseUrl = function (baseUrl) {
-        return "http://{{domains[www]}}:{{ports[http][0]}}";
+        return "http://{{hosts[alt][]}}:{{ports[http][0]}}";
     };
 
     // Implement the self.buildTargetUrl extension to append a directive
@@ -60,8 +55,13 @@
     self.buildTargetUrl = function (targetUrl) {
         return `${targetUrl}&origin=http://{{host}}:{{ports[http][0]}}&credentials=true&preflightExpected=true`;
     }
-
-    runTests(preflightTests);
+    const tests = [];
+    for (const test of preflightTests) {
+        const copy = Object.assign({}, test);
+        copy.id = `${test.id}-PREFLIGHT-ALLOW`;
+        tests.push(copy);
+    }
+    runTests(tests);
 }
 
-done();
\ No newline at end of file
+done();

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.sub.window-expected.txt (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.sub.window-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.sub.window-expected.txt	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1,6 @@
+
+PASS Verify calling 'navigator.sendBeacon()' with a large payload returns 'false'. 
+PASS Verify calling 'navigator.sendBeacon()' with an invalid URL throws an exception. 
+PASS Verify calling 'navigator.sendBeacon()' with a URL that is not a http(s) scheme throws an exception. 
+PASS Verify the behavior after the quota is exhausted. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.sub.window.html (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.sub.window.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.sub.window.html	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.sub.window.js (from rev 253759, trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.window.js) (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.sub.window.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.sub.window.js	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1,48 @@
+// META: script=/common/utils.js
+// META: script=beacon-common.sub.js
+
+"use strict";
+
+test(function() {
+    // Payload that should cause sendBeacon to return false because it exceeds the maximum payload size.
+    var exceedPayload = Array(maxPayloadSize + 1).fill('z').join("");
+
+    var success = navigator.sendBeacon("http://{{hosts[][nonexistent]}}", exceedPayload);
+    assert_false(success, "calling 'navigator.sendBeacon()' with payload size exceeding the maximum size must fail");
+}, "Verify calling 'navigator.sendBeacon()' with a large payload returns 'false'.");
+
+test(function() {
+    var invalidUrl = "http://invalid:url";
+    assert_throws(new TypeError(), function() { navigator.sendBeacon(invalidUrl, smallPayload); },
+        `calling 'navigator.sendBeacon()' with an invalid URL '${invalidUrl}' must throw a TypeError`);
+}, "Verify calling 'navigator.sendBeacon()' with an invalid URL throws an exception.");
+
+test(function() {
+    var invalidUrl = "nothttp://invalid.url";
+    assert_throws(new TypeError(), function() { navigator.sendBeacon(invalidUrl, smallPayload); },
+         `calling 'navigator.sendBeacon()' with a non-http(s) URL '${invalidUrl}' must throw a TypeError`);
+}, "Verify calling 'navigator.sendBeacon()' with a URL that is not a http(s) scheme throws an exception.");
+
+// We'll validate that we can send one beacon that uses our entire Quota and then fail to send one that is just one char.
+promise_test(async () => {
+    function wait(ms) {
+        return new Promise(res => step_timeout(res, ms));
+    }
+    const url = '';
+    assert_true(navigator.sendBeacon(url, maxPayload),
+                "calling 'navigator.sendBeacon()' with our max payload size should succeed.");
+
+    // Now we'll send just one character.
+    assert_false(navigator.sendBeacon(url, '1'),
+                 "calling 'navigator.sendBeacon()' with just one char should fail while our Quota is used up.");
+
+    for (let i = 0; i < 20; ++i) {
+        await wait(100);
+        if (navigator.sendBeacon(url, maxPayload)) {
+           return;
+        }
+    }
+    assert_unreached('The quota should recover after fetching.');
+}, "Verify the behavior after the quota is exhausted.");
+
+done();

Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.window.js (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.window.js	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.window.js	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,48 +0,0 @@
-// META: script=/common/utils.js
-// META: script=beacon-common.sub.js
-
-"use strict";
-
-test(function() {
-    // Payload that should cause sendBeacon to return false because it exceeds the maximum payload size.
-    var exceedPayload = Array(maxPayloadSize + 1).fill('z').join("");
-
-    var success = navigator.sendBeacon("http://doesnotmatter", exceedPayload);
-    assert_false(success, "calling 'navigator.sendBeacon()' with payload size exceeding the maximum size must fail");
-}, "Verify calling 'navigator.sendBeacon()' with a large payload returns 'false'.");
-
-test(function() {
-    var invalidUrl = "http://invalid:url";
-    assert_throws(new TypeError(), function() { navigator.sendBeacon(invalidUrl, smallPayload); },
-        `calling 'navigator.sendBeacon()' with an invalid URL '${invalidUrl}' must throw a TypeError`);
-}, "Verify calling 'navigator.sendBeacon()' with an invalid URL throws an exception.");
-
-test(function() {
-    var invalidUrl = "nothttp://invalid.url";
-    assert_throws(new TypeError(), function() { navigator.sendBeacon(invalidUrl, smallPayload); },
-         `calling 'navigator.sendBeacon()' with a non-http(s) URL '${invalidUrl}' must throw a TypeError`);
-}, "Verify calling 'navigator.sendBeacon()' with a URL that is not a http(s) scheme throws an exception.");
-
-// We'll validate that we can send one beacon that uses our entire Quota and then fail to send one that is just one char.
-promise_test(async () => {
-    function wait(ms) {
-        return new Promise(res => step_timeout(res, ms));
-    }
-    const url = '';
-    assert_true(navigator.sendBeacon(url, maxPayload),
-                "calling 'navigator.sendBeacon()' with our max payload size should succeed.");
-
-    // Now we'll send just one character.
-    assert_false(navigator.sendBeacon(url, '1'),
-                 "calling 'navigator.sendBeacon()' with just one char should fail while our Quota is used up.");
-
-    for (let i = 0; i < 20; ++i) {
-        await wait(100);
-        if (navigator.sendBeacon(url, maxPayload)) {
-           return;
-        }
-    }
-    assert_unreached('The quota should recover after fetching.');
-}, "Verify the behavior after the quota is exhausted.");
-
-done();

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-navigate-expected.txt (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-navigate-expected.txt	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-navigate-expected.txt	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,13 +1,13 @@
 
 
-PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-beacon-NAVIGATE 
-PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-beacon-NAVIGATE 
-PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-beacon-NAVIGATE 
-PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-beacon-NAVIGATE 
-PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-beacon-NAVIGATE 
-PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-beacon-NAVIGATE 
-PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-beacon-NAVIGATE 
-PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-beacon-NAVIGATE 
-PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-beacon-NAVIGATE 
-PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-beacon-NAVIGATE 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-NAVIGATE 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-NAVIGATE 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-NAVIGATE 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-NAVIGATE 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-NAVIGATE 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-NAVIGATE 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-NAVIGATE 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-NAVIGATE 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-NAVIGATE 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-NAVIGATE 
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-readablestream.window-expected.txt (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-readablestream.window-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-readablestream.window-expected.txt	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1,3 @@
+
+PASS sendBeacon() with a stream does not work due to the keepalive flag being set 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-readablestream.window.html (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-readablestream.window.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-readablestream.window.html	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-readablestream.window.js (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-readablestream.window.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-readablestream.window.js	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1,3 @@
+test(() => {
+  assert_throws(new TypeError(), () => navigator.sendBeacon("...", new ReadableStream()));
+}, "sendBeacon() with a stream does not work due to the keepalive flag being set");

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-redirect.window-expected.txt (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-redirect.window-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-redirect.window-expected.txt	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1,22 @@
+
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-307 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-307 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-307 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-307 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-307 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-307 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-307 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-307 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-307 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-307 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-308 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-308 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-308 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-308 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-308 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-308 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-308 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-308 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-308 
+PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-308 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-redirect.window.html (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-redirect.window.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-redirect.window.html	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-redirect.window.js (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-redirect.window.js	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-redirect.window.js	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,3 +1,4 @@
+// META: timeout=long
 // META: script=/common/utils.js
 // META: script=beacon-common.sub.js
 
@@ -7,19 +8,18 @@
 // Note that status codes 307 and 308 are the only codes that will maintain POST data
 // through a redirect.
 [307, 308].forEach(function(status) {
-    // Implement the self.buildId extension to identify the parameterized
-    // test in the report.
-    self.buildId = function(baseId) {
-        return `${baseId}-${status}`;
-    };
-
     // Implement the self.buildTargetUrl extension to inject a redirect to
     // the sendBeacon target.
     self.buildTargetUrl = function(targetUrl) {
         return `/common/redirect.py?status=${status}&location=${encodeURIComponent(targetUrl)}`;
     };
-
-    runTests(sampleTests);
+    const tests = [];
+    for (const test of sampleTests) {
+        const copy = Object.assign({}, test);
+        copy.id = `${test.id}-${status}`;
+        tests.push(copy);
+    }
+    runTests(tests);
 });
 
 done();

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-strict-origin-when-cross-origin.https-expected.txt (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-strict-origin-when-cross-origin.https-expected.txt	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-strict-origin-when-cross-origin.https-expected.txt	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,4 +1,4 @@
 
-PASS Test referer header https://localhost:9443/beacon/resources/ 
-PASS Test referer header http://localhost:8800/beacon/resources/ 
+PASS Test referer header https://127.0.0.1:9443/beacon/resources/ 
+PASS Test referer header http://127.0.0.1:8800/beacon/resources/ 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-strict-origin-when-cross-origin.https.html (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-strict-origin-when-cross-origin.https.html	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-strict-origin-when-cross-origin.https.html	2019-12-19 17:55:36 UTC (rev 253760)
@@ -12,10 +12,10 @@
     <script src=""
     <script src=""
     <script>
-      var testBase = get_host_info().HTTPS_ORIGIN +  RESOURCES_DIR;
+      var testBase = get_host_info().HTTPS_REMOTE_ORIGIN +  RESOURCES_DIR;
       testReferrerHeader(testBase, referrerOrigin);
-      testBase = get_host_info().HTTP_ORIGIN + RESOURCES_DIR;
-      testReferrerHeader(testBase, "");
+      testBase = get_host_info().HTTP_REMOTE_ORIGIN + RESOURCES_DIR;
+      testReferrerHeader(testBase, "", true);
     </script>
   </body>
 </html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-strict-origin.https.html (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-strict-origin.https.html	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-strict-origin.https.html	2019-12-19 17:55:36 UTC (rev 253760)
@@ -15,7 +15,7 @@
       var testBase = get_host_info().HTTPS_ORIGIN +  RESOURCES_DIR;
       testReferrerHeader(testBase, referrerOrigin);
       testBase = get_host_info().HTTP_ORIGIN + RESOURCES_DIR;
-      testReferrerHeader(testBase, "");
+      testReferrerHeader(testBase, "", true);
     </script>
   </body>
 </html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-unsafe-url.https-expected.txt (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-unsafe-url.https-expected.txt	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-unsafe-url.https-expected.txt	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,3 +1,4 @@
 
+PASS Test referer header https://localhost:9443/beacon/resources/ 
 PASS Test referer header http://localhost:8800/beacon/resources/ 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-unsafe-url.https.html (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-unsafe-url.https.html	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-unsafe-url.https.html	2019-12-19 17:55:36 UTC (rev 253760)
@@ -12,8 +12,10 @@
     <script src=""
     <script src=""
     <script>
-      var testBase = get_host_info().HTTP_ORIGIN + RESOURCES_DIR;
+      var testBase = get_host_info().HTTPS_ORIGIN +  RESOURCES_DIR;
       testReferrerHeader(testBase, referrerUrl);
+      testBase = get_host_info().HTTP_ORIGIN + RESOURCES_DIR;
+      testReferrerHeader(testBase, referrerUrl, true);
     </script>
   </body>
 </html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer.js (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer.js	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer.js	2019-12-19 17:55:36 UTC (rev 253760)
@@ -3,12 +3,15 @@
 var referrerOrigin = self.location.origin + '/';
 var referrerUrl = self.location.href;
 
-function testReferrerHeader(testBase, expectedReferrer) {
+function testReferrerHeader(testBase, expectedReferrer, mayBeBlockedAsMixedContent = false) {
   var id = self.token();
   var testUrl = testBase + "inspect-header.py?header=referer&cmd=put&id=" + id;
 
   promise_test(function(test) {
-    assert_true(navigator.sendBeacon(testUrl), "SendBeacon Succeeded");
+    const sentBeacon = navigator.sendBeacon(testUrl);
+    if (mayBeBlockedAsMixedContent && !sentBeacon)
+      return Promise.resolve();
+    assert_true(sentBeacon, "SendBeacon Succeeded");
     return pollResult(expectedReferrer, id) .then(result => {
       assert_equals(result, expectedReferrer, "Correct referrer header result");
     });

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/w3c-import.log (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/w3c-import.log	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/w3c-import.log	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,7 +1,7 @@
 The tests in this directory were imported from the W3C repository.
 Do NOT modify these tests directly in WebKit.
 Instead, create a pull request on the WPT github:
-	https://github.com/w3c/web-platform-tests
+	https://github.com/web-platform-tests/wpt
 
 Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any-expected.txt (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any-expected.txt	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1,17 @@
+
+PASS idl_test setup 
+PASS idl_test validation 
+PASS Partial interface Navigator: original interface defined 
+PASS Partial interface Navigator: member names are unique 
+PASS Partial interface mixin NavigatorID: member names are unique 
+PASS Navigator includes NavigatorID: member names are unique 
+PASS Navigator includes NavigatorLanguage: member names are unique 
+PASS Navigator includes NavigatorOnLine: member names are unique 
+PASS Navigator includes NavigatorContentUtils: member names are unique 
+PASS Navigator includes NavigatorCookies: member names are unique 
+PASS Navigator includes NavigatorPlugins: member names are unique 
+PASS Navigator includes NavigatorConcurrentHardware: member names are unique 
+PASS Navigator interface: operation sendBeacon(USVString, BodyInit) 
+PASS Navigator interface: navigator must inherit property "sendBeacon(USVString, BodyInit)" with the proper type 
+PASS Navigator interface: calling sendBeacon(USVString, BodyInit) on navigator with too few arguments must throw TypeError 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.html (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.html	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.js (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.js	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1,14 @@
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+
+// https://w3c.github.io/beacon/
+
+idl_test(
+  ['beacon'],
+  ['html'],
+  idl_array => {
+    idl_array.add_objects({
+      Navigator: ['navigator'],
+    });
+  }
+);

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.worker-expected.txt (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.worker-expected.txt	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1,16 @@
+
+PASS idl_test setup 
+PASS idl_test validation 
+PASS Partial interface Navigator: original interface defined 
+PASS Partial interface Navigator: member names are unique 
+PASS Partial interface mixin NavigatorID: member names are unique 
+PASS Navigator includes NavigatorID: member names are unique 
+PASS Navigator includes NavigatorLanguage: member names are unique 
+PASS Navigator includes NavigatorOnLine: member names are unique 
+PASS Navigator includes NavigatorContentUtils: member names are unique 
+PASS Navigator includes NavigatorCookies: member names are unique 
+PASS Navigator includes NavigatorPlugins: member names are unique 
+PASS Navigator includes NavigatorConcurrentHardware: member names are unique 
+PASS Navigator interface: existence and properties of interface object 
+PASS Navigator interface: navigator must not have property "sendBeacon" 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.worker.html (0 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.worker.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.worker.html	2019-12-19 17:55:36 UTC (rev 253760)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/navigate.iFrame.sub.html (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/navigate.iFrame.sub.html	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/navigate.iFrame.sub.html	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <title>W3C Beacon As Fetch (Fetch KeepAlive) Navigate Test</title>
-</head>
-<body>
-    <script src=""
-    <script>
-        "use strict";
-
-        // An array should be passed through postMessage to this iFrame, where
-        //     [0] contains a test case id as defined in beacon-common.js.
-        //     [1] is the URL for the keep alive fetch() or sendBeacon().
-        //     [2] string indicating the function to call - "fetch" to call fetch() or "beacon" to call sendBeacon().
-        // The testcase id is returned back to the window through postMesage.
-        var tests = 0;
-        window._onmessage_ = function(e) {
-            var testCaseId = e.data[0];
-            var url = ""
-            var func = e.data[2];
-            tests++;
-
-            // Reconstruct enough of the test case to send the keep alive fetch (data and url).
-            var testCase = testLookup[testCaseId];
-            testCase.url = ""
-
-            if (func === "beacon") {
-                // sendData calls sendBeacon
-                sendData(testCase);
-            }
-            else {
-                throw new Error(func + " is an invalid function");
-            }
-
-            // Let the main page continue the test if we don't immediately throw an exception.
-            parent.postMessage(testCaseId, "*");
-
-            // Now navigate ourselves.
-            if (tests == sampleTests.length) {
-                window.location = "http://{{host}}:{{ports[http][0]}}/";
-            }
-        }
-    </script>
-</body>
-</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/w3c-import.log (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/w3c-import.log	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/w3c-import.log	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,7 +1,7 @@
 The tests in this directory were imported from the W3C repository.
 Do NOT modify these tests directly in WebKit.
 Instead, create a pull request on the WPT github:
-	https://github.com/w3c/web-platform-tests
+	https://github.com/web-platform-tests/wpt
 
 Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/w3c-import.log (253759 => 253760)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/w3c-import.log	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/w3c-import.log	2019-12-19 17:55:36 UTC (rev 253760)
@@ -1,7 +1,7 @@
 The tests in this directory were imported from the W3C repository.
 Do NOT modify these tests directly in WebKit.
 Instead, create a pull request on the WPT github:
-	https://github.com/w3c/web-platform-tests
+	https://github.com/web-platform-tests/wpt
 
 Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
 
@@ -14,7 +14,7 @@
 None
 ------------------------------------------------------------------------
 List of files:
-/LayoutTests/imported/w3c/web-platform-tests/beacon/OWNERS
+/LayoutTests/imported/w3c/web-platform-tests/beacon/META.yml
 /LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-basic-blob.html
 /LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-basic-blobMax.html
 /LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-basic-buffersource.html
@@ -25,7 +25,8 @@
 /LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-basic-stringMax.html
 /LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-common.sub.js
 /LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.sub.window.js
-/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.window.js
+/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-error.sub.window.js
 /LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-navigate.html
+/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-readablestream.window.js
 /LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-redirect.window.js
-/LayoutTests/imported/w3c/web-platform-tests/beacon/navigate.iFrame.sub.html
+/LayoutTests/imported/w3c/web-platform-tests/beacon/idlharness.any.js

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_converter.py (253759 => 253760)


--- trunk/Tools/Scripts/webkitpy/w3c/test_converter.py	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_converter.py	2019-12-19 17:55:36 UTC (rev 253760)
@@ -48,9 +48,15 @@
 
     Returns the list of modified properties and the modified text if the file was modifed, None otherwise."""
     contents = host.filesystem.read_text_file(filename)
+
+    # WebKit does not have a www test domain.
+    contents = contents.replace('{{domains[www]}}', '{{hosts[alt][]}}')
+
     converter = _W3CTestConverter(new_path, filename, reference_support_info, host, convert_test_harness_links, webkit_test_runner_options)
     if filename.endswith('.css'):
         return converter.add_webkit_prefix_to_unprefixed_properties_and_values(contents)
+    elif filename.endswith('.js'):
+        return ([], [], contents)
     else:
         converter.feed(contents)
         converter.close()

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_importer.py (253759 => 253760)


--- trunk/Tools/Scripts/webkitpy/w3c/test_importer.py	2019-12-19 17:48:47 UTC (rev 253759)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_importer.py	2019-12-19 17:55:36 UTC (rev 253760)
@@ -446,7 +446,7 @@
 
         # We currently need to rewrite css web-platform-tests because they use a separate "reference" folder for
         # their ref-tests' results.
-        folders_needing_file_rewriting = ['web-platform-tests/css', ]
+        folders_needing_file_rewriting = ['web-platform-tests/']
 
         for dir_to_copy in self.import_list:
             total_imported_tests += dir_to_copy['total_tests']
@@ -510,7 +510,7 @@
                 # FIXME: Eventually, so should js when support is added for this type of conversion
                 mimetype = mimetypes.guess_type(orig_filepath)
                 if should_rewrite_files and ('text/' in str(mimetype[0]) or 'application/' in str(mimetype[0])) \
-                                        and ('html' in str(mimetype[0]) or 'xml' in str(mimetype[0])  or 'css' in str(mimetype[0])):
+                                        and ('html' in str(mimetype[0]) or 'xml' in str(mimetype[0])  or 'css' in str(mimetype[0]) or '_javascript_' in str(mimetype[0])):
                     _log.info("Rewriting: %s" % new_filepath)
                     try:
                         converted_file = convert_for_webkit(new_path, filename=orig_filepath, reference_support_info=reference_support_info, host=self.host, convert_test_harness_links=self.should_convert_test_harness_links(subpath), webkit_test_runner_options=self._webkit_test_runner_options(new_filepath))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to