Skip to content

Commit

Permalink
Bug 639707 - Back out changeset 5c2c9bbf9fcc and replace with a patch…
Browse files Browse the repository at this point in the history
… to restore the ability to open new windows in new spaces when a window is already in fullscreen mode on macOS that supports macOS session restore. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D167445
  • Loading branch information
Stephen A Pohl committed Feb 2, 2023
1 parent 831445a commit df29973
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 2 additions & 0 deletions browser/app/macbuild/Contents/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@
<key>org.mozilla.updater</key>
<string>identifier "org.mozilla.updater" and ((anchor apple generic and certificate leaf[field.1.2.840.113635.100.6.1.9]) or (anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = "43AQ936H96"))</string>
</dict>
<key>NSDisablePersistence</key>
<true/>
<key>MozillaDeveloperRepoPath</key>
<string>@MOZ_DEVELOPER_REPO_PATH@</string>
<key>MozillaDeveloperObjPath</key>
Expand Down
3 changes: 2 additions & 1 deletion widget/cocoa/nsCocoaWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
protected:
virtual ~nsCocoaWindow();

nsresult CreateNativeWindow(const NSRect& aRect, BorderStyle aBorderStyle, bool aRectIsFrameRect);
nsresult CreateNativeWindow(const NSRect& aRect, BorderStyle aBorderStyle, bool aRectIsFrameRect,
bool aIsPrivateBrowsing);
nsresult CreatePopupContentView(const LayoutDeviceIntRect& aRect, InitData*);
void DestroyNativeWindow();
void UpdateBounds();
Expand Down
15 changes: 9 additions & 6 deletions widget/cocoa/nsCocoaWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ static DesktopRect GetWidgetScreenRectForChildren(nsIWidget* aWidget, NSView* aV

DesktopIntRect widgetRect = aRect + parentOrigin;

nsresult rv =
CreateNativeWindow(nsCocoaUtils::GeckoRectToCocoaRect(widgetRect), mBorderStyle, false);
nsresult rv = CreateNativeWindow(nsCocoaUtils::GeckoRectToCocoaRect(widgetRect), mBorderStyle,
false, aInitData->mIsPrivateBrowsing);
NS_ENSURE_SUCCESS(rv, rv);

if (mWindowType == WindowType::Popup) {
Expand Down Expand Up @@ -407,7 +407,7 @@ static unsigned int WindowMaskForBorderStyle(BorderStyle aBorderStyle) {
// the bottom of the menubar and aRect.width/height specify the size of the
// content rect.
nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, BorderStyle aBorderStyle,
bool aRectIsFrameRect) {
bool aRectIsFrameRect, bool aIsPrivateBrowsing) {
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;

// We default to NSWindowStyleMaskBorderless, add features if needed.
Expand Down Expand Up @@ -504,8 +504,10 @@ static unsigned int WindowMaskForBorderStyle(BorderStyle aBorderStyle) {

// Make sure that window titles don't leak to disk in private browsing mode
// due to macOS' resume feature.
[mWindow setRestorable:NO];
[mWindow disableSnapshotRestoration];
[mWindow setRestorable:!aIsPrivateBrowsing];
if (aIsPrivateBrowsing) {
[mWindow disableSnapshotRestoration];
}

// setup our notification delegate. Note that setDelegate: does NOT retain.
mDelegate = [[WindowDelegate alloc] initWithGeckoWindow:this];
Expand Down Expand Up @@ -1497,7 +1499,8 @@ static CGSRemoveWindowsFromSpacesFunc GetCGSRemoveWindowsFromSpacesFunc() {
// Recreate the window with the right border style.
NSRect frameRect = [mWindow frame];
DestroyNativeWindow();
nsresult rv = CreateNativeWindow(frameRect, aShouldHide ? BorderStyle::None : mBorderStyle, true);
nsresult rv = CreateNativeWindow(frameRect, aShouldHide ? BorderStyle::None : mBorderStyle, true,
mWindow.restorable);
NS_ENSURE_SUCCESS_VOID(rv);

// Re-import state.
Expand Down
6 changes: 2 additions & 4 deletions xpfe/appshell/nsAppShellService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,6 @@ nsresult nsAppShellService::JustCreateTopWindow(

widgetInitData.mRTL = LocaleService::GetInstance()->IsAppLocaleRTL();

if (aChromeMask & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW) {
widgetInitData.mIsPrivate = true;
}

nsresult rv =
window->Initialize(parent, center ? aParent : nullptr, aInitialWidth,
aInitialHeight, aIsHiddenWindow, widgetInitData);
Expand All @@ -689,6 +685,8 @@ nsresult nsAppShellService::JustCreateTopWindow(
// Caller requested a private window
isPrivateBrowsingWindow = true;
}
widgetInitData.mIsPrivate = isPrivateBrowsingWindow;

nsCOMPtr<mozIDOMWindowProxy> domWin = do_GetInterface(aParent);
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(domWin);
nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(webNav);
Expand Down

0 comments on commit df29973

Please sign in to comment.