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

Conversation

3 participants
@annevk
Copy link
Member

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

This comment has been minimized.

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.

Make Request constructor more forgiving
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 Sep 27, 2016

@annevk annevk merged commit 76578f4 into master Sep 27, 2016

@annevk annevk deleted the forgive-change-and-forget branch Sep 27, 2016

@jdm

This comment has been minimized.

Copy link
Collaborator

jdm commented Dec 15, 2016

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

@jdalton

This comment has been minimized.

Copy link

jdalton commented Dec 15, 2016

@jdm Up for a pull request?

@jdm

This comment has been minimized.

Copy link
Collaborator

jdm commented Dec 15, 2016

That's my plan.

@annevk

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member Author

annevk commented Feb 21, 2017

annevk added 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

[Fetch API] Allow creating a request from a navigation request
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

Bug 1464759 [wpt PR 11176] - [Fetch] Mutation on navigation request, …
…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

Bug 1464759 [wpt PR 11176] - [Fetch] Mutation on navigation request, …
…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 that referenced this pull request Aug 20, 2018

commit-queue@webkit.org
Relax Request constructor around referrers
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

carlosgc@webkit.org
Merge r235025 - Relax Request constructor around referrers
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

carlosgc@webkit.org
Merge r235025 - Relax Request constructor around referrers
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.