зеркало из https://github.com/mozilla/pjs.git
Bug 739004. When cloning a static clone, set the mOriginalDocument of the new clone to the mOriginalDocument of the thing being cloned, not to the thing being cloned (which is not an original document at all). r=smaug
This commit is contained in:
Родитель
0714ed6312
Коммит
1bd6168046
|
@ -1421,7 +1421,11 @@ public:
|
|||
* If this document is a static clone, this returns the original
|
||||
* document.
|
||||
*/
|
||||
nsIDocument* GetOriginalDocument() { return mOriginalDocument; }
|
||||
nsIDocument* GetOriginalDocument()
|
||||
{
|
||||
MOZ_ASSERT(!mOriginalDocument || !mOriginalDocument->GetOriginalDocument());
|
||||
return mOriginalDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by nsParser to preload images. Can be removed and code moved
|
||||
|
|
|
@ -8086,9 +8086,12 @@ nsIDocument::CreateStaticClone(nsISupports* aCloneContainer)
|
|||
nsCOMPtr<nsIDocument> clonedDoc;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
clonedDoc = do_QueryInterface(clonedNode);
|
||||
nsCOMPtr<nsIDOMDocument> clonedDOMDoc = do_QueryInterface(clonedDoc);
|
||||
if (clonedDOMDoc) {
|
||||
clonedDoc->mOriginalDocument = this;
|
||||
if (clonedDoc) {
|
||||
if (IsStaticDocument()) {
|
||||
clonedDoc->mOriginalDocument = mOriginalDocument;
|
||||
} else {
|
||||
clonedDoc->mOriginalDocument = this;
|
||||
}
|
||||
PRInt32 sheetsCount = GetNumberOfStyleSheets();
|
||||
for (PRInt32 i = 0; i < sheetsCount; ++i) {
|
||||
nsRefPtr<nsCSSStyleSheet> sheet = do_QueryObject(GetStyleSheetAt(i));
|
||||
|
|
|
@ -1413,11 +1413,8 @@ PresShell::SetPrefNoScriptRule()
|
|||
// also handle the case where print is done from print preview
|
||||
// see bug #342439 for more details
|
||||
nsIDocument* doc = mDocument;
|
||||
if (mPresContext->Type() == nsPresContext::eContext_PrintPreview ||
|
||||
mPresContext->Type() == nsPresContext::eContext_Print) {
|
||||
while (doc->GetOriginalDocument()) {
|
||||
doc = doc->GetOriginalDocument();
|
||||
}
|
||||
if (doc->IsStaticDocument()) {
|
||||
doc = doc->GetOriginalDocument();
|
||||
}
|
||||
|
||||
bool scriptEnabled = doc->IsScriptEnabled();
|
||||
|
|
Загрузка…
Ссылка в новой задаче