1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /* We used to use this component to heuristically determine which links to
6 * direct to the user's default browser, but we no longer use that heuristic.
7 * It will come in handy when we implement support for trusted apps, however,
8 * so we left it in (although it is disabled in the manifest).
11 const Cc = Components.classes;
12 const Ci = Components.interfaces;
13 const Cu = Components.utils;
15 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
17 function ContentPolicy() {}
19 ContentPolicy.prototype = {
20 classID: Components.ID("{75acd178-3d5a-48a7-bd92-fba383520ae6}"),
22 QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPolicy]),
24 shouldLoad: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) {
26 return Ci.nsIContentPolicy.ACCEPT;
28 // When rejecting a load due to a content policy violation, use this code
29 // to close the window opened by window.open, if any.
30 //if (context.currentURI.spec == "about:blank") {
31 // context.ownerDocument.defaultView.close();
35 shouldProcess: function(contentType, contentLocation, requestOrigin, context, mimeType, extra) {
36 return Ci.nsIContentPolicy.ACCEPT;
40 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPolicy]);