Throwing away getters/setters instead of raising an exception

RESOLVED DUPLICATE of bug 1144204

Status

()

Core
DOM
RESOLVED DUPLICATE of bug 1144204
2 years ago
2 years ago

People

(Reporter: karlcow, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

2 years ago
Users on nasa.gov get a blank page on nasa.gov.
I'm opening this here to see if we need to fix something on the side on Firefox. If not we will go back to trying to contact the nasa owners.

An explanation has been provided on 
https://webcompat.com/issues/1984#issuecomment-169042096

==============================
> To ensure that a user doesn't update something a template 
> is watching without using Ember.set (to trigger observers), 
> ember adds its own meta stuff directly on the object that 
> adds assertions when you try to update it via normal 
> javascript assignment.
> 
> So something like
> 
> var stuff = {}
> 
> // routes/application.js
> Ember.Route.extend({
>   model() {
>     return stuff;
>   }
> })
> 
> Would add the meta you're seeing in the bug. A workaround 
> if you know the mimeTypes object will never change is to 
> do a shallow copy:
> 
> mimeTypes: Ember.computed(function() {
>   return Ember.$.extend({}, navigator.mimeTypes);
> })
> 
> I suspect firefox is throwing what ever property or ES5 
> getters/setters away instead of raising an exception that 
> they should not be modified. Maybe other browsers allow the 
> navigator.mimeTypes object to be modified. Reading the other 
> ticket it sounds like it is returning an object for ember_meta 
> that Ember assumes has already been setup so it tries to 
> access its meta properties.
> 
> I think the computed property workaround should work.
====================

It would be good to understand 

* why other browsers have no issues and if we should fix it on Firefox. 
* if it's something common with Ember sites.
A minimal testcase would be great here. I can't quite parse what https://webcompat.com/issues/1984#issuecomment-169042096 is trying to say.
The minimal testcase is basically at http://hallvord.com/temp/moz/bug/wc1984.htm as far as I can tell.  But that's tracked by bug 1144204, no?

I can't tell what this bug is supposed to be about...
Flags: needinfo?(kdubost)
And in particular, a simple testcase shows that we totally raise an exception if you try to override one of the named properties on navigator.mimeTypes:

  Object.defineProperty(navigator.mimeTypes, "text/html", { get: function() {}, set: function() {} })
(Reporter)

Comment 4

2 years ago
My bad. I should have checked that with Hallvord it was already reported. 
Sorry for the noise.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Flags: needinfo?(kdubost)
Resolution: --- → DUPLICATE
Duplicate of bug: 1144204
You need to log in before you can comment on or make changes to this bug.