зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1472829. Add use counters for document.open. r=smaug
The idea is to count non-no-op document.open and to count how many times that's done with the replace argument set to "replace".
This commit is contained in:
Родитель
04b4925170
Коммит
96d0b4cc2e
|
@ -115,3 +115,7 @@ method console.exception
|
|||
method console.timeStamp
|
||||
method console.profile
|
||||
method console.profileEnd
|
||||
|
||||
// document.open information
|
||||
custom DocumentOpen calls document.open in a way that creates a new Window object
|
||||
custom DocumentOpenReplace calls document.open in a way that creates a new Window object and replaces the old history entry.
|
||||
|
|
|
@ -1339,6 +1339,14 @@ nsHTMLDocument::Open(JSContext* cx,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// At this point we know this is a valid-enough document.open() call
|
||||
// and not a no-op. Increment our use counters.
|
||||
SetDocumentAndPageUseCounter(eUseCounter_custom_DocumentOpen);
|
||||
bool isReplace = aReplace.LowerCaseEqualsLiteral("replace");
|
||||
if (isReplace) {
|
||||
SetDocumentAndPageUseCounter(eUseCounter_custom_DocumentOpenReplace);
|
||||
}
|
||||
|
||||
// Stop current loads targeted at the window this document is in.
|
||||
if (mScriptGlobalObject) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
|
@ -1567,8 +1575,7 @@ nsHTMLDocument::Open(JSContext* cx,
|
|||
// so, we need to tell the docshell to not create a new history
|
||||
// entry for this load. Otherwise, make sure that we're doing a normal load,
|
||||
// not whatever type of load was previously done on this docshell.
|
||||
shell->SetLoadType(aReplace.LowerCaseEqualsLiteral("replace") ?
|
||||
LOAD_NORMAL_REPLACE : LOAD_NORMAL);
|
||||
shell->SetLoadType(isReplace ? LOAD_NORMAL_REPLACE : LOAD_NORMAL);
|
||||
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
shell->GetContentViewer(getter_AddRefs(cv));
|
||||
|
|
Загрузка…
Ссылка в новой задаче