Title: [209172] trunk
Revision
209172
Author
[email protected]
Date
2016-11-30 19:56:12 -0800 (Wed, 30 Nov 2016)

Log Message

[JSC] Specifying same module entry point multiple times cause TypeError
https://bugs.webkit.org/show_bug.cgi?id=164858

Reviewed by Saam Barati.

Source/_javascript_Core:

Allow importing the same module multiple times. Previously, when specifying the same
module in the <script type="module" src="" it throws TypeError.

* builtins/ModuleLoaderPrototype.js:
(requestFetch):
(requestTranslate):
(requestInstantiate):
(requestSatisfy):

LayoutTests:

* js/dom/modules/module-load-same-module-from-different-entry-point-in-src-expected.txt: Added.
* js/dom/modules/module-load-same-module-from-different-entry-point-in-src.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (209171 => 209172)


--- trunk/LayoutTests/ChangeLog	2016-12-01 03:54:24 UTC (rev 209171)
+++ trunk/LayoutTests/ChangeLog	2016-12-01 03:56:12 UTC (rev 209172)
@@ -1,3 +1,13 @@
+2016-11-30  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Specifying same module entry point multiple times cause TypeError
+        https://bugs.webkit.org/show_bug.cgi?id=164858
+
+        Reviewed by Saam Barati.
+
+        * js/dom/modules/module-load-same-module-from-different-entry-point-in-src-expected.txt: Added.
+        * js/dom/modules/module-load-same-module-from-different-entry-point-in-src.html: Added.
+
 2016-11-30  Antoine Quint  <[email protected]>
 
         [Modern Media Controls] Add support for right-to-left layouts

Added: trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-in-src-expected.txt (0 => 209172)


--- trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-in-src-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-in-src-expected.txt	2016-12-01 03:56:12 UTC (rev 209172)
@@ -0,0 +1,15 @@
+2 different module tag will attempt to load the same module with "src" attribute.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Module is not executed yet.
+PASS window.moduleExecutedCount is 0
+Executing module-load-same-module-from-different-entry-point.js.
+PASS window.moduleExecutedCount is 1
+PASS window.moduleExecutedCount is 1
+PASS counter is 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-in-src.html (0 => 209172)


--- trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-in-src.html	                        (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-in-src.html	2016-12-01 03:56:12 UTC (rev 209172)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description('2 different module tag will attempt to load the same module with "src" attribute.');
+window.jsTestIsAsync = true;
+window.moduleExecutedCount = 0;
+debug('Module is not executed yet.');
+shouldBe(`window.moduleExecutedCount`, `0`);
+var counter = 0;
+function onLoad() {
+    shouldBe(`window.moduleExecutedCount`, `1`);
+    ++counter;
+}
+function finish() {
+    shouldBe(`counter`, `2`);
+    finishJSTest();
+}
+
+</script>
+<script src=""
+<script type="module" src="" _onload_="onLoad()"></script>
+<script type="module" src="" _onload_="onLoad()"></script>
+<script type="module">
+finish();
+</script>
+</body>
+</html>

Modified: trunk/Source/_javascript_Core/ChangeLog (209171 => 209172)


--- trunk/Source/_javascript_Core/ChangeLog	2016-12-01 03:54:24 UTC (rev 209171)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-12-01 03:56:12 UTC (rev 209172)
@@ -1,5 +1,21 @@
 2016-11-30  Yusuke Suzuki  <[email protected]>
 
+        [JSC] Specifying same module entry point multiple times cause TypeError
+        https://bugs.webkit.org/show_bug.cgi?id=164858
+
+        Reviewed by Saam Barati.
+
+        Allow importing the same module multiple times. Previously, when specifying the same
+        module in the <script type="module" src="" it throws TypeError.
+
+        * builtins/ModuleLoaderPrototype.js:
+        (requestFetch):
+        (requestTranslate):
+        (requestInstantiate):
+        (requestSatisfy):
+
+2016-11-30  Yusuke Suzuki  <[email protected]>
+
         WebAssembly JS API: export a module namespace object instead of a module environment
         https://bugs.webkit.org/show_bug.cgi?id=165121
 

Modified: trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js (209171 => 209172)


--- trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js	2016-12-01 03:54:24 UTC (rev 209171)
+++ trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js	2016-12-01 03:56:12 UTC (rev 209172)
@@ -230,12 +230,6 @@
     "use strict";
 
     var entry = this.ensureRegistered(key);
-    if (entry.state > @ModuleLink) {
-        var deferred = @newPromiseCapability(@InternalPromise);
-        deferred.@reject.@call(@undefined, new @TypeError("Requested module is already ready to be executed."));
-        return deferred.@promise;
-    }
-
     if (entry.fetch)
         return entry.fetch;
 
@@ -260,12 +254,6 @@
     "use strict";
 
     var entry = this.ensureRegistered(key);
-    if (entry.state > @ModuleLink) {
-        var deferred = @newPromiseCapability(@InternalPromise);
-        deferred.@reject.@call(@undefined, new @TypeError("Requested module is already ready to be executed."));
-        return deferred.@promise;
-    }
-
     if (entry.translate)
         return entry.translate;
 
@@ -291,12 +279,6 @@
     "use strict";
 
     var entry = this.ensureRegistered(key);
-    if (entry.state > @ModuleLink) {
-        var deferred = @newPromiseCapability(@InternalPromise);
-        deferred.@reject.@call(@undefined, new @TypeError("Requested module is already ready to be executed."));
-        return deferred.@promise;
-    }
-
     if (entry.instantiate)
         return entry.instantiate;
 
@@ -324,12 +306,6 @@
     "use strict";
 
     var entry = this.ensureRegistered(key);
-    if (entry.state > @ModuleLink) {
-        var deferred = @newPromiseCapability(@InternalPromise);
-        deferred.@reject.@call(@undefined, new @TypeError("Requested module is already ready to be executed."));
-        return deferred.@promise;
-    }
-
     if (entry.satisfy)
         return entry.satisfy;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to