From c11ddf3017b5e0a3e3772348e6a18b9e9443a70d Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Fri, 26 May 2017 13:46:10 -0700 Subject: [PATCH] Bug 1368170 - Remove unused Function.prototype.inherits methods. r=francois These methods do not appear to be used. When JSM global sharing is enabled, these methods contaminate the global Function.prototype, which breaks Marionette object serialization. MozReview-Commit-ID: CAfJ2FCkhlK --HG-- extra : rebase_source : 38acb4616ee14283d0f67e1b2144972c7d139f84 --- .../url-classifier/content/moz/lang.js | 32 ------------------- .../nsUrlClassifierListManager.js | 6 ---- 2 files changed, 38 deletions(-) diff --git a/toolkit/components/url-classifier/content/moz/lang.js b/toolkit/components/url-classifier/content/moz/lang.js index 804a6e973e83..a41252950e9d 100644 --- a/toolkit/components/url-classifier/content/moz/lang.js +++ b/toolkit/components/url-classifier/content/moz/lang.js @@ -48,35 +48,3 @@ this.BindToObject = function BindToObject(fn, self, opt_args) { return newfn; } - -/** - * Inherit the prototype methods from one constructor into another. - * - * Usage: - * - * function ParentClass(a, b) { } - * ParentClass.prototype.foo = function(a) { } - * - * function ChildClass(a, b, c) { - * ParentClass.call(this, a, b); - * } - * - * ChildClass.inherits(ParentClass); - * - * var child = new ChildClass("a", "b", "see"); - * child.foo(); // works - * - * In addition, a superclass' implementation of a method can be invoked - * as follows: - * - * ChildClass.prototype.foo = function(a) { - * ChildClass.superClass_.foo.call(this, a); - * // other code - * }; - */ -Function.prototype.inherits = function(parentCtor) { - var tempCtor = function(){}; - tempCtor.prototype = parentCtor.prototype; - this.superClass_ = parentCtor.prototype; - this.prototype = new tempCtor(); -} diff --git a/toolkit/components/url-classifier/nsUrlClassifierListManager.js b/toolkit/components/url-classifier/nsUrlClassifierListManager.js index 7b3c181af7d1..db34afd17b3b 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierListManager.js +++ b/toolkit/components/url-classifier/nsUrlClassifierListManager.js @@ -14,12 +14,6 @@ function Init() { // Pull the library in. var jslib = Cc["@mozilla.org/url-classifier/jslib;1"] .getService().wrappedJSObject; - Function.prototype.inherits = function(parentCtor) { - var tempCtor = function(){}; - tempCtor.prototype = parentCtor.prototype; - this.superClass_ = parentCtor.prototype; - this.prototype = new tempCtor(); - }, modScope.G_Preferences = jslib.G_Preferences; modScope.G_PreferenceObserver = jslib.G_PreferenceObserver; modScope.G_ObserverServiceObserver = jslib.G_ObserverServiceObserver;