Skip to content

Instantly share code, notes, and snippets.

@fbennett
Created March 29, 2010 03:18
Show Gist options
  • Save fbennett/347326 to your computer and use it in GitHub Desktop.
Save fbennett/347326 to your computer and use it in GitHub Desktop.
diff -u -b -r zoteroORIG/content/zotero/webpagedump/domsaver.js zoteroNEW/content/zotero/webpagedump/domsaver.js
--- zoteroORIG/content/zotero/webpagedump/domsaver.js 2008-09-23 11:11:56.000000000 +0900
+++ zoteroNEW/content/zotero/webpagedump/domsaver.js 2010-03-29 11:27:18.000000000 +0900
@@ -176,8 +176,11 @@
// Added by Dan S. for Zotero, replacing three lines below
this.document = document;
this.setFrameList(document.defaultView);
+ if (document.location) {
this.baseURL = document.location.href;
-
+ } else {
+ this.baseURL = 'http://nolink/index.html';
+ }
// Set the document and frames
//this.document = top.window._content.document;
@@ -1056,7 +1059,11 @@
{
// we have to set a new current url which is the
// base reference url (necessary for frame processing)
+ if (aDocument.location) {
this.currentURL = aDocument.location.href;
+ } else {
+ this.currentURL = 'http:///nolink/index.html';
+ }
// distinguish between HTML Documents and other
// embedded files like flash, video or images...
Only in zoteroNEW/content/zotero/webpagedump: domsaver.js~
diff -u -b -r zoteroORIG/content/zotero/xpcom/attachments.js zoteroNEW/content/zotero/xpcom/attachments.js
--- zoteroORIG/content/zotero/xpcom/attachments.js 2010-02-09 02:56:43.000000000 +0900
+++ zoteroNEW/content/zotero/xpcom/attachments.js 2010-03-29 11:29:36.000000000 +0900
@@ -488,6 +488,7 @@
* Save a snapshot -- uses synchronous WebPageDump or asynchronous saveURI()
*/
function importFromDocument(document, sourceItemID, forceTitle, parentCollectionIDs, callback, libraryID) {
+ var url;
Zotero.debug('Importing attachment from document');
if (sourceItemID && parentCollectionIDs) {
@@ -497,7 +498,11 @@
parentCollectionIDs = undefined;
}
- var url = document.location.href;
+ if (document.location) {
+ url = document.location.href;
+ } else {
+ url = 'http://nolink/index.html';
+ }
var title = forceTitle ? forceTitle : document.title;
var mimeType = document.contentType;
var charsetID = Zotero.CharacterSets.getID(document.characterSet);
@@ -563,6 +568,7 @@
}
if (mimeType == 'text/html') {
+ Zotero.debug('Saving with wpdDOMSaver.saveHTMLDocument()');
var sync = true;
// Load WebPageDump code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment