Skip to content

Commit

Permalink
Private protocol: always mark tab as private, even in case of malform…
Browse files Browse the repository at this point in the history
…ed URI

(related to #94)
  • Loading branch information
Infocatcher committed Aug 24, 2013
1 parent 5ee0130 commit 4913a81
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions protocolRedirect.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@
<script>
try {
var spec = location.hash.substr(1);
if(!spec)
throw new Error("No URI");
Components.utils.import("resource://gre/modules/Services.jsm");
var uri = Services.io.newURI(spec, null, null); // We accept only valid URIs

try {
var iconURL = uri.scheme + "://" + uri.hostPort + "/favicon.ico";
var icon = document.createElement("link");
icon.rel = "shortcut icon";
icon.href = iconURL;
document.documentElement.insertBefore(icon, document.documentElement.firstChild);
}
catch(e2) {
}

try {
var dwu = Components.classes["@mozilla.org/inspector/dom-utils;1"]
Expand Down Expand Up @@ -57,7 +43,7 @@
try {
return gBrowser.mStringBundle.getString(id);
}
catch(e) {
catch(e3) {
}
return undefined;
}
Expand All @@ -69,6 +55,22 @@
document.title = spec;
Components.utils.reportError(e2);
}

if(!spec)
throw new Error("No URI");
Components.utils.import("resource://gre/modules/Services.jsm");
var uri = Services.io.newURI(spec, null, null); // We accept only valid URIs

try {
var iconURL = uri.scheme + "://" + uri.hostPort + "/favicon.ico";
var icon = document.createElement("link");
icon.rel = "shortcut icon";
icon.href = iconURL;
document.documentElement.insertBefore(icon, document.documentElement.firstChild);
}
catch(e2) {
}

location.replace(spec);
}
catch(e) {
Expand Down

0 comments on commit 4913a81

Please sign in to comment.