Closed Bug 939327 Opened 11 years ago Closed 9 years ago

Provide scriptable utility functions to obtain URL bar domain

Categories

(Core :: Security, defect)

24 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 962326

People

(Reporter: mikeperry, Unassigned)

Details

Attachments

(1 file)

When making various security and privacy decisions about a page, it is often desirable to determine the URI in the location bar for a given sub-document to decide what to do. An easy to use utility function that provides the top-level location URI for an nsIChannel or an nsIDocument is an extremely useful thing to aid in these decisions.

In Tor Browser, we created a single API for this purpose that can take either an nsIChannel or nsIDocument. We resurrected the old mozIThirdPartyUtil.getOriginatingURI() API to use its logic for the channel case, and wrote our own logic for the nsIDocument case.

We chose this implementation because it made error handling simpler (for the case where both a channel and a document are available, but the channel path fails).

It is possible we want to rewrite this to fold in getOriginatingURI rather than resurrect it (since it was removed in Bug 769589), and/or to split it into two utility functions (one for the channel, one for the document). We're open to suggestions.
OS: Windows 7 → All
Hardware: x86 → All
I would suggest resolving this as a duplicate of Bug 962326.
Flags: needinfo?(mikeperry)
Yep, looks like same patch with some updates.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Flags: needinfo?(mikeperry)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: