Presentation Screenshots Download Support Development Forum    
   

Welcome to the Community Forum.

Here you can discuss with other users or with the author, suggest new features, report bugs, ask for filters creation or correction, etc. Select the forum you wish to read or post below :

Forum
Forum > Development & Bug report > ASF makes saving impossible with e10s (Aurora 42+)

Pages : [1] Add a reply
User info ASF makes saving impossible with e10s (Aurora 42+)
ssokolow
Avatar
Aug 18 2015, 10:12 pm
With ASF enabled at the same time as e10s (multi-process Firefox), which is now default in both Nightly and Developer Edition, any attempt to call up a save dialog (Ctrl+C, "Save Page As...", etc.) will fail with the following error in the browser console:

TypeError: mainWindow.gBrowser.docShell is null
line 134 in chrome://asf/content/asf_right_click.js
Post #1
Edit
aldago
Avatar
Aug 25 2015, 11:00 am
You can edit that file (in your profile, extensions, open asf.xpi with any zip utility) and comment that line (add "//" at the beginning of the line) as long as you don't care about the private mode.

Anyway, the extension should stop working in the next official version of FF, as it won't be possible to use unsigned extensions
Post #2
Edit
aldago
Avatar
Aug 25 2015, 12:25 pm
This should work as a full fix without losing functionality:

try
{
var pbs = Components.classes["@mozilla.org/privatebrowsing;1"]
.getService(Components.interfaces.nsIPrivateBrowsingService);
this.inPrivateBrowsing = pbs.privateBrowsingEnabled;
}
catch(e) // FF21+
{
try{
this.inPrivateBrowsing = mainWindow.gBrowser.docShell.QueryInterface(Components.interfaces.nsILoadContext).usePrivateBrowsing;
}
catch(e) // FF42+
{
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
this.inPrivateBrowsing = PrivateBrowsingUtils.privacyContextFromWindow(mainWindow).usePrivateBrowsing;
}
}
Post #3
Edit
gimmathis
Avatar
Oct 18 2015, 9:54 am
thanks for the fix!
Post #4
Edit
Cyan
Avatar
Feb 13 2016, 7:14 pm
Your issue wasn't related to e10s, but to the private browsing detection.
I released 1.0.5b129 on mozilla, it should work up to Firefox 46 (or even 48).


About the e10s (not the private browsing issue):
e10s use a new method to communicate between the functions and the browser's content.

I've tried to update the addon to detect e10s and use the new communication method but I couldn't fix it yet.
For the moment, Firefox is switching all the addons to compatible mode (setting "compatible with e10s" to false) so it will still work even if it's not updated for e10s.
Later, mozilla plan to set the e10s compatibility switch to ON by default and addons will have to specifically set it to false to continue working.
It's not an issue yet, so you can install and use Automatic Save Folder with latest Aurora/nightly/dev builds.

Edit:
I looked at how e10s works, and it requires Asynch communication with all processes.
I don't know how to make ASF compatible with Asynch. If I add a loop until I receive the data back from the content window, firefox freezes.
Post #5
Edit
Cyan
Avatar
Feb 15 2016, 9:33 am
I thought of a way to add e10s support (asynch functions to retrieve data from the content window).

Currently, two variables are affected:
read of : URI located in the current tab's address bar
read of : current tab's page referrer


The current URI could use a different retrieving method, but the referrer is unfortunately only available from the window.content data and will require an asynch function to get its value.
The way I'm thinking adding it to prevent blocking the interface is to run the asynch function before running the "main()" function, save the data in global score, and the callback will run main().

I don't know how long it will take before the data is retrieved and main() is launched. It might takes few miliseconds to process.
It shouldn't be an issue for the "left click" mode, but it might be with the "right click" mode as the file picker might open before ASF has run its functions due to asynch delayed functions.

I will try and hope my idea can be done, as I don't see another way to do it.
Post #6
Edit
V@no
Avatar
Feb 29 2016, 6:36 am
One way work with e10s and async is to split code into functions or even maybe use observers (which basically the same thing)

You've said about trying use loops and wait for the data to arrive, using the same principal, split the code into separate functions (function A would be part before your proposed loop and function B with the code when the data arrived) if async required, then execute function A and execute the async with function B as callback, otherwise execute function A then B.
Post #7
Edit
millzmer
Avatar
Mar 10 2016, 8:10 pm
cool, thanks for doing latest work. :)
Post #8
Edit
Cyan
Avatar
Mar 20 2016, 2:33 pm
I split the code and used a frame-script to load data from the current tab's content and continue execution to check the filters.

It's now working with the "left-click" download method, even if there are warning and strange logs in the console.
I still have to port it to right-click download method, and to the filter list menu when opened from the "left-click" window prompt as it reads the current tab's information to highlight the filters with the correct color.



issues I found for the moment are:
1- there's no way to check if the user has a e10s compatible browser.
There's the "browser.tabs.remote.autostart" preference, but if the user set it on FF40+ and launch an old browser version, it will still be marked as enabled even if e10s is not possible.


2- the "window.sizeToContent();" bug is back on e10s
calling this doesn't resize the window anymore if it was already called once while not needed. the workaround I used until now seems broken now.
Mozilla still haven't fix that bug since firefox 3 !
https://bugzilla.mozilla.org/show_bug.cgi?id=439323

3- frame-scrpt is not auto-unloaded:
The asynch frame event listener seems to be reinstalled at each file download.
as a result the async is triggered multiple times, triggering a filter check command while not needed anymore. once is enough.
I don't know why the async message doesn't trigger only once, it's said that "If the same listener registers twice for the same message, the second registration is ignored." but it seems it still does. maybe a firefox bug?
I added a message unregister command for now, it seems to be a working solution.


4- console window has this error :
Sending message that cannot be cloned. Are you trying to send an XPCOM object?1 frame-script.js:5:1

and here is my framescript, I don't see what could be wrong to trigger that message.
Also, I often get "undefined" in returned values, maybe due to async and lost information between page load and file download event.

Quote :
// Frame script
function getPageInfo()
{
console.log("ASF:message triggered");
sendAsyncMessage("asf@mangaheart.org:page-info-loaded", {
pageLocation : content.document.location,
pageReferrer : content.document.referrer
});
}
console.log("ASF:frame installed");
addMessageListener("asf@mangaheart.org:get-page-info", getPageInfo);




All this async is hard for me to understand.
It works better with e10s disabled and logical step by step events.
I don't know if I can really fix the addon to work async, I can just mark it as incompatible and it will use sync events instead. but I don't know when mozilla will enforced users to use e10s addons.
Post #9
Edit / Delete
Pages : [1] Add a reply

Return to top