New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use fetch infrastructure to load external scripts #12472
Merged
+363
−352
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f566a8d
Update step annotations for prepare a script
KiChjang 4c616da
Add crossorigin attribute and implement step 14 of prepare a script
KiChjang 5729a4a
Fix incorrect indentation
KiChjang 2bb9598
Implement default values for RequestInit
KiChjang d481676
Add fetch_async to PendingAsyncLoad, DocumentLoader and Document
KiChjang 4dcf693
Use fetch infrastructure to load external scripts
KiChjang 07c9cfe
Add FetchMetadata and update corresponding methods
KiChjang 6fbd2aa
Avoid deadlock in main_fetch
KiChjang File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
Add crossorigin attribute and implement step 14 of prepare a script
Add WPT test for HTMLScriptElement crossOrigin IDL attribute
- Loading branch information
commit 4c616dad9093b5320ee27629c89c57da038d6705
| "path": "html/semantics/forms/the-input-element/minlength.html", | ||
| "url": "/html/semantics/forms/the-input-element/minlength.html" | ||
| } | ||
| ], | ||
| "html/semantics/scripting-1/the-script-element/script-crossorigin-network.html": [ | ||
| { | ||
| "path": "html/semantics/scripting-1/the-script-element/script-crossorigin-network.html", | ||
| "url": "/html/semantics/scripting-1/the-script-element/script-crossorigin-network.html" | ||
| } | ||
| ], | ||
| "html/semantics/scripting-1/the-script-element/script-crossorigin.html": [ | ||
| { | ||
| "path": "html/semantics/scripting-1/the-script-element/script-crossorigin.html", | ||
| "url": "/html/semantics/scripting-1/the-script-element/script-crossorigin.html" | ||
| } | ||
| ] | ||
| } | ||
| }, |
| @@ -0,0 +1,10 @@ | ||
| def main(request, response): | ||
| headers = [("Content-Type", "text/javascript")] | ||
| milk = request.cookies.first("milk", None) | ||
|
|
||
| if milk is None: | ||
| return headers, "var included = false;" | ||
| elif milk.value == "yes": | ||
| return headers, "var included = true;" | ||
|
|
||
| return headers, "var included = false;" |
| @@ -0,0 +1,49 @@ | ||
| <!doctype html> | ||
| <meta charset="utf-8"> | ||
| <title>HTMLScriptElement: crossorigin attribute network test</title> | ||
| <link rel="author" title="KiChjang" href="mailto:kungfukeith11@gmail.com"> | ||
| <link rel="help" href="https://html.spec.whatwg.org/multipage/#cors-settings-attribute"> | ||
| <script src="/resources/testharness.js"></script> | ||
| <script src="/resources/testharnessreport.js"></script> | ||
|
|
||
| <body> | ||
| <script type="text/javascript"> | ||
| var test1 = async_test(document.title + "1"); | ||
| var test2 = async_test(document.title + "2"); | ||
| var test3 = async_test(document.title + "3"); | ||
|
|
||
| var script1 = document.createElement("script"); | ||
| script1.src = "resources/cross-origin.py"; | ||
| script1.crossOrigin = "use-credentials"; | ||
| var script2 = document.createElement("script"); | ||
| script2.src = "resources/cross-origin.py"; | ||
| script2.crossOrigin = "gibberish"; | ||
| var script3 = document.createElement("script"); | ||
| script3.src = "resources/cross-origin.py"; | ||
|
|
||
| document.cookie = "milk=yes"; | ||
| document.body.appendChild(script1); | ||
| script1.onload = function() { | ||
| test1.step(function() { | ||
| assert_true(included, "credentials should be included in script request"); | ||
| test1.done(); | ||
| }); | ||
| }; | ||
|
|
||
| document.body.appendChild(script2); | ||
| script2.onload = function() { | ||
| test2.step(function() { | ||
| assert_true(included, "invalid values should default to include credentials due to response tainting"); | ||
| test2.done(); | ||
| }); | ||
| }; | ||
|
|
||
| document.body.appendChild(script3); | ||
| script3.onload = function() { | ||
| test3.step(function() { | ||
| assert_true(included, "missing value should default to include credentials"); | ||
| test3.done(); | ||
| }); | ||
| }; | ||
| </script> | ||
| </body> |
Oops, something went wrong.
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
What about step 19? I think that's all handled in the if-else chain below.