mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-30 11:07:29 +09:00
Bug 1189073 - Handle entering 'localhost:12345' into the cookie exceptions dialog correctly
This commit is contained in:
parent
994a317fec
commit
f4d42d9e7a
1 changed files with 13 additions and 2 deletions
|
|
@ -86,14 +86,25 @@ var gPermissionManager = {
|
||||||
var input_url = textbox.value.replace(/^\s*/, ""); // trim any leading space
|
var input_url = textbox.value.replace(/^\s*/, ""); // trim any leading space
|
||||||
let principal;
|
let principal;
|
||||||
try {
|
try {
|
||||||
// If the uri doesn't successfully parse, try adding a http:// and parsing again
|
// The origin accessor on the principal object will throw if the
|
||||||
|
// principal doesn't have a canonical origin representation. This will
|
||||||
|
// help catch cases where the URI parser parsed something like
|
||||||
|
// `localhost:8080` as having the scheme `localhost`, rather than being
|
||||||
|
// an invalid URI. A canonical origin representation is required by the
|
||||||
|
// permission manager for storage, so this won't prevent any valid
|
||||||
|
// permissions from being entered by the user.
|
||||||
let uri;
|
let uri;
|
||||||
try {
|
try {
|
||||||
uri = Services.io.newURI(input_url, null, null);
|
uri = Services.io.newURI(input_url, null, null);
|
||||||
|
principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||||
|
// If we have ended up with an unknown scheme, the following will throw.
|
||||||
|
principal.origin;
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
uri = Services.io.newURI("http://" + input_url, null, null);
|
uri = Services.io.newURI("http://" + input_url, null, null);
|
||||||
|
principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||||
|
// If we have ended up with an unknown scheme, the following will throw.
|
||||||
|
principal.origin;
|
||||||
}
|
}
|
||||||
principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
var message = this._bundle.getString("invalidURI");
|
var message = this._bundle.getString("invalidURI");
|
||||||
var title = this._bundle.getString("invalidURITitle");
|
var title = this._bundle.getString("invalidURITitle");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue