Skip to content

Commit

Permalink
1.8
Browse files Browse the repository at this point in the history
RELEASE
resotring donotsign to default on defualt button click
  • Loading branch information
Noitidart committed Apr 24, 2016
1 parent edfbe42 commit 4a0a718
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 165 deletions.
90 changes: 45 additions & 45 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const core = {
modules: 'chrome://chrome-store-foxified/content/modules/',
workers: 'chrome://chrome-store-foxified/content/modules/workers/',
},
cache_key: Math.random() // set to version on release
cache_key: 'v1.8' // set to version on release
},
os: {
name: OS.Constants.Sys.Name.toLowerCase(),
Expand Down Expand Up @@ -95,7 +95,7 @@ var MainWorkerMainThreadFuncs = {
var installListener = {
onInstallEnded: function(aInstall, aAddon) {
var str = [];
console.log('ok install ended');

//str.push('"' + aAddon.name + '" Install Ended!');
if (aAddon.appDisabled) {
//str.push('appDisabled: ' + aAddon.appDisabled);
Expand Down Expand Up @@ -150,14 +150,14 @@ var MainWorkerMainThreadFuncs = {
}
};

console.log('ok making nsifile');

var xpiNsiFile = new FileUtils.File(aXpiPlatPath);
console.log('ok made');

AddonManager.getInstallForFile(xpiNsiFile, function(aInstall) {
// aInstall is an instance of AddonInstall
console.log('ok adding listeners');

aInstall.addListener(installListener);
console.log('ok kicking off install');

aInstall.install(); //does silent install
// AddonManager.installAddonsFromWebpage('application/x-xpinstall', Services.wm.getMostRecentWindow('navigator:browser').gBrowser.selectedBrowser, null, [aInstall]); //does regular popup install
}, 'application/x-xpinstall');
Expand Down Expand Up @@ -258,7 +258,7 @@ var MainWorkerMainThreadFuncs = {
var promise_tempInstall = AddonManager.installTemporaryAddon(xpi);
promise_tempInstall.then(
function(aVal) {
console.log('Fullfilled - promise_tempInstall - ', aVal, 'arguments:', arguments);


aAttnBarInfoObj.aPriority = 6;
aAttnBarInfoObj.aTxt = gL10N.bootstrap['installed-as-temp'];
Expand All @@ -278,7 +278,7 @@ var MainWorkerMainThreadFuncs = {
name: 'promise_tempInstall',
aReason: aReason
};
console.error('Rejected - promise_tempInstall - ', rejObj);


aAttnBarInfoObj.aPriority = 10;
aAttnBarInfoObj.aTxt = gL10N.bootstrap['install-as-temp-fail'];
Expand All @@ -298,7 +298,7 @@ var MainWorkerMainThreadFuncs = {
name: 'promise_tempInstall',
aCaught: aCaught
};
console.error('Caught - promise_tempInstall - ', rejObj);

Services.prompt.alert(null, 'Error', "devleoper error!!! Error while installing the addon: see browser console!!\n");
// xpi.append('noida.txt');
xpi = null;
Expand Down Expand Up @@ -355,7 +355,7 @@ var AB = { // AB stands for attention bar
if (winAB) {
if (aInstId in winAB.Insts) {
// unmount this
console.error('aInstId:', aInstId, 'notificationbox-' + aInstId + '--' + AB.domIdPrefix);

var cNotificationBox = aDOMWindow.document.getElementById('notificationbox-' + aInstId + '--' + AB.domIdPrefix);
aDOMWindow.ReactDOM.unmountComponentAtNode(cNotificationBox);
cNotificationBox.parentNode.removeChild(cNotificationBox);
Expand Down Expand Up @@ -488,7 +488,7 @@ var AB = { // AB stands for attention bar
aDOMWindow[core.addon.id + '-AB'].Insts[aInstState.aId].state = aDOMWindow.JSON.parse(aDOMWindow.JSON.stringify(aInstState));
var cDeck = aDOMWindow.document.getElementById('content-deck');
var cNotificationBox = aDOMWindow.document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'notificationbox');
console.error('inserting', 'notificationbox-' + aInstState.aId + '--' + AB.domIdPrefix);

cNotificationBox.setAttribute('id', 'notificationbox-' + aInstState.aId + '--' + AB.domIdPrefix);
if (!aInstState.aPos) {
cDeck.parentNode.appendChild(cNotificationBox);
Expand Down Expand Up @@ -553,19 +553,19 @@ var AB = { // AB stands for attention bar
if (!aDOMWindow[core.addon.id + '-AB']) {
return;
}
console.error('doing uninit from window');

// start - original block link77728110
var winAB = aDOMWindow[core.addon.id + '-AB'];
for (var aInstsId in winAB.Insts) {
// unmount this
console.error('aInstsId:', aInstsId, 'notificationbox-' + aInstsId + '--' + AB.domIdPrefix);

var cNotificationBox = aDOMWindow.document.getElementById('notificationbox-' + aInstsId + '--' + AB.domIdPrefix);
aDOMWindow.ReactDOM.unmountComponentAtNode(cNotificationBox);
cNotificationBox.parentNode.removeChild(cNotificationBox);
}
// end - original block link77728110
delete aDOMWindow[core.addon.id + '-AB'];
console.error('done uninit');

},
ensureInitedIntoWindow: function(aDOMWindow) {
// dont run this yoruself, ensureInstancesToWindow runs this. so if you want to run yourself, then run ensureInstancesToWindow(aDOMWindow)
Expand All @@ -575,11 +575,11 @@ var AB = { // AB stands for attention bar
domIdPrefix: AB.domIdPrefix
}; // ab stands for attention bar
if (!aDOMWindow.React) {
console.error('WILL NOW LOAD IN REACT');

Services.scriptloader.loadSubScript(core.addon.path.scripts + 'react.js?' + core.addon.cache_key, aDOMWindow); // even if i load it into aDOMWindow.blah and .blah is an object, it goes into global, so i just do aDOMWindow now
}
if (!aDOMWindow.ReactDOM) {
console.error('WILL NOW LOAD IN REACTDOM');

Services.scriptloader.loadSubScript(core.addon.path.scripts + 'react-dom.js?' + core.addon.cache_key, aDOMWindow);
}
Services.scriptloader.loadSubScript(core.addon.path.scripts + 'ab-react-components.js?' + core.addon.cache_key, aDOMWindow);
Expand Down Expand Up @@ -611,7 +611,7 @@ var AB = { // AB stands for attention bar
msgListener: {
receiveMessage: function(aMsgEvent) {
var aMsgEventData = aMsgEvent.data;
console.error('getting aMsgEvent, data:', aMsgEventData);

// this means trigger a callback with id aMsgEventData
var cCallbackId = aMsgEventData;
var cBrowser = aMsgEvent.target;
Expand Down Expand Up @@ -646,7 +646,7 @@ var AB = { // AB stands for attention bar
for (var aInstId in AB.Insts) {
var aInstState = AB.Insts[aInstId].state;
if (aInstState.aId in aDOMWindow[core.addon.id + '-AB'].Insts) {
console.error('this is really weird, it should never happen, as i only call this function when a new window opens');

aDOMWindow[core.addon.id + '-AB'].Insts[aInstState.aId].state = aDOMWindow.JSON.parse(aDOMWindow.JSON.stringify(aInstState));
aDOMWindow[core.addon.id + '-AB'].Insts[aInstState.aId].setState(JSON.parse(JSON.stringify(aInstState)));
} else {
Expand All @@ -655,7 +655,7 @@ var AB = { // AB stands for attention bar
aDOMWindow[core.addon.id + '-AB'].Insts[aInstState.aId].state = aDOMWindow.JSON.parse(aDOMWindow.JSON.stringify(aInstState));
var cDeck = aDOMWindow.document.getElementById('content-deck');
var cNotificationBox = aDOMWindow.document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'notificationbox');
console.error('inserting', 'notificationbox-' + aInstState.aId + '--' + AB.domIdPrefix);

cNotificationBox.setAttribute('id', 'notificationbox-' + aInstState.aId + '--' + AB.domIdPrefix);
if (!aInstState.aPos) {
cDeck.parentNode.appendChild(cNotificationBox);
Expand Down Expand Up @@ -741,7 +741,7 @@ function startup(aData, aReason) {
var aTimer = Cc['@mozilla.org/timer;1'].createInstance(Ci.nsITimer);
aTimer.initWithCallback({
notify: function() {
console.error('ok starting up adding');

// register framescript listener
Services.mm.addMessageListener(core.addon.id, fsMsgListener);

Expand All @@ -755,7 +755,7 @@ function startup(aData, aReason) {
var promise_initMainWorker = SIPWorker('MainWorker', core.addon.path.modules + 'MainWorker/MainWorker.js?' + core.addon.cache_key, core, MainWorkerMainThreadFuncs);
promise_initMainWorker.then(
function(aInitObj) {
console.log('Fullfilled - promise_initMainWorker - ', aInitObj);

// start - do stuff here - promise_initMainWorker
setupMainWorkerCustomErrors();
afterWorker(aInitObj);
Expand All @@ -766,15 +766,15 @@ function startup(aData, aReason) {
name: 'promise_initMainWorker',
aReason: aReason
};
console.warn('Rejected - promise_initMainWorker - ', rejObj);

}
).catch(
function(aCaught) {
var rejObj = {
name: 'promise_initMainWorker',
aCaught: aCaught
};
console.error('Caught - promise_initMainWorker - ', rejObj);

}
);

Expand All @@ -797,7 +797,7 @@ function shutdown(aData, aReason) {
// terminate worker
if (typeof(MainWorker) != 'undefined') {
MainWorker._worker.terminate();
console.log('ok terminated worker');

}
}

Expand All @@ -807,7 +807,7 @@ var fsFuncs = { // can use whatever, but by default its setup to use this
requestInit: function(aMsgEvent) {
// start - l10n injection into fs

console.error('in requestinit server side');


return [{
aCore: core,
Expand Down Expand Up @@ -867,7 +867,7 @@ var fsFuncs = { // can use whatever, but by default its setup to use this
var rez_pwcall = MainWorker.post(aArrOfWorker_FuncnameThenArgs.shift(), aArrOfWorker_FuncnameThenArgs);
rez_pwcall.then(
function(aVal) {
console.log('Fullfilled - rez_pwcall - ', aVal);

if (returnToFramescript) {
if (Array.isArray(aVal)) {
mainDeferred_callInPromiseWorker.resolve(aVal);
Expand All @@ -881,7 +881,7 @@ var fsFuncs = { // can use whatever, but by default its setup to use this
name: 'rez_pwcall',
aReason: aReason
};
console.error('Rejected - rez_pwcall - ', rejObj);

if (returnToFramescript) {
mainDeferred_callInPromiseWorker.resolve([rejObj]);
}
Expand All @@ -892,7 +892,7 @@ var fsFuncs = { // can use whatever, but by default its setup to use this
name: 'rez_pwcall',
aCaught: aCaught
};
console.error('Caught - rez_pwcall - ', rejObj);

if (returnToFramescript) {
mainDeferred_callInPromiseWorker.resolve([rejObj]);
}
Expand All @@ -908,7 +908,7 @@ var fsMsgListener = {
funcScope: fsFuncs,
receiveMessage: function(aMsgEvent) {
var aMsgEventData = aMsgEvent.data;
console.log('fsMsgListener getting aMsgEventData:', aMsgEventData, 'aMsgEvent:', aMsgEvent);

// aMsgEvent.data should be an array, with first item being the unfction name in bootstrapCallbacks

var callbackPendingId;
Expand All @@ -931,23 +931,23 @@ var fsMsgListener = {
aMsgEvent.target.messageManager.sendAsyncMessage(core.addon.id, [callbackPendingId, aVal]);
},
function(aReason) {
console.error('aReject:', aReason);

aMsgEvent.target.messageManager.sendAsyncMessage(core.addon.id, [callbackPendingId, ['promise_rejected', aReason]]);
}
).catch(
function(aCatch) {
console.error('aCatch:', aCatch);

aMsgEvent.target.messageManager.sendAsyncMessage(core.addon.id, [callbackPendingId, ['promise_rejected', aCatch]]);
}
);
} else {
// assume array
console.warn('ok responding to callback id:', callbackPendingId, aMsgEvent.target);

aMsgEvent.target.messageManager.sendAsyncMessage(core.addon.id, [callbackPendingId, rez_parentscript_call]);
}
}
}
else { console.warn('funcName', funcName, 'not in scope of this.funcScope') } // else is intentionally on same line with console. so on finde replace all console. lines on release it will take this out


}
};
Expand Down Expand Up @@ -1041,7 +1041,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 Down Expand Up @@ -1096,7 +1096,7 @@ function genericReject(aPromiseName, aPromiseToReject, aReason) {
name: aPromiseName,
aReason: aReason
};
console.error('Rejected - ' + aPromiseName + ' - ', rejObj);

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

if (aPromiseToReject) {
aPromiseToReject.reject(rejObj);
}
Expand Down Expand Up @@ -1139,10 +1139,10 @@ function SIPWorker(workerScopeName, aPath, aCore=core, aFuncExecScope) {
bootstrap[workerScopeName]._worker.onmessage = function(aMsgEvent) {
////// start - my custom stuff
var aMsgEventData = aMsgEvent.data;
console.log('promiseworker receiving msg:', aMsgEventData);

if (Array.isArray(aMsgEventData)) {
// my custom stuff, PromiseWorker did self.postMessage to call a function from here
console.log('promsieworker is trying to execute function in mainthread');


var callbackPendingId;
if (typeof aMsgEventData[aMsgEventData.length-1] == 'string' && aMsgEventData[aMsgEventData.length-1].indexOf(SIP_CB_PREFIX) == 0) {
Expand All @@ -1159,20 +1159,20 @@ function SIPWorker(workerScopeName, aPath, aCore=core, aFuncExecScope) {
function(aVal) {
if (aVal.length >= 2 && aVal[aVal.length-1] == SIP_TRANS_WORD && Array.isArray(aVal[aVal.length-2])) {
// to transfer in callback, set last element in arr to SIP_TRANS_WORD and 2nd to last element an array of the transferables // cannot transfer on promise reject, well can, but i didnt set it up as probably makes sense not to
console.error('doing transferrrrr');

aVal.pop();
bootstrap[workerScopeName]._worker.postMessage([callbackPendingId, aVal], aVal.pop());
} else {
bootstrap[workerScopeName]._worker.postMessage([callbackPendingId, aVal]);
}
},
function(aReason) {
console.error('aReject:', aReason);

bootstrap[workerScopeName]._worker.postMessage([callbackPendingId, ['promise_rejected', aReason]]);
}
).catch(
function(aCatch) {
console.error('aCatch:', aCatch);

bootstrap[workerScopeName]._worker.postMessage([callbackPendingId, ['promise_rejected', aCatch]]);
}
);
Expand All @@ -1188,7 +1188,7 @@ function SIPWorker(workerScopeName, aPath, aCore=core, aFuncExecScope) {
}
}
}
else { console.error('funcName', funcName, 'not in scope of aFuncExecScope') } // else is intentionally on same line with console. so on finde replace all console. lines on release it will take this out

////// end - my custom stuff
} else {
origOnmessage(aMsgEvent);
Expand All @@ -1204,20 +1204,20 @@ function SIPWorker(workerScopeName, aPath, aCore=core, aFuncExecScope) {
var promise_initWorker = bootstrap[workerScopeName].post('init', [aCore]);
promise_initWorker.then(
function(aVal) {
console.log('Fullfilled - promise_initWorker - ', aVal);

// start - do stuff here - promise_initWorker
deferredMain_SIPWorker.resolve(aVal);
// end - do stuff here - promise_initWorker
},
function(aReason) {
var rejObj = {name:'promise_initWorker', aReason:aReason};
console.warn('Rejected - promise_initWorker - ', rejObj);

deferredMain_SIPWorker.reject(rejObj);
}
).catch(
function(aCaught) {
var rejObj = {name:'promise_initWorker', aCaught:aCaught};
console.error('Caught - promise_initWorker - ', rejObj);

deferredMain_SIPWorker.reject(rejObj);
}
);
Expand Down
4 changes: 2 additions & 2 deletions 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>1.8b</em:version>
<em:version>1.8</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>

Expand All @@ -14,7 +14,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>42.0</em:minVersion> <!-- due to options page -->
<em:maxVersion>44.0</em:maxVersion> <!-- the latest version i tested it in -->
<em:maxVersion>46.0</em:maxVersion> <!-- the latest version i tested it in -->
</Description>
</em:targetApplication>

Expand Down
Loading

0 comments on commit 4a0a718

Please sign in to comment.