diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources')
14 files changed, 0 insertions, 251 deletions
diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/bom-utf-16be.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/bom-utf-16be.js Binary files differdeleted file mode 100644 index 8a529e10b13..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/bom-utf-16be.js +++ /dev/null diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/bom-utf-16le.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/bom-utf-16le.js Binary files differdeleted file mode 100644 index 578f7f19519..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/bom-utf-16le.js +++ /dev/null diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/bom-utf-8.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/bom-utf-8.js deleted file mode 100644 index fb88bdda2af..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/bom-utf-8.js +++ /dev/null @@ -1,2 +0,0 @@ -// JavaScript file with UTF-8 BOM. -window.executed_utf8_bom = '三村かな子'; diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/cocoa-module.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/cocoa-module.js deleted file mode 100644 index 24360a7bfe7..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/cocoa-module.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Cocoa { - taste() { - return "awesome"; - } -}; diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/cross-origin.py b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/cross-origin.py deleted file mode 100644 index abac1901b7d..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/cross-origin.py +++ /dev/null @@ -1,20 +0,0 @@ -def main(request, response): - origin = request.headers.get(b"origin") - - if origin is not None: - response.headers.set(b"Access-Control-Allow-Origin", origin) - response.headers.set(b"Access-Control-Allow-Methods", b"GET") - response.headers.set(b"Access-Control-Allow-Credentials", b"true") - - if request.method == u"OPTIONS": - return u"" - - headers = [(b"Content-Type", b"text/javascript")] - milk = request.cookies.first(b"milk", None) - - if milk is None: - return headers, u"var included = false;" - elif milk.value == b"yes": - return headers, u"var included = true;" - - return headers, u"var included = false;" diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/exports-cocoa.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/exports-cocoa.js deleted file mode 100644 index 02967bc6319..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/exports-cocoa.js +++ /dev/null @@ -1,3 +0,0 @@ -import Cocoa from "./cocoa-module.js"; -var cocoa = new Cocoa(); -window.exportedCocoa = cocoa; diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/flag-setter.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/flag-setter.js deleted file mode 100644 index 3274e5bfeb2..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/flag-setter.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -window.didExecute = true; diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/load-error-events-helpers.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/load-error-events-helpers.js deleted file mode 100644 index bbd6b09c6cf..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/load-error-events-helpers.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -// Helper functions to be used from load-error-events*.html tests. - -function event_test(name, load_to_be_fired, error_to_be_fired) { - return { - test: async_test(name), - executed: false, - load_event_to_be_fired: load_to_be_fired, - error_event_to_be_fired: error_to_be_fired - }; -} - -// Should be used as load/error event handlers of script tags, -// with |t| = the object returned by event_test(). -function onLoad(t) { - t.test.step(function() { - if (t.load_event_to_be_fired) { - assert_true(t.executed, - 'Load event should be fired after script execution'); - // Delay done() a little so that if an error event happens - // the assert_unreached is reached and fails the test. - t.test.step_timeout(() => t.test.done(), 100); - } else { - assert_unreached('Load event should not be fired.'); - } - }); -}; -function onError(t) { - t.test.step(function() { - if (t.error_event_to_be_fired) { - assert_false(t.executed); - // Delay done() a little so that if a load event happens - // the assert_unreached is reached and fails the test. - t.test.step_timeout(() => t.test.done(), 100); - } else { - assert_unreached('Error event should not be fired.'); - } - }); -}; - -// To be called from inline scripts, which expect no load/error events. -function onExecute(t) { - t.executed = true; - // Delay done() a little so that if a load/error event happens - // the assert_unreached is reached and fails the test. - t.test.step_timeout(() => t.test.done(), 100); -} diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/load-error-events.py b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/load-error-events.py deleted file mode 100644 index 1eb82cd497d..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/load-error-events.py +++ /dev/null @@ -1,15 +0,0 @@ -import re - -def main(request, response): - headers = [(b"Content-Type", b"text/javascript")] - test = request.GET.first(b'test') - assert(re.match(b'^[a-zA-Z0-9_]+$', test)) - - if test.find(b'_load') >= 0: - status = 200 - content = b'"use strict"; %s.executed = true;' % test - else: - status = 404 - content = b'"use strict"; %s.test.step(function() { assert_unreached("404 script should not be executed"); });' % test - - return status, headers, content diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/promise-reject-and-remove-iframe.html b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/promise-reject-and-remove-iframe.html deleted file mode 100644 index 6da274469f8..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/promise-reject-and-remove-iframe.html +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<script> -const promise = Promise.reject(); - -window.onload = () => { - promise.catch(() => parent.document.querySelector('iframe').remove()); -}; -</script> - -<!-- Load a slow script to delay window.onload for a while. - Without this, crashes are flaky. --> -<script src="/common/slow.py"></script> diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/script-type-and-language-js.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/script-type-and-language-js.js deleted file mode 100644 index d357bc49944..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/script-type-and-language-js.js +++ /dev/null @@ -1,141 +0,0 @@ -function testAttribute(attr, val, shouldRun) { - test(function() { - assert_false(window.ran, "ran variable not reset"); - let script; - if (document.contentType === 'image/svg+xml') { - // SVG - script = document.createElementNS("http://www.w3.org/2000/svg", "script"); - } else { - // HTML or XHTML - script = document.createElement("script"); - } - script.setAttribute(attr, val); - script.textContent = "window.ran = true;"; - document.querySelector('#script-placeholder').appendChild(script); - assert_equals(window.ran, shouldRun); - }, "Script should" + (shouldRun ? "" : "n't") + " run with " + attr + "=" + - format_value(val)); - window.ran = false; -} -function testTypeShouldRun(type) { - testAttribute("type", type, true); -} -function testLanguageShouldRun(lang) { - testAttribute("language", lang, true); -} -function testTypeShouldNotRun(type) { - testAttribute("type", type, false); -} -function testLanguageShouldNotRunUnlessSVG(lang) { - // In SVGs, there is no concrete spec but all browsers agree that - // language attributes have no effects and thus script elements - // without type attributes are always expected to run regardless of - // language attributes. - const expectedToRun = document.contentType === 'image/svg+xml'; - testAttribute("language", lang, expectedToRun); -} - -// Unlike `test*()` methods above, there should be a (parser-inserted) script -// with an invalid type/language that would set `window.ran` to true just -// before `testParserInsertedDidNotRun()`, and -// `testParserInsertedDidNotRun()` asserts that the script did not run. -// `window.ran` should be reset where needed. For example: -// <script>window.ran = false;</script> -// <script type="invalid-type">window.ran = true;</script> -// <script>testParserInsertedDidNotRun('type=invalid-type');</script> -function testParserInsertedDidNotRun(description) { - test(() => assert_false(window.ran), - "Script shouldn't run with " + description + " (parser-inserted)"); - window.ran = false; -} - -// When prefixed by "application/", these match with -// https://mimesniff.spec.whatwg.org/#javascript-mime-type -const application = [ - "ecmascript", - "javascript", - "x-ecmascript", - "x-javascript" -]; - -// When prefixed by "text/", these match with -// https://mimesniff.spec.whatwg.org/#javascript-mime-type -const text = [ - "ecmascript", - "javascript", - "javascript1.0", - "javascript1.1", - "javascript1.2", - "javascript1.3", - "javascript1.4", - "javascript1.5", - "jscript", - "livescript", - "x-ecmascript", - "x-javascript" -]; - -const legacyTypes = [ - "javascript1.6", - "javascript1.7", - "javascript1.8", - "javascript1.9" -]; - -const spaces = [" ", "\t", "\n", "\r", "\f"]; - -window.ran = false; - -// Type attribute - -testTypeShouldRun(""); -testTypeShouldNotRun(" "); - -application.map(t => "application/" + t).forEach(testTypeShouldRun); -application.map(t => ("application/" + t).toUpperCase()).forEach( - testTypeShouldRun); - -spaces.forEach(function(s) { - application.map(t => "application/" + t + s).forEach(testTypeShouldRun); - application.map(t => s + "application/" + t).forEach(testTypeShouldRun); -}); - -application.map(t => "application/" + t + "\0").forEach(testTypeShouldNotRun); -application.map(t => "application/" + t + "\0foo").forEach( - testTypeShouldNotRun); - -text.map(t => "text/" + t).forEach(testTypeShouldRun); -text.map(t => ("text/" + t).toUpperCase()).forEach(testTypeShouldRun); - -legacyTypes.map(t => "text/" + t).forEach(testTypeShouldNotRun); - -spaces.forEach(function(s) { - text.map(t => "text/" + t + s).forEach(testTypeShouldRun); - text.map(t => s + "text/" + t).forEach(testTypeShouldRun); -}); - -text.map(t => "text/" + t + "\0").forEach(testTypeShouldNotRun); -text.map(t => "text/" + t + "\0foo").forEach(testTypeShouldNotRun); - -text.forEach(testTypeShouldNotRun); -legacyTypes.forEach(testTypeShouldNotRun); - -// Language attribute - -testLanguageShouldRun(""); -testLanguageShouldNotRunUnlessSVG(" "); - -text.forEach(testLanguageShouldRun); -text.map(t => t.toUpperCase()).forEach(testLanguageShouldRun); - -legacyTypes.forEach(testLanguageShouldNotRunUnlessSVG); - -spaces.forEach(function(s) { - text.map(t => t + s).forEach(testLanguageShouldNotRunUnlessSVG); - text.map(t => s + t).forEach(testLanguageShouldNotRunUnlessSVG); -}); -text.map(t => t + "xyz").forEach(testLanguageShouldNotRunUnlessSVG); -text.map(t => "xyz" + t).forEach(testLanguageShouldNotRunUnlessSVG); - -text.map(t => t + "\0").forEach(testLanguageShouldNotRunUnlessSVG); -text.map(t => t + "\0foo").forEach(testLanguageShouldNotRunUnlessSVG); diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/set-script-executed.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/set-script-executed.js deleted file mode 100644 index a6095097dd7..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/set-script-executed.js +++ /dev/null @@ -1 +0,0 @@ -window.executed = true; diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/syntax-error.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/syntax-error.js deleted file mode 100644 index 40dc81dcfac..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/syntax-error.js +++ /dev/null @@ -1 +0,0 @@ -This cannot be parsed as JavaScript diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/throw.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/throw.js deleted file mode 100644 index be53dd1ef3f..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/resources/throw.js +++ /dev/null @@ -1 +0,0 @@ -document.querySelector(":::not-going-to-be-valid"); |