Bug 1119777 - Remove non-standard Function.prototype.isGenerator. r=arai,kmag
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 03 Nov 2017 17:27:43 +0100
changeset 390000 a19aef803cdb0797029d2440b9320e9b22efc195
parent 389999 cbac4c5957cd88538d46a7cc0248c68149b83e5d
child 390001 fb2b705b77cbf2d0b4607e262100bc3b7c1ee6d4
push id96970
push userjandemooij@gmail.com
push dateFri, 03 Nov 2017 16:28:13 +0000
treeherdermozilla-inbound@a19aef803cdb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai, kmag
bugs1119777
milestone58.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 1119777 - Remove non-standard Function.prototype.isGenerator. r=arai,kmag
js/src/jsfun.cpp
js/src/tests/js1_8_5/extensions/is-generator.js
js/xpconnect/tests/chrome/test_xrayToJS.xul
toolkit/modules/DeferredTask.jsm
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -1735,38 +1735,23 @@ JSFunction::maybeRelazify(JSRuntime* rt)
         MOZ_ASSERT(isSelfHostedBuiltin());
         MOZ_ASSERT(isExtended());
         MOZ_ASSERT(getExtendedSlot(LAZY_FUNCTION_NAME_SLOT).toString()->isAtom());
     }
 
     comp->scheduleDelazificationForDebugger();
 }
 
-static bool
-fun_isGenerator(JSContext* cx, unsigned argc, Value* vp)
-{
-    CallArgs args = CallArgsFromVp(argc, vp);
-    JSFunction* fun;
-    if (!IsFunctionObject(args.thisv(), &fun)) {
-        args.rval().setBoolean(false);
-        return true;
-    }
-
-    args.rval().setBoolean(fun->isGenerator());
-    return true;
-}
-
 const JSFunctionSpec js::function_methods[] = {
 #if JS_HAS_TOSOURCE
     JS_FN(js_toSource_str,   fun_toSource,   0,0),
 #endif
     JS_FN(js_toString_str,   fun_toString,   0,0),
     JS_FN(js_apply_str,      fun_apply,      2,0),
     JS_FN(js_call_str,       fun_call,       1,0),
-    JS_FN("isGenerator",     fun_isGenerator,0,0),
     JS_SELF_HOSTED_FN("bind", "FunctionBind", 2, 0),
     JS_SYM_FN(hasInstance, fun_symbolHasInstance, 1, JSPROP_READONLY | JSPROP_PERMANENT),
     JS_FS_END
 };
 
 // ES2018 draft rev 2aea8f3e617b49df06414eb062ab44fad87661d3
 // 19.2.1.1.1 CreateDynamicFunction( constructor, newTarget, kind, args )
 static bool
deleted file mode 100644
--- a/js/src/tests/js1_8_5/extensions/is-generator.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/licenses/publicdomain/
- */
-
-/*
- * Bug 648355: Function.prototype.isGenerator
- */
-
-reportCompare(true, "isGenerator" in Function.prototype, "Function.prototype.isGenerator present");
-
-reportCompare(false, (function(){}).isGenerator(), "lambda is not a generator fn");
-reportCompare(false, Function.prototype.toString.isGenerator(), "native is not a generator fn");
-reportCompare(false, (function(){with(obj){}}).isGenerator(), "heavyweight is not a generator fn");
-reportCompare(false, (function(){obj}).isGenerator(), "upvar function is not a generator fn");
-
-reportCompare(true, (function*(){yield}).isGenerator(), "simple generator fn");
-reportCompare(true, (function*(){with(obj){yield}}).isGenerator(), "heavyweight generator fn");
-reportCompare(true, (function*(){yield; obj}).isGenerator(), "upvar generator fn");
-
-reportCompare(false, Function.prototype.isGenerator.call(42), "number is not a generator fn");
-reportCompare(false, Function.prototype.isGenerator.call({}), "vanilla object is not a generator fn");
-reportCompare(false, Function.prototype.isGenerator.call(new Date()), "date object is not a generator fn");
--- a/js/xpconnect/tests/chrome/test_xrayToJS.xul
+++ b/js/xpconnect/tests/chrome/test_xrayToJS.xul
@@ -230,17 +230,17 @@ https://bugzilla.mozilla.org/show_bug.cg
       gConstructorProperties[c] = constructorProps([]);
   }
   // toString and toSource only live on the parent proto (Error.prototype).
   gPrototypeProperties['Error'].push('toString');
   gPrototypeProperties['Error'].push('toSource');
 
   gPrototypeProperties['Function'] =
     ["constructor", "toSource", "toString", "apply", "call", "bind",
-     "isGenerator", "length", "name", "arguments", "caller", Symbol.hasInstance];
+     "length", "name", "arguments", "caller", Symbol.hasInstance];
   gConstructorProperties['Function'] = constructorProps([])
 
   gPrototypeProperties['RegExp'] =
     ["constructor", "toSource", "toString", "compile", "exec", "test",
      Symbol.match, Symbol.replace, Symbol.search, Symbol.split,
      "flags", "global", "ignoreCase", "multiline", "source", "sticky", "unicode"];
   gConstructorProperties['RegExp'] =
     constructorProps(["input", "lastMatch", "lastParen",
--- a/toolkit/modules/DeferredTask.jsm
+++ b/toolkit/modules/DeferredTask.jsm
@@ -113,20 +113,16 @@ const Timer = Components.Constructor("@m
  *        The maximum time to wait for an idle slot on the main thread after
  *        aDelayMs have elapsed. If omitted, waits indefinitely for an idle
  *        callback.
  */
 this.DeferredTask = function(aTaskFn, aDelayMs, aIdleTimeoutMs) {
   this._taskFn = aTaskFn;
   this._delayMs = aDelayMs;
   this._timeoutMs = aIdleTimeoutMs;
-
-  if (aTaskFn.isGenerator()) {
-    Cu.reportError(new Error("Unexpected generator function passed to DeferredTask"));
-  }
 };
 
 this.DeferredTask.prototype = {
   /**
    * Function or generator function to execute.
    */
   _taskFn: null,