Uncontemplated firefox idb error
Closed this issue · 0 comments
After updating firefox (78->81, but whatever) there were no more styles in stylus for me.
default-default/storage/default/moz-extension+++...^userContextId=/idb/...wleabcEoxlt-eengsairo.sqlite
is almost empty (updates info) and no files.
default-default/storage/default/moz-extension+++...
has styles in ...shtsyil.sqlite
and file 37
in a ...shtsyil.files
folder.
https://gitlab.com/ntninja/moz-idb-edit has python program to output mozilla's sqlite contents. And https://gitlab.com/riki137/moz-idb-edit at 32173c681d53f112d37d1efb6844cbc436e0e52e (Read all keys) to not read exact key, but output full database. // needs snappy
But if use this program on the database it will throw an error on key=X'10C03E'
(at 18's place for me; first 17 ones will be outputed)
so change assert file_ids is None
in mozidb.py
to
if file_ids is not None:
continue
and dump resulting json: moz-idb-edit --dbpath "/tmp/shit_styl/...shtsyil.sqlite" >! /tmp/shit_styl/dump.json
Maybe change pprint...
to pprint.pprint(reader.read(), compact=False, width=1000)
to get code
section one-line for most scripts (others will be probably downloadable ones)
but it is not valid json file, so edit it:
True -> true ; False -> false ; None -> null
# escaping '"' in code strings
sed -r "/\{'code': /,/'domains|regexps': / {s:(\"):\\\\\\1:g}"
# deleting ''' and collapse code strings into one
sed -r "/\{'code': / {s:\: '(.*)'$:\: \"\1:;; :start s:\n::; N; /'domains|regexps': /\!{s: '(.*?)'\n:\1:g; b start;}; s: '([^\n]*?)',:\1\",:; s:(.*)([ ]*'domains|regexps'\: .*):\1\2: }"
# -//- when there is only one string with code
sed -r "/\{'code': \"/ N; /'domains|regexps': /{s:[^\"](.)\n$:\"\1\n:;}"
sed -r "s/'(_rev|enabled|id|updateDate|installDate)'(: .*,)$/\"\1\"\2/"
# just do for 'code' apart
sed "s:{'code'\: :{\"code\"\: :"
# when: code '', in one string after all previous
sed -r "/\{\"code\": '.*',/ s:'(.*)':\"\1\":"
# firstly do many-string urlPrefixes
sed -r "/'urlPrefixes': / {s:\['(.*?)',$:\[\"\1\",:; :start s:\n: :; N; /'.*]/\!{ s:[ ]*'([^ ]*?)',:\"\1\",:; b start; }; s:\n[ ]*'(.*)'],: \"\1\"],: };"
# for one string length
sed -r "/'urlPrefixes': \['/ {:start s/(.*'urlPrefixes'.*)'([^']*?)'(.*)/\1\"\2\"\3/ ; T end; b start ; :end}"
sed -r "/'domains|regexps|urlPrefixes': \[/ s/'{1}([^']+?)'{1}/\"\1\"/g"
sed -r "s/'(_id|method|md5Url|name|originalDigest|originalMd5|originalName|updateUrl)': '(.*)',$/\"\1\": \"\2\",/"
sed -r "s/'(md5Url|originalMd5|updateUrl)': null,$/\"\1\": null,/"
sed -r "s/'(urls)'(: \[]}]?,)$/\"\1\"\2/g"
# i have only '^ \'url\'' so this one:
sed -r "/^ 'url': / s/'([^']+?)'/\"\1\"/g"
sed -r "s/'(sections)'(: \[.*)$/\"\1\"\2/"
add at the begining and at the end '[' ']' respectively.
delete 'Key #' string or comment out the output in the program.
strings inside `code` could start with '"' and not ''', so manual editing.
// i could entirely failed somewhere here, so cautionary warning
But i still couldn't import the .json styles (even file with one valid (i guess) style), 'cause there was an error in the cmdline when i tried to add json.
...So just delete obstructing part of the sql db (INSERT INTO object_data VALUES(1,X'10c03e',NULL,'.37',4294967296);
).
SELECT hex(key), file_ids FROM object_data WHERE key=X'10C03E';
10C03E|.37 # 'file_ids' as a filename of file in the files folder
but to delete this part you have to delete deleter trigger:
DROP TRIGGER object_data_delete_trigger;
DELETE FROM object_data WHERE key=X'10C03E';
and return that trigger back.
And replaced (extension was disabled at this moment) that db under normal folder (not '^contextid'). And they are reappeared.
One css style (the last, afair) was displayed (and not only) twicely, maybe it was just mistake of mine from the last editing.
P. S. i will try to restart browser now...