Closed Bug 736113 Opened 12 years ago Closed 12 years ago

Can't get camera stream when camera app served from subdomain

Categories

(Firefox OS Graveyard :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: benfrancis, Assigned: fabrice)

Details

Attachments

(1 file)

I set up my desktop PC to serve each Gaia app from its own subdomain and then set homescreen.gaiamobile.org as the homescreen on the device so it fetches apps over Wifi.

When the camera app is served from camera.gaiamobile.org and I start the app from homescreen.gaiamobile.org it fails to get a video stream and I see the following output in logcat:

E/GeckoConsole( 3122): [JavaScript Error: "uncaught exception: [Exception... "'[JavaScript Error: "from is not defined" {file: "jar:file:///system/b2g/omni.ja!/components/CameraContent.js" line: 65}]' when calling method: [nsIDOMGlobalPropertyInitializer::init]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: http://camera.gaiamobile.org/js/camera.js :: camera_setSource :: line 60"  data: yes]"]
E/GeckoConsole( 3122): [JavaScript Warning: "Invalid URI. Load of media resource  failed." {file: "http://camera.gaiamobile.org/camera.html" line: 0}]
E/GeckoConsole( 3122): [JavaScript Error: "label is null" {file: "chrome://global/content/bindings/videocontrols.xml" line: 684}]
> When the camera app is served from camera.gaiamobile.org and I start the app from homescreen.gaiamobile.org it fails to get a video stream and I see the following output in logcat:

Just to be clear, you mean the homescreen is served from homescreen.gaiamobile.org?
(In reply to Chris Jones [:cjones] [:warhammer] from comment #1)
> > When the camera app is served from camera.gaiamobile.org and I start the app from homescreen.gaiamobile.org it fails to get a video stream and I see the following output in logcat:
> 
> Just to be clear, you mean the homescreen is served from
> homescreen.gaiamobile.org?

Yes that's correct. The homescreen is served from homescreen.gaiamobile.org and the camera is served from camera.gaiamobile.org

Fabrice has looked into this and it turns out that we need to add permission for the subdomain using the permissions manager in shell.js, I was only aware of the whitelist prefs. He said there was also another minor thing that needed fixing to close this bug.

We're currently using two different mechanisms for giving permissions - prefs and the existing permissions DB, Fabrice thinks we should use the permissions DB for everything.
Attached patch patchSplinter Review
This patch just fixes the error that Ben saw. I'd prefer to have a follow-up dealing with a sane way to set up permissions for default apps in their subdomains.
Assignee: nobody → fabrice
Attachment #606410 - Flags: review?(21)
Comment on attachment 606410 [details] [diff] [review]
patch

>diff --git a/b2g/components/CameraContent.js b/b2g/components/CameraContent.js
>@@ -62,7 +62,7 @@ CameraContent.prototype = {
>     let perm = principal == secMan.getSystemPrincipal() ? Ci.nsIPermissionManager.ALLOW_ACTION : Services.perms.testExactPermission(principal.URI, "content-camera");
> 
>     //only pages with perm set and chrome pages can use the camera in content
>-    this.hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION || from.schemeIs("chrome");
>+    this.hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;

uh. I guess this is because |from| is undefined.
Attachment #606410 - Flags: review?(21) → review+
https://hg.mozilla.org/mozilla-central/rev/9b7eb2c85266
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: