WorkerLocation.prototype.toString() should be enumerable
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Aug 2016 06:07:44 +0000 (06:07 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Aug 2016 06:07:44 +0000 (06:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161183

Reviewed by Ryosuke Niwa.

Source/WebCore:

WorkerLocation.prototype.toString() should be enumerable:
- https://html.spec.whatwg.org/#workerlocation
- http://heycam.github.io/webidl/#es-stringifier

No new tests, updated existing test.

* workers/WorkerLocation.h:
(WebCore::WorkerLocation::toString): Deleted.
* workers/WorkerLocation.idl:
Also use USVString string type instead of DOMString to match the
specification. There is no behavior change because those attributes
are readonly.

LayoutTests:

Add layout test coverage.

* fast/workers/resources/worker-location.js:
* fast/workers/worker-location-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204954 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/workers/resources/worker-location.js
LayoutTests/fast/workers/worker-location-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/workers/WorkerLocation.h
Source/WebCore/workers/WorkerLocation.idl

index b34904d..c882025 100644 (file)
@@ -1,5 +1,17 @@
 2016-08-24  Chris Dumez  <cdumez@apple.com>
 
+        WorkerLocation.prototype.toString() should be enumerable
+        https://bugs.webkit.org/show_bug.cgi?id=161183
+
+        Reviewed by Ryosuke Niwa.
+
+        Add layout test coverage.
+
+        * fast/workers/resources/worker-location.js:
+        * fast/workers/worker-location-expected.txt:
+
+2016-08-24  Chris Dumez  <cdumez@apple.com>
+
         Location.toString() should be enumerable
         https://bugs.webkit.org/show_bug.cgi?id=161179
 
index 6f0d079..f9d3433 100644 (file)
@@ -23,6 +23,7 @@ worker.postMessage("eval WorkerLocation");
 worker.postMessage("eval typeof location");
 worker.postMessage("eval location");
 worker.postMessage("eval location.href");
+worker.postMessage("eval location.href === location.toString()");
 worker.postMessage("eval location.protocol");
 worker.postMessage("eval location.host");
 worker.postMessage("eval location.hostname");
@@ -31,6 +32,9 @@ worker.postMessage("eval location.pathname");
 worker.postMessage("eval location.search");
 worker.postMessage("eval location.hash");
 worker.postMessage("eval location.origin");
+worker.postMessage("eval Object.getOwnPropertyDescriptor(location.__proto__, 'toString').writable === true");
+worker.postMessage("eval Object.getOwnPropertyDescriptor(location.__proto__, 'toString').enumerable === true");
+worker.postMessage("eval Object.getOwnPropertyDescriptor(location.__proto__, 'toString').configurable === true");
 worker.postMessage("eval foo//bar");
 
 worker.onmessage = function(evt) {
index 5908fed..95805a3 100644 (file)
@@ -4,6 +4,7 @@ WorkerLocation: function WorkerLocation() { [native code] }
 typeof location: object
 location: file:<...>/fast/workers/resources/worker-common.js
 location.href: file:<...>/fast/workers/resources/worker-common.js
+location.href === location.toString(): true
 location.protocol: file:
 location.host: 
 location.hostname: 
@@ -12,5 +13,8 @@ location.pathname: <...>/fast/workers/resources/worker-common.js
 location.search: 
 location.hash: 
 location.origin: file://
+Object.getOwnPropertyDescriptor(location.__proto__, 'toString').writable === true: true
+Object.getOwnPropertyDescriptor(location.__proto__, 'toString').enumerable === true: true
+Object.getOwnPropertyDescriptor(location.__proto__, 'toString').configurable === true: true
 DONE
 
index 07c6cc9..769b33a 100644 (file)
@@ -1,5 +1,25 @@
 2016-08-24  Chris Dumez  <cdumez@apple.com>
 
+        WorkerLocation.prototype.toString() should be enumerable
+        https://bugs.webkit.org/show_bug.cgi?id=161183
+
+        Reviewed by Ryosuke Niwa.
+
+        WorkerLocation.prototype.toString() should be enumerable:
+        - https://html.spec.whatwg.org/#workerlocation
+        - http://heycam.github.io/webidl/#es-stringifier
+
+        No new tests, updated existing test.
+
+        * workers/WorkerLocation.h:
+        (WebCore::WorkerLocation::toString): Deleted.
+        * workers/WorkerLocation.idl:
+        Also use USVString string type instead of DOMString to match the
+        specification. There is no behavior change because those attributes
+        are readonly.
+
+2016-08-24  Chris Dumez  <cdumez@apple.com>
+
         Location.toString() should be enumerable
         https://bugs.webkit.org/show_bug.cgi?id=161179
 
index 4b89620..864a0f1 100644 (file)
@@ -55,8 +55,6 @@ namespace WebCore {
         String hash() const;
         String origin() const;
 
-        String toString() const { return href(); }
-
     private:
         explicit WorkerLocation(const URL& url) : m_url(url) { }
 
index 89e09c7..f025ebf 100644 (file)
     GenerateIsReachable=Impl,
     ImplementationLacksVTable,
 ] interface WorkerLocation {
-    readonly attribute DOMString href;
-    readonly attribute DOMString protocol;
-    readonly attribute DOMString host;
-    readonly attribute DOMString hostname;
-    readonly attribute DOMString port;
-    readonly attribute DOMString pathname;
-    readonly attribute DOMString search;
-    readonly attribute DOMString hash;
-    readonly attribute DOMString origin;
-
-    [NotEnumerable] DOMString toString();
+    stringifier readonly attribute USVString href;
+    readonly attribute USVString protocol;
+    readonly attribute USVString host;
+    readonly attribute USVString hostname;
+    readonly attribute USVString port;
+    readonly attribute USVString pathname;
+    readonly attribute USVString search;
+    readonly attribute USVString hash;
+    readonly attribute USVString origin;
 };