quoid / userscripts

An open-source userscript manager for Safari
https://quoid.github.io/userscripts/
GNU General Public License v3.0
3.3k stars 188 forks source link

Catalina Popover Bug #15

Closed quoid closed 5 years ago

quoid commented 5 years ago

From a Reddit comment:

The editor's broken in Catalina at the moment, but if you can populate the JSON in ~/Library/Containers/com.userscripts.macos.Userscripts-Extension/Data/Documents/data.json it works regardless

I am not and won't be on the dev beta, but if any user(s) is on Catalina and check the console of the popover (right click, inspect) to see if that's where the bug is emanating from, it would be appreciated.

billstanden commented 5 years ago

What I'm seeing on 10.15 the editor popover doesn't come up at all.

You get a little faint "arrow" animation under the button (possibly some artefact of it trying to draw the popover) but no actual popover.

Is there anywhere else we can get you a useful log in that instance?

quoid commented 5 years ago

@billstanden, thanks for the report

Is there anywhere else we can get you a useful log in that instance?

Outside of loading the project in Xcode 11 on 10.15, I don't think so. I would imagine there are api changes in 10.15 that are causing the issue.

I will likely be updating to 10.15 shortly after release so the bugs shouldn't be present for long after 10.15 ships. In the meantime, I am not sure I will be able to address the bug, without external help. I was hoping it was an issue with the content within the popover (editor.html) rather than the popover itself.

If anyone does have the Xcode 11 beta, running 10.15 and feels up to loading the project to see what errors pop up, please let us know in this ticket what you encounter.

jocamero commented 5 years ago

I have it cloned and built in Xcode 11. Clicking the icon / button in the built project doesn't seem to do anything. What can I do to help?

If anyone does have the Xcode 11 beta, running 10.15 and feels up to loading the project to see what errors pop up, please let us know in this ticket what you encounter.

quoid commented 5 years ago

I have it cloned and built in Xcode 11. Clicking the icon / button in the built project doesn't seem to do anything. What can I do to help?

I really appreciate this @jocamero, thank you.

The popover isn't opening, and no errors are being thrown?

Could you connect with me over email? justin@k21p.com

quoid commented 5 years ago

@jocamero @billstanden

Crappy image, but is this what happens to the popover when the button is clicked?

Screen Shot 2019-06-06 at 2 10 20 PM
quoid commented 5 years ago

I downloaded Xcode 11 and Safari Technology Preview.

Within Xcode, I saw no new errors and could build/run the extension without issue. It worked as expected in Safari 13 (technology preview). I am running v1.1.0 of the extension though, which has not be released on the app store yet, but I don't think that makes much of a difference.

It seems like nothing radical has changed with the SDK, but I won't anything for sure until it's tested on a Catalina machine.

Screen Shot 2019-06-06 at 3 42 24 PM
jocamero commented 5 years ago

@jocamero @billstanden

Crappy image, but is this what happens to the popover when the button is clicked?

Screen Shot 2019-06-06 at 2 10 20 PM

Yep! That's it.

quoid commented 5 years ago

I was able to install Catalina alongside Mojave and do some testing.

There's certainly some sort of bug, but I am unsure if it's directly related to Userscripts or something more upstream.

From what I can gather the source of the bug lies with the WebKit View. I am fairly certain that the WebKit View is configured properly with this extension so I am at a loss as to why it is causing issues.

As a test, I created a new blank Safari Extension project and did nothing but simply add a WebKit View to the storyboard in the interface builder. I didn't add any outlets nor actions, just place it on the canvas and I got the same error I was getting the Userscripts project.

This leads me to believe that perhaps the bug isn't directly related to Userscripts but something upstream that should be brought to the attention of Apple.

I am open to any suggestions anyone has.

Screenshot below of what I am seeing

Screen Shot 2019-06-09 at 5 28 08 PM
libobjc.A.dylib`objc_release:
    0x7fff6bdf8a50 <+0>:   testq  %rdi, %rdi
    0x7fff6bdf8a53 <+3>:   je     0x7fff6bdf8ab9            ; <+105>
    0x7fff6bdf8a55 <+5>:   testb  $0x1, %dil
    0x7fff6bdf8a59 <+9>:   jne    0x7fff6bdf8ab9            ; <+105>
    0x7fff6bdf8a5b <+11>:  movabsq $0x7ffffffffff8, %rax     ; imm = 0x7FFFFFFFFFF8 
    0x7fff6bdf8a65 <+21>:  andq   (%rdi), %rax
->  0x7fff6bdf8a68 <+24>:  testb  $0x4, 0x20(%rax)
    0x7fff6bdf8a6c <+28>:  je     0x7fff6bdf8ad7            ; <+135>
    0x7fff6bdf8a6e <+30>:  movabsq $0x100000000000000, %rcx  ; imm = 0x100000000000000 
    0x7fff6bdf8a78 <+40>:  movabsq $0x40000000000000, %rdx   ; imm = 0x40000000000000 
    0x7fff6bdf8a82 <+50>:  movq   (%rdi), %rax
    0x7fff6bdf8a85 <+53>:  testb  $0x1, %al
    0x7fff6bdf8a87 <+55>:  je     0x7fff6bdf8ac7            ; <+119>
    0x7fff6bdf8a89 <+57>:  movq   %rax, %rsi
    0x7fff6bdf8a8c <+60>:  subq   %rcx, %rsi
    0x7fff6bdf8a8f <+63>:  jae    0x7fff6bdf8ab2            ; <+98>
    0x7fff6bdf8a91 <+65>:  btq    $0x37, %rax
    0x7fff6bdf8a96 <+70>:  jb     0x7fff6bdf8ae4            ; <+148>
    0x7fff6bdf8a98 <+72>:  btq    $0x36, %rax
    0x7fff6bdf8a9d <+77>:  jb     0x7fff6be11b8c            ; objc_object::overrelease_error()
    0x7fff6bdf8aa3 <+83>:  movq   %rax, %rsi
    0x7fff6bdf8aa6 <+86>:  orq    %rdx, %rsi
    0x7fff6bdf8aa9 <+89>:  lock   
    0x7fff6bdf8aaa <+90>:  cmpxchgq %rsi, (%rdi)
    0x7fff6bdf8aae <+94>:  jne    0x7fff6bdf8a82            ; <+50>
    0x7fff6bdf8ab0 <+96>:  jmp    0x7fff6bdf8aba            ; <+106>
    0x7fff6bdf8ab2 <+98>:  lock   
    0x7fff6bdf8ab3 <+99>:  cmpxchgq %rsi, (%rdi)
    0x7fff6bdf8ab7 <+103>: jne    0x7fff6bdf8a82            ; <+50>
    0x7fff6bdf8ab9 <+105>: retq   
    0x7fff6bdf8aba <+106>: movq   0x2eb2b42f(%rip), %rsi    ; "dealloc"
    0x7fff6bdf8ac1 <+113>: jmpq   *0x2eb295a9(%rip)         ; (void *)0x00007fff6bdf6d40: objc_msgSend
    0x7fff6bdf8ac7 <+119>: testb  $0x1, 0x1c(%rax)
    0x7fff6bdf8acb <+123>: jne    0x7fff6bdf8ab9            ; <+105>
    0x7fff6bdf8acd <+125>: movl   $0x1, %esi
    0x7fff6bdf8ad2 <+130>: jmp    0x7fff6bdfdb1e            ; objc_object::sidetable_release(bool)
    0x7fff6bdf8ad7 <+135>: movq   0x2eb2b342(%rip), %rsi    ; "release"
    0x7fff6bdf8ade <+142>: jmpq   *0x2eb2958c(%rip)         ; (void *)0x00007fff6bdf6d40: objc_msgSend
    0x7fff6bdf8ae4 <+148>: movl   $0x1, %esi
    0x7fff6bdf8ae9 <+153>: jmp    0x7fff6bdfde36            ; objc_object::rootRelease_underflow(bool)
    0x7fff6bdf8aee <+158>: nop    
    0x7fff6bdf8aef <+159>: nop    
    0x7fff6bdf8af0 <+160>: nop    
    0x7fff6bdf8af1 <+161>: nop    
    0x7fff6bdf8af2 <+162>: nop    
    0x7fff6bdf8af3 <+163>: nop    
gingerbeardman commented 5 years ago

I was able to install Catalina alongside Mojave and do some testing.

Any gotchas? I should do this

quoid commented 5 years ago

Any gotchas? I should do this

Other than additional drive space, I haven't yet encountered any. It seems very similar to dual booting or using boot camp, except that you can share files and apps between the installations. I'm able to open apps/files installed on my Mojave volume from the Catalina volume, but settings from Mojave don't seem to be carried over across volumes. For example, my terminal settings on the Mojave volume are not present on the Catalina volume. This was the same for Xcode - opening it on the Catalina side was like opening it for the first time.

I attached some images of what my drive looks like post-installation:

Screen Shot 2019-06-10 at 9 09 15 AM Screen Shot 2019-06-10 at 9 08 35 AM
gingerbeardman commented 5 years ago

Thank you!

billstanden commented 5 years ago

1.1.0 was just pushed out to me via the App Store. Unfortunately it doesn't appear to resolve the issue on Catalina.

Still works great if you just work against the json file directly though.

quoid commented 5 years ago

@billstanden Thank you for the update

I am waiting to hear back from Apple about my bug report, hopefully they can shed light on why WebKit Views are breaking extension popovers.

quoid commented 5 years ago

It seems like this bug is still present in Catalina Beta 3 - still no word from Apple.

If anyone can verify on their own system, here's a sample project file. Make sure to "Allow Unsigned Extensions" in Safari, or the extension wont show up.

testExt.zip

quoid commented 5 years ago

I did some testing this weekend - if I create the WebKit View programmatically rather than through the Interface Builder, the extension does not crash and the popover shows as expected.

I will fix this issue in v1.3.0 😄 🎉🎊

quoid commented 5 years ago

v1.3.0 has been submitted to Apple, if all goes well, the update should be pushed to users soon.

As mentioned above, it seems using a different implementation method for the WKWebView resolved the issue of the popover not being displayed in Catalina. For my testing, I used Catalina beta build 4, I do not know if the same results can been seen is earlier builds.

I am going to leave this issue up for a little bit, if anyone using the Catalina beta can verify the fix on their machines, I would greatly appreciate it!

billstanden commented 5 years ago

Just had 1.3.0 pushed out to my machine, working perfectly now in Catalina 19A512f.

quoid commented 5 years ago

Thanks for letting me know @billstanden !

quoid commented 5 years ago

I've had confirmations from other users that, right now, the extension is functioning as intended in current Catalina builds.

I'm going to close this issue and make new ones if compatibility issues spring up in the future.

@billstanden @jocamero @gingerbeardman thank you for the help on this!

gingerbeardman commented 5 years ago

Keep up the great work!