Bug 1210459: Add originAttributes for tests that implement nsILoadContext. r=bholley
authorYoshi Huang <allstars.chh@mozilla.com>
Wed, 30 Sep 2015 18:14:12 -0700
changeset 265544 051906f42649489490d50f26cb890dc87ffbb20c
parent 265543 19db5133d27c559a3fd9977dff10a989d1a35bcf
child 265545 e843ef367f3535bdb675f6afd501ac8b8d0220d8
push id15472
push usercbook@mozilla.com
push dateFri, 02 Oct 2015 11:51:34 +0000
treeherderfx-team@2c33ef6b27e0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1210459
milestone44.0a1
Bug 1210459: Add originAttributes for tests that implement nsILoadContext. r=bholley
dom/apps/AppsUtils.jsm
dom/apps/Webapps.jsm
extensions/cookie/test/channel_utils.js
netwerk/test/unit/test_bug826063.js
netwerk/test/unit/test_cacheflags.js
toolkit/mozapps/downloads/DownloadLastDir.jsm
--- a/dom/apps/AppsUtils.jsm
+++ b/dom/apps/AppsUtils.jsm
@@ -146,16 +146,20 @@ this.AppsUtils = {
 
   // Creates a nsILoadContext object with a given appId and isBrowser flag.
   createLoadContext: function createLoadContext(aAppId, aIsBrowser) {
     return {
        associatedWindow: null,
        topWindow : null,
        appId: aAppId,
        isInBrowserElement: aIsBrowser,
+       originAttributes: {
+         appId: aAppId,
+         inBrowser: aIsBrowser
+       },
        usePrivateBrowsing: false,
        isContent: false,
 
        isAppOfType: function(appType) {
          throw Cr.NS_ERROR_NOT_IMPLEMENTED;
        },
 
        QueryInterface: XPCOMUtils.generateQI([Ci.nsILoadContext,
--- a/dom/apps/Webapps.jsm
+++ b/dom/apps/Webapps.jsm
@@ -3463,16 +3463,20 @@ this.DOMApplicationRegistry = {
           this._saveApps();
         }
       }).bind(this),
       onStatus: function(aRequest, aContext, aStatus, aStatusArg) { },
 
       // nsILoadContext
       appId: aOldApp.installerAppId,
       isInBrowserElement: aOldApp.installerIsBrowser,
+      originAttributes: {
+        appId: aOldApp.installerAppId,
+        inBrowser: aOldApp.installerIsBrowser
+      },
       usePrivateBrowsing: false,
       isContent: false,
       associatedWindow: null,
       topWindow : null,
       isAppOfType: function(appType) {
         throw Cr.NS_ERROR_NOT_IMPLEMENTED;
       }
     };
--- a/extensions/cookie/test/channel_utils.js
+++ b/extensions/cookie/test/channel_utils.js
@@ -166,16 +166,20 @@ ChannelListener.prototype = {
  * Class that implements nsILoadContext.  Use it as callbacks for channel when
  * test needs it.
  */
 function LoadContextCallback(appId, inBrowserElement, isPrivate, isContent) {
   this.appId = appId;
   this.isInBrowserElement = inBrowserElement;
   this.usePrivateBrowsing = isPrivate;
   this.isContent = isContent;
+  this.originAttributes = {
+    appId: appId,
+    inBrowser: inBrowserElement
+  };
 }
 
 LoadContextCallback.prototype = {
   associatedWindow: null,
   topWindow : null,
   isAppOfType: function(appType) {
     throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
   },
--- a/netwerk/test/unit/test_bug826063.js
+++ b/netwerk/test/unit/test_bug826063.js
@@ -14,16 +14,17 @@ var URIs = [
   "https://example.org",
   "ftp://example.org"
   ];
 
 function LoadContext(usePrivateBrowsing) {
   this.usePrivateBrowsing = usePrivateBrowsing;
 }
 LoadContext.prototype = {
+  originAttributes: {},
   QueryInterface: XPCOMUtils.generateQI([Ci.nsILoadContext, Ci.nsIInterfaceRequestor]),
   getInterface: XPCOMUtils.generateQI([Ci.nsILoadContext])
 };
 
 function getChannels() {
   for (let u of URIs) {
     yield Services.io.newChannel2(u,
                                   null,
--- a/netwerk/test/unit/test_cacheflags.js
+++ b/netwerk/test/unit/test_cacheflags.js
@@ -15,16 +15,17 @@ var nocachePath = "/nocache" + suffix;
 var nostorePath = "/nostore" + suffix;
 
 // We attach this to channel when we want to test Private Browsing mode
 function LoadContext(usePrivateBrowsing) {
   this.usePrivateBrowsing = usePrivateBrowsing;
 }
 
 LoadContext.prototype = {
+  originAttributes: {},
   usePrivateBrowsing: false,
   // don't bother defining rest of nsILoadContext fields: don't need 'em
 
   QueryInterface: function(iid) {
     if (iid.equals(Ci.nsILoadContext))
       return this;
     throw Cr.NS_ERROR_NO_INTERFACE;
   },
--- a/toolkit/mozapps/downloads/DownloadLastDir.jsm
+++ b/toolkit/mozapps/downloads/DownloadLastDir.jsm
@@ -92,17 +92,18 @@ this.DownloadLastDir = function Download
   let loadContext = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                            .getInterface(Components.interfaces.nsIWebNavigation)
                            .QueryInterface(Components.interfaces.nsILoadContext);
   // Need this in case the real thing has gone away by the time we need it.
   // We only care about the private browsing state. All the rest of the
   // load context isn't of interest to the content pref service.
   this.fakeContext = {
     QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsILoadContext]),
-    usePrivateBrowsing: loadContext.usePrivateBrowsing
+    usePrivateBrowsing: loadContext.usePrivateBrowsing,
+    originAttributes: {},
   };
 }
 
 DownloadLastDir.prototype = {
   isPrivate: function DownloadLastDir_isPrivate() {
     return this.fakeContext.usePrivateBrowsing;
   },
   // compat shims