mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Fixing bug 284364. Turn on plugins again if they were enabled before we started editing a document. r+sr=bzbarsky@mit.edu
This commit is contained in:
parent
d6b4a62ca7
commit
3a7c8a9086
@ -143,26 +143,33 @@ nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow,
|
||||
nsIDocShell *docShell = GetDocShellFromWindow(aWindow);
|
||||
if (!docShell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv = docShell->SetAllowPlugins(PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// register as a content listener, so that we can fend off URL
|
||||
// loads from sidebar
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURIContentListener> listener = do_GetInterface(docShell, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = listener->SetParentContentListener(this);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Disable JavaScript in this document:
|
||||
PRBool scriptsEnabled;
|
||||
rv = docShell->GetAllowJavascript(&scriptsEnabled);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mScriptsEnabled = scriptsEnabled;
|
||||
if (scriptsEnabled) {
|
||||
rv = docShell->SetAllowJavascript(PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
PRBool tmp;
|
||||
rv = docShell->GetAllowJavascript(&tmp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mScriptsEnabled = tmp;
|
||||
|
||||
rv = docShell->SetAllowJavascript(PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Disable plugins in this document:
|
||||
rv = docShell->GetAllowPlugins(&tmp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mPluginsEnabled = tmp;
|
||||
|
||||
rv = docShell->SetAllowPlugins(PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Always remove existing editor
|
||||
TearDownEditorOnWindow(aWindow);
|
||||
@ -618,6 +625,10 @@ nsEditingSession::TearDownEditorOnWindow(nsIDOMWindow *aWindow)
|
||||
docShell->SetAllowJavascript(PR_TRUE);
|
||||
}
|
||||
|
||||
if (mPluginsEnabled) {
|
||||
docShell->SetAllowPlugins(PR_TRUE);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils(do_GetInterface(aWindow));
|
||||
if (utils)
|
||||
utils->SetImageAnimationMode(mImageAnimationMode);
|
||||
|
@ -141,6 +141,10 @@ protected:
|
||||
// off, otherwise false.
|
||||
PRPackedBool mScriptsEnabled;
|
||||
|
||||
// True if plugins were enabled before the editor turned plugins
|
||||
// off, otherwise false.
|
||||
PRPackedBool mPluginsEnabled;
|
||||
|
||||
PRPackedBool mProgressListenerRegistered;
|
||||
|
||||
// The image animation mode before it was turned off.
|
||||
|
Loading…
Reference in New Issue
Block a user