Closed Bug 1368170 Opened 7 years ago Closed 7 years ago

Remove unused Function.prototype.inherits methods

Categories

(Toolkit :: Safe Browsing, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(1 file)

content/moz/lang.js and nsUrlClassifierListManager.js both define a method named "inherits" on Function.prototype, which I guess is supposed to be some kind of class-based inheritance. However, as far as I can tell, these methods are never called. There are a few places that explicitly call a .inherits methods, but they define them right before their use, so hopefully this is okay.

I want to make this change because with JSM global sharing (bug 1186409) changing Function.prototype in this way affects all JSMs, including Services.jsm. Marionette code tries to serialize Services.appInfo, which has a field QueryInterface, which is a function. Because of the inherits field on Function.prototype, this serialization seems to result in infinite recursion. (Presumably because the inherits method is itself a function.)
(In reply to Andrew McCreight [:mccr8] from comment #0)
> Marionette code tries to serialize Services.appInfo, which has
> a field QueryInterface, which is a function. Because of the inherits field
> on Function.prototype, this serialization seems to result in infinite
> recursion. (Presumably because the inherits method is itself a function.)

This seems like a bug.  Do you have a link to the exact location where we try to serialise Services.appInfo directly?  I Know we extract values from it, but we should not be trying to serialise Services.appInfo.
(In reply to Andreas Tolfsen ‹:ato› from comment #1)
> This seems like a bug.  Do you have a link to the exact location where we
> try to serialise Services.appInfo directly?  I Know we extract values from
> it, but we should not be trying to serialise Services.appInfo.

I don't exactly know where it was happening, but the script it was running was the same as the one here, which is returning Services.appinfo:
http://searchfox.org/mozilla-central/source/testing/marionette/harness/marionette_harness/runner/base.py#669
See Also: → 1368195
Comment on attachment 8871978 [details]
Bug 1368170 - Remove unused Function.prototype.inherits methods.

https://reviewboard.mozilla.org/r/143514/#review147912
Attachment #8871978 - Flags: review?(francois) → review+
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0a56ccf2f145
Remove unused Function.prototype.inherits methods. r=francois
https://hg.mozilla.org/mozilla-central/rev/0a56ccf2f145
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: