Bug 1368170 - Remove unused Function.prototype.inherits methods. r=francois draft
authorAndrew McCreight <continuation@gmail.com>
Fri, 26 May 2017 13:46:10 -0700
changeset 585501 b9391a49447a47d5a602836ddb90d4b8c84e3778
parent 585500 df1e9885701fe2fc5dbc2e0801fbe53260f97c2e
child 630734 ebecc80bc469cfbc6981ec402189df9324951f8a
push id61126
push userbmo:continuation@gmail.com
push dateFri, 26 May 2017 23:08:04 +0000
reviewersfrancois
bugs1368170
milestone55.0a1
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
toolkit/components/url-classifier/content/moz/lang.js
toolkit/components/url-classifier/nsUrlClassifierListManager.js
--- a/toolkit/components/url-classifier/content/moz/lang.js
+++ b/toolkit/components/url-classifier/content/moz/lang.js
@@ -43,40 +43,8 @@ this.BindToObject = function BindToObjec
   }
 
   newfn.boundArgs_ = boundargs;
   newfn.boundSelf_ = self;
   newfn.boundFn_ = fn;
 
   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();
-}
--- a/toolkit/components/url-classifier/nsUrlClassifierListManager.js
+++ b/toolkit/components/url-classifier/nsUrlClassifierListManager.js
@@ -9,22 +9,16 @@ Components.utils.import("resource://gre/
 
 #include ./content/listmanager.js
 
 var modScope = this;
 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;
   modScope.G_Debug = jslib.G_Debug;
   modScope.G_Assert = jslib.G_Assert;
   modScope.G_debugService = jslib.G_debugService;
   modScope.G_Alarm = jslib.G_Alarm;
   modScope.BindToObject = jslib.BindToObject;