Bug 1505935 Part 3 - Add pref allowing system scripts to be exposed to the debugger, r=lsmyth.
authorBrian Hackett <bhackett1024@gmail.com>
Sat, 10 Nov 2018 15:27:54 -1000
changeset 503032 d0f5ccba021a48e14743f9c67af3b1d9fd547151
parent 503031 4ebebcc2d18301f5a1a5babd79fbc58b71324a67
child 503033 c7d45d65740417ab9f8c910f27268d41ce8689ec
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsmyth
bugs1505935
milestone65.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 1505935 Part 3 - Add pref allowing system scripts to be exposed to the debugger, r=lsmyth.
modules/libpref/init/all.js
toolkit/recordreplay/ipc/JSControl.cpp
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1107,16 +1107,17 @@ pref("toolkit.dump.emit", false);
 #if defined(XP_MACOSX) && defined(NIGHTLY_BUILD)
 pref("devtools.recordreplay.enabled", true);
 pref("devtools.recordreplay.enableRewinding", true);
 #endif
 
 pref("devtools.recordreplay.mvp.enabled", false);
 pref("devtools.recordreplay.timeline.enabled", false);
 pref("devtools.recordreplay.allowRepaintFailures", true);
+pref("devtools.recordreplay.includeSystemScripts", false);
 
 // view source
 pref("view_source.syntax_highlight", true);
 pref("view_source.wrap_long_lines", false);
 pref("view_source.editor.path", "");
 // allows to add further arguments to the editor; use the %LINE% placeholder
 // for jumping to a specific line (e.g. "/line:%LINE%" or "--goto %LINE%")
 pref("view_source.editor.args", "");
--- a/toolkit/recordreplay/ipc/JSControl.cpp
+++ b/toolkit/recordreplay/ipc/JSControl.cpp
@@ -444,16 +444,19 @@ Middleman_ChildIsRecording(JSContext* aC
 // Devtools Sandbox
 ///////////////////////////////////////////////////////////////////////////////
 
 static PersistentRootedObject* gDevtoolsSandbox;
 
 // URL of the root script that runs when recording/replaying.
 #define ReplayScriptURL "resource://devtools/server/actors/replay/replay.js"
 
+// Whether to expose chrome:// and resource:// scripts to the debugger.
+static bool gIncludeSystemScripts;
+
 void
 SetupDevtoolsSandbox()
 {
   MOZ_RELEASE_ASSERT(!gDevtoolsSandbox);
 
   dom::AutoJSAPI jsapi;
   if (!jsapi.Init(xpc::PrivilegedJunkScope())) {
     MOZ_CRASH("SetupDevtoolsSandbox");
@@ -474,24 +477,36 @@ SetupDevtoolsSandbox()
   JSAutoRealm ar(cx, *gDevtoolsSandbox);
 
   ErrorResult er;
   dom::GlobalObject global(cx, *gDevtoolsSandbox);
   RootedObject obj(cx);
   dom::ChromeUtils::Import(global, NS_LITERAL_STRING(ReplayScriptURL),
                            dom::Optional<HandleObject>(), &obj, er);
   MOZ_RELEASE_ASSERT(!er.Failed());
+
+  gIncludeSystemScripts = Preferences::GetBool("devtools.recordreplay.includeSystemScripts");
 }
 
 extern "C" {
 
 MOZ_EXPORT bool
-RecordReplayInterface_IsInternalScript(const char* aURL)
+RecordReplayInterface_ShouldUpdateProgressCounter(const char* aURL)
 {
-  return !strcmp(aURL, ReplayScriptURL);
+  // Progress counters are only updated for scripts which are exposed to the
+  // debugger. The devtools timeline is based on progress values and we don't
+  // want gaps on the timeline which users can't seek to.
+  if (gIncludeSystemScripts) {
+    // Always exclude ReplayScriptURL. Scripts in this file are internal to the
+    // record/replay infrastructure and run non-deterministically between
+    // recording and replaying.
+    return aURL && strcmp(aURL, ReplayScriptURL);
+  } else {
+    return aURL && strncmp(aURL, "resource:", 9) && strncmp(aURL, "chrome:", 7);
+  }
 }
 
 } // extern "C"
 
 #undef ReplayScriptURL
 
 void
 ProcessRequest(const char16_t* aRequest, size_t aRequestLength, CharBuffer* aResponse)