Bug 1470795 Part 5 - Update content parse users for API movement, r=froydnj.
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 23 Jul 2018 21:45:33 +0000
changeset 822116 337cda619aeeea05c46cc5ddcebfc371e6bc9737
parent 822115 818c1a79b41dc6d18c9dbe2c600fe02905f3e7d0
child 822117 6f0edf4a20203db99cf6ea67b3ad3b6fb5324993
push id117296
push userbmo:gl@mozilla.com
push dateTue, 24 Jul 2018 20:28:07 +0000
reviewersfroydnj
bugs1470795
milestone63.0a1
Bug 1470795 Part 5 - Update content parse users for API movement, r=froydnj.
dom/script/ScriptLoader.cpp
js/src/vm/JSScript.cpp
parser/html/nsHtml5StreamParser.cpp
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -2357,20 +2357,18 @@ ScriptLoader::EvaluateScript(ScriptLoadR
                                               aRequest->ScriptBinASTData().length(),
                                               &script);
               } else {
                 MOZ_ASSERT(aRequest->IsTextSource());
                 nsAutoString inlineData;
                 SourceBufferHolder srcBuf = GetScriptSource(aRequest, inlineData);
 
                 if (recordreplay::IsRecordingOrReplaying()) {
-                  JS::BeginContentParseForRecordReplay(this, options.filename(), "application/javascript",
-                                                       JS::SmallestEncoding::UTF16);
-                  JS::AddContentParseDataForRecordReplay(this, srcBuf.get(), srcBuf.length() * sizeof(char16_t));
-                  JS::EndContentParseForRecordReplay(this);
+                  recordreplay::NoteContentParse(this, options.filename(), "application/javascript",
+                                                 srcBuf.get(), srcBuf.length());
                 }
 
                 rv = exec.CompileAndExec(options, srcBuf, &script);
               }
             }
           }
 
           // Queue the current script load request to later save the bytecode.
--- a/js/src/vm/JSScript.cpp
+++ b/js/src/vm/JSScript.cpp
@@ -2216,20 +2216,18 @@ ScriptSource::performXDR(XDRState<mode>*
             return xdr->fail(JS::TranscodeResult_Throw);
 
         // Note the content of sources decoded when recording or replaying.
         if (mode == XDR_DECODE && hasSourceData() && mozilla::recordreplay::IsRecordingOrReplaying()) {
             UncompressedSourceCache::AutoHoldEntry holder;
             ScriptSource::PinnedChars chars(xdr->cx(), this, holder, 0, length());
             if (!chars.get())
                 return xdr->fail(JS::TranscodeResult_Throw);
-            JS::BeginContentParseForRecordReplay(this, filename(), "application/javascript",
-                                                 JS::SmallestEncoding::UTF16);
-            JS::AddContentParseDataForRecordReplay(this, chars.get(), length() * sizeof(char16_t));
-            JS::EndContentParseForRecordReplay(this);
+            mozilla::recordreplay::NoteContentParse(this, filename(), "application/javascript",
+                                                    chars.get(), length());
         }
     }
 
     return Ok();
 }
 
 // Format and return a cx->pod_malloc'ed URL for a generated script like:
 //   {filename} line {lineno} > {introducer}
--- a/parser/html/nsHtml5StreamParser.cpp
+++ b/parser/html/nsHtml5StreamParser.cpp
@@ -215,17 +215,17 @@ nsHtml5StreamParser::nsHtml5StreamParser
   // There's a zeroing operator new for everything else
 }
 
 nsHtml5StreamParser::~nsHtml5StreamParser()
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   mTokenizer->end();
   if (recordreplay::IsRecordingOrReplaying()) {
-    JS::EndContentParseForRecordReplay(this);
+    recordreplay::EndContentParse(this);
   }
 #ifdef DEBUG
   {
     mozilla::MutexAutoLock flushTimerLock(mFlushTimerMutex);
     MOZ_ASSERT(!mFlushTimer, "Flush timer was not dropped before dtor!");
   }
   mRequest = nullptr;
   mObserver = nullptr;
@@ -285,18 +285,17 @@ nsHtml5StreamParser::Notify(const char* 
 }
 
 void
 nsHtml5StreamParser::SetViewSourceTitle(nsIURI* aURL)
 {
   if (recordreplay::IsRecordingOrReplaying()) {
     nsAutoCString spec;
     aURL->GetSpec(spec);
-    JS::BeginContentParseForRecordReplay(this, spec.get(), "text/html",
-                                         JS::SmallestEncoding::UTF16);
+    recordreplay::BeginContentParse(this, spec.get(), "text/html");
   }
 
   if (aURL) {
     nsCOMPtr<nsIURI> temp;
     bool isViewSource;
     aURL->SchemeIs("view-source", &isViewSource);
     if (isViewSource) {
       nsCOMPtr<nsINestedURI> nested = do_QueryInterface(aURL);
@@ -841,17 +840,17 @@ nsHtml5StreamParser::WriteStreamBytes(co
     auto dst = mLastBuffer->TailAsSpan(NS_HTML5_STREAM_PARSER_READ_BUFFER_SIZE);
     uint32_t result;
     size_t read;
     size_t written;
     bool hadErrors;
     Tie(result, read, written, hadErrors) =
       mUnicodeDecoder->DecodeToUTF16(src, dst, false);
     if (recordreplay::IsRecordingOrReplaying()) {
-      JS::AddContentParseDataForRecordReplay(this, dst.data(), written * sizeof(char16_t));
+      recordreplay::AddContentParseData(this, dst.data(), written);
     }
     if (hadErrors && !mHasHadErrors) {
       mHasHadErrors = true;
       if (mEncoding == UTF_8_ENCODING) {
         mTreeBuilder->TryToEnableEncodingMenu();
       }
     }
     src = src.From(read);
@@ -1100,17 +1099,17 @@ nsHtml5StreamParser::DoStopRequest()
     auto dst = mLastBuffer->TailAsSpan(NS_HTML5_STREAM_PARSER_READ_BUFFER_SIZE);
     uint32_t result;
     size_t read;
     size_t written;
     bool hadErrors;
     Tie(result, read, written, hadErrors) =
       mUnicodeDecoder->DecodeToUTF16(src, dst, true);
     if (recordreplay::IsRecordingOrReplaying()) {
-      JS::AddContentParseDataForRecordReplay(this, dst.data(), written * sizeof(char16_t));
+      recordreplay::AddContentParseData(this, dst.data(), written);
     }
     if (hadErrors && !mHasHadErrors) {
       mHasHadErrors = true;
       if (mEncoding == UTF_8_ENCODING) {
         mTreeBuilder->TryToEnableEncodingMenu();
       }
     }
     MOZ_ASSERT(read == 0, "How come an empty span was read form?");