Closed
Bug 1315547
Opened 8 years ago
Closed 7 years ago
require() is broken in fennec 50 beta if called from process script
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: m_khvoinitsky, Unassigned)
References
Details
Attachments
(1 file)
1.92 KB,
application/x-xpinstall
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
Build ID: 20161104030521
Steps to reproduce:
Trying to require() something from add-on's process script this way:
const { require } = Components.utils.import('resource://gre/modules/commonjs/toolkit/require.js', {});
const events = require("sdk/system/events");
causes NS_NOINTERFACE exception (see full traceback here: https://git.io/vX4X5 )
I'm talking about this process scripts: https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Message_Manager/Process_scripts
Same code in desktop firefox just warns that "Use of nsIFile in content process is deprecated"
Reporter | ||
Comment 1•8 years ago
|
||
Attached a demo.
Reporter | ||
Comment 2•8 years ago
|
||
Just want to emphasize one thing.
This bug breaks my add-on ( https://addons.mozilla.org/en-US/firefox/addon/dark-background-light-text/ ) in the next version of Firefox for Android which is scheduled to Nov 15. It have over 7k users on android (not the top one but still).
My current implementation (having require() inside a process script) is not the best one and have it own drawbacks (for details, see https://discourse.mozilla-community.org/t/using-add-on-sdk-modules-outside-of-add-on-sdk/10754 ), I really need to rewrite it. The only reasonable way is to rewrite it as webextension. However, I need at least embedded webextensions support which will only be available in 51. Anyway, it will take significantly more than 8 days.
So, I really need this to be fixed.
Thank you in advance.
Comment 3•8 years ago
|
||
Kris, do you have an idea why the SDK starts balking on this in Firefox (for Android) 50?
Flags: needinfo?(kmaglione+bmo)
looks like the use of zipcache was introduced as part of bug 1309350
Blocks: 1309350
Comment 5•8 years ago
|
||
I suppose there's probably a jar inside a jar involved somewhere that's causing the lookup to fail.
Flags: needinfo?(kmaglione+bmo)
Updated•8 years ago
|
Flags: needinfo?(sescalante)
Updated•8 years ago
|
Flags: needinfo?(sescalante)
Comment 6•8 years ago
|
||
I suspect that this is one of those cases of the loader trying to be especially clever and filter out its own stack frames from the error, and hiding the actual cause. The require calls before that all succeed. There's also a weird frame for the console global getter where it makes no sense, which kind of supports that idea.
Your process script doesn't fail until it tries to require 'sdk/system/xul-app'. There's a good chance the actual failure is from where that script tries to include './xul-app.jsm'. But either way, it's hard to make much from the existing data.
Reporter | ||
Comment 7•8 years ago
|
||
I've just tried to require() some internal add-on module which doesn't have any sdk dependency and it's works. But sdk modules (I've tried at least sdk/timers, sdk/system/events) aren't.
Reporter | ||
Comment 8•8 years ago
|
||
I was suggested to use SDK's remote/parent instead of loadProcessScript. I've tested and the bug is not reproduced.
Thank all of you and The 8472 for the suggestion.
Reporter | ||
Updated•7 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Assignee | ||
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•