Closed Bug 510523 Opened 15 years ago Closed 15 years ago

Checking "Remember for this site" stops prompt from working on file:// URIs

Categories

(Core :: DOM: Geolocation, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: mmcnicklebugs, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2a2pre) Gecko/20090814 Minefield/3.6a2pre

If you check the "Remember for this site" checkbox on the geolocation prompt for a file:// URI, clicking the "Share Location" or "Don't Share" buttons does nothing.

Reproducible: Always

Steps to Reproduce:
1. Open a file that requests the use of geolocation.
2. Click the "Remember for this site" checkbox on the prompt
3. Click either of the action buttons on the prompt.
Actual Results:  
The buttons click but don't submit the prompt.

Expected Results:  
The prompt should disappear and the preference to remember the decision should be stored.

Error console output on clicking the buttons:

Error: uncaught exception: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPermissionManager.add]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: file:///home/martin/mozilla-src/src/obj-i686-pc-linux-gnu/dist/bin/components/nsBrowserGlue.js :: setPagePermission :: line 1038"  data: no]
Component: General → Geolocation
Product: Firefox → Core
Version: unspecified → Trunk
This seems to be due to the fact that you can't set a permission via the permission manager for file:// URIs (can't assign it a host?).

Perhaps the best thing would be just to hide the checkbox in this instance?
Removes the "Remember for this site" checkbox when deailing with file:// URIs.
Attachment #394523 - Flags: review?(doug.turner)
Attachment #394523 - Flags: review?(gavin.sharp)
Attachment #394523 - Flags: review?(doug.turner)
Attachment #394523 - Flags: review+
QA Contact: general → geolocation
Comment on attachment 394523 [details] [diff] [review]
Remove checkbox for file:// URIs

>diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js

>+        if (!inPrivateBrowsing && !request.requestingURI.schemeIs("file")) {

Seems like this would be better as a check for whether pm.add() will do something useful - i.e. a check that getting .host doesn't throw, and doesn't return an empty string:

var host;
try {
  host = request.requestingURI.host;
} catch (ex) {}

if (!inPrivateBrowsing && host)

r=me with that change.
Attachment #394523 - Flags: review?(gavin.sharp) → review+
Status: UNCONFIRMED → NEW
Ever confirmed: true
http://hg.mozilla.org/mozilla-central/rev/cedb40879bc6
Status: NEW → RESOLVED
Closed: 15 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: