Closed Bug 816406 Opened 7 years ago Closed 7 years ago

Disallow dragging a private tab into a non-private window and vice versa

Categories

(Firefox :: Tabbed Browser, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 20

People

(Reporter: ehsan, Assigned: ehsan)

References

Details

Attachments

(1 file)

This is definitely unintuitive, and can cause confusion and unexpected results.  We should disallow it in the first place.
Component: Private Browsing → Tabbed Browser
OS: Mac OS X → All
Hardware: x86 → All
Assignee: nobody → ehsan
Whiteboard: [appcoast]
Attached patch Patch (v1)Splinter Review
Attachment #687548 - Flags: review?(dao)
ping?
Comment on attachment 687548 [details] [diff] [review]
Patch (v1)

>--- a/browser/base/content/tabbrowser.xml
>+++ b/browser/base/content/tabbrowser.xml
>@@ -1895,6 +1895,15 @@
>         <parameter name="aOtherTab"/>
>         <body>
>           <![CDATA[
>+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
>+            // Do not allow transfering a private tab to a non-private window
>+            // and vice versa.
>+            if (PrivateBrowsingUtils.isWindowPrivate(window) !=
>+                PrivateBrowsingUtils.isWindowPrivate(aOtherTab.ownerDocument.defaultView)) {
>+              return;
>+            }
>+#endif

remove { } per local style

>@@ -3421,6 +3430,15 @@
>                 sourceNode.ownerDocument.defaultView instanceof ChromeWindow &&
>                 sourceNode.ownerDocument.documentElement.getAttribute("windowtype") == "navigator:browser" &&
>                 sourceNode.ownerDocument.defaultView.gBrowser.tabContainer == sourceNode.parentNode) {
>+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
>+              // Do not allow transfering a private tab to a non-private window
>+              // and vice versa.
>+              if (PrivateBrowsingUtils.isWindowPrivate(window) !=
>+                  PrivateBrowsingUtils.isWindowPrivate(sourceNode.ownerDocument.defaultView)) {
>+                return dt.effectAllowed = "none";
>+              }
>+#endif

ditto

Please make sure to use unified = 8 and showfunc = 1 when generating patches.
Attachment #687548 - Flags: review?(dao) → review+
(In reply to Dão Gottwald [:dao] from comment #3)
> Please make sure to use unified = 8 and showfunc = 1 when generating patches.

Sure, will do.  Sorry!
https://hg.mozilla.org/mozilla-central/rev/d1fba48c7253
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 20
You need to log in before you can comment on or make changes to this bug.