Skip to content

Commit

Permalink
3.0b4
Browse files Browse the repository at this point in the history
RELEASE
  • Loading branch information
Noitidart committed Mar 17, 2016
1 parent 13e8688 commit b274a4f
Show file tree
Hide file tree
Showing 15 changed files with 846 additions and 21,615 deletions.
162 changes: 81 additions & 81 deletions bootstrap.js

Large diffs are not rendered by default.

120 changes: 60 additions & 60 deletions modules/ICGenWorker/worker.js

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions modules/commonProfilistFuncs.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ function getSpecificnessForKeyInIniEntry(aIniEntry, aGenIniEntry, aKeyName) {
// 1 for specific
// 2 for unspecific

if (!(aKeyName in gKeyInfoStore)) { console.error('DEV_ERROR - aKeyName does not exist in gKeyInfoStore, aKeyName:', aKeyName); throw new Error('DEV_ERROR'); } // console message intentionaly on same line with if, as this is developer error only so on release this is removed


if (gKeyInfoStore[aKeyName].unspecificOnly || gKeyInfoStore[aKeyName].specificOnly) { console.error('DEV_ERROR - aKeyName is ONLY-like, aKeyName:', aKeyName, 'see gKeyInfoStore entry it is either unspecificOnly or specificOnly, dont use this function to determine that:', gKeyInfoStore[aKeyName]); throw new Error('DEV_ERROR - cannot toggle this setting as it is specificOnly or unspecificOnly'); }


// :note: :important: this is my NEW determinign factor for specificness of a toggleable (meaning no specificOnly or unspecificOnly). if setting exists in aIniEntry then it is specific. else it is unspecific (regardless if a value exists in aGenIniEntry - as if it doesnt exist it obviously uses the default value) - so therefore it is important to delete key from aIniEntry when togglign to unspecific crossfile-link75748383322222 IGNORE THIS ON RIGHT as this on left ovverides it ---> // :note: :important: this is my determining factor for specificness of non-only pref-like's - if key exists in aGenIniEntry then it is unspecific. because of this its important to clear out genearl when going to specific. link757483833
if (!(aKeyName in aGenIniEntry) && !(aKeyName in aIniEntry)) {
Expand All @@ -134,7 +134,7 @@ function getSpecificnessForKeyInIniEntry(aIniEntry, aGenIniEntry, aKeyName) {
// it is unspecific
return 2;
}
console.error('DEV_ERROR - should never ever get here');

throw new Error('DEV_ERROR - should never ever get here');
}

Expand All @@ -147,7 +147,7 @@ function getPrefLikeValForKeyInIniEntry(aIniEntry, aGenIniEntry, aKeyName) {

// aIniEntry is almost always the curProfIniEntry

if (!(aKeyName in gKeyInfoStore)) { console.error('DEV_ERROR - aKeyName does not exist in gKeyInfoStore, aKeyName:', aKeyName); throw new Error('DEV_ERROR'); } // console message intentionaly on same line with if, as this is developer error only so on release this is removed


if (gKeyInfoStore[aKeyName].unspecificOnly) {
// get profile-unspecific value else null
Expand Down Expand Up @@ -182,7 +182,7 @@ function getPrefLikeValForKeyInIniEntry(aIniEntry, aGenIniEntry, aKeyName) {
if (aKeyName in aIniEntry) {
return aIniEntry[aKeyName];
}
else { console.error('this should never happen! as per crossfile-link75748383322222, a setting is defined as specific IF it has an entry in aIniEntry'); throw new Error('DEV ERROR'); } // this should never happen! as per crossfile-link75748383322222, a setting is defined as specific IF it has an entry in aIniEntry

}
}

Expand Down Expand Up @@ -217,9 +217,9 @@ function setPrefLikeValForKeyInIniEntry(aIniEntry, aGenIniEntry, aKeyName, aNewV

// aIniEntry is almost always the curProfIniEntry

if (!(aKeyName in gKeyInfoStore)) { console.error('DEV_ERROR - aKeyName does not exist in gKeyInfoStore, aKeyName:', aKeyName); throw new Error('DEV_ERROR'); throw new Error('DEV_ERROR'); } // console message intentionaly on same line with if, as this is developer error only so on release this is removed


if (aNewSpecifincess_optional !== undefined && (gKeyInfoStore[aKeyName].unspecificOnly || gKeyInfoStore[aKeyName].specificOnly)) { console.error('DEV_ERROR - aKeyName is unspecific ONLY or specific ONLY, therefore you cannot pass a aNewSpecifincess_optional, aNewSpecifincess_optional:', aNewSpecifincess_optional, 'gKeyInfoStore[aKeyName]:', gKeyInfoStore[aKeyName]); throw new Error('DEV_ERROR'); } // console message intentionaly on same line with if, as this is developer error only so on release this is removed


// LOGIC
// if gKeyInfoStore[aKeyName].unspecificOnly
Expand All @@ -235,15 +235,15 @@ function setPrefLikeValForKeyInIniEntry(aIniEntry, aGenIniEntry, aKeyName, aNewV

if (gKeyInfoStore[aKeyName].unspecificOnly) {
aGenIniEntry[aKeyName] = aNewVal;
console.log('set unspecificOnly', 'key:', aKeyName, 'aGenIniEntry:', aGenIniEntry);

} else if (gKeyInfoStore[aKeyName].specificOnly) {
aIniEntry[aKeyName] = aNewVal;
console.log('set specificOnly', 'key:', aKeyName, 'aIniEntry:', aIniEntry);

} else {
// figure out specificness
var specificness;
if (aNewSpecifincess_optional !== undefined) {
if (aNewSpecifincess_optional !== 1 && aNewSpecifincess_optional !== 2) { console.error('DEV_ERROR - aNewSpecifincess_optional must be 1 or 2! you set it to:', aNewSpecifincess_optional); throw new Error('DEV_ERROR'); }

specificness = aNewSpecifincess_optional;
} else {
specificness = getSpecificnessForKeyInIniEntry(aIniEntry, aGenIniEntry, aKeyName);
Expand All @@ -257,7 +257,7 @@ function setPrefLikeValForKeyInIniEntry(aIniEntry, aGenIniEntry, aKeyName, aNewV
// aGenIniEntry[aKeyName] = aNewVal; // aNewVal is ignored when toggling to unspecific link11194229319
} else {
aGenIniEntry[aKeyName] = aNewVal;
console.log('set unspecific calcd', 'key:', aKeyName, 'aGenIniEntry:', aGenIniEntry);

}
} else {
// it is specific
Expand All @@ -267,7 +267,7 @@ function setPrefLikeValForKeyInIniEntry(aIniEntry, aGenIniEntry, aKeyName, aNewV
// // delete aGenIniEntry[aKeyName];
// // }
aIniEntry[aKeyName] = aNewVal;
console.log('set specific calcd', 'key:', aKeyName, 'aIniEntry:', aIniEntry);

}
}
}
Expand Down
24 changes: 12 additions & 12 deletions modules/cutils.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function utilsInit() {
// this argument means if at deepest level, it finds it has .contents but cannot access .contents on it, then it will get the number that pointer is pointing to (of course if its a ctype [meaning a cdata], meaning if its just an object with a .contents it wont do it on that)
/*
if (obj !== null && obj !== undefined) {
console.log('trying on:', obj.toString())
}
*/
var lastTypeof = typeof(obj);
Expand Down Expand Up @@ -65,7 +65,7 @@ function utilsInit() {
var str1 = this.jscGetDeepest(str1); //cuz apparently its not passing by reference
var str2 = this.jscGetDeepest(str2); //cuz apparently its not passing by reference

//console.info('comparing:', str1, str2);


if (str1 == str2) {
return true;
Expand Down Expand Up @@ -159,34 +159,34 @@ function utilsInit() {
var readJSCharString = function() {
var assumption_max_len = known_len ? known_len : 500;
var ptrAsArr = ctypes.cast(stringPtr, ctypes.unsigned_char.array(assumption_max_len).ptr).contents; // MUST cast to unsigned char (not ctypes.jschar, or ctypes.char) as otherwise i dont get foreign characters, as they are got as negative values, and i should read till i find a 0 which is null terminator which will have unsigned_char code of 0 // can test this by reading a string like this: "_scratchpad/EnTeHandle.js at master · Noitidart/_scratchpad - Mozilla Firefox" at js array position 36 (so 37 if count from 1), we see 183, and at 77 we see char code of 0 IF casted to unsigned_char, if casted to char we see -73 at pos 36 but pos 77 still 0, if casted to jschar we see chineese characters in all spots expect spaces even null terminator is a chineese character
//console.info('ptrAsArr.length:', ptrAsArr.length);
//console.log('debug-msg :: dataCasted:', dataCasted, uneval(dataCasted), dataCasted.toString());


var charCode = [];
var fromCharCode = []
for (var i=0; i<ptrAsArr.length; i++) { //if known_len is correct, then will not hit null terminator so like in example of "_scratchpad/EnTeHandle.js at master · Noitidart/_scratchpad - Mozilla Firefox" if you pass length of 77, then null term will not get hit by this loop as null term is at pos 77 and we go till `< known_len`
var thisUnsignedCharCode = ptrAsArr.addressOfElement(i).contents;
if (thisUnsignedCharCode == 0) {
// reached null terminator, break
//console.log('reached null terminator, at pos: ', i);

break;
}
charCode.push(thisUnsignedCharCode);
fromCharCode.push(String.fromCharCode(thisUnsignedCharCode));
}
//console.info('charCode:', charCode);
//console.info('fromCharCode:', fromCharCode);


var char16_val = fromCharCode.join('');
//console.info('char16_val:', char16_val);

return char16_val;
}

if (!jschar) {
try {
var char8_val = stringPtr.readString();
//console.info('stringPtr.readString():', char8_val);

return char8_val;
} catch (ex if ex.message.indexOf('malformed UTF-8 character sequence at offset ') == 0) {
//console.warn('ex of offset utf8 read error when trying to do readString so using alternative method, ex:', ex);

return readJSCharString();
}
} else {
Expand Down Expand Up @@ -255,7 +255,7 @@ function utilsInit() {
throw new Error('not enough room in ctypesCharArr for the newStr_js and its null terminator');
}

//console.info('pre mod readString():', ctypesCharArr.readString().toString());


for (var i=0; i<ctypesCharArr.length; i++) {
var charCodeAtCurrentPosition = ctypesCharArr.addressOfElement(i).contents;
Expand All @@ -271,7 +271,7 @@ function utilsInit() {
ctypesCharArr.addressOfElement(i).contents = newStr_js.charCodeAt(i);
}

//console.info('post mod readString():', ctypesCharArr.readString().toString());

};

this.typeOfField = function(structDef, fieldName) {
Expand Down
18 changes: 9 additions & 9 deletions modules/ostypes_mac.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1314,15 +1314,15 @@ var macInit = function() {
sel: function(jsStrSEL) {
if (!(jsStrSEL in self.HELPER._selLC)) {
self.HELPER._selLC[jsStrSEL] = self.API('sel_registerName')(jsStrSEL);
// console.info('sel c got', jsStrSEL, self.HELPER._selLC[jsStrSEL].toString());

}
return self.HELPER._selLC[jsStrSEL];
},
_classLC: {}, // LC = Lazy Cache
class: function(jsStrCLASS) {
if (!(jsStrCLASS in self.HELPER._classLC)) {
self.HELPER._classLC[jsStrCLASS] = self.API('objc_getClass')(jsStrCLASS);
// console.info('class c got', jsStrCLASS, self.HELPER._classLC[jsStrCLASS].toString());

}
return self.HELPER._classLC[jsStrCLASS];
},
Expand All @@ -1331,29 +1331,29 @@ var macInit = function() {
// if get and it doesnt exist then it makes and stores it
// if get and already exists then it returns that lazy
// can releaseAll on it
// console.error('nssstringColll');

this.coll = {};
this.class = {};
this.get = function(jsStr) {
// console.error('enter get');

if (!(jsStr in this.coll)) {
// console.error('here');

this.class[jsStr] = self.API('objc_msgSend')(self.HELPER.class('NSString'), self.HELPER.sel('alloc'));;
// console.info('pre init this.class[jsStr]:', jsStr, this.class[jsStr].toString());


var rez_initWithUTF8String = self.API('objc_msgSend')(this.class[jsStr], self.HELPER.sel('initWithUTF8String:'), self.TYPE.char.array()(jsStr));
this.coll[jsStr] = rez_initWithUTF8String;
// console.info('post init this.class:', jsStr, this.class[jsStr].toString(), 'this.coll[jsStr]:', this.coll[jsStr].toString());

}
// else { console.error('jsStr already in coll', jsStr); }

return this.coll[jsStr];
};

this.releaseAll = function() {
for (var nsstring in this.coll) {
var rez_relNSS = self.API('objc_msgSend')(this.coll[nsstring], self.HELPER.sel('release'));
var rez_relCLASS = self.API('objc_msgSend')(this.class[nsstring], self.HELPER.sel('release'));
// console.info(nsstring, 'rez_relNSS:', rez_relNSS.toString(), 'rez_relCLASS:', rez_relCLASS.toString());

}
this.coll = null;
};
Expand Down
24 changes: 12 additions & 12 deletions modules/ostypes_win.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -2291,10 +2291,10 @@ var winInit = function() {
// throws if bad hresult
var primitiveHR = parseInt(cutils.jscGetDeepest(hr))
if (cutils.jscEqual(primitiveHR, ostypes.CONST.S_FALSE)) {
console.error('SPECIAL HRESULT FAIL RESULT!!!', 'HRESULT is 1!!! hr:', hr, 'funcName:', funcName);

} else if (primitiveHR < 0) {
// FAILED macro does this, linked from the msdn page at top of this func
console.error('HRESULT', hr, 'returned from function', funcName, 'getStrOfResult:', self.HELPER.getStrOfResult(primitiveHR));

throw new Error('HRESULT ' + hr + ' returned from function ' + funcName + ' getStrOfResult:' + JSON.stringify(self.HELPER.getStrOfResult(primitiveHR)));
} // else then it was success
},
Expand All @@ -2304,7 +2304,7 @@ var winInit = function() {
rezObj.strPrim = '0x' + PrimitiveJS_RESULT.toString(16);
for (var group in WIN32_ERROR_STR) {
for (var str in WIN32_ERROR_STR[group]) {
//console.error(WIN32_ERROR_STR[group][str], PrimativeJS_RESULT, str);

if (WIN32_ERROR_STR[group][str] == PrimitiveJS_RESULT) {
rezObj[group] = str;
break;
Expand Down Expand Up @@ -2345,7 +2345,7 @@ var winInit = function() {
self.HELPER.checkHRESULT(hr_SetValue, 'IPropertyStore_SetValue');

var rez_PropVariantClear = self.API('PropVariantClear')(ppropvar.address());
// console.info('rez_PropVariantClear:', rez_PropVariantClear, rez_PropVariantClear.toString(), uneval(rez_PropVariantClear));


return hr_SetValue;
},
Expand All @@ -2360,28 +2360,28 @@ var winInit = function() {
ret_js = true;
}

//console.info('pps.GetValue', pps.GetValue);

var hr_GetValue = pps.GetValue(vtblPpsPtr, pkey, ppropvar.address());
self.HELPER.checkHRESULT(hr_GetValue, 'IPropertyStore_GetValue');

//console.info('ppropvar:', ppropvar.toString(), uneval(ppropvar));


if (ret_js) {
//console.info('ppropvar.pwszVal:', ppropvar.pwszVal.toString(), uneval(ppropvar.pwszVal));

var jsstr;
if (ppropvar.pwszVal.isNull()) {
console.log('ppropvar.pwszVal is NULL so blank string was found');

jsstr = '';
} else {
jsstr = ppropvar.pwszVal.readStringReplaceMalformed();
}

var rez_PropVariantClear = self.API('PropVariantClear')(ppropvar.address());
//console.info('rez_PropVariantClear:', rez_PropVariantClear.toString(), uneval(rez_PropVariantClear));


return jsstr;
} else {
// console.warn('remember to clear the PROPVARIANT yourself then');

return hr_GetValue;
}
},
Expand All @@ -2396,9 +2396,9 @@ var winInit = function() {
*/
// SHStrDup uses CoTaskMemAlloc to allocate the strin so is true to the noe from MSDN
var hr_SHStrDup = self.API('SHStrDup')(psz, ppropvar.contents.pwszVal.address()); //note in PROPVARIANT defintion `pwszVal` is defined as `LPWSTR` and `SHStrDup` expects second arg as `LPTSTR.ptr` but both `LPTSTR` and `LPWSTR` are defined the same with `ctypes.jschar` so this should be no problem // after learnin that LPTSTR is wchar when ifdef_UNICODE and i have ifdef_UNICODE set to true so they are the same
// console.info('hr_SHStrDup:', hr_SHStrDup.toString(), uneval(hr_SHStrDup));


// console.log('propvarPtr.contents.pwszVal', propvarPtr.contents.pwszVal);

self.HELPER.checkHRESULT(hr_SHStrDup, 'InitPropVariantFromString -> hr_SHStrDup'); // this will throw if HRESULT is bad

ppropvar.contents.vt = self.CONST.VT_LPWSTR;
Expand Down
26 changes: 13 additions & 13 deletions modules/ostypes_x11.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1902,7 +1902,7 @@ var x11Init = function() {
var atom = self.API('XInternAtom')(self.HELPER.cachedXOpenDisplay(), aAtomName, createAtomIfDne ? self.CONST.False : self.CONST.True); //passing 3rd arg of false, means even if atom doesnt exist it returns a created atom, this can be used with GetProperty to see if its supported etc, this is how Chromium does it
if (!createAtomIfDne) {
if (atom == self.CONST.None) { // if i pass 3rd arg as False, it will will never equal self.CONST.None it gets creatd if it didnt exist on line before
console.warn('No atom with name:', aAtomName, 'return val of atom:', atom.toString());

throw new Error('No atom with name "' + aAtomName + '"), return val of atom:"' + atom.toString() + '"');
}
}
Expand All @@ -1914,23 +1914,23 @@ var x11Init = function() {
// devUserRequestedType is req_type arg passed to XGetWindowProperty
// this tells us what the return of XGetWindowProperty means and if it needs XFree'ing
// returns < 0 if nitems_return is empty and no need for XFree. > 0 if needs XFree as there are items. 0 if no items but needs XFree, i have never seen this situation and so have not set up this to return 0 // actually scratch this xfree thing it seems i have to xfree it everytime: // XGetWindowProperty() always allocates one extra byte in prop_return (even if the property is zero length) and sets it to zero so that simple properties consisting of characters do not have to be copied into yet another string before use. // wait tested it, and i was getting some weird errors so only XFree when not empty, interesting
// -1 - console.log('The specified property does not exist for the specified window. The delete argument was ignored. The nitems_return argument will be empty.');
// -2 - must set dontThrowOnDevTypeMismatch to true else it throws - console.log('Specified property/atom exists on window but here because returns actual type does not match the specified type (the xgwpArg.req_type) you supplied to function. The delete argument was ignored. The nitems_return argument will be empty.');
// 1 - console.log('The specified property exists and either you assigned AnyPropertyType to the req_type argument or the specified type matched the actual property type of the returned data.');




if (cutils.jscEqual(funcReturnedType, self.CONST.None) && cutils.jscEqual(funcReturnedFormat, 0) && cutils.jscEqual(funcBytesAfterReturned, 0)) {
// console.log('The specified property does not exist for the specified window. The delete argument was ignored. The nitems_return argument will be empty.');

return -1;
} else if (!cutils.jscEqual(devUserRequestedType, self.CONST.AnyPropertyType) && !cutils.jscEqual(devUserRequestedType, funcReturnedType)) {
// console.log('Specified property/atom exists on window but here because returns actual type does not match the specified type (the xgwpArg.req_type) you supplied to function. The delete argument was ignored. The nitems_return argument will be empty.');
console.info('devUserRequestedType:', cutils.jscGetDeepest(devUserRequestedType));
console.info('funcReturnedType:', cutils.jscGetDeepest(funcReturnedType));



if (!dontThrowOnDevTypeMismatch) {
throw new Error('devuser supplied wrong type for title, fix it stupid, or maybe not a throw? maybe intentionally wrong? to just check if it exists on the window but dont want any data returend as dont want to XFree?');
}
return -2;
} else if (cutils.jscEqual(devUserRequestedType, self.CONST.AnyPropertyType) || cutils.jscEqual(devUserRequestedType, funcReturnedType)) {
// console.log('The specified property exists and either you assigned AnyPropertyType to the req_type argument or the specified type matched the actual property type of the returned data.');

return 1;
} else {
throw new Error('should never get here')
Expand Down Expand Up @@ -2005,15 +2005,15 @@ var x11Init = function() {
fd_set_set: function(fdset, fd) {
// https://github.com/pioneers/tenshi/blob/9b3273298c34b9615e02ac8f021550b8e8291b69/angel-player/src/chrome/content/common/serport_posix.js#L497
let { elem8, bitpos8 } = self.HELPER.fd_set_get_idx(fd);
console.info('elem8:', elem8.toString());
console.info('bitpos8:', bitpos8.toString());


fdset[elem8] = 1 << bitpos8;
},
fd_set_isset: function(fdset, fd) {
// https://github.com/pioneers/tenshi/blob/9b3273298c34b9615e02ac8f021550b8e8291b69/angel-player/src/chrome/content/common/serport_posix.js#L497
let { elem8, bitpos8 } = self.HELPER.fd_set_get_idx(fd);
console.info('elem8:', elem8.toString());
console.info('bitpos8:', bitpos8.toString());


return !!(fdset[elem8] & (1 << bitpos8));
}
};
Expand Down
Loading

0 comments on commit b274a4f

Please sign in to comment.