Bug 1544170 Part 1 - Notify record/replay system about parsed style sheets, r=heycam.
authorBrian Hackett <bhackett1024@gmail.com>
Fri, 12 Apr 2019 16:33:00 -1000
changeset 470215 66ff290649f725c50c4b1815ab2294cbe1fc2f00
parent 470214 1305877ca306a4ff075c9ef84acf8ba4141e8888
child 470216 c04849933658c636fa3b3f3a3521f94141c36b28
push id112849
push userbhackett@mozilla.com
push dateSat, 20 Apr 2019 02:36:08 +0000
treeherdermozilla-inbound@3425e11a7a2d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1544170
milestone68.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 1544170 Part 1 - Notify record/replay system about parsed style sheets, r=heycam. Differential Revision: https://phabricator.services.mozilla.com/D27408
layout/style/Loader.cpp
mfbt/RecordReplay.h
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -1571,16 +1571,25 @@ nsresult Loader::LoadSheet(SheetLoadData
 Loader::Completed Loader::ParseSheet(const nsACString& aBytes,
                                      SheetLoadData* aLoadData,
                                      AllowAsyncParse aAllowAsync) {
   LOG(("css::Loader::ParseSheet"));
   AUTO_PROFILER_LABEL("css::Loader::ParseSheet", LAYOUT_CSSParsing);
   MOZ_ASSERT(aLoadData);
   aLoadData->mIsBeingParsed = true;
 
+  // Tell the record/replay system about any sheets that are being parsed,
+  // so that devtools code can find them later.
+  if (recordreplay::IsRecordingOrReplaying() && aLoadData->mURI) {
+    recordreplay::NoteContentParse(
+        aLoadData, aLoadData->mURI->GetSpecOrDefault().get(), "text/css",
+        reinterpret_cast<const Utf8Unit*>(aBytes.BeginReading()),
+        aBytes.Length());
+  }
+
   StyleSheet* sheet = aLoadData->mSheet;
   MOZ_ASSERT(sheet);
 
   // Some cases, like inline style and UA stylesheets, need to be parsed
   // synchronously. The former may trigger child loads, the latter must not.
   if (aLoadData->mSyncLoad || aAllowAsync == AllowAsyncParse::No) {
     sheet->ParseSheetSync(this, aBytes, aLoadData, aLoadData->mLineNumber);
     aLoadData->mIsBeingParsed = false;
--- a/mfbt/RecordReplay.h
+++ b/mfbt/RecordReplay.h
@@ -311,17 +311,17 @@ MFBT_API ProgressCounter NewTimeWarpTarg
 // Return whether a script should update the progress counter when it runs.
 MFBT_API bool ShouldUpdateProgressCounter(const char* aURL);
 
 // Define a RecordReplayControl object on the specified global object, with
 // methods specialized to the current recording/replaying or middleman process
 // kind.
 MFBT_API bool DefineRecordReplayControlObject(JSContext* aCx, JSObject* aObj);
 
-// Notify the infrastructure that some URL which contains JavaScript is
+// Notify the infrastructure that some URL which contains JavaScript or CSS is
 // being parsed. This is used to provide the complete contents of the URL to
 // devtools code when it is inspecting the state of this process; that devtools
 // code can't simply fetch the URL itself since it may have been changed since
 // the recording was made or may no longer exist. The token for a parse may not
 // be used in other parses until after EndContentParse() is called.
 MFBT_API void BeginContentParse(const void* aToken, const char* aURL,
                                 const char* aContentType);