Bug 1253016 - Remove legacy __defineGetter__/__defineSetter__ this behavior. r=till
authorTom Schuster <evilpies@gmail.com>
Sat, 12 Mar 2016 15:02:11 +0100
changeset 288422 bd22586cac8283289b3440bfe74d7ef79e1ef2bf
parent 288421 ba5dd6053cc4351e58ad407d8ef96a6dfcf344d4
child 288423 16b05a0fb83aa8a444d6afe0942291627c500960
push id30079
push userryanvm@gmail.com
push dateSat, 12 Mar 2016 20:24:19 +0000
treeherdermozilla-central@d1d47ba19ce9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1253016
milestone48.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 1253016 - Remove legacy __defineGetter__/__defineSetter__ this behavior. r=till
js/src/builtin/Object.js
js/src/jit-test/tests/auto-regress/bug488421.js
js/src/jit-test/tests/auto-regress/bug490191.js
js/src/jit-test/tests/auto-regress/bug521163.js
js/src/jit-test/tests/auto-regress/bug560796.js
js/src/jit-test/tests/auto-regress/bug580699.js
js/src/jit-test/tests/auto-regress/bug600128.js
js/src/jit-test/tests/auto-regress/bug653789.js
js/src/jit-test/tests/baseline/bug1153458.js
js/src/jit-test/tests/basic/bug593611.js
js/src/jit-test/tests/basic/bug641229.js
js/src/jit-test/tests/basic/testBug628564.js
js/src/jit-test/tests/ion/bug1076026.js
--- a/js/src/builtin/Object.js
+++ b/js/src/builtin/Object.js
@@ -56,24 +56,22 @@ function Object_toLocaleString() {
     // Step 1.
     var O = this;
 
     // Step 2.
     return callContentFunction(O.toString, O);
 }
 
 function ObjectDefineSetter(name, setter) {
-    var object;
-    if (this === null || this === undefined) {
+    if (this === null || this === undefined)
         AddContentTelemetry(TELEMETRY_DEFINE_GETTER_SETTER_THIS_NULL_UNDEFINED, 1);
-        object = global;
-    } else {
+    else
         AddContentTelemetry(TELEMETRY_DEFINE_GETTER_SETTER_THIS_NULL_UNDEFINED, 0);
-        object = ToObject(this);
-    }
+
+    var object = ToObject(this);
 
     if (!IsCallable(setter))
         ThrowTypeError(JSMSG_BAD_GETTER_OR_SETTER, "setter");
 
     var key = ToPropertyKey(name);
 
     var desc = {
         __proto__: null,
@@ -81,24 +79,22 @@ function ObjectDefineSetter(name, setter
         configurable: true,
         set: setter
     };
 
     std_Object_defineProperty(object, key, desc);
 }
 
 function ObjectDefineGetter(name, getter) {
-    var object;
-    if (this === null || this === undefined) {
+    if (this === null || this === undefined)
         AddContentTelemetry(TELEMETRY_DEFINE_GETTER_SETTER_THIS_NULL_UNDEFINED, 1);
-        object = global;
-    } else {
+    else
         AddContentTelemetry(TELEMETRY_DEFINE_GETTER_SETTER_THIS_NULL_UNDEFINED, 0);
-        object = ToObject(this);
-    }
+
+    var object = ToObject(this);
 
     if (!IsCallable(getter))
         ThrowTypeError(JSMSG_BAD_GETTER_OR_SETTER, "getter");
 
     var key = ToPropertyKey(name);
 
     var desc = {
         __proto__: null,
--- a/js/src/jit-test/tests/auto-regress/bug488421.js
+++ b/js/src/jit-test/tests/auto-regress/bug488421.js
@@ -1,12 +1,12 @@
 // Binary: cache/js-dbg-64-862693caa320-linux
 // Flags:
 //
 function f(foo)
 {
   var x;
-  eval("__defineGetter__(\"y\", function ()x)");
+  eval("this.__defineGetter__(\"y\", function ()x)");
 }
 f("");
 try {
 ((function(){ throw y })())
 } catch(exc1) {}
--- a/js/src/jit-test/tests/auto-regress/bug490191.js
+++ b/js/src/jit-test/tests/auto-regress/bug490191.js
@@ -1,15 +1,15 @@
 // Binary: cache/js-dbg-64-daefd30072a6-linux
 // Flags:
 //
 function f(param) {
   var w;
   return eval("\
     (function(){\
-      __defineGetter__(\"y\", function()({\
+      this.__defineGetter__(\"y\", function()({\
         x: function(){ return w }()\
       }))\
     });\
   ");
 }
 (f())();
 (new Function("eval(\"y\")"))();
--- a/js/src/jit-test/tests/auto-regress/bug521163.js
+++ b/js/src/jit-test/tests/auto-regress/bug521163.js
@@ -1,11 +1,11 @@
 // |jit-test| error:ReferenceError
 
 // Binary: cache/js-dbg-32-c08baee44cf4-linux
 // Flags:
 //
 for (c in [0]) {
     {
-        let c = __defineGetter__("", function(){});
+        let c = this.__defineGetter__("", function(){});
         eval("function w(){}")++
     }
 }
--- a/js/src/jit-test/tests/auto-regress/bug560796.js
+++ b/js/src/jit-test/tests/auto-regress/bug560796.js
@@ -1,9 +1,9 @@
 // Binary: cache/js-dbg-64-a6d7a5677b4c-linux
 // Flags:
 //
-__defineSetter__("x", function(){})
+this.__defineSetter__("x", function(){})
 this.watch("x", "".localeCompare)
 window = x
 Object.defineProperty(this, "x", ({
     set: window
 }))
--- a/js/src/jit-test/tests/auto-regress/bug580699.js
+++ b/js/src/jit-test/tests/auto-regress/bug580699.js
@@ -3,10 +3,10 @@
 //
 function f() {
     (function () {
         x;
         function a() {}
         print(a)
     })()
 }
-__defineGetter__("x", gc)
+this.__defineGetter__("x", gc)
 f()
--- a/js/src/jit-test/tests/auto-regress/bug600128.js
+++ b/js/src/jit-test/tests/auto-regress/bug600128.js
@@ -1,10 +1,10 @@
 // Binary: cache/js-dbg-64-54700fad8cf9-linux
 // Flags: -j
 //
-__defineSetter__("x", Object.freeze)
+this.__defineSetter__("x", Object.freeze)
 x = this;
 for (let z = 0; z < 5; z++) {
     for each(let y in [0, 0, 0]) {
         print(u = "")
     }
 }
--- a/js/src/jit-test/tests/auto-regress/bug653789.js
+++ b/js/src/jit-test/tests/auto-regress/bug653789.js
@@ -1,8 +1,8 @@
 // |jit-test| error:InternalError
 
 // Binary: cache/js-dbg-64-3dd6ec45084c-linux
 // Flags:
 //
-__defineGetter__("x", eval);
+this.__defineGetter__("x", eval);
 eval.toString = toLocaleString
 eval < x
--- a/js/src/jit-test/tests/baseline/bug1153458.js
+++ b/js/src/jit-test/tests/baseline/bug1153458.js
@@ -1,11 +1,11 @@
 // |jit-test| --baseline-eager; error: TypeError
 try {
-    __defineGetter__("x", Iterator)()
+    this.__defineGetter__("x", Iterator)()
 } catch (e) {}
 f = function() {
     return (function() {
         this.x
     })
 }()
 try {
     f()
--- a/js/src/jit-test/tests/basic/bug593611.js
+++ b/js/src/jit-test/tests/basic/bug593611.js
@@ -1,10 +1,11 @@
+var global = this;
 (function() {
-  __defineGetter__("x", /x/.constructor)
+  global.__defineGetter__("x", /x/.constructor)
 })()
 for (var a = 0; a < 4; ++a) {
   if (a % 4 == 1) {
     gc()
   } else {
     print(x);
   }
 }
--- a/js/src/jit-test/tests/basic/bug641229.js
+++ b/js/src/jit-test/tests/basic/bug641229.js
@@ -1,2 +1,2 @@
-__defineSetter__("x",Math.max)
+this.__defineSetter__("x",Math.max)
 Function("({x}=[])")()
--- a/js/src/jit-test/tests/basic/testBug628564.js
+++ b/js/src/jit-test/tests/basic/testBug628564.js
@@ -1,8 +1,8 @@
 x = 0
 for (a = 0; a < 13; ++a) {
   if (a == 7) {
     if (!x) {
-      __defineSetter__("x", Object.defineProperties)
+      this.__defineSetter__("x", Object.defineProperties)
     }
   }
 }
--- a/js/src/jit-test/tests/ion/bug1076026.js
+++ b/js/src/jit-test/tests/ion/bug1076026.js
@@ -1,9 +1,9 @@
 (function f() {
     let x = (new function() {})
-    __defineGetter__("x", function() {
+    this.__defineGetter__("x", function() {
         ({
             e: x
         })
     })
 })();
 print(x)