Bug 1533523 - Fire Debugger::onNewScript for default class constructors, r=loganfsmyth.
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 07 Mar 2019 20:56:11 +0000
changeset 521050 6d82d52f6279
parent 521049 8d02942b98f5
child 521051 def4c8434246
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersloganfsmyth
bugs1533523
milestone67.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 1533523 - Fire Debugger::onNewScript for default class constructors, r=loganfsmyth. Differential Revision: https://phabricator.services.mozilla.com/D22580
js/src/vm/Interpreter.cpp
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -291,17 +291,17 @@ JSFunction* js::MakeDefaultConstructor(J
           /* nargs = */ !!derived, proto, TenuredObject, &ctor)) {
     return nullptr;
   }
 
   ctor->setIsConstructor();
   ctor->setIsClassConstructor();
 
   // Create the script now, so we can fix up its source span below.
-  JSScript* ctorScript = JSFunction::getOrCreateScript(cx, ctor);
+  RootedScript ctorScript(cx, JSFunction::getOrCreateScript(cx, ctor));
   if (!ctorScript) {
     return nullptr;
   }
 
   // This function's frames are fine to expose to JS; it should not be treated
   // as an opaque self-hosted builtin. But the script cloning code naturally
   // expects to be applied to self-hosted functions, so do the clone first,
   // and clear this afterwards.
@@ -312,16 +312,18 @@ JSFunction* js::MakeDefaultConstructor(J
   // (self-hosted) constructor function.
   uint32_t classStartOffset = GetSrcNoteOffset(classNote, 0);
   uint32_t classEndOffset = GetSrcNoteOffset(classNote, 1);
   unsigned column;
   unsigned line = PCToLineNumber(script, pc, &column);
   ctorScript->setDefaultClassConstructorSpan(
       script->sourceObject(), classStartOffset, classEndOffset, line, column);
 
+  Debugger::onNewScript(cx, ctorScript);
+
   return ctor;
 }
 
 bool js::ReportIsNotFunction(JSContext* cx, HandleValue v, int numToSkip,
                              MaybeConstruct construct) {
   unsigned error = construct ? JSMSG_NOT_CONSTRUCTOR : JSMSG_NOT_FUNCTION;
   int spIndex = numToSkip >= 0 ? -(numToSkip + 1) : JSDVG_SEARCH_STACK;