Closed Bug 722853 Opened 12 years ago Closed 12 years ago

Determine Private Browsing state from nearest docshell

Categories

(Core :: Layout, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: jdm, Assigned: jdm)

References

(Depends on 1 open bug)

Details

Attachments

(1 file, 4 obsolete files)

The PB service is going away. We need to get this information from the closest docshell instead when determining whether to use information such as link visited state.
Depends on: 722840
Attachment #593347 - Attachment is obsolete: true
Attachment #593578 - Attachment is obsolete: true
Attachment #593595 - Attachment is obsolete: true
Is this ready for review Josh?
Comment on attachment 593596 [details] [diff] [review]
Derive private browsing status from docshell when assigning element states.

Feel free to turn this into a review request, or pass it off to someone else. I'm looking for feedback as to the kinds of tests I should run, as I have not run any yet. I'm also flailing around in the code, so confirmation that this is the right way to do this would be good.
Attachment #593596 - Flags: feedback?(dbaron)
Attachment #593596 - Flags: review?(roc)
Comment on attachment 593596 [details] [diff] [review]
Derive private browsing status from docshell when assigning element states.

Review of attachment 593596 [details] [diff] [review]:
-----------------------------------------------------------------

I assume the PB-status of a docshell can't change during its lifetime.

dbaron needs to review this.

::: layout/style/nsRuleProcessorData.h
@@ +147,5 @@
>    {
> +    nsCOMPtr<nsISupports> container = mDocument->GetContainer();
> +    nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(container);
> +    if (loadContext) {
> +      loadContext->GetUsePrivateBrowsing(&mUsingPrivateBrowsing);

Could there be a deCOM version of this method?

@@ +150,5 @@
> +    if (loadContext) {
> +      loadContext->GetUsePrivateBrowsing(&mUsingPrivateBrowsing);
> +    } else {
> +      //XXXjdm What's the right thing to do here?
> +      NS_WARNING("Couldn't get loadContext from container; assuming no private browsing.");

Wouldn't it be better to default to private?
Attachment #593596 - Flags: review?(roc)
Attachment #593596 - Flags: review?(dbaron)
Attachment #593596 - Flags: feedback?(dbaron)
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #7)
> Comment on attachment 593596 [details] [diff] [review]
> Derive private browsing status from docshell when assigning element states.
> 
> Review of attachment 593596 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I assume the PB-status of a docshell can't change during its lifetime.

It can.

> @@ +150,5 @@
> > +    if (loadContext) {
> > +      loadContext->GetUsePrivateBrowsing(&mUsingPrivateBrowsing);
> > +    } else {
> > +      //XXXjdm What's the right thing to do here?
> > +      NS_WARNING("Couldn't get loadContext from container; assuming no private browsing.");
> 
> Wouldn't it be better to default to private?

I don't think so.  That's definitely not the current behavior.

Is there any case where loadContext can be null there?
Comment on attachment 593596 [details] [diff] [review]
Derive private browsing status from docshell when assigning element states.

Oops, I probably should have tossed this review to bz when it came in, since he's been in this code more lately (and has some patches-in-progress affecting it, I think).  That said, it looks fine.

Could you name the params that are of type TreeMatchContext aTreeMatchContext rather than aMatchContext -- since some functions could end up with a NodeMatchContext at some point in the future too?

>+      //XXXjdm What's the right thing to do here?
>+      NS_WARNING("Couldn't get loadContext from container; assuming no private browsing.");

Seems like this ought to be at least an NS_ASSERTION.

r=dbaron with that
Attachment #593596 - Flags: review?(dbaron) → review+
Hmm.  Can we end up there with a data document of some sort?  Or do those have containers?
Try run for ad8586ccbe14 is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=ad8586ccbe14
Results (out of 55 total builds):
    success: 43
    warnings: 12
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/josh@joshmatthews.net-ad8586ccbe14
Attachment #593596 - Attachment is obsolete: true
Try run for 9e829ab62cd0 is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=9e829ab62cd0
Results (out of 62 total builds):
    success: 54
    warnings: 8
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/josh@joshmatthews.net-9e829ab62cd0
Whiteboard: [passes tests, needs landing]
Assignee: nobody → josh
https://hg.mozilla.org/integration/mozilla-inbound/rev/0c0553bc5bc9
Whiteboard: [passes tests, needs landing] → [doesn't pass tests]
Target Milestone: mozilla14 → ---
Now passes with bug 723353 landed.
Depends on: 723353
Whiteboard: [doesn't pass tests]
https://hg.mozilla.org/mozilla-central/rev/cf941140cded
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
Depends on: 762345
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: