Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stylus is broken in the last Chrome canary #528

Closed
vsemozhetbyt opened this issue Oct 26, 2018 · 39 comments
Closed

Stylus is broken in the last Chrome canary #528

vsemozhetbyt opened this issue Oct 26, 2018 · 39 comments
Labels

Comments

@vsemozhetbyt
Copy link

vsemozhetbyt commented Oct 26, 2018

  • Browser: Google Chrome 72.0.3592.0 (Official Build) canary (64-bit)
  • Operating System: Windows 7 x64

Styles list in the manage.html is empty. There is an error in the console:

Uncaught (in promise) TypeError: Cannot read property 'name' of null
    at sorter.sort.styles.styles.map.style (manage.js:122)
    at Array.map (<anonymous>)
    at showStyles (manage.js:120)
    at Promise.all.then.args (manage.js:39)

The same error after an attempt to create and save a new style and go back to manage page. The style is not shown, the list is still empty.

@vsemozhetbyt
Copy link
Author

Error in the "Inspect views - background page":

Uncaught (in promise) TypeError: Cannot read property 'id' of null
    at dbExec.then.event (storage.js:179)

Mottie added a commit that referenced this issue Oct 26, 2018
Mottie added a commit that referenced this issue Oct 26, 2018
@eight04
Copy link
Collaborator

eight04 commented Oct 26, 2018

@Mottie I think we have to investigate why there is a null value inside the array to fix this bug.

@eight04
Copy link
Collaborator

eight04 commented Oct 26, 2018

@vsemozhetbyt Have you done something before the manager becomes empty?

@emeryao
Copy link

emeryao commented Oct 26, 2018

+1
same here with chrome 72.0.3592.0 canary 64bit

@vsemozhetbyt
Copy link
Author

@eight04 No, nothing at all. Canary has just updated and stylus has broken.

@eight04
Copy link
Collaborator

eight04 commented Oct 26, 2018

Open manage.html and try executing these commands in the dev console:

  1. BG.dbExec - this should report a function name, which should be dbExecIndexedDB or dbExecChromeStorage.
  2. copy(BG.cachedStyles.list) - this would copy all styles to the clipboard. It would also help if you can post them here.

@vsemozhetbyt
Copy link
Author

vsemozhetbyt commented Oct 26, 2018

@eight04

> BG.dbExec
< ƒ dbExecIndexedDB(method, ...args) {
  return new Promise((resolve, reject) => {
    Object.assign(indexedDB.open('stylish', 2), {
      onsuccess(event) {
        const database = event.target.result;
> copy(BG.cachedStyles.list)
< undefined

Copied BG.cachedStyles.list (the first 4 null seems to be my disappeared styles, the 5th object seems to be the last attempt to save a new style which is not shown in the list though):

[
  null,
  null,
  null,
  null,
  {
    "enabled": true,
    "updateUrl": null,
    "md5Url": null,
    "url": null,
    "originalMd5": null,
    "installDate": 1540555811467,
    "name": "global",
    "sections": [
      {
        "code": ":link, :link * {color: blue !important;}\n:visited, :visited * {color: red !important;}\n\n:link img {outline: 1px solid white !important;}\n:visited img {outline: 1px solid red !important;}\n\n:focus {outline: 1px solid blue !important;}\n",
        "urls": [],
        "urlPrefixes": [],
        "domains": [],
        "regexps": []
      }
    ],
    "id": 14
  }
]

@vsemozhetbyt
Copy link
Author

vsemozhetbyt commented Oct 26, 2018

I've opened manage.html and cleared the IndexedDB and the Local Storage in the DevTools Application tab. Then I've managed to create and save my styles. Now everything is OK.

@jonyroda97
Copy link

Same problem here. Executing the commands said above gives me:

> BG.dbExec
< ƒ dbExecIndexedDB(method, ...args) {
  return new Promise((resolve, reject) => {
    Object.assign(indexedDB.open('stylish', 2), {
      onsuccess(event) {
        const database = event.target.result;
> copy(BG.cachedStyles.list)
< undefined
[
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null
]

@vsemozhetbyt
Copy link
Author

To be clear: I had to manually recreate all my styles. It seems they were lost in an unrecoverable way if I am not mistaken. If you find the cause, maybe it is worth to report to the Chromium issue tracker to prevent such things in future, as many users would be hurt by this.

@vsemozhetbyt
Copy link
Author

To be on the safe side: https://bugs.chromium.org/p/chromium/issues/detail?id=899446

@jonyroda97
Copy link

To be clear: I had to manually recreate all my styles. It seems they were lost in an unrecoverable way if I am not mistaken.

Same here

@myfonj
Copy link

myfonj commented Oct 27, 2018

This brings back one question that I'd like to have answered here clearly:

Can WebExtension create file in its own folder without user interaction?

Pardon this silly hijack and my ignorance; I've searched for this simple information and my currently limited knowledge suggests it is not possible, but I think it would be beneficial to have such stance around here somewhere, so the questions like "why doesn't Stylus do periodical automated backups" is answered beforehand.

@eight04
Copy link
Collaborator

eight04 commented Oct 27, 2018

Can WebExtension create file in its own folder without user interaction?

Webextensions can download files without user interaction by using the downloads API. However, the location must be inside the default download folder.

BTW, someone had suggested synchronizing styles through cloud services. See #82.

@Mottie
Copy link
Member

Mottie commented Oct 27, 2018

Can WebExtension create file in its own folder without user interaction?

No, this isn't possible. Why? Because reading/writing local files opens many attack vectors for malware (ref).

I found that there is a method to use the IndexedDB file storage library (ref); but after some digging, it appears that this method still uses the indexDB to store the blob. It's not storing an actual file outside of the database.

What else can be done?

Earlier in another discussion, Tophf mentioned working on a time machine, but he's taking a break from Stylus and he didn't share any specifics of his idea with any of us.

Currently, the user can export all the styles to the download folder by using the manage page "Export styles" button. After which, the file is safe from data loss by whatever is causing the issue reported here; but a user may never open the manager...

The only solution I can think of would be to periodically replace the popup contents with a reminder and an export button. This is necessary if a user rarely opens the manager or popup. Would that be annoying? yes, so we would need also to add an option to disable it.

And please let's keep the discussion about backups in issue #278.

@Multiboxer
Copy link

Same issue here, after the update all my styIes in IndexedDB had a value of "null" however I was able to manually recover all of my lost styles by combing through the "000003.log" file located in AppData\Local\Google\Chrome Dev\User Data\Default\IndexedDB\chrome-extension_clngdbkpkpeebahjckkjfobafhncgmne_0.indexeddb.leveldb\ as it had not been wiped by the recent Canary update and contains readable CSS information.

@norti
Copy link

norti commented Oct 31, 2018

Chrome Version 72.0.3595.2 (Official Build) dev (64-bit) also has this bug, all styles are deleted. I cleared all storage for Stylus tried the import option, doesn't work.

@eight04
Copy link
Collaborator

eight04 commented Oct 31, 2018

After deleting the database, you have to restart your browser (extensions).

@vsemozhetbyt
Copy link
Author

vsemozhetbyt commented Nov 1, 2018

Update to 72.0.3597.0 has deleted all styles again. Maybe this is intended as a side-effect of the fix.

@vsemozhetbyt
Copy link
Author

https://bugs.chromium.org/p/chromium/issues/detail?id=899446#c14 :

If you recreated the styles in the broken Canary, it made the data incompatible with the fixed version, so I guess you'll have to recreate them again or restore a backup of the old pre-buggy database.

@SakalliTavernaci
Copy link

Okay, so after the last update, my styles are back. However the manage page is still empty. When i disable and re-enable any style it appears in the manage page temporarily, because when i refresh the page or toggle "New manage UI layout" it disappears.

capture

capture2

@Multiboxer
Copy link

@sovmu Does exporting styles work? If so, you can try and reinstall stylus and import the styles to see if the problem persists.

@SakalliTavernaci
Copy link

@sovmu Does exporting styles work? If so, you can try and reinstall stylus and import the styles to see if the problem persists.

Thanks, it worked!

@DanaMW
Copy link

DanaMW commented Nov 1, 2018

When I hit the update in chrome that zapped away all my styles it took about 20 seconds to fix. Open dev tools, Go to the Application tab index.db on the left over there and delete the stylus (stylish) db, restarted Chrome and then imported yesterdays backups because everyone knows that if you make changes to styles you create a new backup (export styles) I was back up and good in 20-30 seconds. It did affect New tab tools too but then again my backup habits saved me again. (I would suggest copying the DB out if your not sure of your backup)

@Mottie Mottie added the external label Nov 2, 2018
@vsemozhetbyt
Copy link
Author

Fixed upstream.

@ronjouch
Copy link

ronjouch commented Nov 6, 2018

To TL;DR the link above to crbug #899446, this is fixed in 72.0.3597.0, which isn't (yet) available to dev channel users but should soon be.

@ocumo
Copy link

ocumo commented Nov 7, 2018

I have the same or very similar problem on Firefox 63, not in Chromium v70.0.3538.77 (running Linux, kubuntu 18.04). I am going to open a new issue because the title of this thread is misleading, makes it seem a Chrome issue only and was not easy to find that this one was same issue and now I see it has been closed "fixed upstream", which doesn't help firefox users. For me it was never broken in my Chromium and it is broken in Firefox.

@eight04
Copy link
Collaborator

eight04 commented Nov 7, 2018

@ocumo It would be nice if you can open a new issue with detailed information 👍 This thread is related to a database bug in Chrome and they definitely are not the same problem.

@ronjouch
Copy link

@vsemozhetbyt issue should be re-opened, it regressed again in the last Chrome build: I'm using Chrome 72.0.3622.0 (Official Build) dev (64-bit), and Stylus fails to load my styles, with this error in the console:

Uncaught (in promise) TypeError: Cannot read property 'id' of null
    at db.exec.then.event (chrome-extension://clngdbkpkpeebahjckkjfobafhncgmne/background/style-manager.js:399)

@vsemozhetbyt
Copy link
Author

Can confirm for 72.0.3622.0 (Official Build) dev (64-bit), but strangely not for 72.0.3624.0 (Official Build) canary (64-bit) (fixed there?).

@vsemozhetbyt vsemozhetbyt reopened this Nov 28, 2018
@ronjouch
Copy link

Can confirm for 72.0.3622.0 (Official Build) dev (64-bit), but strangely not for 72.0.3624.0 (Official Build) canary (64-bit) (fixed there?).

@vsemozhetbyt good to know! count on me to ping you here with a status when the next Dev (not Canary) build lands.

@ronjouch
Copy link

ronjouch commented Dec 5, 2018

@vsemozhetbyt @Mottie bad news: testing Chrome 72.0.3626.7 (Official Build) dev (64-bit) / Ubuntu that just landed in the repos, styles still fail to load, and the console still shows:

Uncaught (in promise) TypeError: Cannot read property 'id' of null
    at db.exec.then.event (chrome-extension://clngdbkpkpeebahjckkjfobafhncgmne/background/style-manager.js:399)

@vsemozhetbyt
Copy link
Author

Yeah, I had to clear IndexedDB again and import my saved styles.

@raceimaztion
Copy link

Has a bug been opened in the Chromium tracker for this issue? I can't seem to find one.

@karolyi
Copy link

karolyi commented Feb 2, 2019

+1, it's broken a long time ago.

@Mottie
Copy link
Member

Mottie commented Feb 2, 2019

@karolyi Would you please be more specific? What issue are you encountering?

@karolyi
Copy link

karolyi commented Feb 2, 2019

@Mottie No style is applied to the pages, and I can't browse for styles.

@sl1pkn07
Copy link

sl1pkn07 commented Apr 11, 2019

same here with latest chomium 75.0.3753.4 dev channel compiled by me

[47101:47101:0411/192006.364190:INFO:CONSOLE(400)] "Uncaught (in promise) TypeError: Cannot read property 'id' of null", source: chrome-extension://clngdbkpkpeebahjckkjfobafhncgmne/background/style-manager.js (400)

greetings

@narcolepticinsomniac
Copy link
Member

Outdated. If you have any similar issues in the future, open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests