зеркало из https://github.com/mozilla/gecko-dev.git
Bug 295994 - [r+sr=sicking]
This commit is contained in:
Родитель
ba381b388a
Коммит
931e5b83f0
|
@ -1315,14 +1315,33 @@ nsXULDocument::Persist(const nsAString& aID,
|
|||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsXULDocument::IsCapabilityEnabled(const char* aCapabilityLabel)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// NodePrincipal is guarantied to be non-null
|
||||
PRBool enabled = PR_FALSE;
|
||||
rv = NodePrincipal()->IsCapabilityEnabled(aCapabilityLabel, nsnull, &enabled);
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsXULDocument::Persist(nsIContent* aElement, PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute)
|
||||
{
|
||||
// For non-chrome documents, persistance is simply broken
|
||||
if (!IsCapabilityEnabled("UniversalBrowserWrite"))
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
// First make sure we _have_ a local store to stuff the persisted
|
||||
// information into. (We might not have one if profile information
|
||||
// hasn't been loaded yet...)
|
||||
if (! mLocalStore)
|
||||
if (!mLocalStore)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
|
@ -2119,13 +2138,26 @@ nsXULDocument::PrepareToLoadPrototype(nsIURI* aURI, const char* aCommand,
|
|||
nsresult
|
||||
nsXULDocument::ApplyPersistentAttributes()
|
||||
{
|
||||
// For non-chrome documents, persistance is simply broken
|
||||
if (!IsCapabilityEnabled("UniversalBrowserRead"))
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
// Add all of the 'persisted' attributes into the content
|
||||
// model.
|
||||
if (! mLocalStore)
|
||||
if (!mLocalStore)
|
||||
return NS_OK;
|
||||
|
||||
mApplyingPersistedAttrs = PR_TRUE;
|
||||
ApplyPersistentAttributesInternal();
|
||||
mApplyingPersistedAttrs = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsXULDocument::ApplyPersistentAttributesInternal()
|
||||
{
|
||||
nsCOMArray<nsIContent> elements;
|
||||
|
||||
nsCAutoString docurl;
|
||||
|
@ -2172,8 +2204,6 @@ nsXULDocument::ApplyPersistentAttributes()
|
|||
ApplyPersistentAttributesToElements(resource, elements);
|
||||
}
|
||||
|
||||
mApplyingPersistedAttrs = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3081,8 +3111,7 @@ nsXULDocument::ResumeWalk()
|
|||
rv = ResolveForwardReferences();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = ApplyPersistentAttributes();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
ApplyPersistentAttributes();
|
||||
|
||||
mStillWalking = PR_FALSE;
|
||||
if (mPendingSheets == 0) {
|
||||
|
|
|
@ -225,6 +225,7 @@ protected:
|
|||
PRBool* aFailureFromContent);
|
||||
|
||||
nsresult ApplyPersistentAttributes();
|
||||
nsresult ApplyPersistentAttributesInternal();
|
||||
nsresult ApplyPersistentAttributesToElements(nsIRDFResource* aResource,
|
||||
nsCOMArray<nsIContent>& aElements);
|
||||
|
||||
|
@ -261,6 +262,9 @@ protected:
|
|||
|
||||
static PRLogModuleInfo* gXULLog;
|
||||
|
||||
PRBool
|
||||
IsCapabilityEnabled(const char* aCapabilityLabel);
|
||||
|
||||
nsresult
|
||||
Persist(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aAttribute);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче