Skip to content

Commit

Permalink
2.0
Browse files Browse the repository at this point in the history
RELEASE
* I did some touch ups to the code (and deleted some unused files)
  • Loading branch information
Noitidart committed Jun 4, 2016
1 parent ffb0252 commit ee99f87
Show file tree
Hide file tree
Showing 15 changed files with 160 additions and 23,847 deletions.
74 changes: 37 additions & 37 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var core = {
// storage: OS.Path.join(OS.Constants.Path.profileDir, 'jetpack', core.addon.id, 'simple-storage')
},
pref_branch: 'extensions.Chrome-Store-Foxified@jetpack.',
cache_key: Math.random() // set to version on release
cache_key: 'v2.0' // set to version on release
},
os: {
// // name: added by worker
Expand Down Expand Up @@ -83,10 +83,10 @@ var gInstallListener = {
// succesfully installed
reason = reasons.SUCCESS;
}
console.log('addon install ended', 'name:', aAddon.name, 'id:', aAddon.id, 'reason:', reason);

},
onInstallStarted: function(aInstall) {
console.log('addon install started', 'name:', aInstall.name, 'id:', aInstall.addon.id);

}
};

Expand Down Expand Up @@ -142,7 +142,7 @@ function startup(aData, aReason) {
getDownloadsDir().then(
function(os_path_downloads) {
core.addon.path.downloads = os_path_downloads;
console.log('core.addon.path.downloads:', core.addon.path.downloads);

startWorker();
}
);
Expand Down Expand Up @@ -213,7 +213,7 @@ function callInWorker(aArg, aMessageManager, aBrowser, aComm) {
// its dead
cmm.splice(i, 1);
i--;
console.error('browser in position', i, 'is dead! removed!');

} else {
if (cbrowser == aBrowser) {
cbrowser_found = true;
Expand All @@ -226,7 +226,7 @@ function callInWorker(aArg, aMessageManager, aBrowser, aComm) {
}
if (!cbrowser_found) {
mm_for_extid[extid].push(Cu.getWeakReference(aBrowser));
console.log('ok pushed aBrowser');

}
}

Expand Down Expand Up @@ -264,15 +264,15 @@ function dispatchInContent(aArg, aComm) {
// its dead
cmm.splice(i, 1);
i--;
console.error('browser in position', i, 'is dead! removed!');

} else {
console.error('ok sending to browser in position', i, 'messageManager:', cbrowser.messageManager);

gFsComm.transcribeMessage(cbrowser.messageManager, 'callInContent', {
method: 'dispatchInContent',
arg: aArg,
wait: false // i just want to know if return is `undefined` or `NO_WIN_COMM`
}, function(aArg, aComm) {
console.log('in callback of dispatchInContent in bootstrap, aArg:', aArg);

});
}
}
Expand Down Expand Up @@ -360,7 +360,7 @@ function browseFile(aArg, aComm) {

}// else { // cancelled }
if (aOptions.async) {
console.error('async resolving');

mainDeferred_browseFile.resolve(retFP);
} else {
return retFP;
Expand Down Expand Up @@ -405,7 +405,7 @@ function downloadFile(aArg, aComm) {

}

}).then(null, console.error);
});
}

function installAddonAsTemp(aArg, aComm) {
Expand All @@ -420,7 +420,7 @@ function installAddonAsTemp(aArg, aComm) {
var promise_uninstall = uninstallAddonsByPartial(partial_id);
promise_uninstall.then(
function(aVal) {
console.log('Fullfilled - promise_uninstall - ', aVal);

install();
},
genericReject.bind(null, 'promise_uninstall', mainDeferred_installAddonAsTemp)
Expand Down Expand Up @@ -458,7 +458,7 @@ function installAddonAsNormal(aArg, aComm) {
var promise_uninstall = uninstallAddonsByPartial(partial_id);
promise_uninstall.then(
function(aVal) {
console.log('Fullfilled - promise_uninstall - ', aVal);

install();
},
genericReject.bind(null, 'promise_uninstall', mainDeferred_installAddonAsNormal)
Expand Down Expand Up @@ -520,7 +520,7 @@ function validateOptionsObj(aOptions, aOptionsDefaults) {
// ensures no invalid keys are found in aOptions, any key found in aOptions not having a key in aOptionsDefaults causes throw new Error as invalid option
for (var aOptKey in aOptions) {
if (!(aOptKey in aOptionsDefaults)) {
console.error('aOptKey of ' + aOptKey + ' is an invalid key, as it has no default value, aOptionsDefaults:', aOptionsDefaults, 'aOptions:', aOptions);

throw new Error('aOptKey of ' + aOptKey + ' is an invalid key, as it has no default value');
}
}
Expand All @@ -547,7 +547,7 @@ function genericReject(aPromiseName, aPromiseToReject, aReason) {
name: aPromiseName,
aReason: aReason
};
console.error('Rejected - ' + aPromiseName + ' - ', rejObj);

if (aPromiseToReject) {
aPromiseToReject.reject(rejObj);
}
Expand All @@ -557,7 +557,7 @@ function genericCatch(aPromiseName, aPromiseToReject, aCaught) {
name: aPromiseName,
aCaught: aCaught
};
console.error('Caught - ' + aPromiseName + ' - ', rejObj);

if (aPromiseToReject) {
aPromiseToReject.reject(rejObj);
}
Expand Down Expand Up @@ -606,28 +606,28 @@ function crossprocComm(aChannelId) {
receiveMessage: function(e) {
var messageManager = e.target.messageManager;
if (!messageManager) {
console.error('bootstrap crossprocComm - ignoring this received message as no messageManager for the one i am getting message from, e.target:', e.target, 'messageManager:', messageManager);

return;
}
var browser = e.target;
var payload = e.data;
console.log('bootstrap crossprocComm - incoming, payload:', payload, 'messageManager:', messageManager, 'browser:', browser, 'e:', e);
// console.log('this in receiveMessage bootstrap:', this);



if (payload.method) {
if (!(payload.method in scope)) { console.error('method of "' + payload.method + '" not in scope'); throw new Error('method of "' + payload.method + '" not in scope') } // dev line remove on prod

var rez_bs_call = scope[payload.method](payload.arg, messageManager, browser, this); // only on bootstrap side, they get extra 2 args
if (payload.cbid) {
if (rez_bs_call && rez_bs_call.constructor.name == 'Promise') {
rez_bs_call.then(
function(aVal) {
console.log('Fullfilled - rez_bs_call - ', aVal);

this.transcribeMessage(messageManager, payload.cbid, aVal);
}.bind(this),
genericReject.bind(null, 'rez_bs_call', 0)
).catch(genericCatch.bind(null, 'rez_bs_call', 0));
} else {
console.log('bootstrap crossprocComm - calling transcribeMessage for callbck with args:', payload.cbid, rez_bs_call);

this.transcribeMessage(messageManager, payload.cbid, rez_bs_call);
}
}
Expand All @@ -636,16 +636,16 @@ function crossprocComm(aChannelId) {
this.callbackReceptacle[payload.cbid](payload.arg, messageManager, browser, this);
delete this.callbackReceptacle[payload.cbid];
} else {
console.error('bootstrap crossprocComm - invalid combination - method:', payload.method, 'cbid:', payload.cbid, 'payload:', payload);

}
}.bind(this)
};
this.nextcbid = 1; //next callback id
this.transcribeMessage = function(aMessageManager, aMethod, aArg, aCallback) {
// console.log('bootstrap sending message to framescript', aMethod, aArg);

// aMethod is a string - the method to call in framescript
// aCallback is a function - optional - it will be triggered when aMethod is done calling
console.log('bootstrap crossprocComm - in transcribeMessage:', aMessageManager, aMethod, aArg, aCallback)

var cbid = null;
if (typeof(aMethod) == 'number') {
// this is a response to a callack waiting in framescript
Expand All @@ -660,7 +660,7 @@ function crossprocComm(aChannelId) {

// return;
if (!aMessageManager) {
console.error('bootstrap crossprocComm - how on earth, im in transcribeMessage but no aMessageManager? arguments:', aMessageManager, aMethod, aArg, aCallback);

}
aMessageManager.sendAsyncMessage(aChannelId, {
method: aMethod,
Expand Down Expand Up @@ -692,7 +692,7 @@ function contentComm(aContentWindow, aPort1, aPort2, onHandshakeComplete) {

this.listener = function(e) {
var payload = e.data;
console.log('bootstrap contentComm - incoming, payload:', payload); //, 'e:', e);


if (payload.method) {
if (payload.method == 'contentComm_handshake_finalized') {
Expand All @@ -702,20 +702,20 @@ function contentComm(aContentWindow, aPort1, aPort2, onHandshakeComplete) {
}
return;
}
if (!(payload.method in scope)) { console.error('method of "' + payload.method + '" not in scope'); throw new Error('method of "' + payload.method + '" not in scope') } // dev line remove on prod

var rez_bs_call_for_win = scope[payload.method](payload.arg, this);
console.log('rez_bs_call_for_win:', rez_bs_call_for_win);

if (payload.cbid) {
if (rez_bs_call_for_win && rez_bs_call_for_win.constructor.name == 'Promise') {
rez_bs_call_for_win.then(
function(aVal) {
console.log('Fullfilled - rez_bs_call_for_win - ', aVal);

this.postMessage(payload.cbid, aVal);
}.bind(this),
genericReject.bind(null, 'rez_bs_call_for_win', 0)
).catch(genericCatch.bind(null, 'rez_bs_call_for_win', 0));
} else {
console.log('calling postMessage for callback with rez_bs_call_for_win:', rez_bs_call_for_win, 'this:', this);

this.postMessage(payload.cbid, rez_bs_call_for_win);
}
}
Expand Down Expand Up @@ -887,7 +887,7 @@ function workerComm(aWorkerPath, onBeforeInit, onAfterInit, aWebWorker) {
};
this.listener = function(e) {
var payload = e.data;
console.log('bootstrap workerComm - incoming, payload:', payload); //, 'e:', e);


if (payload.method) {
if (payload.method == 'triggerOnAfterInit') {
Expand All @@ -896,20 +896,20 @@ function workerComm(aWorkerPath, onBeforeInit, onAfterInit, aWebWorker) {
}
return;
}
if (!(payload.method in scope)) { console.error('method of "' + payload.method + '" not in scope'); throw new Error('method of "' + payload.method + '" not in scope') } // dev line remove on prod

var rez_bs_call_for_worker = scope[payload.method](payload.arg, this);
console.log('rez_bs_call_for_worker:', rez_bs_call_for_worker);

if (payload.cbid) {
if (rez_bs_call_for_worker && rez_bs_call_for_worker.constructor.name == 'Promise') {
rez_bs_call_for_worker.then(
function(aVal) {
console.log('Fullfilled - rez_bs_call_for_worker - ', aVal);

this.postMessage(payload.cbid, aVal);
}.bind(this),
genericReject.bind(null, 'rez_bs_call_for_worker', 0)
).catch(genericCatch.bind(null, 'rez_bs_call_for_worker', 0));
} else {
console.log('calling postMessage for callback with rez_bs_call_for_worker:', rez_bs_call_for_worker, 'this:', this);

this.postMessage(payload.cbid, rez_bs_call_for_worker);
}
}
Expand All @@ -918,7 +918,7 @@ function workerComm(aWorkerPath, onBeforeInit, onAfterInit, aWebWorker) {
this.callbackReceptacle[payload.cbid](payload.arg, this);
delete this.callbackReceptacle[payload.cbid];
} else {
console.error('bootstrap workerComm - invalid combination');

throw new Error('bootstrap workerComm - invalid combination');
}
}.bind(this);
Expand Down
2 changes: 1 addition & 1 deletion install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>Chrome-Store-Foxified@jetpack</em:id>
<em:version>2.0b</em:version>
<em:version>2.0</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>

Expand Down
49 changes: 0 additions & 49 deletions locale/en-US/bootstrap.properties

This file was deleted.

7 changes: 0 additions & 7 deletions locale/en-US/inlay.properties

This file was deleted.

6 changes: 3 additions & 3 deletions locale/en-US/main.properties
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ singin_xpi_failed_missing_fields=Signing failed, could not find AMO credentials
signing_xpi_failed_xhr=Signing failed, contacting server failed. Status: %S Status Text: %S URL: %S
signing_xpi_failed_max_attempts=Signing failed, max attempts reached while waiting for review to complete. The review may have failed.
signing_xpi_failed_report_url=Open Validation Report in New Tab
signing_xpi_failed_toolong=Signing failed. Upload took too long and request token expired. This addon will have to be manually signed on AMO.

all_done=All process complete. Choose from any of the actions below. *Note* WebExtensions API is not yet complete by Mozilla so all extensions may not work yet.

all_done=All process complete. Choose from any of the actions below.

unsigned_installed_warn=Temporarily installed, will be auto-uninstalled when Firefox closes.
unsigned_installed_warn=Temporarily installed, will be auto-uninstalled when Firefox closes. *Note* WebExtensions API is not yet complete by Mozilla so all extensions will not work.
10 changes: 0 additions & 10 deletions locale/en-US/options_inline.dtd

This file was deleted.

11 changes: 0 additions & 11 deletions options.xul

This file was deleted.

Loading

0 comments on commit ee99f87

Please sign in to comment.