New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 646715 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Sth goes wrong when excuting window.fetch witch 'headers' after extending Object.prototype with line-break.

Reported by o...@mug.dog, Sep 14 2016

Issue description

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

Steps to reproduce the problem:
1. Open the console

2. Type the code
```
Object.prototype.foo = function () {}
fetch('/', {method: 'POST', headers: {}})
```

3. All going well.

4. Type the code
```
Object.prototype.foo = function () {
}
fetch('/', {method: 'POST', headers: {}})
```

5.  Throwing an error:
```
TypeError: Failed to execute 'fetch' on 'Window': Invalid value
```

What is the expected behavior?
It should works well whether line-break exsists.

What went wrong?
When extending Object.prototype with line-break, the fetch API with POST method and headers goes wrong. 

Did this work before? N/A 

Chrome version: 52.0.2743.116  Channel: n/a
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 22.0 r0
 

Comment 1 by o...@mug.dog, Sep 14 2016

Wrong spell in title: *witch -> with
Cc: dgozman@chromium.org
Components: -Blink Platform>DevTools
dgozman@ any idea why this is different?
Cc: kozyatinskiy@chromium.org yhirano@chromium.org
Components: Blink>Network>FetchAPI
Played with this. Using "headers: {__proto__: null}" makes everything work, so the problem is definitely with the headers being enumerated.
I'm surprised that "foo" from the prototype is even used here.

@kozyatinskiy, yhirano: any thoughts?
Because String(headers.foo) includes a line-break and HTTP doesn't allow it.

See https://fetch.spec.whatwg.org/#concept-headers-fill.
Status: WontFix (was: Unconfirmed)
Thanks for clarification. Sounds like this is according to the spec.
I still think that grabbing properties from a prototype is somewhat counter-intuitive, but spec is a spec.

Sign in to add a comment