Bug 1422643 - deal with tabs in the protocol in js paste detection code, r=florian,valentin
MozReview-Commit-ID: Ax5LGkIedkY
This commit is contained in:
@@ -6052,14 +6052,18 @@ function middleMousePaste(event) {
|
||||
function stripUnsafeProtocolOnPaste(pasteData) {
|
||||
// Don't allow pasting javascript URIs since we don't support
|
||||
// LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL for those.
|
||||
let changed = false;
|
||||
let pasteDataNoJS = pasteData.replace(/\r?\n/g, "")
|
||||
.replace(/^(?:\W*javascript:)+/i,
|
||||
() => {
|
||||
changed = true;
|
||||
return "";
|
||||
});
|
||||
return changed ? pasteDataNoJS : pasteData;
|
||||
while (true) {
|
||||
let scheme = "";
|
||||
try {
|
||||
scheme = Services.io.extractScheme(pasteData);
|
||||
} catch (ex) { }
|
||||
if (scheme != "javascript") {
|
||||
break;
|
||||
}
|
||||
|
||||
pasteData = pasteData.substring(pasteData.indexOf(":") + 1);
|
||||
}
|
||||
return pasteData;
|
||||
}
|
||||
|
||||
// handleDroppedLink has the following 2 overloads:
|
||||
|
||||
Reference in New Issue
Block a user