Bug 1459498: Avoid a useless QI. r?heycam
MozReview-Commit-ID: FCLEoZnTjYG
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -874,34 +874,33 @@ Loader::ObsoleteSheet(nsIURI* aURI)
}
return NS_OK;
}
nsresult
Loader::CheckContentPolicy(nsIPrincipal* aLoadingPrincipal,
nsIPrincipal* aTriggeringPrincipal,
nsIURI* aTargetURI,
- nsISupports* aContext,
+ nsINode* aRequestingNode,
bool aIsPreload)
{
// When performing a system load (e.g. aUseSystemPrincipal = true)
// then aLoadingPrincipal == null; don't consult content policies.
if (!aLoadingPrincipal) {
return NS_OK;
}
nsContentPolicyType contentPolicyType =
aIsPreload ? nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD
: nsIContentPolicy::TYPE_INTERNAL_STYLESHEET;
- nsCOMPtr<nsINode> requestingNode = do_QueryInterface(aContext);
nsCOMPtr<nsILoadInfo> secCheckLoadInfo =
new net::LoadInfo(aLoadingPrincipal,
aTriggeringPrincipal,
- requestingNode,
+ aRequestingNode,
nsILoadInfo::SEC_ONLY_FOR_EXPLICIT_CONTENTSEC_CHECK,
contentPolicyType);
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
nsresult rv = NS_CheckContentLoadPolicy(aTargetURI,
secCheckLoadInfo,
NS_LITERAL_CSTRING("text/css"),
&shouldLoad,
@@ -2158,18 +2157,20 @@ Loader::LoadChildSheet(StyleSheet* aPare
LOG_WARN((" Not enabled"));
return NS_ERROR_NOT_AVAILABLE;
}
LOG_URI(" Child uri: '%s'", aURL);
nsCOMPtr<nsINode> owningNode;
- // check for an associated document: if none, don't bother walking up the
- // parent sheets
+ // Check for an associated document: if none, don't bother walking up the
+ // parent sheets.
+ //
+ // FIXME(emilio): This looks wrong for Shadow DOM.
if (aParentSheet->GetAssociatedDocument()) {
StyleSheet* topSheet = aParentSheet;
while (StyleSheet* parent = topSheet->GetParentSheet()) {
topSheet = parent;
}
owningNode = topSheet->GetOwnerNode();
}
--- a/layout/style/Loader.h
+++ b/layout/style/Loader.h
@@ -455,17 +455,17 @@ private:
// Helper to select the correct dispatch target for asynchronous events for
// this loader.
already_AddRefed<nsISerialEventTarget> DispatchTarget();
nsresult CheckContentPolicy(nsIPrincipal* aLoadingPrincipal,
nsIPrincipal* aTriggeringPrincipal,
nsIURI* aTargetURI,
- nsISupports* aContext,
+ nsINode* aRequestingNode,
bool aIsPreload);
nsresult CreateSheet(const StyleSheetInfo& aInfo,
nsIPrincipal* aLoaderPrincipal,
css::SheetParsingMode aParsingMode,
bool aSyncLoad,
StyleSheetState& aSheetState,
RefPtr<StyleSheet>* aSheet)