mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Fix for bug 499910. r/sr=bz.
--HG-- extra : rebase_source : 923016caa3c0b3a4dd04ff14eedd512b2ed2706b
This commit is contained in:
parent
c75c21f508
commit
793e298b9f
@ -444,8 +444,19 @@ nsContentSink::ProcessHTTPHeaders(nsIChannel* aChannel)
|
||||
nsresult rv = httpchannel->GetResponseHeader(NS_LITERAL_CSTRING("link"),
|
||||
linkHeader);
|
||||
if (NS_SUCCEEDED(rv) && !linkHeader.IsEmpty()) {
|
||||
ProcessHeaderData(nsGkAtoms::link,
|
||||
NS_ConvertASCIItoUTF16(linkHeader));
|
||||
mDocument->SetHeaderData(nsGkAtoms::link,
|
||||
NS_ConvertASCIItoUTF16(linkHeader));
|
||||
|
||||
NS_ASSERTION(!mProcessLinkHeaderEvent.get(),
|
||||
"Already dispatched an event?");
|
||||
|
||||
mProcessLinkHeaderEvent =
|
||||
new nsNonOwningRunnableMethod<nsContentSink>(this,
|
||||
&nsContentSink::DoProcessLinkHeader);
|
||||
rv = NS_DispatchToCurrentThread(mProcessLinkHeaderEvent.get());
|
||||
if (NS_FAILED(rv)) {
|
||||
mProcessLinkHeaderEvent.Forget();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -540,6 +551,14 @@ nsContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsContentSink::DoProcessLinkHeader()
|
||||
{
|
||||
nsAutoString value;
|
||||
mDocument->GetHeaderData(nsGkAtoms::link, value);
|
||||
ProcessLinkHeader(nsnull, value);
|
||||
}
|
||||
|
||||
static const PRUnichar kSemiCh = PRUnichar(';');
|
||||
static const PRUnichar kCommaCh = PRUnichar(',');
|
||||
static const PRUnichar kEqualsCh = PRUnichar('=');
|
||||
@ -1727,6 +1746,12 @@ nsContentSink::WillBuildModelImpl()
|
||||
}
|
||||
|
||||
mScrolledToRefAlready = PR_FALSE;
|
||||
|
||||
if (mProcessLinkHeaderEvent.get()) {
|
||||
mProcessLinkHeaderEvent.Revoke();
|
||||
|
||||
DoProcessLinkHeader();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include "nsIRequest.h"
|
||||
#include "nsTimer.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
class nsIDocument;
|
||||
class nsIURI;
|
||||
@ -284,6 +285,8 @@ protected:
|
||||
// (e.g. stop waiting after some timeout or whatnot).
|
||||
PRBool WaitForPendingSheets() { return mPendingSheetCount > 0; }
|
||||
|
||||
void DoProcessLinkHeader();
|
||||
|
||||
private:
|
||||
// People shouldn't be allocating this class directly. All subclasses should
|
||||
// be allocated using a zeroing operator new.
|
||||
@ -394,6 +397,9 @@ protected:
|
||||
|
||||
PRUint32 mPendingSheetCount;
|
||||
|
||||
nsRevocableEventPtr<nsNonOwningRunnableMethod<nsContentSink> >
|
||||
mProcessLinkHeaderEvent;
|
||||
|
||||
// Measures content model creation time for current document
|
||||
MOZ_TIMER_DECLARE(mWatch)
|
||||
};
|
||||
|
@ -3538,8 +3538,9 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
||||
mLayoutHistoryState = nsnull;
|
||||
mScopeObject = do_GetWeakReference(aScriptGlobalObject);
|
||||
|
||||
// If we already have a wrapper at this point, it might have the wrong
|
||||
// parent and scope, so reparent it.
|
||||
#ifdef DEBUG
|
||||
// We really shouldn't have a wrapper here but if we do we need to make sure
|
||||
// it has the correct parent.
|
||||
nsIXPConnectWrappedNative *wrapper =
|
||||
static_cast<nsIXPConnectWrappedNative*>(GetWrapper());
|
||||
if (wrapper) {
|
||||
@ -3557,14 +3558,12 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
||||
}
|
||||
}
|
||||
if (cx) {
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> newWrapper;
|
||||
nsContentUtils::XPConnect()->
|
||||
ReparentWrappedNativeIfFound(cx, JS_GetGlobalForObject(cx, obj),
|
||||
newScope, wrapper->Native(),
|
||||
getter_AddRefs(newWrapper));
|
||||
NS_ASSERTION(JS_GetGlobalForObject(cx, obj) == newScope,
|
||||
"Wrong scope, this is really bad!");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mAllowDNSPrefetch) {
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
|
||||
|
Loading…
Reference in New Issue
Block a user