Bug 1368170 - Remove unused Function.prototype.inherits methods. r=francois
authorAndrew McCreight <continuation@gmail.com>
Fri, 26 May 2017 13:46:10 -0700
changeset 409452 0a56ccf2f1458ae51769a64bfda365fc97662902
parent 409451 0710e3c80efacf47fa68a3a25379f6cc33dbe1af
child 409453 0d668dc55c451b3014272056eb738c127374374e
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrancois
bugs1368170
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;