зеркало из https://github.com/mozilla/gecko-dev.git
Bug 965413 part 9. Support use of a LoadInfo for javascript: URLs. r=smaug
This commit is contained in:
Родитель
744cc503d7
Коммит
321102201e
|
@ -48,6 +48,7 @@
|
|||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "nsILoadInfo.h"
|
||||
|
||||
using mozilla::dom::AutoEntryScript;
|
||||
|
||||
|
@ -153,10 +154,16 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
|
|||
aChannel->GetOwner(getter_AddRefs(owner));
|
||||
nsCOMPtr<nsIPrincipal> principal = do_QueryInterface(owner);
|
||||
if (!principal) {
|
||||
// No execution without a principal!
|
||||
NS_ASSERTION(!owner, "Non-principal owner?");
|
||||
NS_WARNING("No principal to execute JS with");
|
||||
return NS_ERROR_DOM_RETVAL_UNDEFINED;
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
|
||||
if (loadInfo && loadInfo->GetForceInheritPrincipal()) {
|
||||
principal = loadInfo->LoadingPrincipal();
|
||||
} else {
|
||||
// No execution without a principal!
|
||||
NS_ASSERTION(!owner, "Non-principal owner?");
|
||||
NS_WARNING("No principal to execute JS with");
|
||||
return NS_ERROR_DOM_RETVAL_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
|
Загрузка…
Ссылка в новой задаче