Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/errored.html

Issue 2838933003: [not-for-commit] kitsune changes + pending kouhei changes (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/errored.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/errored.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/errored.html
new file mode 100644
index 0000000000000000000000000000000000000000..c84734a4ce9bd91c92db88cbedd76215e674b724
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/errored.html
@@ -0,0 +1,58 @@
+<!doctype HTML>
+<html>
+<head>
+ <title>html-script-module-errored</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+
+<script>
+// The case where Step 6 of
+// https://html.spec.whatwg.org/#internal-module-script-graph-fetching-procedure
+// fails. In such cases, fetch a module script graph returns a non-null
+// module script with instantiation state = "errored"
+// and module record = null.
+
+setup({allow_uncaught_exception:true});
+internals.runtimeFlags.moduleScriptsEnabled = true;
+
+var test1 = async_test('foo');
+
+var isWindowOnErrorCalled = false;
+
+window.addEventListener("error", test1.step_func(function(ev) {
+ console.log(ev);
+ console.log(ev.error);
+
+ assert_false(isWindowOnErrorCalled,
+ "window's error event shouldn't be fired twice");
+ isWindowOnErrorCalled = true;
+
+ for (var a in ev) {
+ console.log(a + " => " + ev[a]);
+ }
+
+ assert_true(ev.filename.endsWith("errored-root.js"),
+ "window's error event's filename is set correctly");
+ assert_equals(ev.message,
+ "Uncaught SyntaxError: The requested module does not " +
+ "provide an export named 'default'",
+ "window's error event is fired for instantiation error");
+ }));
+
+var scriptOnLoad = test1.step_func_done(function() {
+ assert_true(isWindowOnErrorCalled,
+ "window's error event should be fired");
+});
+
+function unreached() {
+ test1.step(function() {
+ assert_unreached("script's error event should not be fired");
+ });
+}
+</script>
+<script type="module" src="errored-root.js" onerror="unreached()" onload="scriptOnLoad()"></script>
+<script type="module" src="errored-root.js" onerror="unreached()" onload="scriptOnLoad()"></script>
+<script>
+testRunner.waitUntilDone();
+setTimeout(() => {testRunner.notifyDone();}, 100);
+</script>

Powered by Google App Engine
This is Rietveld 408576698