Closed Bug 279710 Opened 20 years ago Closed 20 years ago

tidy up popup blocking code

Categories

(Core :: Networking: Cookies, defect)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED

People

(Reporter: dwitte, Assigned: dwitte)

Details

Attachments

(1 file, 1 obsolete file)

not really much to do here, except removing some interface methods and fixing up
some implementation nits. {Get,Set}DefaultPermission is unused... the pref will
give that information if code wants to check it.
Attached patch patch (obsolete) — Splinter Review
dveditz, i'm not sure if you're still doing reviews or not, but this is an easy
one :)
Attachment #172330 - Flags: superreview?(dveditz)
Attachment #172330 - Flags: review?(dveditz)
Comment on attachment 172330 [details] [diff] [review]
patch

> nsPopupWindowManager::Observe(nsISupports *aSubject, 
>                               const char *aTopic,
>                               const PRUnichar *aData)
> {
>-  NS_LossyConvertUCS2toASCII pref(aData);
>-  if (pref.Equals(kPopupDisablePref)) {
>+  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(aSubject);
>+  NS_ASSERTION(!nsCRT::strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic),
>+               "unexpected topic - we only deal with pref changes!");
>+
>+  if (prefBranch) {

Doesn't this change mean we hit the pref hashtable for every pref change
anywhere in the browser? I don't know how often that actually happens but it
seems like we should keep the prefname check too.

>     // refresh our local copy of the "disable popups" pref
>     PRBool permission = PR_FALSE;
>+    prefBranch->GetBoolPref(kPopupDisablePref, &permission);

Should permission default to PR_TRUE, blocking popups?

> // {4275d3f4-752a-427a-b432-14d5dda1c20b}
> #define NS_POPUPWINDOWMANAGER_CID \
>- {0x4275d3f4, 0x752a, 0x427a, {0xb4, 0x32, 0x14, 0xd5, 0xdd, 0xa1, 0xc2, 0x0b}}
>+ {0x822bcd11, 0x6432, 0x48be, {0x9e, 0x9d, 0x36, 0xf7, 0x80, 0x4b, 0x77, 0x47}}

Please make the comment match
(In reply to comment #2)
> Doesn't this change mean we hit the pref hashtable for every pref change
> anywhere in the browser? I don't know how often that actually happens but it
> seems like we should keep the prefname check too.

Woah... but we registered ourselves as an observer for just that pref, right?
Will that notification fire on _any_ pref change?

> Should permission default to PR_TRUE, blocking popups?

Hmm, given that the pref defaults to true, it probably should.

> Please make the comment match

Will do.
http://lxr.mozilla.org/seamonkey/source/modules/libpref/src/prefapi.cpp#862

the prefservice will only call our ::Observe for changes to that pref.
Attachment #172330 - Flags: superreview?(dveditz)
Attachment #172330 - Flags: review?(dveditz)
Attached patch v2Splinter Review
fixed, except for prefname comparison.
Attachment #172330 - Attachment is obsolete: true
Attachment #172384 - Flags: superreview?(dveditz)
Attachment #172384 - Flags: review?(dveditz)
Comment on attachment 172384 [details] [diff] [review]
v2

r/sr=dveditz.

If we're registered for just that pref (and we are, I checked this time unlike
last time), why did the original code bother with the name compare?
Attachment #172384 - Flags: superreview?(dveditz)
Attachment #172384 - Flags: superreview+
Attachment #172384 - Flags: review?(dveditz)
Attachment #172384 - Flags: review+
who knows. that's why it needed cleaning up ;)

checked in, thanks for the quick reviews.
Status: NEW → RESOLVED
Closed: 20 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: