Bug 1275698. Get rid of nsScriptSecurityManager::ScriptAllowed and replace it with xpc::Scriptability::Get(obj).Allowed() for better performance and less indirection. r=khuey
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIWebShellServices.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
@@ -33,6 +32,7 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIViewSourceChannel.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@@ -581,6 +581,9 @@ nsHtml5TreeOpExecutor::FlushDocumentWrite()
|
||||
bool
|
||||
nsHtml5TreeOpExecutor::IsScriptEnabled()
|
||||
{
|
||||
// Note that if we have no document or no docshell or no global or whatnot we
|
||||
// want to claim script _is_ enabled, so we don't parse the contents of
|
||||
// <noscript> tags!
|
||||
if (!mDocument || !mDocShell)
|
||||
return true;
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject = do_QueryInterface(mDocument->GetInnerWindow());
|
||||
@@ -588,11 +591,9 @@ nsHtml5TreeOpExecutor::IsScriptEnabled()
|
||||
// GlobalObject set yet
|
||||
if (!globalObject) {
|
||||
globalObject = mDocShell->GetScriptGlobalObject();
|
||||
NS_ENSURE_TRUE(globalObject, true);
|
||||
}
|
||||
NS_ENSURE_TRUE(globalObject && globalObject->GetGlobalJSObject(), true);
|
||||
return nsContentUtils::GetSecurityManager()->
|
||||
ScriptAllowed(globalObject->GetGlobalJSObject());
|
||||
return xpc::Scriptability::Get(globalObject->GetGlobalJSObject()).Allowed();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user