Title: [258431] trunk/LayoutTests
Revision
258431
Author
[email protected]
Date
2020-03-13 14:32:45 -0700 (Fri, 13 Mar 2020)

Log Message

Add mixed content block test for imported scripts in worker global scope
https://bugs.webkit.org/show_bug.cgi?id=209075
<rdar://problem/27483005>

Reviewed by Brent Fulgham.

* http/tests/security/mixedContent/insecure-worker-global-scope-expected.txt: Added.
* http/tests/security/mixedContent/insecure-worker-global-scope.html: Added.
* http/tests/security/mixedContent/resources/worker-importing-insecure-script.js: Added.
* http/tests/security/mixedContent/resources/worker-importing-secure-script.js: Added.
* http/tests/security/mixedContent/resources/worker-sending-message.js: Added.
* platform/mac-wk1/TestExpectations:
    Test for some reason fails on Mojave Debug WK1 but not on Mojave Release WK1 or other bots.
    Therefore skipped.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (258430 => 258431)


--- trunk/LayoutTests/ChangeLog	2020-03-13 21:25:03 UTC (rev 258430)
+++ trunk/LayoutTests/ChangeLog	2020-03-13 21:32:45 UTC (rev 258431)
@@ -1,3 +1,20 @@
+2020-03-13  John Wilander  <[email protected]>
+
+        Add mixed content block test for imported scripts in worker global scope
+        https://bugs.webkit.org/show_bug.cgi?id=209075
+        <rdar://problem/27483005>
+
+        Reviewed by Brent Fulgham.
+
+        * http/tests/security/mixedContent/insecure-worker-global-scope-expected.txt: Added.
+        * http/tests/security/mixedContent/insecure-worker-global-scope.html: Added.
+        * http/tests/security/mixedContent/resources/worker-importing-insecure-script.js: Added.
+        * http/tests/security/mixedContent/resources/worker-importing-secure-script.js: Added.
+        * http/tests/security/mixedContent/resources/worker-sending-message.js: Added.
+        * platform/mac-wk1/TestExpectations:
+            Test for some reason fails on Mojave Debug WK1 but not on Mojave Release WK1 or other bots.
+            Therefore skipped.
+
 2020-03-13  Jacob Uphoff  <[email protected]>
 
         REGRESSION (r257840): [ iOS ] fast/backgrounds/hidpi-bitmap-background-on-subpixel-position.html is flaky failing

Added: trunk/LayoutTests/http/tests/security/mixedContent/insecure-worker-global-scope-expected.txt (0 => 258431)


--- trunk/LayoutTests/http/tests/security/mixedContent/insecure-worker-global-scope-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/mixedContent/insecure-worker-global-scope-expected.txt	2020-03-13 21:32:45 UTC (rev 258431)
@@ -0,0 +1,13 @@
+CONSOLE MESSAGE: [blocked] The page at https://127.0.0.1:8443/security/mixedContent/insecure-worker-global-scope.html was not allowed to display insecure content from http://127.0.0.1:8000/security/mixedContent/resources/worker-sending-message.js.
+
+Tests that mixed content check blocks imported insecure script in a global worker scope.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Imported, secure worker script is running and sent a message: 'Running.'
+PASS Imported, insecure worker script threw an exception.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/http/tests/security/mixedContent/insecure-worker-global-scope.html (0 => 258431)


--- trunk/LayoutTests/http/tests/security/mixedContent/insecure-worker-global-scope.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/mixedContent/insecure-worker-global-scope.html	2020-03-13 21:32:45 UTC (rev 258431)
@@ -0,0 +1,42 @@
+<html>
+<head>
+    <script src=""
+</head>
+<body _onload_="runTest()">
+<script>
+    description("Tests that mixed content check blocks imported insecure script in a global worker scope.");
+    jsTestIsAsync = true;
+
+    if (document.location.protocol !== "https:")
+        document.location.href = ""
+
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    const numberOfTestsToRun = 2;
+    let numberOfTestsDone = 0;
+    let interval = setInterval(function () {
+        if (numberOfTestsDone === numberOfTestsToRun) {
+            clearInterval(interval);
+            finishJSTest();
+        }
+    }, 50);
+    function runTest() {
+        let worker = new Worker("https://127.0.0.1:8443/security/mixedContent/resources/worker-importing-secure-script.js");
+        worker.addEventListener('message', function (message) {
+            testPassed("Imported, secure worker script is running and sent a message: '" + message.data + "'");
+            numberOfTestsDone++;
+        });
+
+        worker = new Worker("https://127.0.0.1:8443/security/mixedContent/resources/worker-importing-insecure-script.js");
+        worker.addEventListener('message', function (message) {
+            if (message.data ="" "ERROR")
+                testPassed("Imported, insecure worker script threw an exception.");
+            else
+                testFailed("Imported, insecure worker script is running and sent a message: '" + message.data + "'");
+            numberOfTestsDone++;
+        });
+    }
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/http/tests/security/mixedContent/resources/worker-importing-insecure-script.js (0 => 258431)


--- trunk/LayoutTests/http/tests/security/mixedContent/resources/worker-importing-insecure-script.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/mixedContent/resources/worker-importing-insecure-script.js	2020-03-13 21:32:45 UTC (rev 258431)
@@ -0,0 +1,5 @@
+try {
+    importScripts("http://127.0.0.1:8000/security/mixedContent/resources/worker-sending-message.js");
+} catch (error) {
+    postMessage("ERROR");
+}

Added: trunk/LayoutTests/http/tests/security/mixedContent/resources/worker-importing-secure-script.js (0 => 258431)


--- trunk/LayoutTests/http/tests/security/mixedContent/resources/worker-importing-secure-script.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/mixedContent/resources/worker-importing-secure-script.js	2020-03-13 21:32:45 UTC (rev 258431)
@@ -0,0 +1 @@
+importScripts("https://127.0.0.1:8443/security/mixedContent/resources/worker-sending-message.js");
\ No newline at end of file

Added: trunk/LayoutTests/http/tests/security/mixedContent/resources/worker-sending-message.js (0 => 258431)


--- trunk/LayoutTests/http/tests/security/mixedContent/resources/worker-sending-message.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/mixedContent/resources/worker-sending-message.js	2020-03-13 21:32:45 UTC (rev 258431)
@@ -0,0 +1 @@
+postMessage("Running.");
\ No newline at end of file

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (258430 => 258431)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2020-03-13 21:25:03 UTC (rev 258430)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2020-03-13 21:32:45 UTC (rev 258431)
@@ -271,6 +271,9 @@
 # Fails with WebKit1 only.
 editing/secure-input/reset-state-on-navigation.html [ Failure ]
 
+# Fails on Mojave Debug WK1
+[ Mojave Debug ] http/tests/security/mixedContent/insecure-worker-global-scope.html [ Skip ]
+
 # Plug-in blocking callback doesn't exist in WebKit1.
 plugins/unavailable-plugin-indicator-obscurity.html
 http/tests/plugins/plugin-allow-then-reload.html [ Skip ]
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to