Merge branch 'chromium' into merge/chromium
This commit is contained in:
commit
b9373c65b1
|
@ -51,6 +51,10 @@
|
|||
}
|
||||
};
|
||||
|
||||
if (!browser.contentScripts) { // #chromium fallback
|
||||
Scripts.register = () => {};
|
||||
}
|
||||
|
||||
let flatten = arr => arr.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []);
|
||||
|
||||
let protocolRx = /^(\w+):/i;
|
||||
|
|
|
@ -20,7 +20,10 @@ var RequestGuard = (() => {
|
|||
media: "media",
|
||||
other: "",
|
||||
};
|
||||
const allTypes = Object.keys(policyTypesMap);
|
||||
const allTypes = UA.isMozilla ? Object.keys(policyTypesMap)
|
||||
: ["main_frame", "sub_frame", "stylesheet", "script", "image", "font",
|
||||
"object", "xmlhttprequest", "ping", "csp_report", "media", "websocket", "other"];
|
||||
|
||||
Object.assign(policyTypesMap, {"webgl": "webgl"}); // fake types
|
||||
const TabStatus = {
|
||||
map: new Map(),
|
||||
|
@ -254,7 +257,7 @@ var RequestGuard = (() => {
|
|||
return redirected;
|
||||
}
|
||||
const ABORT = {cancel: true}, ALLOW = {};
|
||||
const INTERNAL_SCHEME = /^(?:chrome|resource|moz-extension|about):/;
|
||||
const INTERNAL_SCHEME = /^(?:chrome|resource|(?:moz|chrome)-extension|about):/;
|
||||
const listeners = {
|
||||
onBeforeRequest(request) {
|
||||
try {
|
||||
|
@ -326,7 +329,7 @@ var RequestGuard = (() => {
|
|||
capabilities = perms.capabilities;
|
||||
} else {
|
||||
capabilities = perms.capabilities;
|
||||
if (frameAncestors.length > 0 && ns.sync.cascadeRestrictions) {
|
||||
if (frameAncestors && frameAncestors.length > 0 && ns.sync.cascadeRestrictions) {
|
||||
// cascade top document's restrictions to subframes
|
||||
let topUrl = frameAncestors.pop().url;
|
||||
let topPerms = policy.get(topUrl, topUrl).perms;
|
||||
|
|
|
@ -31,7 +31,7 @@ function deferWebTraffic(promiseToWaitFor, next) {
|
|||
if (type === "main_frame") {
|
||||
seenTabs.add(tabId);
|
||||
} else if (documentUrl) {
|
||||
if (frameId !== 0) {
|
||||
if (frameId !== 0 && request.frameAncestors) {
|
||||
documentUrl = request.frameAncestors.pop().url;
|
||||
}
|
||||
reloadTab(tabId);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
headCells[i].addEventListener("click", rowAction(i), true);
|
||||
}
|
||||
if (gUI_showHidden) {
|
||||
gRows = Array.slice(gTBody.rows);
|
||||
gRows = Array.from(gTBody.rows);
|
||||
hiddenObjects = gRows.some(row => row.className == "hidden-object");
|
||||
}
|
||||
gTable.setAttribute("order", "");
|
||||
|
@ -60,7 +60,7 @@
|
|||
}
|
||||
function orderBy(column) {
|
||||
if (!gRows)
|
||||
gRows = Array.slice(gTBody.rows);
|
||||
gRows = Array.from(gTBody.rows);
|
||||
var order;
|
||||
if (gOrderBy == column) {
|
||||
order = gTable.getAttribute("order") == "asc" ? "desc" : "asc";
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
var UA = {
|
||||
isMozilla: document.URL.startsWith("moz-"),
|
||||
}
|
||||
|
||||
if (!UA.isMozilla) {
|
||||
if (typeof chrome === "object" && !chrome.tabs && typeof exportFunction === "undefined") {
|
||||
// content script shims
|
||||
window.exportFunction = () => {};
|
||||
}
|
||||
} else {
|
||||
document.documentElement.classList.add("mozwebext");
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -7,12 +7,12 @@ if (typeof flextabs === "function") {
|
|||
let rx = new RegExp(`(?:^|[#;])tab-${id}=(\\d+)(?:;|$)`);
|
||||
let current = location.hash.match(rx);
|
||||
console.log(`persisted %o`, current);
|
||||
let toggles = tabs.querySelectorAll(".flextabs__toggle");
|
||||
let toggles = Array.from(tabs.querySelectorAll(".flextabs__toggle"));
|
||||
let currentToggle = toggles[current && parseInt(current[1]) || 0];
|
||||
if (currentToggle) currentToggle.click();
|
||||
for (let toggle of toggles) {
|
||||
toggle.addEventListener("click", e => {
|
||||
let currentIdx = Array.indexOf(toggles, toggle);
|
||||
let currentIdx = toggles.indexOf(toggle);
|
||||
location.hash = location.hash.split(";").filter(p => !rx.test(p))
|
||||
.concat(`tab-${id}=${currentIdx}`).join(";");
|
||||
});
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
{
|
||||
// see https://bugzilla.mozilla.org/show_bug.cgi?id=1415644
|
||||
let domains = [
|
||||
"accounts-static.cdn.mozilla.net",
|
||||
"accounts.firefox.com",
|
||||
"addons.cdn.mozilla.net",
|
||||
"addons.mozilla.org",
|
||||
"api.accounts.firefox.com",
|
||||
"content.cdn.mozilla.net",
|
||||
"content.cdn.mozilla.net",
|
||||
"discovery.addons.mozilla.org",
|
||||
"input.mozilla.org",
|
||||
"install.mozilla.org",
|
||||
"oauth.accounts.firefox.com",
|
||||
"profile.accounts.firefox.com",
|
||||
"support.mozilla.org",
|
||||
"sync.services.mozilla.com",
|
||||
"testpilot.firefox.com",
|
||||
];
|
||||
let domains = UA.isMozilla ? [
|
||||
"accounts-static.cdn.mozilla.net",
|
||||
"accounts.firefox.com",
|
||||
"addons.cdn.mozilla.net",
|
||||
"addons.mozilla.org",
|
||||
"api.accounts.firefox.com",
|
||||
"content.cdn.mozilla.net",
|
||||
"content.cdn.mozilla.net",
|
||||
"discovery.addons.mozilla.org",
|
||||
"input.mozilla.org",
|
||||
"install.mozilla.org",
|
||||
"oauth.accounts.firefox.com",
|
||||
"profile.accounts.firefox.com",
|
||||
"support.mozilla.org",
|
||||
"sync.services.mozilla.com",
|
||||
"testpilot.firefox.com",
|
||||
] : [ "chrome.google.com" ];
|
||||
|
||||
function isRestrictedURL(u) {
|
||||
try {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"strict_min_version": "59.0"
|
||||
}
|
||||
},
|
||||
"version": "10.2.5",
|
||||
"version": "10.5rc1",
|
||||
"description": "__MSG_Description__",
|
||||
"incognito": "spanning",
|
||||
|
||||
|
@ -35,6 +35,8 @@
|
|||
"background": {
|
||||
"persistent": true,
|
||||
"scripts": [
|
||||
"lib/UA.js",
|
||||
"lib/browser-polyfill.js",
|
||||
"lib/uuid.js",
|
||||
"lib/log.js",
|
||||
"lib/include.js",
|
||||
|
@ -77,6 +79,8 @@
|
|||
"match_about_blank": true,
|
||||
"all_frames": true,
|
||||
"js": [
|
||||
"lib/UA.js",
|
||||
"lib/browser-polyfill.js",
|
||||
"lib/log.js",
|
||||
"lib/uuid.js",
|
||||
"lib/sha256.js",
|
||||
|
@ -117,11 +121,13 @@
|
|||
|
||||
"commands": {
|
||||
"_execute_browser_action": {
|
||||
"description": "NoScript UI",
|
||||
"suggested_key": {
|
||||
"default": "Alt+Shift+N"
|
||||
}
|
||||
},
|
||||
"togglePermissions": {
|
||||
"description": "Toggle permissions",
|
||||
"suggested_key": {
|
||||
"default": "Ctrl+Shift+T"
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ var Test = (() => {
|
|||
error(e);
|
||||
}
|
||||
this[r ? "passed" : "failed"]++;
|
||||
log(`${r ? "PASSED" : "FAILED"} ${msg || uneval(test)}`);
|
||||
log(`${r ? "PASSED" : "FAILED"} ${msg || test}`);
|
||||
if (typeof callback === "function") try {
|
||||
callback(r, test, msg);
|
||||
} catch(e) {
|
||||
|
|
|
@ -7,14 +7,16 @@ var Prompts = (() => {
|
|||
async open(data) {
|
||||
promptData = data;
|
||||
this.close();
|
||||
this.currentWindow = await browser.windows.create({
|
||||
let options = {
|
||||
url: browser.extension.getURL("ui/prompt.html"),
|
||||
type: "panel",
|
||||
allowScriptsToClose: true,
|
||||
// titlePreface: "NoScript ",
|
||||
width: data.features.width,
|
||||
height: data.features.height,
|
||||
});
|
||||
};
|
||||
if (UA.isMozilla) {
|
||||
options.allowScriptsToClose = true;
|
||||
}
|
||||
this.currentWindow = await browser.windows.create(options);
|
||||
}
|
||||
async close() {
|
||||
if (this.currentWindow) {
|
||||
|
|
|
@ -195,3 +195,11 @@ input[type="file"] {
|
|||
border-radius: .2em .2em 0 0;
|
||||
padding: .2em .4em;
|
||||
}
|
||||
|
||||
#xss-options {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mozwebext #xss-options {
|
||||
display: block;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
<link rel="stylesheet" href="/lib/flextabs.css" />
|
||||
<link rel="stylesheet" href="options.css" />
|
||||
<link rel="stylesheet" href="whirlpool.css" />
|
||||
<script src="/lib/UA.js"></script>
|
||||
<script src="/lib/browser-polyfill.js"></script>
|
||||
<script src="/lib/include.js"></script>
|
||||
<script src="/lib/log.js"></script>
|
||||
<script src="/lib/flextabs.js"></script>
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
}
|
||||
let button = document.querySelector("#btn-delete-xss-choices");
|
||||
let choices = UI.xssUserChoices;
|
||||
button.disabled = Object.keys(choices).length === 0;
|
||||
button.disabled = !choices || Object.keys(choices).length === 0;
|
||||
button.onclick = () => {
|
||||
UI.updateSettings({
|
||||
xssUserChoices: {}
|
||||
|
|
|
@ -16,6 +16,7 @@ body {
|
|||
|
||||
#top a {
|
||||
appearance: none !important;
|
||||
webkit-appearance: none !important;
|
||||
-moz-appearance: none !important;
|
||||
width: 2em;
|
||||
height: 2em;
|
||||
|
@ -119,8 +120,9 @@ body {
|
|||
}
|
||||
|
||||
.hider-close {
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
color: black;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
<title>NoScript Settings</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="popup.css" />
|
||||
<script src="/lib/UA.js"></script>
|
||||
<script src="/lib/browser-polyfill.js"></script>
|
||||
<script src="/lib/include.js"></script>
|
||||
<script src="/lib/log.js"></script>
|
||||
<script src="/common/locale.js"></script>
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
<title></title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="prompt.css" />
|
||||
<script src="/lib/UA.js"></script>
|
||||
<script src="/lib/browser-polyfill.js"></script>
|
||||
<script src="/lib/include.js"></script>
|
||||
<script src="/lib/log.js"></script>
|
||||
<script src="/common/locale.js"></script>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<script src="/lib/UA.js"></script>
|
||||
<script src="/lib/browser-polyfill.js"></script>
|
||||
<script src="/lib/log.js"></script>
|
||||
<script src="/lib/include.js"></script>
|
||||
<script src="siteInfo.js"></script>
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
}
|
||||
UI.local.toolbarLayout = {
|
||||
left, right,
|
||||
hidden: Array.map(document.querySelectorAll("#top > .hider > .icon"), el => el.id),
|
||||
hidden: Array.from(document.querySelectorAll("#top > .hider > .icon")).map(el => el.id),
|
||||
};
|
||||
|
||||
debug("%o", UI.local);
|
||||
|
|
|
@ -5,10 +5,14 @@ input {
|
|||
}
|
||||
|
||||
input[type="radio"] {
|
||||
appearance: radio !important;
|
||||
-webkit-appearance: radio !important;
|
||||
-moz-appearance: radio !important;
|
||||
padding-right: .2em !important;
|
||||
}
|
||||
input[type="checkbox"] {
|
||||
appearance: checkbox !important;
|
||||
-webkit-appearance: checkbox !important;
|
||||
-moz-appearance: checkbox !important;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ body {
|
|||
font-family: sans-serif;
|
||||
font: -moz-use-system-font;
|
||||
font-size: 12px;
|
||||
min-width: 600px;
|
||||
}
|
||||
|
||||
.mobile > body {
|
||||
|
@ -139,6 +140,8 @@ input[type="checkbox"] {
|
|||
|
||||
input.https-only {
|
||||
font-size: 1em;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
background: url(/img/ui-http64.png) no-repeat center;
|
||||
background-size: 1.5em;
|
||||
|
@ -186,6 +189,8 @@ span.preset {
|
|||
|
||||
.presets input.preset {
|
||||
font-size: 1em;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
background: url(/img/ui-no64.png) no-repeat center left;
|
||||
background-size: 1.5em;
|
||||
|
@ -264,6 +269,8 @@ input.preset:active, input.preset:focus, input.preset:hover {
|
|||
}
|
||||
|
||||
button.options {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
border: none;
|
||||
background: none transparent;
|
||||
|
@ -276,6 +283,8 @@ button.options {
|
|||
}
|
||||
|
||||
.preset .options {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
|
||||
border: 0;
|
||||
|
@ -315,6 +324,8 @@ input.preset[value="CUSTOM"] {
|
|||
|
||||
input.temp {
|
||||
font-size: 1em;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
|
|
@ -107,11 +107,10 @@ XSS.InjectionChecker = (async () => {
|
|||
var bs = {
|
||||
nq: new RegExp("[" + def + "]")
|
||||
};
|
||||
Array.forEach("'\"`", // special treatment for quotes
|
||||
function(c) {
|
||||
bs[c] = new RegExp("[" + def + c + "]");
|
||||
}
|
||||
);
|
||||
for (let c of ['"', '"', '`']) {
|
||||
// special treatment for quotes
|
||||
bs[c] = new RegExp("[" + def + c + "]");
|
||||
}
|
||||
delete this.breakStops;
|
||||
return (this.breakStops = bs);
|
||||
},
|
||||
|
|
|
@ -113,6 +113,8 @@ var XSS = (() => {
|
|||
|
||||
return {
|
||||
async start() {
|
||||
if (!UA.isMozilla) return; // async webRequest is supported on Mozilla only
|
||||
|
||||
let {onBeforeRequest} = browser.webRequest;
|
||||
let {xssScanRequestBody} = ns.sync;
|
||||
if (xssScanRequestBody !== this.xssScanRequestBody) {
|
||||
|
|
Loading…
Reference in New Issue