Bug 1412866 - Use spec nomenclature for the ignore-destructive-writes counter. r=smaug

MozReview-Commit-ID: FKwbEZll95J

--HG--
extra : rebase_source : b42a7a17434f1c711c395fd5a09893cac81b7a9d
This commit is contained in:
Henri Sivonen 2017-10-30 17:45:09 +02:00
Родитель 86e2b8ebf1
Коммит 080aa07386
4 изменённых файлов: 12 добавлений и 13 удалений

Просмотреть файл

@ -1585,7 +1585,7 @@ nsIDocument::nsIDocument()
mPresShell(nullptr),
mSubtreeModifiedDepth(0),
mEventsSuppressed(0),
mExternalScriptsBeingEvaluated(0),
mIgnoreDestructiveWritesCounter(0),
mFrameRequestCallbackCounter(0),
mStaticCloneCount(0),
mWindow(nullptr),

Просмотреть файл

@ -2446,14 +2446,14 @@ public:
}
/**
* 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; }
@ -3670,10 +3670,9 @@ protected:
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

Просмотреть файл

@ -1951,7 +1951,7 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
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,
@ -1966,7 +1966,7 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
}
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,
@ -3816,4 +3816,4 @@ nsHTMLDocument::GetFormsAndFormControls(nsContentList** aFormList,
NS_ADDREF(*aFormList = holder->mFormList);
NS_ADDREF(*aFormControlList = holder->mFormControlList);
}
}

Просмотреть файл

@ -1890,11 +1890,11 @@ ScriptLoader::ProcessRequest(ScriptLoadRequest* aRequest)
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(),