Skip to content
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 2 commits into from
Sep 27, 2016
Merged

Conversation

annevk
Copy link
Member

@annevk annevk commented Aug 26, 2016

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.

@annevk
Copy link
Member Author

annevk commented Sep 15, 2016

@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.
@annevk annevk force-pushed the forgive-change-and-forget branch from 13e097d to 4db046c Compare September 27, 2016 09:57
@annevk annevk merged commit 76578f4 into master Sep 27, 2016
@annevk annevk deleted the forgive-change-and-forget branch September 27, 2016 09:59
@jdm
Copy link
Member

jdm commented Dec 15, 2016

It's disappointing that the web-platform-tests were not updated to reflect this change.

@jdalton
Copy link

jdalton commented Dec 15, 2016

@jdm Up for a pull request?

@jdm
Copy link
Member

jdm commented Dec 15, 2016

That's my plan.

@annevk
Copy link
Member Author

annevk commented Dec 16, 2016

@jdm @jdalton sorry about that, it's a policy we only started relatively recently. Future changes should land together with WPT changes.

@annevk
Copy link
Member Author

annevk commented Feb 21, 2017

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
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants