Comments (7)
Yes, beastify does not currently work in Firefox due to some bugs, so I omitted the "applications" key (otherwise, since Google Chrome doesn't like the "applications" key, it would not be installable anywhere!). I should have noted this, but I hadn't really expected anyone to stumble on this one. I have now updated the README: https://github.com/mdn/webextensions-examples/blob/master/README.md.
Once the Firefox bugs are fixed, I'll add the "applications" key back and close this bug.
Thanks for trying it out!
from webextensions-examples.
The documentation should also explicitly mention that the "id" needs to be in an email format.
"applications": {
"gecko": {
"id": "[email protected]"
}
}
I did find a reference here, but it took a lot of link clicking to get there.
Also, on this page, the following comment should mention that the key is mandatory and again, that the id should be in an email format:
The next key, "applications", contains Firefox-specific information.
Thanks!
from webextensions-examples.
Beastify now installs, but it doesn't work. I get
TypeError: tab is null (ext-tabs.js:442:13)
Is this expected?
from webextensions-examples.
Is this expected?
Yes! There are at least 2 issues that stop it from working in current Nightlies. This is noted in my comment upthread and in the docs for these examples: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Examples.
from webextensions-examples.
'tab' problem could easily be fixed if you replace 'currentWindow' key in 'chrome.tabs.query' method with 'lastFocusedWindow'. Also you should add 'tabs' permissions in manifest. Nevertheless I still couldn't successfully run it. I believe there are still problems with obtaining web accessible resources. I am developing extension of my own and I face problems with 'chrome.extension.getURL'. I simply can't find workaround to access extension resources from content.
from webextensions-examples.
'tab' problem could easily be fixed if you replace 'currentWindow' key
in 'chrome.tabs.query' method with 'lastFocusedWindow'.
I don't think so. I think this "tab is null" error is because we were omitting the first argument to "tabs.executeScript" [1]. According to the Chrome docs, if you omit this, you execute the script in the current tab [2]. This does not work on Firefox [3]. The workaround is to pass null instead of just omitting that argument. Since the workaround is a simple one, and the code seems less magical that way anyway, I just updated the example to do that.
However, the next bug is that Firefox doesn't support the "callback" argument to executeScript [4]. I'm using this so I know that the content script has executed (and therefore that message listeners have been added) before I try to send a message to the content script.
Actually, I don't know if this is needed, or if I can just send messages right after calling executeScript. I have tried sending messages right after executeScript, and it works, but I don't know if it just happens to work in my case, or if it is generally a safe thing to do (for example: if the API queues messages until the script has executed. But that sounds kind of unlikely). If it is needed, then it's hard to fix this example without bug 1210583 being fixed, so the example is kind of in limbo.
I believe there are still problems with obtaining web accessible resources.
One problem that would affect this example is that wildcards in web_accessible_resources don't work [5]. If you list all the resources explicitly, then it should work. But that would not be a natural way to write an add-on like this, so I don't want to make that change, and would prefer to wait for the bug fix.
Also you should add 'tabs' permissions in manifest.
Are you sure about that? It works fine in Chrome as it is, without "tabs". And I don't see any permission problems in Firefox either. I thought specifying a host (or every host, in this case :) ) gave you permission to use executeScript? What I really ought to do here is use "activeTab" instead of requesting access to every host in the world, but I can't, because Firefox does not yet support the activeTab permission[6].
I am developing extension of my own and I face problems with 'chrome.extension.getURL'
What problem? It works for me. It didn't work a few weeks ago, but seems to be fixed in current Nightlies.
[1] https://github.com/mdn/webextensions-examples/blob/master/beastify/popup/choose_beast.js#L22 - but note that I've just updated this to pass "null".
[2] https://developer.chrome.com/extensions/tabs#method-executeScript
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1208257
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=1210583
[5] https://bugzilla.mozilla.org/show_bug.cgi?id=1217944
[6] https://bugzilla.mozilla.org/show_bug.cgi?id=1190688
from webextensions-examples.
OK, so I've had it confirmed that the callback stuff is not needed, so I made the other changes and this add-on ought to work in Firefox Nightly now.
from webextensions-examples.
Related Issues (20)
- Favourite Color bug manifest HOT 11
- Native messaging example doesn't pong after a while HOT 3
- browser is not defined in firefox HOT 3
- Can't get response in Ubuntu HOT 10
- Python Native Messaging host does not process 1MB input HOT 11
- Image is not loading by innerHTML in the content-script-register HOT 3
- Create an example of getting select text to a variable HOT 2
- Please add example for "Paste text from clipboard" HOT 5
- examples.json should include a way to list significant manifest keys
- Update eslint, fix linting errors and integrate in CI
- MV3 example for getting data from page/content script/activeTab context into action / popup HOT 3
- Broken root-cert-stats due to var -> let change HOT 6
- Firefox Load temporary addon not working HOT 12
- native-messaging app example: provide non-contrived example for each platform HOT 1
- Update root-cert-stats to use runtime.sendMessage HOT 3
- zip does not contain a valid manifest HOT 2
- Examples disabled when run via web-ext or from folder (applyCSS, borderify) HOT 9
- minor bug with native messaging example HOT 2
- native messaging example: port disconnects without an error HOT 14
- devtools-panels example broken with manifest v3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webextensions-examples.