Backed out 5 changesets (bug 1180921) for build failures in BasePrincipal.cpp
authorWes Kocher <wkocher@mozilla.com>
Thu, 09 Jul 2015 17:43:08 -0700
changeset 283851 fb0c6275d5c2b06d8467c9aa69ff2e50af16ecef
parent 283850 d8c1a2e11a9af450a534cf6d83bc592952df4d70
child 283852 6734292ea4b2156bd4909fc17b758455f11eaade
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1180921
milestone42.0a1
backs outd8c1a2e11a9af450a534cf6d83bc592952df4d70
f4dd8c53df5f21651d167166c626e859d312ed1d
b272a0ebf5d85669ac9a99d5525778202c2a4125
8e86b6a7d20189ca64d768f73043c2d77b5a3a81
bbdebd7b8881cfbfb49cb8a699ab8ae4ec77541d
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
Backed out 5 changesets (bug 1180921) for build failures in BasePrincipal.cpp Backed out changeset d8c1a2e11a9a (bug 1180921) Backed out changeset f4dd8c53df5f (bug 1180921) Backed out changeset b272a0ebf5d8 (bug 1180921) Backed out changeset 8e86b6a7d201 (bug 1180921) Backed out changeset bbdebd7b8881 (bug 1180921)
browser/installer/package-manifest.in
caps/BasePrincipal.cpp
caps/BasePrincipal.h
caps/moz.build
caps/nsIAddonPolicyService.idl
caps/nsNullPrincipal.h
caps/nsPrincipal.cpp
caps/nsPrincipal.h
caps/tests/mochitest/chrome.ini
caps/tests/mochitest/file_data.txt
caps/tests/mochitest/mochitest.ini
caps/tests/mochitest/test_addonMayLoad.html
caps/tests/unit/test_origin.js
dom/bindings/BindingDeclarations.h
dom/webidl/ChromeUtils.webidl
toolkit/components/addoncompat/addoncompat.manifest
toolkit/components/addoncompat/moz.build
toolkit/components/addoncompat/remoteTagService.js
toolkit/components/moz.build
toolkit/components/utils/moz.build
toolkit/components/utils/simpleServices.js
toolkit/components/utils/utils.manifest
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -431,18 +431,17 @@
 @RESPATH@/components/nsUpdateService.js
 @RESPATH@/components/nsUpdateServiceStub.js
 #endif
 @RESPATH@/components/nsUpdateTimerManager.manifest
 @RESPATH@/components/nsUpdateTimerManager.js
 @RESPATH@/components/addoncompat.manifest
 @RESPATH@/components/multiprocessShims.js
 @RESPATH@/components/defaultShims.js
-@RESPATH@/components/utils.manifest
-@RESPATH@/components/simpleServices.js
+@RESPATH@/components/remoteTagService.js
 @RESPATH@/components/pluginGlue.manifest
 @RESPATH@/components/ProcessSingleton.manifest
 @RESPATH@/components/MainProcessSingleton.js
 @RESPATH@/components/ContentProcessSingleton.js
 @RESPATH@/browser/components/nsSessionStore.manifest
 @RESPATH@/browser/components/nsSessionStartup.js
 @RESPATH@/browser/components/nsSessionStore.js
 @RESPATH@/components/nsURLFormatter.manifest
--- a/caps/BasePrincipal.cpp
+++ b/caps/BasePrincipal.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 sw=2 et tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/BasePrincipal.h"
 
-#include "nsIAddonPolicyService.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 
 #include "nsPrincipal.h"
 #include "nsNetUtil.h"
 #include "nsIURIWithPrincipal.h"
 #include "nsNullPrincipal.h"
@@ -37,20 +36,16 @@ OriginAttributes::CreateSuffix(nsACStrin
     value.AppendInt(mAppId);
     params->Set(NS_LITERAL_STRING("appId"), value);
   }
 
   if (mInBrowser) {
     params->Set(NS_LITERAL_STRING("inBrowser"), NS_LITERAL_STRING("1"));
   }
 
-  if (!mAddonId.IsEmpty()) {
-    params->Set(NS_LITERAL_STRING("addonId"), mAddonId);
-  }
-
   aStr.Truncate();
 
   params->Serialize(value);
   if (!value.IsEmpty()) {
     aStr.AppendLiteral("!");
     aStr.Append(NS_ConvertUTF16toUTF8(value));
   }
 }
@@ -88,22 +83,16 @@ public:
       if (!aValue.EqualsLiteral("1")) {
         return false;
       }
 
       mOriginAttributes->mInBrowser = true;
       return true;
     }
 
-    if (aName.EqualsLiteral("addonId")) {
-      MOZ_RELEASE_ASSERT(mOriginAttributes->mAddonId.IsEmpty());
-      mOriginAttributes->mAddonId.Assign(aValue);
-      return true;
-    }
-
     // No other attributes are supported.
     return false;
   }
 
 private:
   OriginAttributes* mOriginAttributes;
 };
 
@@ -352,24 +341,9 @@ BasePrincipal::CreateCodebasePrincipal(n
 
   // Mint a codebase principal.
   nsRefPtr<nsPrincipal> codebase = new nsPrincipal();
   rv = codebase->Init(aURI, aAttrs);
   NS_ENSURE_SUCCESS(rv, nullptr);
   return codebase.forget();
 }
 
-bool
-BasePrincipal::AddonAllowsLoad(nsIURI* aURI)
-{
-  if (mOriginAttributes.mAddonId.IsEmpty()) {
-    return false;
-  }
-
-  nsCOMPtr<nsIAddonPolicyService> aps = do_GetService("@mozilla.org/addons/policy-service;1");
-  NS_ENSURE_TRUE(aps, false);
-
-  bool allowed = false;
-  nsresult rv = aps->AddonMayLoadURI(mOriginAttributes.mAddonId, aURI, &allowed);
-  return NS_SUCCEEDED(rv) && allowed;
-}
-
 } // namespace mozilla
--- a/caps/BasePrincipal.h
+++ b/caps/BasePrincipal.h
@@ -29,18 +29,17 @@ public:
     mInBrowser = aInBrowser;
   }
   explicit OriginAttributes(const OriginAttributesDictionary& aOther)
     : OriginAttributesDictionary(aOther) {}
 
   bool operator==(const OriginAttributes& aOther) const
   {
     return mAppId == aOther.mAppId &&
-           mInBrowser == aOther.mInBrowser &&
-           mAddonId == aOther.mAddonId;
+           mInBrowser == aOther.mInBrowser;
   }
   bool operator!=(const OriginAttributes& aOther) const
   {
     return !(*this == aOther);
   }
 
   // Serializes/Deserializes non-default values into the suffix format, i.e.
   // |!key1=value1&key2=value2|. If there are no non-default attributes, this
@@ -102,19 +101,15 @@ public:
   bool IsInBrowserElement() const { return mOriginAttributes.mInBrowser; }
 
 protected:
   virtual ~BasePrincipal();
 
   virtual nsresult GetOriginInternal(nsACString& aOrigin) = 0;
   virtual bool SubsumesInternal(nsIPrincipal* aOther, DocumentDomainConsideration aConsider) = 0;
 
-  // Helper to check whether this principal is associated with an addon that
-  // allows unprivileged code to load aURI.
-  bool AddonAllowsLoad(nsIURI* aURI);
-
   nsCOMPtr<nsIContentSecurityPolicy> mCSP;
   OriginAttributes mOriginAttributes;
 };
 
 } // namespace mozilla
 
 #endif /* mozilla_BasePrincipal_h */
--- a/caps/moz.build
+++ b/caps/moz.build
@@ -4,17 +4,16 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini']
 MOCHITEST_CHROME_MANIFESTS += ['tests/mochitest/chrome.ini']
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
 
 XPIDL_SOURCES += [
-    'nsIAddonPolicyService.idl',
     'nsIDomainPolicy.idl',
     'nsIPrincipal.idl',
     'nsIScriptSecurityManager.idl',
 ]
 
 XPIDL_MODULE = 'caps'
 
 EXPORTS += [
deleted file mode 100644
--- a/caps/nsIAddonPolicyService.idl
+++ /dev/null
@@ -1,22 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-#include "nsIURI.idl"
-
-/**
- * This interface allows the security manager to query custom per-addon security
- * policy.
- */
-[scriptable,uuid(fedf126c-988e-42df-82c9-f2ac99cd65f3)]
-interface nsIAddonPolicyService : nsISupports
-{
-  /**
-   * Returns true if unprivileged code associated with the given addon may load
-   * data from |aURI|.
-   */
-  boolean addonMayLoadURI(in AString aAddonId, in nsIURI aURI);
-};
--- a/caps/nsNullPrincipal.h
+++ b/caps/nsNullPrincipal.h
@@ -18,18 +18,18 @@
 #include "nsCOMPtr.h"
 #include "nsIContentSecurityPolicy.h"
 
 #include "mozilla/BasePrincipal.h"
 
 class nsIURI;
 
 #define NS_NULLPRINCIPAL_CID \
-{ 0x34a19ab6, 0xca47, 0x4098, \
-  { 0xa7, 0xb8, 0x4a, 0xfc, 0xdd, 0xcd, 0x8f, 0x88 } }
+{ 0xe502ffb8, 0x5d95, 0x48e8, \
+  { 0x82, 0x3c, 0x0d, 0x29, 0xd8, 0x3a, 0x59, 0x33 } }
 #define NS_NULLPRINCIPAL_CONTRACTID "@mozilla.org/nullprincipal;1"
 
 #define NS_NULLPRINCIPAL_SCHEME "moz-nullprincipal"
 
 class nsNullPrincipal final : public mozilla::BasePrincipal
 {
 public:
   // This should only be used by deserialization, and the factory constructor.
--- a/caps/nsPrincipal.cpp
+++ b/caps/nsPrincipal.cpp
@@ -231,22 +231,16 @@ nsPrincipal::CheckMayLoad(nsIURI* aURI, 
   nsCOMPtr<nsIPrincipal> uriPrin;
   if (uriWithPrin) {
     uriWithPrin->GetPrincipal(getter_AddRefs(uriPrin));
   }
   if (uriPrin && nsIPrincipal::Subsumes(uriPrin)) {
       return NS_OK;
   }
 
-  // If this principal is associated with an addon, check whether that addon
-  // has been given permission to load from this domain.
-  if (AddonAllowsLoad(aURI)) {
-    return NS_OK;
-  }
-
   if (nsScriptSecurityManager::SecurityCompareURIs(mCodebase, aURI)) {
     return NS_OK;
   }
 
   // If strict file origin policy is in effect, local files will always fail
   // SecurityCompareURIs unless they are identical. Explicitly check file origin
   // policy, in that case.
   if (nsScriptSecurityManager::GetStrictFileOriginPolicy() &&
--- a/caps/nsPrincipal.h
+++ b/caps/nsPrincipal.h
@@ -107,17 +107,17 @@ protected:
   bool SubsumesInternal(nsIPrincipal* aOther, DocumentDomainConsideration aConsideration) override;
 
 private:
   nsTArray< nsCOMPtr<nsIPrincipal> > mPrincipals;
 };
 
 #define NS_PRINCIPAL_CONTRACTID "@mozilla.org/principal;1"
 #define NS_PRINCIPAL_CID \
-{ 0xb02c3023, 0x5b37, 0x472a, \
-  { 0xa2, 0xcd, 0x35, 0xaa, 0x5e, 0xe2, 0xa8, 0x19 } }
+  { 0xb7c8505e, 0xc56d, 0x4191, \
+    { 0xa1, 0x5e, 0x5d, 0xcb, 0x88, 0x9b, 0xa0, 0x94 }}
 
 #define NS_EXPANDEDPRINCIPAL_CONTRACTID "@mozilla.org/expandedprincipal;1"
 #define NS_EXPANDEDPRINCIPAL_CID \
-{ 0xe8ee88b0, 0x5571, 0x4086, \
-  { 0xa4, 0x5b, 0x39, 0xa7, 0x16, 0x90, 0x6b, 0xdb } }
+  { 0x38539471, 0x68cc, 0x4a6f, \
+    { 0x81, 0x20, 0xdb, 0xd5, 0x4a, 0x22, 0x0a, 0x13 }}
 
 #endif // nsPrincipal_h__
--- a/caps/tests/mochitest/chrome.ini
+++ b/caps/tests/mochitest/chrome.ini
@@ -1,11 +1,10 @@
 [DEFAULT]
 skip-if = buildapp == 'b2g'
 support-files =
   file_disableScript.html
 
 [test_bug995943.xul]
-[test_addonMayLoad.html]
 [test_disableScript.xul]
 [test_principal_jarprefix_origin_appid_appstatus.html]
 # jarPrefix test doesn't work on Windows, see bug 776296.
 skip-if = os == "win"
deleted file mode 100644
--- a/caps/tests/mochitest/file_data.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-server data fetched over XHR
--- a/caps/tests/mochitest/mochitest.ini
+++ b/caps/tests/mochitest/mochitest.ini
@@ -1,11 +1,10 @@
 [DEFAULT]
 support-files =
-  file_data.txt
   file_disableScript.html
 
 [test_app_principal_equality.html]
 skip-if = e10s
 [test_bug246699.html]
 [test_bug292789.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
 [test_bug423375.html]
deleted file mode 100644
--- a/caps/tests/mochitest/test_addonMayLoad.html
+++ /dev/null
@@ -1,97 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1180921
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 1180921</title>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-  <script type="application/javascript;version=1.8">
-
-  /** Test for Bug 1180921 **/
-  const Cc = Components.classes;
-  const Ci = Components.interfaces;
-  const Cu = Components.utils;
-  Cu.import("resource://gre/modules/Services.jsm");
-  let ssm = Services.scriptSecurityManager;
-  let aps = Cc["@mozilla.org/addons/policy-service;1"].getService(Ci.nsIAddonPolicyService).wrappedJSObject;
-
-  SimpleTest.waitForExplicitFinish();
-  SimpleTest.registerCleanupFunction(function() {
-    aps.setAddonLoadURICallback('addonA', null);
-    aps.setAddonLoadURICallback('addonB', null);
-  });
-
-  function tryLoad(sb, uri) {
-    let p = new Promise(function(resolve, reject) {
-      Cu.exportFunction(resolve, sb, { defineAs: "finish" });
-      Cu.exportFunction(reject, sb, { defineAs: "error" });
-      sb.eval("try { (function () { " +
-              "  var xhr = new XMLHttpRequest();" +
-              "  xhr.onreadystatechange = function() { if (xhr.readyState == XMLHttpRequest.DONE) { finish(xhr.status == 200); } };" +
-              "  xhr.open('GET', '" + uri + "', true);" +
-              "  xhr.send();" +
-              "})() } catch (e) { error(e); }");
-    });
-    return p;
-  }
-
-  let exampleCom_addonA = new Cu.Sandbox(ssm.createCodebasePrincipal(Services.io.newURI('http://example.com', null, null), {addonId: 'addonA'}),
-                                         {wantGlobalProperties: ['XMLHttpRequest']});
-  let nullPrin_addonA = new Cu.Sandbox(ssm.createNullPrincipal({addonId: 'addonA'}),
-                                       {wantGlobalProperties: ['XMLHttpRequest']});
-  let exampleCom_addonB = new Cu.Sandbox(ssm.createCodebasePrincipal(Services.io.newURI('http://example.com', null, null), {addonId: 'addonB'}),
-                                         {wantGlobalProperties: ['XMLHttpRequest']});
-
-  function uriForDomain(d) { return d + '/tests/caps/tests/mochitest/file_data.txt' }
-
-  tryLoad(exampleCom_addonA, uriForDomain('http://example.com'))
-  .then(function(success) {
-    ok(success, "same-origin load should succeed for addon A");
-    return tryLoad(nullPrin_addonA, uriForDomain('http://example.com'));
-  }).then(function(success) {
-    ok(!success, "null-principal load should fail for addon A");
-    return tryLoad(exampleCom_addonB, uriForDomain('http://example.com'));
-  }).then(function(success) {
-    ok(success, "same-origin load should succeed for addon B");
-    return tryLoad(exampleCom_addonA, uriForDomain('http://test1.example.org'));
-  }).then(function(success) {
-    ok(!success, "cross-origin load should fail for addon A");
-    aps.setAddonLoadURICallback('addonA', function(uri) { return /test1/.test(uri.host); });
-    aps.setAddonLoadURICallback('addonB', function(uri) { return /test2/.test(uri.host); });
-    return tryLoad(exampleCom_addonA, uriForDomain('http://test1.example.org'));
-  }).then(function(success) {
-    ok(success, "whitelisted cross-origin load of test1 should succeed for addon A");
-    return tryLoad(nullPrin_addonA, uriForDomain('http://test1.example.org'));
-  }).then(function(success) {
-    ok(!success, "whitelisted null principal load of test1 should still fail for addon A");
-    return tryLoad(exampleCom_addonB, uriForDomain('http://test1.example.org'));
-  }).then(function(success) {
-    ok(!success, "non-whitelisted cross-origin load of test1 should fail for addon B");
-    return tryLoad(exampleCom_addonB, uriForDomain('http://test2.example.org'));
-  }).then(function(success) {
-    ok(success, "whitelisted cross-origin load of test2 should succeed for addon B");
-    return tryLoad(exampleCom_addonA, uriForDomain('http://test2.example.org'));
-  }).then(function(success) {
-    ok(!success, "non-whitelisted cross-origin load of test2 should fail for addon A");
-    SimpleTest.finish();
-  }, function(e) {
-    ok(false, "Rejected promise chain: " + e);
-    SimpleTest.finish();
-  });
-
-  </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1180921">Mozilla Bug 1180921</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-</pre>
-</body>
-</html>
--- a/caps/tests/unit/test_origin.js
+++ b/caps/tests/unit/test_origin.js
@@ -20,20 +20,19 @@ function checkCrossOrigin(a, b) {
   do_check_false(a.subsumesConsideringDomain(b));
   do_check_false(b.subsumes(a));
   do_check_false(b.subsumesConsideringDomain(a));
   do_check_eq(a.cookieJar === b.cookieJar,
               a.originAttributes.appId == b.originAttributes.appId &&
               a.originAttributes.inBrowser == b.originAttributes.inBrowser);
 }
 
-function checkOriginAttributes(prin, attrs, suffix) {
-  attrs = attrs || {};
-  do_check_eq(prin.originAttributes.appId, attrs.appId || 0);
-  do_check_eq(prin.originAttributes.inBrowser, attrs.inBrowser || false);
+function checkOriginAttributes(prin, appId, inBrowser, suffix) {
+  do_check_eq(prin.originAttributes.appId, appId || 0);
+  do_check_eq(prin.originAttributes.inBrowser, inBrowser || false);
   do_check_eq(prin.originSuffix, suffix || '');
   if (!prin.isNullPrincipal && !prin.origin.startsWith('[')) {
     do_check_true(BrowserUtils.principalFromOrigin(prin.origin).equals(prin));
   } else {
     checkThrows(() => BrowserUtils.principalFromOrigin(prin.origin));
   }
 }
 
@@ -63,46 +62,40 @@ function run_test() {
 
   //
   // Test origin attributes.
   //
 
   // Just app.
   var exampleOrg_app = ssm.createCodebasePrincipal(makeURI('http://example.org'), {appId: 42});
   var nullPrin_app = ssm.createNullPrincipal({appId: 42});
-  checkOriginAttributes(exampleOrg_app, {appId: 42}, '!appId=42');
-  checkOriginAttributes(nullPrin_app, {appId: 42}, '!appId=42');
+  checkOriginAttributes(exampleOrg_app, 42, false, '!appId=42');
+  checkOriginAttributes(nullPrin_app, 42, false, '!appId=42');
   do_check_eq(exampleOrg_app.origin, 'http://example.org!appId=42');
 
   // Just browser.
   var exampleOrg_browser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {inBrowser: true});
   var nullPrin_browser = ssm.createNullPrincipal({inBrowser: true});
-  checkOriginAttributes(exampleOrg_browser, {inBrowser: true}, '!inBrowser=1');
-  checkOriginAttributes(nullPrin_browser, {inBrowser: true}, '!inBrowser=1');
+  checkOriginAttributes(exampleOrg_browser, 0, true, '!inBrowser=1');
+  checkOriginAttributes(nullPrin_browser, 0, true, '!inBrowser=1');
   do_check_eq(exampleOrg_browser.origin, 'http://example.org!inBrowser=1');
 
   // App and browser.
   var exampleOrg_appBrowser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {inBrowser: true, appId: 42});
   var nullPrin_appBrowser = ssm.createNullPrincipal({inBrowser: true, appId: 42});
-  checkOriginAttributes(exampleOrg_appBrowser, {appId: 42, inBrowser: true}, '!appId=42&inBrowser=1');
-  checkOriginAttributes(nullPrin_appBrowser, {appId: 42, inBrowser: true}, '!appId=42&inBrowser=1');
+  checkOriginAttributes(exampleOrg_appBrowser, 42, true, '!appId=42&inBrowser=1');
+  checkOriginAttributes(nullPrin_appBrowser, 42, true, '!appId=42&inBrowser=1');
   do_check_eq(exampleOrg_appBrowser.origin, 'http://example.org!appId=42&inBrowser=1');
 
   // App and browser, different domain.
   var exampleCom_appBrowser = ssm.createCodebasePrincipal(makeURI('https://www.example.com:123'), {appId: 42, inBrowser: true});
-  checkOriginAttributes(exampleCom_appBrowser, {appId: 42, inBrowser: true}, '!appId=42&inBrowser=1');
+  checkOriginAttributes(exampleCom_appBrowser, 42, true, '!appId=42&inBrowser=1');
   do_check_eq(exampleCom_appBrowser.origin, 'https://www.example.com:123!appId=42&inBrowser=1');
 
-  // Addon.
-  var exampleOrg_addon = ssm.createCodebasePrincipal(makeURI('http://example.org'), {addonId: 'dummy'});
-  checkOriginAttributes(exampleOrg_addon, { addonId: "dummy" }, '!addonId=dummy');
-  do_check_eq(exampleOrg_addon.origin, 'http://example.org!addonId=dummy');
-
   // Check that all of the above are cross-origin.
   checkCrossOrigin(exampleOrg_app, exampleOrg);
   checkCrossOrigin(exampleOrg_app, nullPrin_app);
   checkCrossOrigin(exampleOrg_browser, exampleOrg_app);
   checkCrossOrigin(exampleOrg_browser, nullPrin_browser);
   checkCrossOrigin(exampleOrg_appBrowser, exampleOrg_app);
   checkCrossOrigin(exampleOrg_appBrowser, nullPrin_appBrowser);
   checkCrossOrigin(exampleOrg_appBrowser, exampleCom_appBrowser);
-  checkCrossOrigin(exampleOrg_addon, exampleOrg);
 }
--- a/dom/bindings/BindingDeclarations.h
+++ b/dom/bindings/BindingDeclarations.h
@@ -114,21 +114,16 @@ public:
   Optional_base()
   {}
 
   explicit Optional_base(const T& aValue)
   {
     mImpl.emplace(aValue);
   }
 
-  bool operator==(const Optional_base<T, InternalType>& aOther) const
-  {
-    return mImpl == aOther.mImpl;
-  }
-
   template<typename T1, typename T2>
   explicit Optional_base(const T1& aValue1, const T2& aValue2)
   {
     mImpl.emplace(aValue1, aValue2);
   }
 
   bool WasPassed() const
   {
--- a/dom/webidl/ChromeUtils.webidl
+++ b/dom/webidl/ChromeUtils.webidl
@@ -35,10 +35,9 @@ interface ChromeUtils : ThreadSafeChrome
  * IMPORTANT: If you add any members here, you need to update the
  * methods on mozilla::OriginAttributes, and bump the CIDs of all
  * the principal implementations that use OriginAttributes in their
  * nsISerializable implementations.
  */
 dictionary OriginAttributesDictionary {
   unsigned long appId = 0;
   boolean inBrowser = false;
-  DOMString addonId = "";
 };
--- a/toolkit/components/addoncompat/addoncompat.manifest
+++ b/toolkit/components/addoncompat/addoncompat.manifest
@@ -1,4 +1,6 @@
 component {1363d5f0-d95e-11e3-9c1a-0800200c9a66} multiprocessShims.js
 contract @mozilla.org/addons/multiprocess-shims;1 {1363d5f0-d95e-11e3-9c1a-0800200c9a66}
 component {50bc93ce-602a-4bef-bf3a-61fc749c4caf} defaultShims.js
 contract @mozilla.org/addons/default-addon-shims;1 {50bc93ce-602a-4bef-bf3a-61fc749c4caf}
+component {dfd07380-6083-11e4-9803-0800200c9a66} remoteTagService.js
+contract @mozilla.org/addons/remote-tag-service;1 {dfd07380-6083-11e4-9803-0800200c9a66}
--- a/toolkit/components/addoncompat/moz.build
+++ b/toolkit/components/addoncompat/moz.build
@@ -5,16 +5,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 TEST_DIRS += ['tests']
 
 EXTRA_COMPONENTS += [
     'addoncompat.manifest',
     'defaultShims.js',
     'multiprocessShims.js',
+    'remoteTagService.js',
 ]
 
 EXTRA_JS_MODULES += [
     'CompatWarning.jsm',
     'Prefetcher.jsm',
     'RemoteAddonsChild.jsm',
     'RemoteAddonsParent.jsm',
 ]
new file mode 100644
--- /dev/null
+++ b/toolkit/components/addoncompat/remoteTagService.js
@@ -0,0 +1,39 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+const Cu = Components.utils;
+const Ci = Components.interfaces;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+function RemoteTagServiceService()
+{
+}
+
+RemoteTagServiceService.prototype = {
+  classID: Components.ID("{dfd07380-6083-11e4-9803-0800200c9a66}"),
+  QueryInterface: XPCOMUtils.generateQI([Ci.nsIRemoteTagService, Ci.nsISupportsWeakReference]),
+
+  /**
+   * CPOWs can have user data attached to them. This data originates
+   * in the local process from this function, getRemoteObjectTag. It's
+   * sent along with the CPOW to the remote process, where it can be
+   * fetched with Components.utils.getCrossProcessWrapperTag.
+   */
+  getRemoteObjectTag: function(target) {
+    if (target instanceof Ci.nsIDocShellTreeItem) {
+      return "ContentDocShellTreeItem";
+    }
+
+    if (target instanceof Ci.nsIDOMDocument) {
+      return "ContentDocument";
+    }
+
+    return "generic";
+  }
+};
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RemoteTagServiceService]);
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -45,17 +45,16 @@ DIRS += [
     'reflect',
     'sqlite',
     'startup',
     'statusfilter',
     'telemetry',
     'thumbnails',
     'timermanager',
     'typeaheadfind',
-    'utils',
     'urlformatter',
     'viewconfig',
     'workerloader',
     'workerlz4',
     'xulstore'
 ]
 
 if CONFIG['MOZ_BUILD_APP'] != 'mobile/android':
deleted file mode 100644
--- a/toolkit/components/utils/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-EXTRA_COMPONENTS += [
-    'simpleServices.js',
-    'utils.manifest',
-]
deleted file mode 100644
--- a/toolkit/components/utils/simpleServices.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * Dumping ground for simple services for which the isolation of a full global
- * is overkill. Be careful about namespace pollution, and be mindful about
- * importing lots of JSMs in global scope, since this file will almost certainly
- * be loaded from enough callsites that any such imports will always end up getting
- * eagerly loaded at startup.
- */
-
-"use strict";
-
-const Cu = Components.utils;
-const Ci = Components.interfaces;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-function RemoteTagServiceService()
-{
-}
-
-RemoteTagServiceService.prototype = {
-  classID: Components.ID("{dfd07380-6083-11e4-9803-0800200c9a66}"),
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIRemoteTagService, Ci.nsISupportsWeakReference]),
-
-  /**
-   * CPOWs can have user data attached to them. This data originates
-   * in the local process from this function, getRemoteObjectTag. It's
-   * sent along with the CPOW to the remote process, where it can be
-   * fetched with Components.utils.getCrossProcessWrapperTag.
-   */
-  getRemoteObjectTag: function(target) {
-    if (target instanceof Ci.nsIDocShellTreeItem) {
-      return "ContentDocShellTreeItem";
-    }
-
-    if (target instanceof Ci.nsIDOMDocument) {
-      return "ContentDocument";
-    }
-
-    return "generic";
-  }
-};
-
-function AddonPolicyService()
-{
-  this.wrappedJSObject = this;
-  this.mayLoadURICallbacks = new Map();
-}
-
-AddonPolicyService.prototype = {
-  classID: Components.ID("{89560ed3-72e3-498d-a0e8-ffe50334d7c5}"),
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIAddonPolicyService]),
-
-  /*
-   * Invokes a callback (if any) associated with the addon to determine whether
-   * unprivileged code running within the addon is allowed to perform loads from
-   * the given URI.
-   *
-   * @see nsIAddonPolicyService.addonMayLoadURI
-   */
-  addonMayLoadURI(aAddonId, aURI) {
-    let cb = this.mayLoadURICallbacks[aAddonId];
-    return cb ? cb(aURI) : false;
-  },
-
-  /*
-   * Sets the callbacks used in addonMayLoadURI above. Not accessible over
-   * XPCOM - callers should use .wrappedJSObject on the service to call it
-   * directly.
-   */
-  setAddonLoadURICallback(aAddonId, aCallback) {
-    this.mayLoadURICallbacks[aAddonId] = aCallback;
-  },
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RemoteTagServiceService, AddonPolicyService]);
deleted file mode 100644
--- a/toolkit/components/utils/utils.manifest
+++ /dev/null
@@ -1,4 +0,0 @@
-component {dfd07380-6083-11e4-9803-0800200c9a66} simpleServices.js
-contract @mozilla.org/addons/remote-tag-service;1 {dfd07380-6083-11e4-9803-0800200c9a66}
-component {89560ed3-72e3-498d-a0e8-ffe50334d7c5} simpleServices.js
-contract @mozilla.org/addons/policy-service;1 {89560ed3-72e3-498d-a0e8-ffe50334d7c5}