Closed Bug 774645 Opened 12 years ago Closed 7 years ago

Move Object.prototype.watch to Object.watch

Categories

(Core :: JavaScript Engine, defect)

17 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 638054

People

(Reporter: medikoo+mozilla.org, Unassigned)

References

Details

(Whiteboard: [js:p2])

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Firefox/17.0 Build ID: 20120717030555 Steps to reproduce: Imagine following code: var someFunction = function (data, options) { if (options && options.watch) { // watch option set, let's do something about it } }; someFunction('foo'); Actual results: It will act in unexpected way, as not standard method exist on Object.prototype. I found that very surprising, even standard committee decided to froze Object.prototype cause of such issues, and defines all new functions for objects on Object constructor directly. Why Firefox breaks that rule? Expected results: Firefox should move all not standard methods from Object.prototype as they can break user code and provide them as functions on Object constructor
(In reply to Mariusz Nowak from comment #0) > I found that very surprising, even standard committee decided to froze > Object.prototype cause of such issues, and defines all new functions for > objects on Object constructor directly. Why Firefox breaks that rule? Because Object.prototype.watch was present in SpiderMonkey far before the decision has been made. > Firefox should move all not standard methods from Object.prototype as they > can break user code and provide them as functions on Object constructor Rather, non-standard methods should be either completely removed or standardized.
Depends on: 638054
Assignee: nobody → general
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
I agree, I don't see how it can be moved elsewhere and still work--we should remove it when we have the replacement.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [js:p2]
Assignee: general → nobody
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.