-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e0aacea
Showing
351 changed files
with
26,827 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
### 1.0.0 | ||
- initial release | ||
- add full Pale Moon compatibility |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# MozArchiver | ||
Extension to allow the creation and viewing of MAFF and MHT archive files within Pale Moon. Fork of the extension [Mozilla Archive Format](https://addons.mozilla.org/en-US/firefox/addon/mozilla-archive-format/) by Christopher Ottley and Paolo Amadini for Pale Moon. | ||
|
||
## Building | ||
Simply download the contents of the "src" folder and pack the contents into a .zip file. Then, rename the file to .xpi and drag into the browser. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
content mza chrome/content/ | ||
|
||
locale mza en-US chrome/locale/en-US/ | ||
|
||
locale mza cs chrome/locale/cs/ | ||
locale mza da chrome/locale/da/ | ||
locale mza de chrome/locale/de/ | ||
locale mza es-ES chrome/locale/es-ES/ | ||
locale mza fr chrome/locale/fr/ | ||
locale mza hu chrome/locale/hu/ | ||
locale mza hy-AM chrome/locale/hy-AM/ | ||
locale mza it chrome/locale/it/ | ||
locale mza ja-JP chrome/locale/ja-JP/ | ||
locale mza ko-KR chrome/locale/ko-KR/ | ||
locale mza mk-MK chrome/locale/mk-MK/ | ||
locale mza pl chrome/locale/pl/ | ||
locale mza pt-BR chrome/locale/pt-BR/ | ||
locale mza ro chrome/locale/ro/ | ||
locale mza ru chrome/locale/ru/ | ||
locale mza sv-SE chrome/locale/sv-SE/ | ||
locale mza tr chrome/locale/tr/ | ||
locale mza zh-CN chrome/locale/zh-CN/ | ||
locale mza zh-TW chrome/locale/zh-TW/ | ||
|
||
skin mza classic/1.0 chrome/skin/ | ||
skin mza-icons classic/1.0 ./ | ||
|
||
component {3b2f1177-d918-44ee-91a6-ba95954064bb} components/DocumentLoaderFactory.js | ||
contract @mozarchiver/document-loader-factory;1 {3b2f1177-d918-44ee-91a6-ba95954064bb} | ||
|
||
component {37116274-8df3-4d48-8533-00eae60c844c} components/Startup.js | ||
contract @mozarchiver/startup;1 {37116274-8df3-4d48-8533-00eae60c844c} | ||
category profile-after-change MozArchiver @mozarchiver/startup;1 | ||
|
||
component {7380f280-ab36-4a23-b213-35c64f8586a0} components/ContentPolicy.js | ||
contract @mozarchiver/content-policy;1 {7380f280-ab36-4a23-b213-35c64f8586a0} | ||
category content-policy MozArchiver @mozarchiver/content-policy;1 | ||
|
||
# Integration with the browsing windows | ||
overlay chrome://browser/content/browser.xul chrome://mza/content/integration/mafBaseBrowserOverlay.xul | ||
|
||
# Integration with the "Multiple Tab Handler" extension | ||
overlay chrome://multipletab/content/multipletab.xul chrome://mza/content/integration/mafMultipleTabOverlay.xul | ||
|
||
# The Archives dialog | ||
overlay chrome://mza/content/archives/archivesDialog.xul chrome://mza/content/archives/archivesDialogBrowserOverlay.xul application={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} | ||
|
||
# The preferences dialog | ||
overlay chrome://mza/content/preferences/prefsDialog.xul chrome://mza/content/preferences/prefsDialogBrowserOverlay.xul application={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} | ||
|
||
# Use the preferences image file from the current theme | ||
override chrome://mza/skin/preferences/Options.png chrome://browser/skin/preferences/Options.png application={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} | ||
|
||
# Once loaded, use the 48x48 pixels application icon instead of the 32x32 pixels one | ||
override chrome://mza-icons/skin/icon.png chrome://mza-icons/skin/icon48.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/** | ||
* Exports all the common JavaScript objects for Mozilla Archive Format. | ||
*/ | ||
|
||
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; | ||
|
||
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | ||
Cu.import("resource://gre/modules/Services.jsm"); | ||
|
||
let objectsByFolder = { | ||
general: [ | ||
"AsyncEnumerator", | ||
"DataSourceWrapper", | ||
"Interface", | ||
"PersistBundle", | ||
"PersistFolder", | ||
"PersistResource", | ||
"SourceFragment", | ||
"CssSourceFragment", | ||
"HtmlSourceFragment", | ||
"TagSourceFragment", | ||
"UrlListSourceFragment", | ||
"UrlSourceFragment", | ||
], | ||
archives: [ | ||
"ArchiveAnnotations", | ||
"ArchiveHistoryObserver", | ||
], | ||
convert: [ | ||
"Candidate", | ||
"CandidateFinder", | ||
"CandidateLocation", | ||
"CandidatesDataSource", | ||
], | ||
engine: [ | ||
"Archive", | ||
"ArchiveCache", | ||
"ArchivePage", | ||
"MaffArchive", | ||
"MaffArchivePage", | ||
"MaffDataSource", | ||
"MhtmlArchive", | ||
"MhtmlArchivePage", | ||
"MimePart", | ||
"MimeSupport", | ||
"MultipartMimePart", | ||
"ZipCreator", | ||
"ZipDirectory", | ||
], | ||
integration: [ | ||
"FileFilters", | ||
"TabsDataSource", | ||
], | ||
loading: [ | ||
"ArchiveLoader", | ||
"ArchiveStreamConverter", | ||
], | ||
preferences: [ | ||
"DynamicPrefs", | ||
"FileAssociations", | ||
"Prefs", | ||
], | ||
savecomplete: [ | ||
"MafSaveComplete", | ||
"SaveCompletePersist", | ||
], | ||
saving: [ | ||
"Job", | ||
"JobRunner", | ||
"ExactPersistInitialJob", | ||
"ExactPersistJob", | ||
"ExactPersist", | ||
"ExactPersistParsedJob", | ||
"ExactPersistReference", | ||
"ExactPersistUnparsedJob", | ||
"MafArchivePersist", | ||
"MafWebProgressListener", | ||
"SaveArchiveJob", | ||
"SaveContentJob", | ||
"SaveJob", | ||
], | ||
startup: [ | ||
"HelperAppsWrapper", | ||
"StartupEvents", | ||
"StartupInitializer", | ||
], | ||
}; | ||
|
||
let EXPORTED_SYMBOLS = []; | ||
for (let folderName of Object.keys(objectsByFolder)) { | ||
for (let objectName of objectsByFolder[folderName]) { | ||
EXPORTED_SYMBOLS.push(objectName); | ||
Services.scriptloader.loadSubScript("chrome://mza/content/" + folderName + | ||
"/" + objectName + ".js"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- | ||
* ***** BEGIN LICENSE BLOCK ***** | ||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
* | ||
* The contents of this file are subject to the Mozilla Public License Version | ||
* 1.1 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* http://www.mozilla.org/MPL/ | ||
* | ||
* Software distributed under the License is distributed on an "AS IS" basis, | ||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
* for the specific language governing rights and limitations under the | ||
* License. | ||
* | ||
* The Original Code is Mozilla Archive Format. | ||
* | ||
* The Initial Developer of the Original Code is | ||
* Paolo Amadini <http://www.amadzone.org/>. | ||
* Portions created by the Initial Developer are Copyright (C) 2009 | ||
* the Initial Developer. All Rights Reserved. | ||
* | ||
* Contributor(s): | ||
* | ||
* Alternatively, the contents of this file may be used under the terms of | ||
* either the GNU General Public License Version 2 or later (the "GPL"), or | ||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||
* in which case the provisions of the GPL or the LGPL are applicable instead | ||
* of those above. If you wish to allow use of your version of this file only | ||
* under the terms of either the GPL or the LGPL, and not to allow others to | ||
* use your version of this file under the terms of the MPL, indicate your | ||
* decision by deleting the provisions above and replace them with the notice | ||
* and other provisions required by the GPL or the LGPL. If you do not delete | ||
* the provisions above, a recipient may use your version of this file under | ||
* the terms of any one of the MPL, the GPL or the LGPL. | ||
* | ||
* ***** END LICENSE BLOCK ***** */ | ||
|
||
/** | ||
* This object handles annotations on archive pages for this session. | ||
* | ||
* Annotations are used to query and display information about the known | ||
* archives using the Places interfaces. At present, the actual annotations are | ||
* only used to sort the results properly in the Places view of the Archives | ||
* dialog. For more information, see | ||
* <https://developer.mozilla.org/en/Using_the_Places_annotation_service> | ||
* (retrieved 2009-05-23). | ||
*/ | ||
var ArchiveAnnotations = { | ||
|
||
/** MAF annotation names */ | ||
MAFANNO_TITLE: "maf/title", | ||
MAFANNO_ORIGINALURL: "maf/originalurl", | ||
MAFANNO_DATEARCHIVED: "maf/datearchived", | ||
MAFANNO_ARCHIVENAME: "maf/archivename", | ||
MAFANNO_TEMPURI: "maf/tempuri", | ||
MAFANNO_DIRECTARCHIVEURI: "maf/directarchiveuri", | ||
|
||
/** | ||
* Sets all the annotations associated with the given ArchivePage object. | ||
*/ | ||
setAnnotationsForPage: function(aPage) { | ||
try { | ||
// For all the possible annotations | ||
[ | ||
[ArchiveAnnotations.MAFANNO_TITLE, aPage.title], | ||
[ArchiveAnnotations.MAFANNO_ORIGINALURL, aPage.originalUrl], | ||
[ArchiveAnnotations.MAFANNO_DATEARCHIVED, aPage.dateArchived], | ||
[ArchiveAnnotations.MAFANNO_ARCHIVENAME, aPage.archive.name], | ||
[ArchiveAnnotations.MAFANNO_TEMPURI, | ||
(aPage.tempUri ? aPage.tempUri.spec : "")], | ||
[ArchiveAnnotations.MAFANNO_DIRECTARCHIVEURI, | ||
(aPage.directArchiveUri ? aPage.directArchiveUri.spec : "")], | ||
].forEach(function([annotationName, annotationValue]) { | ||
// Set the annotation while handling the data types correctly. | ||
ArchiveAnnotations._setAnnotationForPage(aPage, annotationName, | ||
annotationValue); | ||
}); | ||
} catch (e if (e instanceof Ci.nsIException && (e.result == | ||
Cr.NS_ERROR_INVALID_ARG))) { | ||
// This error is raised if the page is not present in history when the | ||
// functions that set annotations are called. In this case, we set a flag | ||
// on the page object indicating that the history observer should add the | ||
// annotations after the page visit information is added. | ||
aPage.annotationsPending = true; | ||
} | ||
}, | ||
|
||
/** | ||
* Removes all the annotations associated with the given ArchivePage object. | ||
*/ | ||
removeAnnotationsForPage: function(aPage) { | ||
// For all the possible annotations | ||
[ | ||
ArchiveAnnotations.MAFANNO_TITLE, | ||
ArchiveAnnotations.MAFANNO_ORIGINALURL, | ||
ArchiveAnnotations.MAFANNO_DATEARCHIVED, | ||
ArchiveAnnotations.MAFANNO_ARCHIVENAME, | ||
ArchiveAnnotations.MAFANNO_TEMPURI, | ||
ArchiveAnnotations.MAFANNO_DIRECTARCHIVEURI, | ||
].forEach(function(annotationName) { | ||
try { | ||
// Clear the annotation if present on the page's specific archive URI. | ||
ArchiveAnnotations._annotationService.removePageAnnotation( | ||
aPage.archiveUri, annotationName); | ||
} catch (e if (e instanceof Ci.nsIException && (e.result == | ||
Cr.NS_ERROR_INVALID_ARG))) { | ||
// Ignore errors due to the fact that the page is not in history. | ||
} | ||
}); | ||
}, | ||
|
||
/** | ||
* Returns the value of an annotation for the given ArchivePage object. | ||
* | ||
* This function returns a Date object for annotations that represent dates. | ||
* | ||
* In order to avoid problems due to the asynchronous adding of history | ||
* entries, the annotation values are not actually read using the Places | ||
* services, but extracted from the provided object. | ||
*/ | ||
getAnnotationForPage: function(aPage, aAnnotationName) { | ||
var annotationValue; | ||
switch (aAnnotationName) { | ||
case ArchiveAnnotations.MAFANNO_TITLE: | ||
annotationValue = aPage.title; | ||
break; | ||
case ArchiveAnnotations.MAFANNO_ORIGINALURL: | ||
annotationValue = aPage.originalUrl; | ||
break; | ||
case ArchiveAnnotations.MAFANNO_DATEARCHIVED: | ||
annotationValue = aPage.dateArchived; | ||
break; | ||
case ArchiveAnnotations.MAFANNO_ARCHIVENAME: | ||
annotationValue = aPage.archive.name; | ||
break; | ||
case ArchiveAnnotations.MAFANNO_TEMPURI: | ||
annotationValue = (aPage.tempUri ? aPage.tempUri.spec : ""); | ||
break; | ||
case ArchiveAnnotations.MAFANNO_DIRECTARCHIVEURI: | ||
annotationValue = (aPage.directArchiveUri ? | ||
aPage.directArchiveUri.spec : ""); | ||
break; | ||
} | ||
// If the value represents an URI, store this information in the value | ||
// itself. This allows for properly displaying the value later. The | ||
// annotation should not be added if the value is empty, otherwise the tests | ||
// to detect this condition will provide incorrect results. | ||
if (annotationValue && ArchiveAnnotations.annotationIsEscapedAsUri( | ||
aAnnotationName)) { | ||
annotationValue = new String(annotationValue); | ||
annotationValue.isEscapedAsUri = true; | ||
} | ||
// Return the string, numeric or date value. | ||
return annotationValue; | ||
}, | ||
|
||
/** | ||
* Returns True if the specified annotation represents a date. | ||
*/ | ||
annotationIsDate: function(aAnnotationName) { | ||
return (aAnnotationName === ArchiveAnnotations.MAFANNO_DATEARCHIVED); | ||
}, | ||
|
||
/** | ||
* Returns True if the specified annotation represents an URI or part of it. | ||
*/ | ||
annotationIsEscapedAsUri: function(aAnnotationName) { | ||
return [ | ||
ArchiveAnnotations.MAFANNO_ORIGINALURL, | ||
ArchiveAnnotations.MAFANNO_ARCHIVENAME, | ||
ArchiveAnnotations.MAFANNO_TEMPURI, | ||
ArchiveAnnotations.MAFANNO_DIRECTARCHIVEURI, | ||
].indexOf(aAnnotationName) >= 0; | ||
}, | ||
|
||
/** | ||
* Sets the value of an annotation for the given ArchivePage object. | ||
* | ||
* This function accepts a Date object for annotations that represent dates. | ||
*/ | ||
_setAnnotationForPage: function(aPage, aAnnotationName, aAnnotationValue) { | ||
var annotationValue = aAnnotationValue; | ||
// If this annotation represents a date, convert the Date object to a | ||
// comparable numeric value. If the date is unspecified, store the numeric | ||
// value 0 in the annotation. | ||
if (ArchiveAnnotations.annotationIsDate(aAnnotationName)) { | ||
annotationValue = annotationValue ? annotationValue.getTime() : 0; | ||
// In order for the sorting to work correctly, we must store the | ||
// annotation as a string, and not a numeric value. Dates before 01 | ||
// January, 1970 UTC are not supported at present. | ||
annotationValue = (annotationValue < 0) ? 0 : annotationValue; | ||
annotationValue = ("000000000000000" + annotationValue).slice(-16); | ||
} | ||
// Set the annotation on the page's specific archive URI. The annotations | ||
// will expire when the current session terminates. | ||
ArchiveAnnotations._annotationService.setPageAnnotation( | ||
aPage.archiveUri, aAnnotationName, annotationValue || "", 0, | ||
Ci.nsIAnnotationService.EXPIRE_SESSION); | ||
}, | ||
|
||
/** | ||
* Returns a reference to the annotation service. | ||
*/ | ||
get _annotationService() { | ||
return Cc["@mozilla.org/browser/annotation-service;1"]. | ||
getService(Ci.nsIAnnotationService); | ||
}, | ||
}; |
Oops, something went wrong.