-
Notifications
You must be signed in to change notification settings - Fork 341
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
Make Request constructor more forgiving #377
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@wanderview you blocked this in #245 but then did not follow up to feedback. Thoughts appreciated for what we should do here. |
Folks are using the Request constructor in unexpected ways and therefore it is throwing in unexpected ways (in particular when mode is “navigate” or when setting referrer to a cross-origin URL). This will make it throw less, while not really being less useful. Fixes #245.
13e097d
to
4db046c
Compare
It's disappointing that the web-platform-tests were not updated to reflect this change. |
@jdm Up for a pull request? |
That's my plan. |
I filed these browser bugs:
I also wanted to further fix the test, but got stuck, see web-platform-tests/wpt#2618 for that. |
annevk
pushed a commit
to web-platform-tests/wpt
that referenced
this pull request
May 28, 2018
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
May 30, 2018
We've disallowed creating a request with a non-empty RequestInit from a navigation request, but the spec changed some time ago([1]). This change follows the spec change: When any of |init|'s member is present and request's mode is "navigate", then set the mode to "same-origin". 1: whatwg/fetch#377 Bug: 847336 Change-Id: I9296dba52519c1cbc84b01db6581ae6da8f15ec9 Reviewed-on: https://chromium-review.googlesource.com/1075917 Reviewed-by: Matt Falkenhagen <falken@chromium.org> Commit-Queue: Yutaka Hirano <yhirano@chromium.org> Cr-Commit-Position: refs/heads/master@{#562739}
moz-v2v-gh
pushed a commit
to mozilla/gecko-dev
that referenced
this pull request
Jun 10, 2018
…a=testonly Automatic update from web-platform-testsFetch: mode "navigate" becomes "same-origin" For whatwg/fetch#377. -- wpt-commits: 864c62d355308cca9ab6d9c939e987cede865d5b wpt-pr: 11176
xeonchen
pushed a commit
to xeonchen/gecko-cinnabar
that referenced
this pull request
Jun 12, 2018
…a=testonly Automatic update from web-platform-testsFetch: mode "navigate" becomes "same-origin" For whatwg/fetch#377. -- wpt-commits: 864c62d355308cca9ab6d9c939e987cede865d5b wpt-pr: 11176
hubot
pushed a commit
to WebKit/WebKit-http
that referenced
this pull request
Aug 20, 2018
https://bugs.webkit.org/show_bug.cgi?id=168649 Patch by Rob Buis <rbuis@igalia.com> on 2018-08-20 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/policies/referrer-origin-expected.txt: * web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt: * web-platform-tests/fetch/api/policies/referrer-origin-worker-expected.txt: * web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: Source/WebCore: Implement remaining part of fetch change whatwg/fetch#377, i.e. if "parsedReferrer’s origin is not same origin with origin", then set request’s referrer to "client", instead of throwing an exception [1]. WebKit's new behavior matches that of Chrome and Firefox. Testing is covered by existing wpt tests. [1] Step 15.3.3 of https://fetch.spec.whatwg.org/#main-fetch * Modules/fetch/FetchRequest.cpp: (WebCore::computeReferrer): LayoutTests: * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@235025 268f45cc-cd09-0410-ab3c-d52691b4dbfc
bertogg
pushed a commit
to Igalia/webkit
that referenced
this pull request
Aug 24, 2018
https://bugs.webkit.org/show_bug.cgi?id=168649 Patch by Rob Buis <rbuis@igalia.com> on 2018-08-20 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/policies/referrer-origin-expected.txt: * web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt: * web-platform-tests/fetch/api/policies/referrer-origin-worker-expected.txt: * web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: Source/WebCore: Implement remaining part of fetch change whatwg/fetch#377, i.e. if "parsedReferrer’s origin is not same origin with origin", then set request’s referrer to "client", instead of throwing an exception [1]. WebKit's new behavior matches that of Chrome and Firefox. Testing is covered by existing wpt tests. [1] Step 15.3.3 of https://fetch.spec.whatwg.org/#main-fetch * Modules/fetch/FetchRequest.cpp: (WebCore::computeReferrer): LayoutTests: * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.22@235076 268f45cc-cd09-0410-ab3c-d52691b4dbfc
aperezdc
pushed a commit
to Igalia/webkit
that referenced
this pull request
Oct 8, 2018
https://bugs.webkit.org/show_bug.cgi?id=168649 Patch by Rob Buis <rbuis@igalia.com> on 2018-08-20 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/policies/referrer-origin-expected.txt: * web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt: * web-platform-tests/fetch/api/policies/referrer-origin-worker-expected.txt: * web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: Source/WebCore: Implement remaining part of fetch change whatwg/fetch#377, i.e. if "parsedReferrer’s origin is not same origin with origin", then set request’s referrer to "client", instead of throwing an exception [1]. WebKit's new behavior matches that of Chrome and Firefox. Testing is covered by existing wpt tests. [1] Step 15.3.3 of https://fetch.spec.whatwg.org/#main-fetch * Modules/fetch/FetchRequest.cpp: (WebCore::computeReferrer): LayoutTests: * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.22@235076 268f45cc-cd09-0410-ab3c-d52691b4dbfc
gecko-dev-updater
pushed a commit
to marco-c/gecko-dev-comments-removed
that referenced
this pull request
Oct 3, 2019
…a=testonly Automatic update from web-platform-testsFetch: mode "navigate" becomes "same-origin" For whatwg/fetch#377. -- wpt-commits: 864c62d355308cca9ab6d9c939e987cede865d5b wpt-pr: 11176 UltraBlame original commit: 57b1f3a1a55206c019aa37a529067669f64d6332
gecko-dev-updater
pushed a commit
to marco-c/gecko-dev-wordified
that referenced
this pull request
Oct 3, 2019
…a=testonly Automatic update from web-platform-testsFetch: mode "navigate" becomes "same-origin" For whatwg/fetch#377. -- wpt-commits: 864c62d355308cca9ab6d9c939e987cede865d5b wpt-pr: 11176 UltraBlame original commit: 57b1f3a1a55206c019aa37a529067669f64d6332
gecko-dev-updater
pushed a commit
to marco-c/gecko-dev-wordified-and-comments-removed
that referenced
this pull request
Oct 3, 2019
…a=testonly Automatic update from web-platform-testsFetch: mode "navigate" becomes "same-origin" For whatwg/fetch#377. -- wpt-commits: 864c62d355308cca9ab6d9c939e987cede865d5b wpt-pr: 11176 UltraBlame original commit: 57b1f3a1a55206c019aa37a529067669f64d6332
ryanhaddad
pushed a commit
to WebKit/WebKit
that referenced
this pull request
Dec 22, 2020
https://bugs.webkit.org/show_bug.cgi?id=168649 Patch by Rob Buis <rbuis@igalia.com> on 2018-08-20 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/policies/referrer-origin-expected.txt: * web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt: * web-platform-tests/fetch/api/policies/referrer-origin-worker-expected.txt: * web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: Source/WebCore: Implement remaining part of fetch change whatwg/fetch#377, i.e. if "parsedReferrer’s origin is not same origin with origin", then set request’s referrer to "client", instead of throwing an exception [1]. WebKit's new behavior matches that of Chrome and Firefox. Testing is covered by existing wpt tests. [1] Step 15.3.3 of https://fetch.spec.whatwg.org/#main-fetch * Modules/fetch/FetchRequest.cpp: (WebCore::computeReferrer): LayoutTests: * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: Canonical link: https://commits.webkit.org/203798@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235025 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JonWBedard
pushed a commit
to WebKit/WebKit
that referenced
this pull request
Dec 1, 2022
https://bugs.webkit.org/show_bug.cgi?id=168649 Patch by Rob Buis <rbuis@igalia.com> on 2018-08-20 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/policies/referrer-origin-expected.txt: * web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt: * web-platform-tests/fetch/api/policies/referrer-origin-worker-expected.txt: * web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt: Source/WebCore: Implement remaining part of fetch change whatwg/fetch#377, i.e. if "parsedReferrer’s origin is not same origin with origin", then set request’s referrer to "client", instead of throwing an exception [1]. WebKit's new behavior matches that of Chrome and Firefox. Testing is covered by existing wpt tests. [1] Step 15.3.3 of https://fetch.spec.whatwg.org/#main-fetch * Modules/fetch/FetchRequest.cpp: (WebCore::computeReferrer): LayoutTests: * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-init-001.sub-expected.txt:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Folks are using the Request constructor in unexpected ways and
therefore it is throwing in unexpected ways (in particular when mode is
“navigate” or when setting referrer to a cross-origin URL). This will
make it throw less, while not really being less useful.
Fixes #245.