mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 23:37:33 +09:00
parent
30c7ed8319
commit
de4d9aa091
5 changed files with 3 additions and 52 deletions
|
|
@ -11,8 +11,7 @@
|
||||||
"choices": [{
|
"choices": [{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
"contextMenus",
|
"contextMenus"
|
||||||
"menus"
|
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
@ -21,7 +20,7 @@
|
||||||
{
|
{
|
||||||
"namespace": "contextMenus",
|
"namespace": "contextMenus",
|
||||||
"description": "Use the <code>browser.contextMenus</code> API to add items to the browser's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.",
|
"description": "Use the <code>browser.contextMenus</code> API to add items to the browser's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.",
|
||||||
"permissions": ["contextMenus", "menus"],
|
"permissions": ["contextMenus"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"ACTION_MENU_TOP_LEVEL_LIMIT": {
|
"ACTION_MENU_TOP_LEVEL_LIMIT": {
|
||||||
"value": 6,
|
"value": 6,
|
||||||
|
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
||||||
|
|
||||||
function dnsResolve(hostname, flags = []) {
|
|
||||||
let mask = 0;
|
|
||||||
for (let flag of flags) {
|
|
||||||
switch (flag) {
|
|
||||||
case "bypass_cache": mask |= Ci.nsIDNSService.RESOLVE_BYPASS_CACHE; break;
|
|
||||||
case "canonical_name": mask |= Ci.nsIDNSService.RESOLVE_CANONICAL_NAME; break;
|
|
||||||
case "disable_ipv4": mask |= Ci.nsIDNSService.RESOLVE_DISABLE_IPV4; break;
|
|
||||||
case "disable_ipv6": mask |= Ci.nsIDNSService.RESOLVE_DISABLE_IPV6; break;
|
|
||||||
case "offline": mask |= Ci.nsIDNSService.RESOLVE_OFFLINE; break;
|
|
||||||
case "priority_low": mask |= Ci.nsIDNSService.RESOLVE_PRIORITY_LOW; break;
|
|
||||||
case "priority_medium": mask |= Ci.nsIDNSService.RESOLVE_PRIORITY_MEDIUM; break;
|
|
||||||
case "allow_name_collisions": mask |= Ci.nsIDNSService.RESOLVE_ALLOW_NAME_COLLISION; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let dns = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService);
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let listener = {
|
|
||||||
onLookupComplete(request, record, status) {
|
|
||||||
if (Components.isSuccessCode(status)) {
|
|
||||||
let addresses = [];
|
|
||||||
try { record.rewind(); while (record.hasMore()) addresses.push(record.getNextAddrAsString()); } catch (e) {}
|
|
||||||
resolve({addresses, canonicalName: record.canonicalName || undefined, isTRR: false});
|
|
||||||
} else {
|
|
||||||
reject(Components.Exception("DNS resolution failed", status));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSListener]),
|
|
||||||
};
|
|
||||||
dns.asyncResolve(hostname, mask, listener, Services.tm.mainThread);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
extensions.registerSchemaAPI("dns", "addon_parent", () => ({
|
|
||||||
dns: { resolve: dnsResolve },
|
|
||||||
}));
|
|
||||||
|
|
@ -47,4 +47,3 @@ category webextension-schemas test chrome://extensions/content/schemas/test.json
|
||||||
category webextension-schemas top_sites chrome://extensions/content/schemas/top_sites.json
|
category webextension-schemas top_sites chrome://extensions/content/schemas/top_sites.json
|
||||||
category webextension-schemas web_navigation chrome://extensions/content/schemas/web_navigation.json
|
category webextension-schemas web_navigation chrome://extensions/content/schemas/web_navigation.json
|
||||||
category webextension-schemas web_request chrome://extensions/content/schemas/web_request.json
|
category webextension-schemas web_request chrome://extensions/content/schemas/web_request.json
|
||||||
category webextension-schemas dns chrome://extensions/content/schemas/dns.json
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
[
|
|
||||||
{"namespace":"manifest","types":[{"$extend":"Permission","choices":[{"type":"string","enum":["dns"]}]}]},
|
|
||||||
{"namespace":"dns","permissions":["dns"],"types":[{"id":"DNSRecord","type":"object","properties":{"addresses":{"type":"array","items":{"type":"string"}},"canonicalName":{"type":"string","optional":true},"isTRR":{"type":"boolean"}}}],"functions":[{"name":"resolve","type":"function","async":"promise","parameters":[{"name":"hostname","type":"string"},{"name":"flags","type":"array","items":{"type":"string"},"optional":true}],"returns":{"$ref":"DNSRecord"}}]}
|
|
||||||
]
|
|
||||||
|
|
@ -18,9 +18,7 @@ this.EXPORTED_SYMBOLS = ["MatchPattern", "MatchGlobs", "MatchURLFilters"];
|
||||||
|
|
||||||
/* globals MatchPattern, MatchGlobs */
|
/* globals MatchPattern, MatchGlobs */
|
||||||
|
|
||||||
// WebExtensions also use WebSocket URLs for request filtering and
|
const PERMITTED_SCHEMES = ["http", "https", "file", "ftp", "data"];
|
||||||
// moz-extension URLs internally when validating web-accessible resources.
|
|
||||||
const PERMITTED_SCHEMES = ["http", "https", "file", "ftp", "data", "ws", "wss", "moz-extension"];
|
|
||||||
const PERMITTED_SCHEMES_REGEXP = PERMITTED_SCHEMES.join("|");
|
const PERMITTED_SCHEMES_REGEXP = PERMITTED_SCHEMES.join("|");
|
||||||
|
|
||||||
// This function converts a glob pattern (containing * and possibly ?
|
// This function converts a glob pattern (containing * and possibly ?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue