-
-
Save jiacai2050/f75f9d1a3d577f9a60e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Cc, Ci } = require("chrome"); | |
const xpcom = require("xpcom"); | |
const { Class } = require("api-utils/heritage"); | |
exports.preventCrossRequest = Class({ | |
extends: xpcom.Unknown, | |
interfaces: ["nsIContentPolicy"], | |
shouldLoad: function (contType, contLoc, reqOrig, ctx, typeGuess, extra) { | |
return Ci.nsIContentPolicy.REJECT; | |
}, | |
shouldProcess: function (contType, contLoc, reqOrig, ctx, mimeType, extra) { | |
return Ci.nsIContentPolicy.ACCEPT; | |
} | |
}); | |
let factory = xpcom.Factory({ | |
Component: exports.preventCrossRequest, | |
description: "Implements content policy to prevent cross requests", | |
contract: "@lduros.net/PreventCrossRequest-policy" | |
}); | |
var catman = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager); | |
catman.addCategoryEntry("content-policy", "prevent-cross-request.preventCrossRequest", factory.contract, false, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment