New issue
Advanced search Search tips

Issue 620746 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 621788
Owner:
Closed: Jun 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Origin header not always being sent on XMLHttpRequest

Reported by eszec...@gmail.com, Jun 16 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2769.0 Safari/537.36

Example URL:
n/a

Steps to reproduce the problem:
1.  set up dummy service-worker (simple console.log as provided by  default polymer project does it for me) 
2. make an XMLHttpRequest from an html to another (allowed) domain(NOTE: The backend server returns the value provided in Origin header as an allowed origin only if it is in the list of allowed domains)
3. Request works up to here
4. Hit refresh
5. Header "Origin" is not sent in request and fails ("XMLHttpRequest cannot load https://api/list. The 'Access-Control-Allow-Origin' header")

If i unregister the service worker, it works again one time till i refresh.

My Service worker is empty for dev (using polymer) so it's code is only a "console.log".

The request is as simple as :

function(rq) {
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', rq.onLoad.bind(this));
xhr.open('GET', rq.url);
xhr.setRequestHeader("Accept","application/json");
xhr.setRequestHeader("Accept-Language","en-US");
xhr.send();
}

What is the expected behavior?
I think that on step (5) the request should have sent the "Origin" header

The exact same page works OK in the current stable version of chrome., but fails on this canary release.

What went wrong?
Header "Origin" was not sent in the request.

Did this work before? Yes Current stable Chrome version works ok.

Chrome version: 53.0.2769.0  Channel: canary
OS Version: OS X 10.11.0
Flash Version: Shockwave Flash 22.0 r0
 
Components: Blink>Network>XHR
Labels: -Type-Bug Needs-Bisect Type-Bug-Regression
What is the version of Chrome Stable that you are using?

Comment 2 by eszec...@gmail.com, Jun 16 2016

The version where the problem does not occur is:
Version 51.0.2704.84 (64-bit)

Comment 3 Deleted

For some reason, the comment body has been deleted, but I just added SW label.
Sorry, I might delete the message by mistake when I looked via my smartphone...

# I think the position of "Delete comment" is quite good to touch for scrolling;(
Labels: Te-NeedsFurtherTriage

Comment 7 by eszec...@gmail.com, Jun 21 2016

Attached is a simple example (html + empty sw) where you can reproduce the issue:

1) load html and click test. you'll see that request sends "Origin" correctly.
2) hit refresh and click "test" again. You'll see that request is not sending "Origin" header.

Additionally, if you go to Dev tools ->  "Application" -> "Clear Storage" -> Clear all. Then hit refresh and It works again.



index.html
659 bytes View Download
service-worker.js
25 bytes View Download
Don't you see "Provisional headers are shown" on the "Request Headers" block you're looking at?

Comment 9 by eszec...@gmail.com, Jun 22 2016

No, attached are screenshots of the header block for both requests 
1st request.png
161 KB View Download
2nd request.png
157 KB View Download
Cc: shimazu@chromium.org
Checked snapshots
- r400924 bad
- r400929 ok

It looks shimazu@'s patch was the cause. Please check the latest canary. I think the regression is gone on it.
I mean r400928. shimazu@, please check if your patch introduces this when you try to reland it.
Cc: -shimazu@chromium.org
Owner: shimazu@chromium.org
Status: Started (was: Unconfirmed)
I guess this is caused by the same reason of  http://crbug.com/621788 . This will be probably fixed when it's relanded. 
Sorry for the inconvenience ;(

Comment 13 by eszec...@gmail.com, Jun 24 2016

Hi guys, 
I checked the latest version:
Google Chrome	53.0.2777.0 (Official Build) canary (64-bit)
Revision	cd5f1c60daa702f416e719edf13358571e0bf084-refs/heads/master@{#401526}

And i can no longer reproduce the issue now
Mergedinto: 621788
Status: Duplicate (was: Started)
Thanks for the followup!  Marking this as a duplicate of the fixed issue.

Sign in to add a comment