Bug 1412866 - Use spec nomenclature for the ignore-destructive-writes counter. r=smaug
authorHenri Sivonen <hsivonen@hsivonen.fi>
Mon, 30 Oct 2017 17:45:09 +0200
changeset 442520 4a51f3ef01e58f1258969b2db76056e4ab1d2e05
parent 442481 a16cc603d0613bbad2eade95b2a99430b5ed062b
child 442521 b5110cc80ef6d86469e1bb62118d596ac293d269
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1412866
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 1412866 - Use spec nomenclature for the ignore-destructive-writes counter. r=smaug MozReview-Commit-ID: FKwbEZll95J
dom/base/nsDocument.cpp
dom/base/nsIDocument.h
dom/html/nsHTMLDocument.cpp
dom/script/ScriptLoader.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1580,17 +1580,17 @@ nsIDocument::nsIDocument()
 #endif
     mBidiOptions(IBMBIDI_DEFAULT_BIDI_OPTIONS),
     mSandboxFlags(0),
     mPartID(0),
     mMarkedCCGeneration(0),
     mPresShell(nullptr),
     mSubtreeModifiedDepth(0),
     mEventsSuppressed(0),
-    mExternalScriptsBeingEvaluated(0),
+    mIgnoreDestructiveWritesCounter(0),
     mFrameRequestCallbackCounter(0),
     mStaticCloneCount(0),
     mWindow(nullptr),
     mBFCacheEntry(nullptr),
     mInSyncOperationCount(0),
     mBlockDOMContentLoaded(0),
     mUseCounters(0),
     mChildDocumentUseCounters(0),
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -2441,24 +2441,24 @@ public:
 
   uint32_t EventHandlingSuppressed() const { return mEventsSuppressed; }
 
   bool IsEventHandlingEnabled() {
     return !EventHandlingSuppressed() && mScriptGlobalObject;
   }
 
   /**
-   * Increment the number of external scripts being evaluated.
+   * Increment https://html.spec.whatwg.org/#ignore-destructive-writes-counter
    */
-  void BeginEvaluatingExternalScript() { ++mExternalScriptsBeingEvaluated; }
+  void IncrementIgnoreDestructiveWritesCounter() { ++mIgnoreDestructiveWritesCounter; }
 
   /**
-   * Decrement the number of external scripts being evaluated.
+   * Decrement https://html.spec.whatwg.org/#ignore-destructive-writes-counter
    */
-  void EndEvaluatingExternalScript() { --mExternalScriptsBeingEvaluated; }
+  void DecrementIgnoreDestructiveWritesCounter() { --mIgnoreDestructiveWritesCounter; }
 
   bool IsDNSPrefetchAllowed() const { return mAllowDNSPrefetch; }
 
   /**
    * Returns true if this document is allowed to contain XUL element and
    * use non-builtin XBL bindings.
    */
   bool AllowXULXBL() {
@@ -3665,20 +3665,19 @@ protected:
   // If we're an external resource document, this will be non-null and will
   // point to our "display document": the one that all resource lookups should
   // go to.
   nsCOMPtr<nsIDocument> mDisplayDocument;
 
   uint32_t mEventsSuppressed;
 
   /**
-   * The number number of external scripts (ones with the src attribute) that
-   * have this document as their owner and that are being evaluated right now.
+   * https://html.spec.whatwg.org/#ignore-destructive-writes-counter
    */
-  uint32_t mExternalScriptsBeingEvaluated;
+  uint32_t mIgnoreDestructiveWritesCounter;
 
   /**
    * The current frame request callback handle
    */
   int32_t mFrameRequestCallbackCounter;
 
   // Count of live static clones of this document.
   uint32_t mStaticCloneCount;
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -1946,32 +1946,32 @@ nsHTMLDocument::WriteCommon(JSContext *c
     // theoretically defined insertion point using mParserAborted.
     return NS_OK;
   }
 
   nsresult rv = NS_OK;
 
   void *key = GenerateParserKey();
   if (mParser && !mParser->IsInsertionPointDefined()) {
-    if (mExternalScriptsBeingEvaluated) {
+    if (mIgnoreDestructiveWritesCounter) {
       // Instead of implying a call to document.open(), ignore the call.
       nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
                                       NS_LITERAL_CSTRING("DOM Events"), this,
                                       nsContentUtils::eDOM_PROPERTIES,
                                       "DocumentWriteIgnored",
                                       nullptr, 0,
                                       mDocumentURI);
       return NS_OK;
     }
     mParser->Terminate();
     NS_ASSERTION(!mParser, "mParser should have been null'd out");
   }
 
   if (!mParser) {
-    if (mExternalScriptsBeingEvaluated) {
+    if (mIgnoreDestructiveWritesCounter) {
       // Instead of implying a call to document.open(), ignore the call.
       nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
                                       NS_LITERAL_CSTRING("DOM Events"), this,
                                       nsContentUtils::eDOM_PROPERTIES,
                                       "DocumentWriteIgnored",
                                       nullptr, 0,
                                       mDocumentURI);
       return NS_OK;
@@ -3811,9 +3811,9 @@ nsHTMLDocument::GetFormsAndFormControls(
     if (NS_SUCCEEDED(Dispatch(TaskCategory::GarbageCollection,
                               runnable.forget()))) {
       mContentListHolder = holder;
     }
   }
 
   NS_ADDREF(*aFormList = holder->mFormList);
   NS_ADDREF(*aFormControlList = holder->mFormControlList);
-}
\ No newline at end of file
+}
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -1885,21 +1885,21 @@ ScriptLoader::ProcessRequest(ScriptLoadR
   pwin = mDocument->GetInnerWindow();
   if (!pwin) {
     runScript = false;
   }
 
   nsresult rv = NS_OK;
   if (runScript) {
     if (doc) {
-      doc->BeginEvaluatingExternalScript();
+      doc->IncrementIgnoreDestructiveWritesCounter();
     }
     rv = EvaluateScript(aRequest);
     if (doc) {
-      doc->EndEvaluatingExternalScript();
+      doc->DecrementIgnoreDestructiveWritesCounter();
     }
 
     nsContentUtils::DispatchTrustedEvent(scriptElem->OwnerDoc(),
                                          scriptElem,
                                          NS_LITERAL_STRING("afterscriptexecute"),
                                          true, false);
   }