Backed out changeset 6cd56d32ec92 (bug 908932) for landing with the wrong bug # in the commit message.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 27 Aug 2013 15:06:51 -0400
changeset 158380 4096100d6dcb53d9e510e1f4d4b49b6713af9646
parent 158379 6cd56d32ec92683135787f666e3c63119fecb17c
child 158381 d3f4b59be97fbcc6536b96a2005e6bedf11686e2
push id407
push userlsblakk@mozilla.com
push dateTue, 03 Dec 2013 03:32:50 +0000
treeherdermozilla-release@babf8c9ebc52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs908932
milestone26.0a1
backs out6cd56d32ec92683135787f666e3c63119fecb17c
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 changeset 6cd56d32ec92 (bug 908932) for landing with the wrong bug # in the commit message.
webapprt/ContentPolicy.js
webapprt/components.manifest
webapprt/moz.build
new file mode 100644
--- /dev/null
+++ b/webapprt/ContentPolicy.js
@@ -0,0 +1,40 @@
+/* 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/. */
+
+/* We used to use this component to heuristically determine which links to
+ * direct to the user's default browser, but we no longer use that heuristic.
+ * It will come in handy when we implement support for trusted apps, however,
+ * so we left it in (although it is disabled in the manifest).
+*/
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+function ContentPolicy() {}
+
+ContentPolicy.prototype = {
+  classID: Components.ID("{75acd178-3d5a-48a7-bd92-fba383520ae6}"),
+
+  QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPolicy]),
+
+  shouldLoad: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) {
+
+    return Ci.nsIContentPolicy.ACCEPT;
+
+    // When rejecting a load due to a content policy violation, use this code
+    // to close the window opened by window.open, if any.
+    //if (context.currentURI.spec == "about:blank") {
+    //  context.ownerDocument.defaultView.close();
+    //};
+  },
+
+  shouldProcess: function(contentType, contentLocation, requestOrigin, context, mimeType, extra) {
+    return Ci.nsIContentPolicy.ACCEPT;
+  },
+};
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPolicy]);
--- a/webapprt/components.manifest
+++ b/webapprt/components.manifest
@@ -2,12 +2,21 @@
 component {6d69c782-40a3-469b-8bfd-3ee366105a4a} CommandLineHandler.js
 contract @mozilla.org/webapprt/clh;1 {6d69c782-40a3-469b-8bfd-3ee366105a4a}
 category command-line-handler x-default @mozilla.org/webapprt/clh;1
 
 # ContentPermission.js
 component {07ef5b2e-88fb-47bd-8cec-d3b0bef11ac4} ContentPermission.js
 contract @mozilla.org/content-permission/prompt;1 {07ef5b2e-88fb-47bd-8cec-d3b0bef11ac4}
 
+# ContentPolicy.js
+# We used to use this component to heuristically determine which links to
+# direct to the user's default browser, but we no longer use that heuristic.
+# It will come in handy when we implement support for trusted apps, however,
+# so we left it in (although it is disabled here).
+# component {75acd178-3d5a-48a7-bd92-fba383520ae6} ContentPolicy.js
+# contract @mozilla.org/webapprt/content-policy;1 {75acd178-3d5a-48a7-bd92-fba383520ae6}
+# category content-policy webapprt-content-policy @mozilla.org/webapprt/content-policy;1
+
 # DirectoryProvider.js
 component {e1799fda-4b2f-4457-b671-e0641d95698d} DirectoryProvider.js
 contract @mozilla.org/webapprt/directory-provider;1 {e1799fda-4b2f-4457-b671-e0641d95698d}
 category xpcom-directory-providers webapprt-directory-provider @mozilla.org/webapprt/directory-provider;1
--- a/webapprt/moz.build
+++ b/webapprt/moz.build
@@ -12,16 +12,17 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gt
     DIRS += ['gtk2']
 
 DIRS += ['locales']
 TEST_DIRS += ['test']
 
 EXTRA_COMPONENTS += [
     'CommandLineHandler.js',
     'ContentPermission.js',
+    'ContentPolicy.js',
     'DirectoryProvider.js',
     'components.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'Startup.jsm',
     'WebappRT.jsm',
     'WebappsHandler.jsm',