Closed Bug 489561 Opened 15 years ago Closed 15 years ago

nsPrincipal should cache nsIPrefBranch and codebase_principal_support pref

Categories

(Core :: Security: CAPS, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: smaug, Assigned: smaug)

Details

Attachments

(3 files)

nsPrincipal::CanEnableCapability is pretty expensive because it calls
do_GetService(NS_PREFSERVICE_CONTRACTID) and GetBoolPref
Attached patch patchSplinter Review
This speeds up content JS DOM event dispatch nearly 10%.
Attachment #381297 - Flags: superreview?(dveditz)
Attachment #381297 - Flags: review?(dveditz)
Assignee: dveditz → Olli.Pettay
Comment on attachment 381297 [details] [diff] [review]
patch

r/sr=dveditz
Attachment #381297 - Flags: superreview?(dveditz)
Attachment #381297 - Flags: superreview+
Attachment #381297 - Flags: review?(dveditz)
Attachment #381297 - Flags: review+
This patch doesn't work right if you set the pref to true and then unset it.  It'l leave the static bool true.  You should be explicitly setting to false when the get fails.

Also, why check observer topic but not pref name?  I'd just assert both...
Ok, I'll fix those cases.
Attached patch v2Splinter Review
> +    if (prefBranch &&

I'd prefer "!prefBranch ||" here, so we fail safe.
Attached patch v3Splinter Review
http://hg.mozilla.org/mozilla-central/rev/5a34b38593e5
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: