New issue
Advanced search Search tips

Issue 724734 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation

Reported by ambar....@gmail.com, May 20 2017

Issue description

Chrome Version       : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36"
URLs (if applicable) :
Other browsers tested:
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari: OK
    Firefox: FAIL
         IE:

What steps will reproduce the problem?
const foo = {fetch}
foo.fetch('/')

What is the expected result?
calls fetch


What happens instead?
TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation

Please provide any additional information below. Attach a screenshot if
possible.

 

Comment 1 by ricea@chromium.org, May 26 2017

Components: Blink>Bindings
Status: Untriaged (was: Unconfirmed)
I suspect this is actually working-as-intended. Firefox's error is very specific:

TypeError: 'fetch' called on an object that does not implement interface Window.

I think this is because the IDL definition at https://fetch.spec.whatwg.org/#fetch-method does not include [LenientThis]. Adding the Blink>Bindings component to direct this to people who should know.
Status: WontFix (was: Untriaged)
This is working-as-intended I think. You cannot call a function implemented by Window with another object (fetch needs "this" to be set to the window object).

So this should work: 
const foo = {fetch: fetch.bind(window)}
foo.fetch('/')

Sign in to add a comment