Closed Bug 326009 Opened 19 years ago Closed 18 years ago

[FIX]Targeting background tabs is impossible

Categories

(SeaMonkey :: Tabbed Browser, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED
seamonkey2.0a1

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

(Keywords: verified1.8.1)

Attachments

(7 files, 1 obsolete file)

Need to do a bit of surgery on tree owners, tabbrowser, etc.
Attached patch Front-end changes (deleted) β€” β€” Splinter Review
Attachment #210803 - Flags: superreview?(neil)
Attachment #210803 - Flags: review?
Attachment #210803 - Flags: review? → review?(mconnor)
Attached patch Back-end changes (obsolete) (deleted) β€” β€” Splinter Review
This part needs more testing, which I'll do once bug 323810 is fixed.
Blocks: 326017
Comment on attachment 210805 [details] [diff] [review]
Back-end changes

>+      nsCOMPtr<nsIDocShellTreeOwner> owner = do_GetInterface(parentItem);
>+      nsCOMPtr<nsIDocShellTreeOwner_MOZILLA_1_8_BRANCH> owner2 =
>+        do_QueryInterface(owner);
Would it be too much trouble to make do_GetInterface work for nsIDocShellTreeOwner_MOZILLA_1_8_BRANCH?

>+       nsRefPtr<nsXULWindow> win;
>+       xulWindow->QueryInterface(NS_GET_IID(nsXULWindow), getter_AddRefs(win));
Ugly IMHO, but I suppose it's valid in the same module.
Comment on attachment 210803 [details] [diff] [review]
Front-end changes

So the use case is someone clicks on an <a target="foo"> which gets diverted into a tab, and the original page needs to be able to find it again?
> Would it be too much trouble to make do_GetInterface work for
> nsIDocShellTreeOwner_MOZILLA_1_8_BRANCH?

Probably not, except I was trying to minimize the spread of nsIDocShellTreeOwner_MOZILLA_1_8_BRANCH

> Ugly IMHO, but I suppose it's valid in the same module.

Yeah.  I could also have changed (or rather extended) nsIXULWindow and gotten an enumerator from it, but this seemed simpler....

For 1.9 I'd really like to significantly change this tree owner stuff.  I just haven't figured out what arch actually makes sense.  ;)
> So the use case is someone clicks on an <a target="foo"> which gets diverted
> into a tab, and the original page needs to be able to find it again?

That's one use case.  The other use case is bug 210986.
So, why can't we make the root docShell FindChildWithName do the work?
nsDocShell::FindItemWithName doesn't cross type boundaries, and that's an invariant I would like to leave, in general.  I suppose we could modify this by extending nsIDocShellTreeItem, but it'd take a lot closer code inspection on my part to ensure it's done safely.

More to the point, I think the idea of trees of docshells that "belong together" and should be able to target each other but not "unrelated" trees is the right conceptual abstraction here.  What we have to express that right now is tree owners...
Attachment #210803 - Flags: superreview?(neil) → superreview+
Attached file File #1 for a testcase (deleted) β€”
Attached file File #2 for a testcase (deleted) β€”
To test, load file #1 in a tab, then open a new tab in the foreground and load file #2 in the foreground tab.  When the JS executes, the load should happen in the background tab instead of opening a new window or notifying about popups or whatever.
Comment on attachment 210805 [details] [diff] [review]
Back-end changes

OK, I tested this and it fixes bug 121377 and the testcase I just attached to this bug.  Doesn't seem to break anything that I can find.  So I think this is good to go.
Attachment #210805 - Flags: superreview?(jst)
Attachment #210805 - Flags: review?(benjamin)
Priority: -- → P1
Summary: Targeting background tabs is impossible → [FIX]Targeting background tabs is impossible
I'd suggest @status TEMPORARY or something, instead of DEPRECATED

It seems to me that, rather than adding a pseudo-IID for nsXULWindow, you could (and probably should)

1) make nsIDocShellTreeItem_MOZILLA_1_8_BRANCH inherit from nsISupports instead of nsIDocShellTreeItem
2) implement nsIDocShellTreeItem_MOZILLA_1_8_BRANCH on nsXULWindow

Except I see that doesn't work because nsContentTreeOwner::FindIt uses ->mTargetableShells directly, ugh.

I don't particularly like that as a long-term solution but I guess it's ok as a hacky interim (in the long term we should probably figure out what to do with nsIWindowMediator, too, since various embedders would like to mix "chrome" XUL windows and embedded windows, and that has lots of window-targeting issues).

Perhaps appshellservice (including xulwindow) should be merged with docshell?
Attachment #210805 - Flags: review?(benjamin) → review+
> Except I see that doesn't work because nsContentTreeOwner::FindIt uses
> ->mTargetableShells directly, ugh.

Right.  This is the only reason I need the new IID.  The content tree owner already has a nsXULWindow* pointer to its own nsXULWindow.  But in FindItemWithName we walk the enumerator, and get nsIXULWindow pointers out of it...

I could also have changes nsIXULWindow (or extended with a new interface for 1.8).  But that seemed to me like more work, and not really necessary...

> in the long term we should probably figure out what to do with
> nsIWindowMediator

Yes, indeed.

> since various embedders would like to mix "chrome" XUL windows and embedded
> windows

In what way?  The way I designed this stuff assumed that chrome XUL windows can only happen with XUL and embedded windows only happen with nsWebBrowser.  Are people mixing the two in a nontrivial way?

> Perhaps appshellservice (including xulwindow) should be merged with docshell?

It's all pretty XUL=app-specific.  I'm not sure there's value in merging it with the much more generic docshell....
> In what way?  The way I designed this stuff assumed that chrome XUL windows can
> only happen with XUL and embedded windows only happen with nsWebBrowser.  Are
> people mixing the two in a nontrivial way?

There was some desire expressed in that regard, though AFAICT it doesn't actually involve loading content in the XUL windows. Think XUL xpinstall dialogs popped up from gtkmozembed windows to aid XULRunner app installation off the web.

OK.  We should probably sort out the use cases and then figure out how to do this stuff, including what window mediator should do (and whether it should exist).
Attachment #210803 - Flags: review?(mconnor) → review+
Comment on attachment 210805 [details] [diff] [review]
Back-end changes

sr=jst
Attachment #210805 - Flags: superreview?(jst) → superreview+
Attachment #210805 - Attachment is obsolete: true
Attached patch Back end patch merged to 1.8 branch (deleted) β€” β€” Splinter Review
Attachment #212693 - Flags: approval-branch-1.8.1?(jst)
Attached patch Front end patch merged to 1.8 branch (deleted) β€” β€” Splinter Review
Attachment #212695 - Flags: approval-branch-1.8.1?(neil)
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Blocks: 273984
Attachment #212693 - Flags: approval-branch-1.8.1?(jst) → approval-branch-1.8.1+
Attachment #212695 - Flags: approval-branch-1.8.1?(neil) → approval-branch-1.8.1+
Fixed on the 1.8 branch.
Keywords: fixed1.8.1
*** Bug 331056 has been marked as a duplicate of this bug. ***
*** Bug 292813 has been marked as a duplicate of this bug. ***
Verified fixed with Windows, Mac and Linux with 2.0.b1rc3 builds
Status: RESOLVED → VERIFIED
For what it's worth... this needs to be separately verified on trunk, since the
changes were somewhat different.  Reopening so I can put it back in a "RESOLVED
FIXED" state...
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 19 years ago18 years ago
Resolution: --- → FIXED
Depends on: 360579
Flags: in-testsuite?
Depends on: 407421
Product: Core → SeaMonkey
Target Milestone: mozilla1.9alpha1 → seamonkey2.0a1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: