Was ExtensionSidebarPane broken in Chrome 92 upgrade? - google-chrome-extension

I released a Chrome DevTools extension a couple years ago that uses
chrome.devtools.panels.elements.createSidebarPane(title, callback)
to add an ExtensionSidebarPane. This worked fine until Chrome 92. Now the Pane is created with the title, but it is blank.
The calls I am using are still documented: https://developer.chrome.com/docs/extensions/reference/devtools_panels/, but the example code that I used has been moved to into the mv2-archive section of the google-extension-samples repo. And the chrome-query example code no longer works either. So maybe that means it is unsupported now. On the other hand, everything I have found so far seems to say v2 should be supported to the end of 2021. And I haven't found any alternative v3 examples of adding info to the devtools UI.
Obviously createSidebarPane is getting called, because the blank pane is created with the expected title. And intentionally throwing an error in the callback shows that it is getting called with the expected ExtensionSidebarPane object as a parameter, it's just that calling setExpression or setObject on it doesn't do anything. I am not seeing any other errors or warnings.
I would hate to retire my extension, since I know people use it, but I am not sure what else to try.

Related

NSProgressIndicator built-in animation raises CA_ASSERT_MAIN_THREAD_TRANSACTIONS

This looks like a bug in either NSProgressIndicator or Xcode 9 to me:
Run Xcode 9 Beta 1 or Beta 4, in macOS 10.12.6.
File > New Project, macOS, Cocoa app, Objective-C or Swift, ARC or not, no storyboards, latest (10.13) SDK.
In the app target's environment, set CA_ASSERT_MAIN_THREAD_TRANSACTIONS=1.
In app delegate, add a IBOutlet progressIndicator.
In the nib, add a NSProgressIndicator to the window, connect to that outlet. Leave the checkbox Indeterminate switched on.
In -applicationDidFinishLaunching, call -startAnimation: on progressIndicator.
Build and run.
Expected Result:
Progress indicator should happily show indeterminate progress, because I did everything on the main thread.
Actual Result:
App crashes, citing CA_ASSERT_MAIN_THREAD_TRANSACTIONS, when
-startAnimation: is called.
You can see this in a tiny demo project.
Did I do anything wrong? Is my Expected Result incorrect?
P.S. I asked this on Apple's Developer Forums, but still awaiting moderator approval after 2 working days, so I deleted it and came here instead :(
Update: Still lacking an explanation, I filed Apple Bug 33593575.
This was a bug in NSProgressIndicator. Your bug report (thank you for filing!) was marked as a duplicate of an earlier bug, which was already resolved in macOS 10.13.

Make Greasemonkey throw error on undefined variable

I've recently switched from chrome to firefox for greasemonkey development. I have some problems with debugging.
The following func
I meant to write:
self = this;
but instead I wrote
this=self;
Self wasn't defined, so the script didn't run, however, nor did I get any javascript error. Why and can I get them somehow? I get some errors.
Unfortunately, Greasemonkey - and javascript in general, along with at least a few other non-compiled languages - do not give very good debugging errors... I can't count the number of times it tells me there is a missing ) at the end of an argument list that doesn't exist, and it turns out my error is elsewhere...
When a script of mine won't run I add an alert after any value assignments and if they don't alert or alert the wrong data I have found the problem... for your example above I would debug by:
this=self;
alert(self);
Although I would probably see the problem when I went to add the alert, but if I didn't notice - the alert either wouldn't pop up or it would have the wrong value... and if it didn't pop up, the error console would likely say self not defined.

Issue with basic AS3 workers classes

I have followed Lee Brimelow's tutorials (part 1, part 2), but somehow my project doesn't work as expected.
Currently, publishing "src/Secondary.as" to "www/assets/swf/secondary.swf" works properly, however when trying to run "src/Main.as", an error shows up:
Exception fault: TypeError: Error #1007: Instantiation attempted on a non-constructor.
at Main/init()[/Volumes/DOCUMENTS/Tests/AS3/test-workers/src/Main.as:52]
at Main()[/Volumes/DOCUMENTS/Tests/AS3/test-workers/src/Main.as:32]
If anybody has time, you can look at my code on Github and maybe see where I screwed up? Thanks a bunch!
As your error message says: the problem raised in Line 52 in your Main.init()method. What you try to do there is to create a new instance of SecondarySWF. I would say that your embedment of Secondary class into SecondarySWF doesn't work properly, so it is not available in your init-method. You should set a breakpoint at the first line of your init-method and when the debugger reaches this point check what's in SecondarySWF. I expect that there's nothing in that variable, so what your new SecondarySWF() then means actually is new null().
Because you embed your secondary.swf with a MIME-type specified the Flex compiler ignores it because it is unable to detect the actual type of data in the loaded file. I found this post on Adobe's cookbook page that explains what you have to do in addition to adding the file using [Embed]. Hope this will fit your needs.

Overriding PromptService in newer XULRunner

Our application uses embedded xulrunner. We override the default PromptService to provide custom dialogs for alert, prompt, etc by
componentRegistrar.RegisterFactory (PROMPTSERVICE_CID, aClassName, aContractID, MyPromptServiceFactory);
where,
PROMPTSERVICE_CID is "a2112d6a-0e28-421f-b46a-25c0b308cbd0"
CONTRACT_ID is "#mozilla.org/embedcomp/prompt-service;1"
When using XULRunner 1.9.* versions, this works perfectly and the call comes to MyPromptSerivceFactory. But, this doesn't work on newer XULRunner versions (>= 4.0)
I have modified the PROMPTSERVICE_CID to "7ad1b327-6dfa-46ec-9234-f2a620ea7e00" (copied from nsPrompter.manifest). While registering the factory I get the error NS_ERROR_FACTORY_EXISTS.
If I continue to use the old PROMPTSERVICE_CID, then nsIPromptService2 is not used instead nsIWindowCreator2.CreateChromeWindow2 is used to display alerts and prompts.
I have googled on this, but I couldn't find a solution to either fix the NS_ERROR_FACTORY_EXISTS error or for MyPromptServiceFactory to be used.
Any help/suggestions?
It would probably be better to use the existing prompt service the way Firefox does it rather than replace it. If you look at nsPrompter.openPrompt(), before opening a modal dialog it will try to locate and call a JavaScript function getTabModalPrompt() in the window containing the browser. It expects to get a promptBox element back and will call methods appendPrompt() and removePrompt() on it. Obviously, you don't have to give it a promptBox element, just something that behaves similarly - and displays a message any way you like.
But if you really want to replace system components, you shouldn't duplicate prompter's CID - use your own one but #mozilla.org/prompter;1 as contract ID (the old contract ID is for backwards compatibility only).

Method for Debugging Userscripts in Chrome

I've attempted to make some modifications to a userscript to enable it to work under Chrome, but when I drag it into Chrome's window in order to install it, a dialog pops up and says 'Invalid Script Header'.
I've tried to use the Developer Tools, and built-in Javascript Console, to debug any errors occurring, but nothing appears to list any information.
Console.app does not list anything meaningful, except for the same error message I already know.
[0x0-0x2d02d].com.google.Chrome: [346:1547:16686819618022:ERROR:extension_error_reporter.cc(55)] Extension error: Invalid script header.
How can I reasonably debug this error message and figure out what about the header is incorrect?
I'm using Chrome 15.0.861.0 on the dev channel, under OS 10.7 Lion.
I finally stumbled across the answer to this question, amusingly via a Chromium Bug Report.
As it turns out, the answer to my question was in the (significantly brief) Userscript Documentation for Chrome page.
With Greasemonkey-style #include rules, it is not possible for Chrome to know for certain the domains a script will run on (because google.* can also run on google.evil.com). Because of this, Chrome just tells users that these scripts will run on all domains, which is sometimes scarier than necessary. With #match, Chrome will tell users the correct set of domains a user script will run on.
As it turns out, I had been using #match http://*musicbrainz.org in an attempt to match www.musicbrainz.org as well as musicbrainz.org, but per the quoted text, that doesn't save you from accidentally matching evilmusicbrainz.org. So, my solution was to use two lines:
#match http://*.musicbrainz.org
#match http://musicbrainz.org
Type:
debugger;
Somewhere in the code, and the Web Inspector will pop up in that location. I have answered similar question here Chrome debugger inject javascript
I figured out while I got the same error message ( INVALID SCRIPT HEADER ) that it accoured cause of a typo between the // ==UserScript== Header info.
wronge line
// #run-at document.end
corrected line
// #run-at document-end

Resources