stylus
stylus copied to clipboard
Prevent long-running or invalid regexps from hanging the extension process
Firefox 57 Developers Linux Arch 4.13.4-1 64 I use an extension called Newtab tools, and I was just trying to write a 2 line script to put a border around the thumbnails. More to see just what i could do with this Firefox and i clicked the test regex button to see if i was connecting with his fine extension (I wasn't) and well Firefox went into shit it's pants mode. The mouse started jerking across the screen and this is a pretty fast machine, but it had it locked up pretty good. I was able to slowly get the mouse to the x and clicked it (more than a few time) and it finally let go. Then one more problem came up. After I clicked the X and went to the other tab in the same Firefox the regexp box came back up on its own and got me again. Again i got to the x but this time i also exited the edit window after clicking the x and it went back to normal. I wasn't finding his tab either because it is the Newtab and i didn't set up right or because i am not allowed, i am not sure yet but i had the regexp you use for dark stylus in there and couldn't find it so i slapped his extension URL (below) in there to see WTF i could do and that is what was in the applies to when it happened. Any other info or help you need let me know. Just shout out I follow you gentlemen all day long anyway.
(New Tab Tools URL) moz-extension://4096e022-b056-4690-a80a-8e43b713cd0b/newTab.xhtml
And thank you, all of you, for the mass amount of work you continue to put into this extension.
Sometimes the issue is the regular expression itself, would you please share the one you're using to help us isolate the problem and hopefully prevent this from happening in the future.
If you mean which Stylus that would be 1.1.4.2 and sorry for forgetting that .. Oh and if you mean which regexp that line above "moz-extension://4096e022-b056-4690-a80a-8e43b713cd0b/newTab.xhtml" minus the quotes
Sorry, did you mean this (moz-extension://4096e022-b056-4690-a80a-8e43b713cd0b/newTab.xhtml
) was the regexp used?
lol yes I intended to trim the file name off but got side tracked so it was exactly that above when it happened. The regexp tester said his Newtab didn't match with the shortened moz-extension URL so i was a bit more direct to see what happened ,,, I found out.
The mouse started jerking across the screen and this is a pretty fast machine, but it had it locked up pretty good
Definitely sounds like a bug in Firefox, not just a CPU bottleneck caused by regexp. Unless you have a 1-core CPU.
Oh no i run 2 i7 7700 machines One win 10 one arch I don't think a lesser machine would have gotten the mouse to the x but i don't know. It took me a half a minute to get to the x
Now as a matter of fact, on that machine if i edit the URL the regexp tester keeps coming up. The X only terminates the tester until I touch the URL again. So I assume something went wrong with it.
Still sounds like a bug in Firefox. Do you have 9001 tabs open?
Also, Stylus cannot style other extension's pages. This is a limitation of WebExtension API.
Nope 1 pined and 3 normal, I tend to use multiple different browsers instead of a lot of tabs in one
guess I will have to stumble across a modified version that say routes as me through the userchrome maybe. is that still active in firefox? I got sort of sick of them (mozilla) and took my work to chrome and vivaldi until 57 came out.
I run developers so i don't really care about extensions being signed.
Also since Im coffee'd up... When i pasted the short script i was trying into the editor the edit screen expanded to cover the toggles and words to the left. The script had the regexp line at the top of it and i can confirm it is because of that it did it as i tried it a couple more times to be sure.
I don't follow. Sounds like an import dialog popped up, but how is this related?
no it was the whole edit window. i pasted this (copy paste) try it you will see.
@-moz-document regexp("chrome-extension://."), regexp("moz-extension://.") { .newtab-thumbnail { border-radius: 3px !important; border: 1px solid rgba(255,0,0,1) !important; } }
I clicked write a new script and control-v'd that and the screen popped (expanded) over. I mean the actual editor section. is what i am trying to get across, poorly.
Does it on both linux and windows...
This is the import dialog. So how is this related to the problem?
I don't believe or don't know that it is related, i was just offering it up as something you might want to know about. I do things weird so I am good at finding weird bugs I guess.
The import dialog imports moz-format you paste so you need to click "Overwrite" or "Append" button.
Yes right at that point is where it expands. Hell for all I know that may be intended behavior but it sure did look weird.
I think the pasting behavior is pretty obvious. You paste a moz-format style, which is not supported directly in WebExtension, so Stylus displays an import dialog with two buttons. Anyway, it's not possible to style other extension's pages. Also, I can't reproduce the initial bug. Try a different version of Firefox.
I have been trying to get it to do it again on the windows machine and so far nothing.
As far as the pasting issue (as I call it) goes the edit window expands 2 or 3 inches to the left so it not only pops up the dialog it jumps the edit window out. Just so you all know.
Did you all ever get an irc channel or something like that going? I thought that was a good idea and would save me about 30-50 emails a day lol.
Note to self: investigate if we can off-load all regexp-testing to a worker process in the background page.
Happens too rarely, so we'd better use the occasional reports to help the authors fix their styles rather than enabling them to write bad expressions that run in a worker and still eat a lot of CPU.