Closed Bug 460124 Opened 16 years ago Closed 16 years ago

remove workaround for principal hashtable inconsistency

Categories

(Firefox :: General, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: mozilla+ben, Assigned: mozilla+ben)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1

With bug #454850 fixed and pushed, this workaround (in nsScriptSecurityManager.cpp) becomes unnecessary:

mPrincipals.Get(principal, getter_AddRefs(fromTable));
if (!fromTable)
{
    //-- Check to see if we have a more general principal

    // XXXbz if only GetOrigin returned a URI!  Or better yet if the
    // HashKey function on principals were smarter.  As it is, we can
    // have cases where two principals will have different hashkeys but
    // test equal via KeyEquals, which is absolutely silly.  That's
    // what we're working around here.
    nsXPIDLCString originUrl;
    rv = principal->GetOrigin(getter_Copies(originUrl));
    if (NS_FAILED(rv)) return rv;
    nsCOMPtr<nsIURI> newURI;
    rv = NS_NewURI(getter_AddRefs(newURI), originUrl, nsnull, sIOService);
    if (NS_FAILED(rv)) return rv;
    nsCOMPtr<nsIPrincipal> principal2;
    rv = CreateCodebasePrincipal(newURI, getter_AddRefs(principal2));
    if (NS_FAILED(rv)) return rv;
    mPrincipals.Get(principal2, getter_AddRefs(fromTable));
}

That is, the first result from mPrincipals.Get can now be trusted.

Reproducible: Didn't try
Attached patch proposed patchSplinter Review
Tempted to unify the similar parts of DoGetCertificatePrincipal with GetCodebasePrincipal, but that's not really at issue here.
Attachment #343297 - Flags: superreview?(bzbarsky)
Attachment #343297 - Flags: review?(bzbarsky)
Assignee: nobody → bnewman
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment on attachment 343297 [details] [diff] [review]
proposed patch

r+sr=bzbarsky

If you do want to do that unification, that sounds pretty good to me!
Attachment #343297 - Flags: superreview?(bzbarsky)
Attachment #343297 - Flags: superreview+
Attachment #343297 - Flags: review?(bzbarsky)
Attachment #343297 - Flags: review+
Pushed changeset 1b853ea8e418.
Status: NEW → RESOLVED
Closed: 16 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: