diff --git a/common/content/buffer.js b/common/content/buffer.js index cc7f0b94..e6109f18 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -326,15 +326,7 @@ function Buffer() //{{{ mappings.add(myModes, ["\\"], "Toggle between rendered and source view", - function () - { - const scheme = "view-source"; - - if (util.newURI(buffer.URL).scheme == scheme) - liberator.open(buffer.URL.substr(scheme.length + 1)); - else - liberator.open(scheme + ":" + buffer.URL); - }); + function () { buffer.viewSource(null, false); }); mappings.add(myModes, ["gi"], "Focus last used input field", @@ -1593,7 +1585,14 @@ function Buffer() //{{{ if (useExternalEditor) editor.editFileExternally(url); else - liberator.open("view-source:" + url); + { + const PREFIX = "view-source:"; + if (url.indexOf(PREFIX) == 0) + url = url.substr(PREFIX.length); + else + url = PREFIX + url; + liberator.open(url, { hide: true }); + } }, /** diff --git a/common/content/liberator.js b/common/content/liberator.js index 81af8f96..a667a6e7 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -1527,7 +1527,7 @@ const liberator = (function () //{{{ * ["url1", "url2", "url3", ...] * or: * [["url1", postdata1], ["url2", postdata2], ...] - * @param {number} where If ommited, CURRENT_TAB is assumed but NEW_TAB + * @param {number|Object} where If ommited, CURRENT_TAB is assumed but NEW_TAB * is set when liberator.forceNewTab is true. * @param {boolean} force Don't prompt whether to open more than 20 * tabs. @@ -1563,6 +1563,15 @@ const liberator = (function () //{{{ return true; } + let flags = 0; + if (where instanceof Object) + { + for (let [opt, flag] in Iterator({ replace: "REPLACE_HISTORY", hide: "BYPASS_HISTORY" })) + if (where[opt]) + flags |= Ci.nsIWebNavigation["LOAD_FLAGS_" + flag]; + where = liberator.CURRENT_TAB; + } + if (urls.length == 0) return false; @@ -1577,7 +1586,7 @@ const liberator = (function () //{{{ switch (where) { case liberator.CURRENT_TAB: - browser.loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, postdata); + browser.loadURIWithFlags(url, flags, null, null, postdata); break; case liberator.NEW_BACKGROUND_TAB: