Bug 1067340 - Don't use nsIDOMWindowUtils in the CSP code, because it's not meant to be used from C++; r=geekboy
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 17 Sep 2014 17:55:43 -0400
changeset 230452 46859d329455a936a3dca1e0983a47e737b798c4
parent 230451 d5423e2b9f7d92daf0c7b633276684ddbdc8e754
child 230453 9a082ef1223af6141df14cdfeba22f1966da0bee
push id611
push userraliiev@mozilla.com
push dateMon, 05 Jan 2015 23:23:16 +0000
treeherdermozilla-release@345cd3b9c445 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeekboy
bugs1067340
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1067340 - Don't use nsIDOMWindowUtils in the CSP code, because it's not meant to be used from C++; r=geekboy
content/base/src/nsCSPContext.cpp
--- a/content/base/src/nsCSPContext.cpp
+++ b/content/base/src/nsCSPContext.cpp
@@ -514,28 +514,24 @@ getInnerWindowID(nsIRequest* aRequest) {
   }
 
   nsCOMPtr<nsIDOMWindow> window;
   rv = loadContext->GetAssociatedWindow(getter_AddRefs(window));
   if (NS_FAILED(rv) || !window) {
     return 0;
   }
 
-  uint64_t id = 0;
-  nsCOMPtr<nsIDOMWindowUtils> du = do_GetInterface(window);
-  if (!du) {
+  nsCOMPtr<nsPIDOMWindow> pwindow = do_QueryInterface(window);
+  if (!pwindow) {
     return 0;
   }
 
-  rv = du->GetCurrentInnerWindowID(&id);
-  if (NS_FAILED(rv)) {
-    return 0;
-  }
+  nsPIDOMWindow* inner = pwindow->IsInnerWindow() ? pwindow.get() : pwindow->GetCurrentInnerWindow();
 
-  return id;
+  return inner->WindowID();
 }
 
 NS_IMETHODIMP
 nsCSPContext::SetRequestContext(nsIURI* aSelfURI,
                                 nsIURI* aReferrer,
                                 nsIChannel* aChannel)
 {
   NS_PRECONDITION(aSelfURI || aChannel, "Need aSelfURI or aChannel to set the context properly");