Skip to content

Commit 4f8e2e2

Browse files
committed
Remove some same-origin checks, so that sites that auto-redirect from x.com to www.x.com will work.
1 parent a0442d3 commit 4f8e2e2

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

content-script.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ const checkSameOrigin = (node, tryLoadUri) => {
7070

7171
const createFrame = (window, src, allowScripts, loadFun) => {
7272
log(LOG_INFO, "creating frame for " + src);
73-
if (!checkSameOrigin(window.document, src)) {
74-
throw new Error("same origin mismatch; frame creation denied");
75-
}
7673
let frame = window.document.createElement("iframe");
7774
frame.setAttribute("sandbox", "allow-scripts");
7875
frame.style.display = "none";

main.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,6 @@ lazy(this, "_", function() {
3434
};
3535
});
3636

37-
function checkSameOrigin(principal, tryLoadUri) {
38-
try {
39-
if (!(tryLoadUri instanceof Ci.nsIURI)) {
40-
tryLoadUri = Services.io.newURI(tryLoadUri, null, null);
41-
}
42-
if (tryLoadUri.schemeIs("data")) {
43-
return true;
44-
}
45-
principal.checkMayLoad(tryLoadUri, false, true);
46-
return true;
47-
}
48-
catch (ex) {
49-
log(LOG_DEBUG, "denied load of " + (tryLoadUri.spec || tryLoadUri), ex);
50-
return false;
51-
}
52-
}
53-
5437
function main(window, document) {
5538
const $ = id => document.getElementById(id);
5639
const $$$ = q => document.querySelectorAll(q);
@@ -209,8 +192,7 @@ function main(window, document) {
209192
log(LOG_DEBUG, `context menu showing for ${gContextMenu.frameOuterWindowID}!`);
210193
try {
211194
if (gContextMenu.onLink && /^https?$/.test(gContextMenu.linkURI.scheme)) {
212-
setMenuHidden(!checkSameOrigin(gContextMenu.principal,
213-
gContextMenu.linkURL));
195+
setMenuHidden(false);
214196
if (!RUNNING.has(gContextMenu.frameOuterWindowID)) {
215197
menuCurrent.stopMenu.hidden = true;
216198
}

0 commit comments

Comments
 (0)