Closed Bug 1195372 Opened 9 years ago Closed 9 years ago

[e10s] Some XPCOM services don't work on pages with custom protocol scheme (e.g. nsIProperties, nsIDirectoryService, nsIPrefBranch)

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: nodaguti, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Build ID: 20150816091433

Steps to reproduce:

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:43.0) Gecko/20100101 Firefox/43.0
Build ID: 20150816091433
E10s: Enabled

I registered a custom scheme using nsIProtocolHandler from my frame script so that it will work in the e10s mode, but some XPCOM scripts does not work on the custom scheme pages. For example,

- Any attempt to get directory locations, such as using nsIDirectoryService (`Services.dirsvc.get()`) and OSFile.jsm (`OS.Constants.Path.profileDir`), are always failed.
- Access to nsIPrincipal.origin is failed with the following error message:
   NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIPrincipal.origin]
- Access to nsIPrefBranch.prefIsLocked is failed with the following error message:
   NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIPrefBranch.prefIsLocked]

The problems are never happened in the non-e10s environment.

Steps to reproduce:
1. Download the attachment archive and unzip it.
2. Open the Firefox Developer Toolbox Options and turn "Enable browser chrome and add-on debugging toolboxes" on.
3. Open the Browser Console.
4. Run the below code in the console to register foobar: scheme.
   Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIFrameScriptLoader).loadFrameScript('file:///path/to/frame.js?' + Date.now(), false);
5. Enter "foobar://test/" in the location bar and press the Enter key.
6. Run the below code in the console to try to get directory locations.
   Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIFrameScriptLoader).loadFrameScript('file:///path/to/path.js?' + Date.now(), false);

I'm not sure there is a bug in Firefox, or just I made some mistakes on my scripts.
I saw bug 940206 comment 22 as a reference to write the frame script.


Actual results:

In step 4, "I'll be careful, I promise!" button is broken and the following error messages are shown in the browser console.

NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIProperties.get] XULStore.js:66:0
NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIPrincipal.origin] SessionStorage.jsm:78:0
NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIPrefBranch.prefIsLocked] config.js:292:0

In step 6, no pathes can be obtained on foobar://test/ page.
Something like "[foobar://test/][osfile.jsm] profileDir: undefined" will be shown in the console.


Expected results:

In step 4, every elements in about:config page works correctly with no errors.
In step 6, all pathes can be obtained even on foobar://test/ page,
showing log messages like "[foobar://test/][osfile.jsm] profileDir: /path/to/profiledir.default" in the console.
Sorry for the confusing report.

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0 is a fake User Agent.
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:43.0) Gecko/20100101 Firefox/43.0 is the actual one.
OS: Unspecified → Mac OS X
Hardware: Unspecified → x86_64
OS: Mac OS X → Unspecified
Hardware: x86_64 → Unspecified
Summary: [e10s] nsIDirectoryService does not work on pages with custom protocol scheme → [e10s] Some XPCOM services don't work on pages with custom protocol scheme (e.g. nsIProperties, nsIDirectoryService, nsIPrefBranch)
Component: Untriaged → XPCOM
Product: Firefox → Core
Blocks: e10s
(In reply to nodaguti from comment #0)
> Created attachment 8648778 [details]
> scripts_for_reproduce.zip
> 
> User Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
> Build ID: 20150816091433
> 
> Steps to reproduce:
> 
> User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:43.0)
> Gecko/20100101 Firefox/43.0
> Build ID: 20150816091433
> E10s: Enabled
> 
> I registered a custom scheme using nsIProtocolHandler from my frame script
> so that it will work in the e10s mode, but some XPCOM scripts does not work
> on the custom scheme pages. For example,
> 
> - Any attempt to get directory locations, such as using nsIDirectoryService
> (`Services.dirsvc.get()`) and OSFile.jsm (`OS.Constants.Path.profileDir`),
> are always failed.
> - Access to nsIPrincipal.origin is failed with the following error message:
>    NS_ERROR_FAILURE: Component returned failure code: 0x80004005
> (NS_ERROR_FAILURE) [nsIPrincipal.origin]
> - Access to nsIPrefBranch.prefIsLocked is failed with the following error
> message:
>    NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111
> (NS_ERROR_NOT_AVAILABLE) [nsIPrefBranch.prefIsLocked]

This is expected, access to the file system isn't allows due to content sandbox policy.

If you want to access the file system you'll have to do it from the browser process.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: