diff --git a/content/buffer.js b/content/buffer.js
index b75b1357..bd63ebdc 100644
--- a/content/buffer.js
+++ b/content/buffer.js
@@ -231,7 +231,7 @@ liberator.Buffer = function () //{{{
{
consoleService.registerListener(listener);
if (testDoc.documentElement.firstChild)
- testDoc.documentElement.removeChild(testDoc.documentElement.firstChild);
+ testDoc.documentElement.removeChild(testDoc.lastChild);
testDoc.documentElement.appendChild(util.xmlToDom(
, testDoc));
@@ -473,7 +473,7 @@ liberator.Buffer = function () //{{{
{
if (liberator.mappings.repeat)
{
- for (let i in liberator.util.range(0, count || 1))
+ for (let i in liberator.util.rangeInterruptable(0, count || 1, 100))
liberator.mappings.repeat();
}
},
@@ -797,20 +797,29 @@ liberator.Buffer = function () //{{{
"Save current document to disk",
function (args, special)
{
- //var file = liberator.io.getFile(args || "");
- // we always want to save that link relative to the current working directory
+ let doc = window.content.document;
+ let file = liberator.io.getFile(args || "");
+ if (args && file.exists() && !special)
+ return liberator.echoerr("E13: File exists (add ! to override)");
+
liberator.options.setPref("browser.download.lastDir", liberator.io.getCurrentDirectory());
- //if (args)
- //{
- // saveURL(liberator.buffer.URL, args, null, true, special, // special == skipPrompt
- // makeURI(liberator.buffer.URL, content.document.characterSet));
- //}
- //else
- saveDocument(window.content.document, special);
+ try
+ {
+ var contentDisposition = window.content
+ .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindowUtils)
+ .getDocumentMetadata("content-disposition");
+ } catch (e) {}
+
+ internalSave(doc.location.href, doc, null, contentDisposition,
+ doc.contentType, false, null,
+ args && { file: file, uri: makeURI(doc.location.href, doc.characterSet) },
+ doc.referrer ? makeURI(doc.referrer) : null,
+ true);
},
{
- argCount: "0",
- bang: true
+ bang: true,
+ completer: function (filter) liberator.completion.file(filter)
});
liberator.commands.add(["st[op]"],
diff --git a/content/events.js b/content/events.js
index e4bf9846..121f3547 100644
--- a/content/events.js
+++ b/content/events.js
@@ -535,6 +535,27 @@ liberator.Events = function () //{{{
}
}
+ function wrapListener(method)
+ {
+ return function (event)
+ {
+ try
+ {
+ liberator.dump(event);
+ eventManager[method](event);
+ }
+ catch (e)
+ {
+ if (e.message == "Interrupted")
+ liberator.echoerr("Interrupted");
+ else
+ liberator.echoerr("Processing " + event.type + " event: " + (e.echoerr || e));
+ if (Components.utils.reportError)
+ Components.utils.reportError(e);
+ }
+ }
+ }
+
// return true when load successful, or false otherwise
function waitForPageLoaded()
{
@@ -1195,6 +1216,13 @@ liberator.Events = function () //{{{
}
}
+ if (key == "")
+ liberator.interrupted = true;
+
+ // feedingKeys needs to be separate from interrupted so
+ // we can differentiate between a recorded
+ // interrupting whatever it's started and a real
+ // interrupting our playback.
if (liberator.events.feedingKeys)
{
if (key == "" && !event.isMacro)
@@ -1207,9 +1235,6 @@ liberator.Events = function () //{{{
}
}
- if (key == "")
- liberator.interrupted = true;
-
var stop = true; // set to false if we should NOT consume this event but let Firefox handle it
var win = document.commandDispatcher.focusedWindow;
@@ -1611,9 +1636,9 @@ liberator.Events = function () //{{{
eventManager.prefObserver.unregister();
});
- window.addEventListener("keypress", eventManager.onKeyPress, true);
- window.addEventListener("keydown", eventManager.onKeyUpOrDown, true);
- window.addEventListener("keyup", eventManager.onKeyUpOrDown, true);
+ window.addEventListener("keypress", wrapListener("onKeyPress"), true);
+ window.addEventListener("keydown", wrapListener("onKeyUpOrDown"), true);
+ window.addEventListener("keyup", wrapListener("onKeyUpOrDown"), true);
return eventManager;
diff --git a/content/ui.js b/content/ui.js
index b6c6cbaa..bb51b3bb 100644
--- a/content/ui.js
+++ b/content/ui.js
@@ -286,7 +286,7 @@ liberator.CommandLine = function () //{{{
}
catch (e)
{
- liberator.echoerr(e.toString());
+ liberator.echoerr(e);
return null;
}
diff --git a/locale/en-US/browsing.txt b/locale/en-US/browsing.txt
index 09b85a3f..d834168b 100644
--- a/locale/en-US/browsing.txt
+++ b/locale/en-US/browsing.txt
@@ -269,12 +269,11 @@ ________________________________________________________________________________
section:Writing[writing,save-file]
|:w| |:write| |:sav| |:saveas| +
-||:sav[eas]||
+||:sav[eas][!] [file]||
________________________________________________________________________________
-Save current web page to disk. Opens the original Firefox "Save page as..."
-dialog. There, you can save the current web page to disk with various
-options. Use [!] to save the file with a default filename to the current working
-directory, skipping the "Save as..." prompt
+Save current web page to disk. If [file] is omitted, save to the page's
+default filename. Existing documents will only be overwritten if [!] is
+given.
________________________________________________________________________________
section:Quitting[quitting,save-session]
diff --git a/skin/liberator.css b/skin/liberator.css
index b8b3d6a4..55d83014 100644
--- a/skin/liberator.css
+++ b/skin/liberator.css
@@ -85,7 +85,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
vertical-align: middle;
padding: 0 .5ex;
}
-.compitem-td-span { height: 1.5em; display: block; min-height: 16px; }
+.compitem-td-span { height: 1.5em; line-height: 1.5em !important; display: block; min-height: 16px; }
.compitem[selected=true] { background-color: yellow; }
.compitem > .favicon { width: 16px; }