mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 02:47:31 +09:00
Compare commits
4 commits
f628239ef3
...
e0fe6706d1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0fe6706d1 | ||
|
|
ae54ac8e28 | ||
|
|
e134fea1ba | ||
|
|
3f10f6cfc5 |
9 changed files with 108 additions and 4 deletions
|
|
@ -11,7 +11,8 @@
|
|||
"choices": [{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"contextMenus"
|
||||
"contextMenus",
|
||||
"menus"
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
|
@ -20,7 +21,7 @@
|
|||
{
|
||||
"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.",
|
||||
"permissions": ["contextMenus"],
|
||||
"permissions": ["contextMenus", "menus"],
|
||||
"properties": {
|
||||
"ACTION_MENU_TOP_LEVEL_LIMIT": {
|
||||
"value": 6,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,9 @@ struct IDBObjectStore::StructuredCloneWriteInfo
|
|||
uint64_t mOffsetToKeyProp;
|
||||
|
||||
explicit StructuredCloneWriteInfo(IDBDatabase* aDatabase)
|
||||
: mCloneBuffer(JS::StructuredCloneScope::DifferentProcessForIndexedDB, nullptr,
|
||||
// DifferentProcessForIndexedDB is a read-only compatibility mode. New
|
||||
// records must use the durable, cross-process serialization format.
|
||||
: mCloneBuffer(JS::StructuredCloneScope::DifferentProcess, nullptr,
|
||||
nullptr)
|
||||
, mDatabase(aDatabase)
|
||||
, mOffsetToKeyProp(0)
|
||||
|
|
|
|||
49
dom/indexedDB/test/unit/test_cache_record_roundtrip.js
Normal file
49
dom/indexedDB/test/unit/test_cache_record_roundtrip.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
var testGenerator = testSteps();
|
||||
|
||||
function* testSteps() {
|
||||
const name = "cache-record-roundtrip";
|
||||
let request = indexedDB.open(name, 1);
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = event => {
|
||||
event.target.result.createObjectStore("cache", {keyPath: "key"});
|
||||
};
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
let event = yield undefined;
|
||||
let db = event.target.result;
|
||||
let transaction = db.transaction("cache", "readwrite");
|
||||
transaction.onabort = errorHandler;
|
||||
transaction.oncomplete = grabEventAndContinueHandler;
|
||||
let store = transaction.objectStore("cache");
|
||||
store.put({key: "text", value: "compiled filter data"});
|
||||
store.put({key: "bytes", value: new Uint8Array([0, 1, 127, 255])});
|
||||
store.put({key: "empty", value: new ArrayBuffer(0)});
|
||||
yield undefined;
|
||||
db.close();
|
||||
|
||||
// Reopen after committing: test the serialized database records, rather than
|
||||
// just observing successful writes or values still held by the caller.
|
||||
request = indexedDB.open(name, 1);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
db = event.target.result;
|
||||
request = db.transaction("cache").objectStore("cache").getAll();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
let records = event.target.result;
|
||||
is(records.length, 3, "All committed records are readable");
|
||||
is(records[0].key, "bytes", "Records retain their keys");
|
||||
ok(records[0].value instanceof Uint8Array, "Typed array type survives storage");
|
||||
is(Array.from(records[0].value).join(), "0,1,127,255", "Bytes survive storage");
|
||||
is(records[1].value.byteLength, 0, "Empty buffers survive storage");
|
||||
is(records[2].value, "compiled filter data", "Strings survive storage");
|
||||
db.close();
|
||||
finishTest();
|
||||
yield undefined;
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
[test_autoIncrement.js]
|
||||
[test_autoIncrement_indexes.js]
|
||||
[test_blocked_order.js]
|
||||
[test_cache_record_roundtrip.js]
|
||||
[test_clear.js]
|
||||
[test_complex_keyPaths.js]
|
||||
[test_count.js]
|
||||
|
|
|
|||
41
toolkit/components/webextensions/ext-dns.js
Normal file
41
toolkit/components/webextensions/ext-dns.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
"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,3 +47,4 @@ 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 web_navigation chrome://extensions/content/schemas/web_navigation.json
|
||||
category webextension-schemas web_request chrome://extensions/content/schemas/web_request.json
|
||||
category webextension-schemas dns chrome://extensions/content/schemas/dns.json
|
||||
|
|
|
|||
4
toolkit/components/webextensions/schemas/dns.json
Normal file
4
toolkit/components/webextensions/schemas/dns.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
{"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"}}]}
|
||||
]
|
||||
|
|
@ -218,9 +218,12 @@
|
|||
"enum": [
|
||||
"alarms",
|
||||
"clipboardWrite",
|
||||
"dns",
|
||||
"idle",
|
||||
"notifications",
|
||||
"privacy",
|
||||
"storage"
|
||||
,"unlimitedStorage"
|
||||
]
|
||||
},
|
||||
{ "$ref": "MatchPattern" }
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ this.EXPORTED_SYMBOLS = ["MatchPattern", "MatchGlobs", "MatchURLFilters"];
|
|||
|
||||
/* globals MatchPattern, MatchGlobs */
|
||||
|
||||
const PERMITTED_SCHEMES = ["http", "https", "file", "ftp", "data"];
|
||||
// WebExtensions also use WebSocket URLs for request filtering and
|
||||
// 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("|");
|
||||
|
||||
// This function converts a glob pattern (containing * and possibly ?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue