Title: [200375] trunk
Revision
200375
Author
[email protected]
Date
2016-05-03 08:50:37 -0700 (Tue, 03 May 2016)

Log Message

WorkerGlobalScope's self, location and navigator attributes should not be replaceable
https://bugs.webkit.org/show_bug.cgi?id=157296
<rdar://problem/25962738>

Patch by Pranjal Jumde <[email protected]> on 2016-05-03
Reviewed by Chris Dumez.

Source/WebCore:

Tests: http/tests/workers/location-readonly.html
       http/tests/workers/navigator-readonly.html
       http/tests/workers/self-readonly.html

* workers/WorkerGlobalScope.idl:
The 'self', 'location', and 'navigator' properties of the WorkerGlobalScope must be immutable.
See: https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface

LayoutTests:

* http/tests/workers/location-readonly-expected.txt: Added.
* http/tests/workers/location-readonly.html: Added.
* http/tests/workers/navigator-readonly-expected.txt: Added.
* http/tests/workers/navigator-readonly.html: Added.
* http/tests/workers/self-readonly-expected.txt: Added.
* http/tests/workers/self-readonly.html: Added.
* http/tests/workers/worker-location.js: Added.
* http/tests/workers/worker-navigator.js: Added.
* http/tests/workers/worker-self.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (200374 => 200375)


--- trunk/LayoutTests/ChangeLog	2016-05-03 15:44:36 UTC (rev 200374)
+++ trunk/LayoutTests/ChangeLog	2016-05-03 15:50:37 UTC (rev 200375)
@@ -1,3 +1,21 @@
+2016-05-03  Pranjal Jumde  <[email protected]>
+
+        WorkerGlobalScope's self, location and navigator attributes should not be replaceable
+        https://bugs.webkit.org/show_bug.cgi?id=157296
+        <rdar://problem/25962738>
+
+        Reviewed by Chris Dumez.
+
+        * http/tests/workers/location-readonly-expected.txt: Added.
+        * http/tests/workers/location-readonly.html: Added.
+        * http/tests/workers/navigator-readonly-expected.txt: Added.
+        * http/tests/workers/navigator-readonly.html: Added.
+        * http/tests/workers/self-readonly-expected.txt: Added.
+        * http/tests/workers/self-readonly.html: Added.
+        * http/tests/workers/worker-location.js: Added.
+        * http/tests/workers/worker-navigator.js: Added.
+        * http/tests/workers/worker-self.js: Added.
+
 2016-05-03  Joanmarie Diggs  <[email protected]>
 
         [ATK] accessibility/content-editable-as-textarea.html fails

Added: trunk/LayoutTests/http/tests/workers/location-readonly-expected.txt (0 => 200375)


--- trunk/LayoutTests/http/tests/workers/location-readonly-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/location-readonly-expected.txt	2016-05-03 15:50:37 UTC (rev 200375)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 9: 127.0.0.1
+Test passes if "127.0.0.1" is returned by the worker.

Added: trunk/LayoutTests/http/tests/workers/location-readonly.html (0 => 200375)


--- trunk/LayoutTests/http/tests/workers/location-readonly.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/location-readonly.html	2016-05-03 15:50:37 UTC (rev 200375)
@@ -0,0 +1,12 @@
+Test passes if "127.0.0.1" is returned by the worker.
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+w = new Worker('worker-location.js');
+w._onmessage_ = function(e){
+    console.log(e.data);
+    testRunner.notifyDone();
+}
+</script>

Added: trunk/LayoutTests/http/tests/workers/navigator-readonly-expected.txt (0 => 200375)


--- trunk/LayoutTests/http/tests/workers/navigator-readonly-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/navigator-readonly-expected.txt	2016-05-03 15:50:37 UTC (rev 200375)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 9: Netscape
+Test passes if "Netscape" is returned by the worker.

Added: trunk/LayoutTests/http/tests/workers/navigator-readonly.html (0 => 200375)


--- trunk/LayoutTests/http/tests/workers/navigator-readonly.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/navigator-readonly.html	2016-05-03 15:50:37 UTC (rev 200375)
@@ -0,0 +1,12 @@
+Test passes if "Netscape" is returned by the worker.
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+w = new Worker('worker-navigator.js');
+w._onmessage_ = function(e){
+    console.log(e.data);
+    testRunner.notifyDone();
+}
+</script>

Added: trunk/LayoutTests/http/tests/workers/self-readonly-expected.txt (0 => 200375)


--- trunk/LayoutTests/http/tests/workers/self-readonly-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/self-readonly-expected.txt	2016-05-03 15:50:37 UTC (rev 200375)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 9: NaN
+Test passes if "NaN" is returned by the worker.

Added: trunk/LayoutTests/http/tests/workers/self-readonly.html (0 => 200375)


--- trunk/LayoutTests/http/tests/workers/self-readonly.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/self-readonly.html	2016-05-03 15:50:37 UTC (rev 200375)
@@ -0,0 +1,12 @@
+Test passes if "NaN" is returned by the worker.
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+w = new Worker('worker-self.js');
+w._onmessage_ = function(e){
+    console.log(e.data);
+    testRunner.notifyDone();
+}
+</script>

Added: trunk/LayoutTests/http/tests/workers/worker-location.js (0 => 200375)


--- trunk/LayoutTests/http/tests/workers/worker-location.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/worker-location.js	2016-05-03 15:50:37 UTC (rev 200375)
@@ -0,0 +1,3 @@
+location = {};
+location.hostname = "FAIL";
+postMessage(location.hostname);

Added: trunk/LayoutTests/http/tests/workers/worker-navigator.js (0 => 200375)


--- trunk/LayoutTests/http/tests/workers/worker-navigator.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/worker-navigator.js	2016-05-03 15:50:37 UTC (rev 200375)
@@ -0,0 +1,3 @@
+navigator = {};
+navigator.appName = "FAIL";
+postMessage(navigator.appName);

Added: trunk/LayoutTests/http/tests/workers/worker-self.js (0 => 200375)


--- trunk/LayoutTests/http/tests/workers/worker-self.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/worker-self.js	2016-05-03 15:50:37 UTC (rev 200375)
@@ -0,0 +1,3 @@
+self = {};
+self.NaN = "100";
+postMessage(self.NaN);

Modified: trunk/Source/WebCore/ChangeLog (200374 => 200375)


--- trunk/Source/WebCore/ChangeLog	2016-05-03 15:44:36 UTC (rev 200374)
+++ trunk/Source/WebCore/ChangeLog	2016-05-03 15:50:37 UTC (rev 200375)
@@ -1,3 +1,19 @@
+2016-05-03  Pranjal Jumde  <[email protected]>
+
+        WorkerGlobalScope's self, location and navigator attributes should not be replaceable
+        https://bugs.webkit.org/show_bug.cgi?id=157296
+        <rdar://problem/25962738>
+
+        Reviewed by Chris Dumez.
+
+        Tests: http/tests/workers/location-readonly.html
+               http/tests/workers/navigator-readonly.html
+               http/tests/workers/self-readonly.html
+
+        * workers/WorkerGlobalScope.idl:
+        The 'self', 'location', and 'navigator' properties of the WorkerGlobalScope must be immutable.
+        See: https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface
+
 2016-05-03  Chris Dumez  <[email protected]>
 
         Drop some unnecessary exception checking in the generated bindings

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.idl (200374 => 200375)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.idl	2016-05-03 15:44:36 UTC (rev 200374)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.idl	2016-05-03 15:50:37 UTC (rev 200375)
@@ -33,9 +33,9 @@
 ] interface WorkerGlobalScope : EventTarget {
 
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
-    [Replaceable] readonly attribute  WorkerGlobalScope self;
+    readonly attribute  WorkerGlobalScope self;
 #endif
-    [Replaceable] readonly attribute WorkerLocation location;
+    readonly attribute WorkerLocation location;
     void close();
 
     attribute EventHandler onerror;
@@ -45,7 +45,7 @@
     // WorkerUtils
 
     [Custom] void importScripts(/*[Variadic] DOMString urls */);
-    [Replaceable] readonly attribute WorkerNavigator navigator;
+    readonly attribute WorkerNavigator navigator;
 
     // Additional constructors
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to