mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-27 21:38:33 +00:00
04045e72b7
- Bug 1398229 - Save-link-as feature should use the loading principal - implementation of nsIContentPolicy.TYPE_SAVE_AS_DOWNLOAD (97c6ecff) - Bug 1398229 - Save-link-as feature should use the loading principal - context menu using nsIContentPolicy.TYPE_SAVE_AS_DOWNLOAD (5f66b032) - Bug 1430758 - No CSP directive for nsIContentPolicy::TYPE_SAVEAS_DOWNLOAD (9578e970) - Remove a comment in nsContextMenu.js (2e3999cd) - Rewrite uuid for ContentPolicy (d4bba670) - Added Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD to next files (d180a351) - nsIContentPolicy: Their order (in nsIContentPolicyBase.idl) must be retained in nsContentBlocker.cpp (0fac4df8) - nsIContentPolicy: Numbers should not be omitted in nsIContentPolicyBase.idl, rewrite uuid (65c35bbe)
59 lines
2.1 KiB
JavaScript
59 lines
2.1 KiB
JavaScript
/* 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 EXPORTED_SYMBOLS = ["WebRequestCommon"];
|
|
|
|
/* exported WebRequestCommon */
|
|
|
|
const Ci = Components.interfaces;
|
|
const Cc = Components.classes;
|
|
const Cu = Components.utils;
|
|
const Cr = Components.results;
|
|
|
|
var WebRequestCommon = {
|
|
typeForPolicyType(type) {
|
|
switch (type) {
|
|
case Ci.nsIContentPolicy.TYPE_DOCUMENT: return "main_frame";
|
|
case Ci.nsIContentPolicy.TYPE_SUBDOCUMENT: return "sub_frame";
|
|
case Ci.nsIContentPolicy.TYPE_STYLESHEET: return "stylesheet";
|
|
case Ci.nsIContentPolicy.TYPE_SCRIPT: return "script";
|
|
case Ci.nsIContentPolicy.TYPE_IMAGE: return "image";
|
|
case Ci.nsIContentPolicy.TYPE_OBJECT: return "object";
|
|
case Ci.nsIContentPolicy.TYPE_OBJECT_SUBREQUEST: return "object_subrequest";
|
|
case Ci.nsIContentPolicy.TYPE_XMLHTTPREQUEST: return "xmlhttprequest";
|
|
case Ci.nsIContentPolicy.TYPE_XBL: return "xbl";
|
|
case Ci.nsIContentPolicy.TYPE_XSLT: return "xslt";
|
|
case Ci.nsIContentPolicy.TYPE_PING: return "ping";
|
|
case Ci.nsIContentPolicy.TYPE_BEACON: return "beacon";
|
|
case Ci.nsIContentPolicy.TYPE_DTD: return "xml_dtd";
|
|
case Ci.nsIContentPolicy.TYPE_FONT: return "font";
|
|
case Ci.nsIContentPolicy.TYPE_MEDIA: return "media";
|
|
case Ci.nsIContentPolicy.TYPE_WEBSOCKET: return "websocket";
|
|
case Ci.nsIContentPolicy.TYPE_CSP_REPORT: return "csp_report";
|
|
case Ci.nsIContentPolicy.TYPE_IMAGESET: return "imageset";
|
|
case Ci.nsIContentPolicy.TYPE_WEB_MANIFEST: return "web_manifest";
|
|
case Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD: return "saveas_download";
|
|
default: return "other";
|
|
}
|
|
},
|
|
|
|
typeMatches(policyType, filterTypes) {
|
|
if (filterTypes === null) {
|
|
return true;
|
|
}
|
|
|
|
return filterTypes.indexOf(this.typeForPolicyType(policyType)) != -1;
|
|
},
|
|
|
|
urlMatches(uri, urlFilter) {
|
|
if (urlFilter === null) {
|
|
return true;
|
|
}
|
|
|
|
return urlFilter.matches(uri);
|
|
},
|
|
};
|