mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 09:18:42 +09:00
[Pale-Moon] Issue MoonchildProductions/UXP#516 - Remove named function syntax from palemoon/components/sessionstore.
This commit is contained in:
parent
9e97918159
commit
8018d9393e
6 changed files with 173 additions and 173 deletions
|
|
@ -25,7 +25,7 @@ this.DocumentUtils = {
|
|||
* @return object
|
||||
* Form data encoded in an object.
|
||||
*/
|
||||
getFormData: function DocumentUtils_getFormData(aDocument) {
|
||||
getFormData: function (aDocument) {
|
||||
let formNodes = aDocument.evaluate(
|
||||
XPathGenerator.restorableFormNodes,
|
||||
aDocument,
|
||||
|
|
@ -117,7 +117,7 @@ this.DocumentUtils = {
|
|||
* @param aData
|
||||
* Object defining form data.
|
||||
*/
|
||||
mergeFormData: function DocumentUtils_mergeFormData(aDocument, aData) {
|
||||
mergeFormData: function (aDocument, aData) {
|
||||
if ("xpath" in aData) {
|
||||
for each (let [xpath, value] in Iterator(aData.xpath)) {
|
||||
let node = XPathGenerator.resolve(aDocument, xpath);
|
||||
|
|
@ -155,7 +155,7 @@ this.DocumentUtils = {
|
|||
* DOMDocument node belongs to. If not defined, node.ownerDocument
|
||||
* is used.
|
||||
*/
|
||||
restoreFormValue: function DocumentUtils_restoreFormValue(aNode, aValue, aDocument) {
|
||||
restoreFormValue: function (aNode, aValue, aDocument) {
|
||||
aDocument = aDocument || aNode.ownerDocument;
|
||||
|
||||
let eventType;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ this.SessionStorage = {
|
|||
* @param aFullData
|
||||
* always return privacy sensitive data (use with care)
|
||||
*/
|
||||
serialize: function ssto_serialize(aDocShell, aFullData) {
|
||||
serialize: function (aDocShell, aFullData) {
|
||||
return DomStorage.read(aDocShell, aFullData);
|
||||
},
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ this.SessionStorage = {
|
|||
* @param aStorageData
|
||||
* Storage data to be restored
|
||||
*/
|
||||
deserialize: function ssto_deserialize(aDocShell, aStorageData) {
|
||||
deserialize: function (aDocShell, aStorageData) {
|
||||
DomStorage.write(aDocShell, aStorageData);
|
||||
}
|
||||
};
|
||||
|
|
@ -46,7 +46,7 @@ var DomStorage = {
|
|||
* @param aFullData
|
||||
* Always return privacy sensitive data (use with care)
|
||||
*/
|
||||
read: function DomStorage_read(aDocShell, aFullData) {
|
||||
read: function (aDocShell, aFullData) {
|
||||
let data = {};
|
||||
let isPinned = aDocShell.isAppTab;
|
||||
let shistory = aDocShell.sessionHistory;
|
||||
|
|
@ -81,7 +81,7 @@ var DomStorage = {
|
|||
* @param aStorageData
|
||||
* Storage data to be restored
|
||||
*/
|
||||
write: function DomStorage_write(aDocShell, aStorageData) {
|
||||
write: function (aDocShell, aStorageData) {
|
||||
for (let [host, data] in Iterator(aStorageData)) {
|
||||
let uri = Services.io.newURI(host, null, null);
|
||||
let principal = Services.scriptSecurityManager.getDocShellCodebasePrincipal(uri, aDocShell);
|
||||
|
|
@ -116,7 +116,7 @@ var DomStorage = {
|
|||
* @param aDocShell
|
||||
* A tab's docshell (containing the sessionStorage)
|
||||
*/
|
||||
_readEntry: function DomStorage_readEntry(aPrincipal, aDocShell) {
|
||||
_readEntry: function (aPrincipal, aDocShell) {
|
||||
let hostData = {};
|
||||
let storage;
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ var History = {
|
|||
* @param aDocShell
|
||||
* That tab's docshell
|
||||
*/
|
||||
getPrincipalForEntry: function History_getPrincipalForEntry(aHistory,
|
||||
getPrincipalForEntry: function (aHistory,
|
||||
aIndex,
|
||||
aDocShell) {
|
||||
try {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -12,7 +12,7 @@ this.XPathGenerator = {
|
|||
/**
|
||||
* Generates an approximate XPath query to an (X)HTML node
|
||||
*/
|
||||
generate: function sss_xph_generate(aNode) {
|
||||
generate: function (aNode) {
|
||||
// have we reached the document node already?
|
||||
if (!aNode.parentNode)
|
||||
return "";
|
||||
|
|
@ -46,7 +46,7 @@ this.XPathGenerator = {
|
|||
/**
|
||||
* Resolves an XPath query generated by XPathGenerator.generate
|
||||
*/
|
||||
resolve: function sss_xph_resolve(aDocument, aQuery) {
|
||||
resolve: function (aDocument, aQuery) {
|
||||
let xptype = Components.interfaces.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
|
||||
return aDocument.evaluate(aQuery, aDocument, this.resolveNS, xptype, null).singleNodeValue;
|
||||
},
|
||||
|
|
@ -54,14 +54,14 @@ this.XPathGenerator = {
|
|||
/**
|
||||
* Namespace resolver for the above XPath resolver
|
||||
*/
|
||||
resolveNS: function sss_xph_resolveNS(aPrefix) {
|
||||
resolveNS: function (aPrefix) {
|
||||
return XPathGenerator.namespaceURIs[aPrefix] || null;
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns valid XPath for the given node (usually just the local name itself)
|
||||
*/
|
||||
escapeName: function sss_xph_escapeName(aName) {
|
||||
escapeName: function (aName) {
|
||||
// we can't just use the node's local name, if it contains
|
||||
// special characters (cf. bug 485482)
|
||||
return /^\w+$/.test(aName) ? aName :
|
||||
|
|
@ -71,7 +71,7 @@ this.XPathGenerator = {
|
|||
/**
|
||||
* @returns a properly quoted string to insert into an XPath query
|
||||
*/
|
||||
quoteArgument: function sss_xph_quoteArgument(aArg) {
|
||||
quoteArgument: function (aArg) {
|
||||
return !/'/.test(aArg) ? "'" + aArg + "'" :
|
||||
!/"/.test(aArg) ? '"' + aArg + '"' :
|
||||
"concat('" + aArg.replace(/'+/g, "',\"$&\",'") + "')";
|
||||
|
|
|
|||
|
|
@ -57,37 +57,37 @@ this._SessionFile = {
|
|||
* A promise fulfilled once initialization (either synchronous or
|
||||
* asynchronous) is complete.
|
||||
*/
|
||||
promiseInitialized: function SessionFile_initialized() {
|
||||
promiseInitialized: function () {
|
||||
return SessionFileInternal.promiseInitialized;
|
||||
},
|
||||
/**
|
||||
* Read the contents of the session file, asynchronously.
|
||||
*/
|
||||
read: function SessionFile_read() {
|
||||
read: function () {
|
||||
return SessionFileInternal.read();
|
||||
},
|
||||
/**
|
||||
* Read the contents of the session file, synchronously.
|
||||
*/
|
||||
syncRead: function SessionFile_syncRead() {
|
||||
syncRead: function () {
|
||||
return SessionFileInternal.syncRead();
|
||||
},
|
||||
/**
|
||||
* Write the contents of the session file, asynchronously.
|
||||
*/
|
||||
write: function SessionFile_write(aData) {
|
||||
write: function (aData) {
|
||||
return SessionFileInternal.write(aData);
|
||||
},
|
||||
/**
|
||||
* Create a backup copy, asynchronously.
|
||||
*/
|
||||
createBackupCopy: function SessionFile_createBackupCopy() {
|
||||
createBackupCopy: function () {
|
||||
return SessionFileInternal.createBackupCopy();
|
||||
},
|
||||
/**
|
||||
* Wipe the contents of the session file, asynchronously.
|
||||
*/
|
||||
wipe: function SessionFile_wipe() {
|
||||
wipe: function () {
|
||||
return SessionFileInternal.wipe();
|
||||
}
|
||||
};
|
||||
|
|
@ -105,7 +105,7 @@ const TaskUtils = {
|
|||
* @return {Promise} A promise behaving as |promise|, but with additional
|
||||
* logging in case of uncaught error.
|
||||
*/
|
||||
captureErrors: function captureErrors(promise) {
|
||||
captureErrors: function (promise) {
|
||||
return promise.then(
|
||||
null,
|
||||
function onError(reason) {
|
||||
|
|
@ -152,7 +152,7 @@ var SessionFileInternal = {
|
|||
* A path to read the file from.
|
||||
* @returns string if successful, undefined otherwise.
|
||||
*/
|
||||
readAuxSync: function ssfi_readAuxSync(aPath) {
|
||||
readAuxSync: function (aPath) {
|
||||
let text;
|
||||
try {
|
||||
let file = new FileUtils.File(aPath);
|
||||
|
|
@ -184,7 +184,7 @@ var SessionFileInternal = {
|
|||
* happened between backup and write), attempt to read the sessionstore.bak
|
||||
* instead.
|
||||
*/
|
||||
syncRead: function ssfi_syncRead() {
|
||||
syncRead: function () {
|
||||
// First read the sessionstore.js.
|
||||
let text = this.readAuxSync(this.path);
|
||||
if (typeof text === "undefined") {
|
||||
|
|
@ -204,7 +204,7 @@ var SessionFileInternal = {
|
|||
* incrementally updated by the worker process.
|
||||
* @returns string if successful, undefined otherwise.
|
||||
*/
|
||||
readAux: function ssfi_readAux(aPath, aReadOptions) {
|
||||
readAux: function (aPath, aReadOptions) {
|
||||
let self = this;
|
||||
return TaskUtils.spawn(function () {
|
||||
let text;
|
||||
|
|
@ -228,7 +228,7 @@ var SessionFileInternal = {
|
|||
* happened between backup and write), attempt to read the sessionstore.bak
|
||||
* instead.
|
||||
*/
|
||||
read: function ssfi_read() {
|
||||
read: function () {
|
||||
let self = this;
|
||||
return TaskUtils.spawn(function task() {
|
||||
// Specify |outExecutionDuration| option to hold the combined duration of
|
||||
|
|
@ -253,7 +253,7 @@ var SessionFileInternal = {
|
|||
});
|
||||
},
|
||||
|
||||
write: function ssfi_write(aData) {
|
||||
write: function (aData) {
|
||||
let refObj = {};
|
||||
let self = this;
|
||||
return TaskUtils.spawn(function task() {
|
||||
|
|
@ -268,7 +268,7 @@ var SessionFileInternal = {
|
|||
});
|
||||
},
|
||||
|
||||
createBackupCopy: function ssfi_createBackupCopy() {
|
||||
createBackupCopy: function () {
|
||||
let backupCopyOptions = {
|
||||
outExecutionDuration: null
|
||||
};
|
||||
|
|
@ -285,7 +285,7 @@ var SessionFileInternal = {
|
|||
});
|
||||
},
|
||||
|
||||
wipe: function ssfi_wipe() {
|
||||
wipe: function () {
|
||||
let self = this;
|
||||
return TaskUtils.spawn(function task() {
|
||||
try {
|
||||
|
|
@ -308,7 +308,7 @@ var SessionFileInternal = {
|
|||
});
|
||||
},
|
||||
|
||||
_isNoSuchFile: function ssfi_isNoSuchFile(aReason) {
|
||||
_isNoSuchFile: function (aReason) {
|
||||
return aReason instanceof OS.File.Error && aReason.becauseNoSuchFile;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ SessionStartup.prototype = {
|
|||
/**
|
||||
* Initialize the component
|
||||
*/
|
||||
init: function sss_init() {
|
||||
init: function () {
|
||||
// do not need to initialize anything in auto-started private browsing sessions
|
||||
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
|
||||
this._initialized = true;
|
||||
|
|
@ -88,14 +88,14 @@ SessionStartup.prototype = {
|
|||
},
|
||||
|
||||
// Wrap a string as a nsISupports
|
||||
_createSupportsString: function ssfi_createSupportsString(aData) {
|
||||
_createSupportsString: function (aData) {
|
||||
let string = Cc["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Ci.nsISupportsString);
|
||||
string.data = aData;
|
||||
return string;
|
||||
},
|
||||
|
||||
_onSessionFileRead: function sss_onSessionFileRead(aStateString) {
|
||||
_onSessionFileRead: function (aStateString) {
|
||||
if (this._initialized) {
|
||||
// Initialization is complete, nothing else to do
|
||||
return;
|
||||
|
|
@ -174,7 +174,7 @@ SessionStartup.prototype = {
|
|||
/**
|
||||
* Handle notifications
|
||||
*/
|
||||
observe: function sss_observe(aSubject, aTopic, aData) {
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case "app-startup":
|
||||
Services.obs.addObserver(this, "final-ui-startup", true);
|
||||
|
|
@ -225,7 +225,7 @@ SessionStartup.prototype = {
|
|||
* session file synchronously.
|
||||
* @returns bool
|
||||
*/
|
||||
doRestore: function sss_doRestore() {
|
||||
doRestore: function () {
|
||||
this._ensureInitialized();
|
||||
return this._willRestore();
|
||||
},
|
||||
|
|
@ -272,7 +272,7 @@ SessionStartup.prototype = {
|
|||
// Ensure that initialization is complete.
|
||||
// If initialization is not complete yet, fall back to a synchronous
|
||||
// initialization and kill ongoing asynchronous initialization
|
||||
_ensureInitialized: function sss__ensureInitialized() {
|
||||
_ensureInitialized: function () {
|
||||
try {
|
||||
if (this._initialized) {
|
||||
// Initialization is complete, nothing else to do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue