Bug 639707 - Back out changeset 5c2c9bbf9fcc and replace with a patch 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
This commit is contained in:
Stephen A Pohl 2023-02-03 03:28:06 +00:00
parent 2d3c312d88
commit bd3d2eacb3
4 changed files with 15 additions and 11 deletions

View File

@ -265,6 +265,8 @@
<key>org.mozilla.updater</key> <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> <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> </dict>
<key>NSDisablePersistence</key>
<true/>
<key>MozillaDeveloperRepoPath</key> <key>MozillaDeveloperRepoPath</key>
<string>@MOZ_DEVELOPER_REPO_PATH@</string> <string>@MOZ_DEVELOPER_REPO_PATH@</string>
<key>MozillaDeveloperObjPath</key> <key>MozillaDeveloperObjPath</key>

View File

@ -366,7 +366,8 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
protected: protected:
virtual ~nsCocoaWindow(); 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*); nsresult CreatePopupContentView(const LayoutDeviceIntRect& aRect, InitData*);
void DestroyNativeWindow(); void DestroyNativeWindow();
void UpdateBounds(); void UpdateBounds();

View File

@ -343,8 +343,8 @@ nsresult nsCocoaWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
DesktopIntRect widgetRect = aRect + parentOrigin; DesktopIntRect widgetRect = aRect + parentOrigin;
nsresult rv = nsresult rv = CreateNativeWindow(nsCocoaUtils::GeckoRectToCocoaRect(widgetRect), mBorderStyle,
CreateNativeWindow(nsCocoaUtils::GeckoRectToCocoaRect(widgetRect), mBorderStyle, false); false, aInitData->mIsPrivateBrowsing);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
if (mWindowType == WindowType::Popup) { if (mWindowType == WindowType::Popup) {
@ -407,7 +407,7 @@ static unsigned int WindowMaskForBorderStyle(BorderStyle aBorderStyle) {
// the bottom of the menubar and aRect.width/height specify the size of the // the bottom of the menubar and aRect.width/height specify the size of the
// content rect. // content rect.
nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, BorderStyle aBorderStyle, nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, BorderStyle aBorderStyle,
bool aRectIsFrameRect) { bool aRectIsFrameRect, bool aIsPrivateBrowsing) {
NS_OBJC_BEGIN_TRY_BLOCK_RETURN; NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// We default to NSWindowStyleMaskBorderless, add features if needed. // We default to NSWindowStyleMaskBorderless, add features if needed.
@ -504,8 +504,10 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, BorderStyle aBor
// Make sure that window titles don't leak to disk in private browsing mode // Make sure that window titles don't leak to disk in private browsing mode
// due to macOS' resume feature. // due to macOS' resume feature.
[mWindow setRestorable:NO]; [mWindow setRestorable:!aIsPrivateBrowsing];
[mWindow disableSnapshotRestoration]; if (aIsPrivateBrowsing) {
[mWindow disableSnapshotRestoration];
}
// setup our notification delegate. Note that setDelegate: does NOT retain. // setup our notification delegate. Note that setDelegate: does NOT retain.
mDelegate = [[WindowDelegate alloc] initWithGeckoWindow:this]; mDelegate = [[WindowDelegate alloc] initWithGeckoWindow:this];
@ -1497,7 +1499,8 @@ void nsCocoaWindow::HideWindowChrome(bool aShouldHide) {
// Recreate the window with the right border style. // Recreate the window with the right border style.
NSRect frameRect = [mWindow frame]; NSRect frameRect = [mWindow frame];
DestroyNativeWindow(); 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); NS_ENSURE_SUCCESS_VOID(rv);
// Re-import state. // Re-import state.

View File

@ -671,10 +671,6 @@ nsresult nsAppShellService::JustCreateTopWindow(
widgetInitData.mRTL = LocaleService::GetInstance()->IsAppLocaleRTL(); widgetInitData.mRTL = LocaleService::GetInstance()->IsAppLocaleRTL();
if (aChromeMask & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW) {
widgetInitData.mIsPrivate = true;
}
nsresult rv = nsresult rv =
window->Initialize(parent, center ? aParent : nullptr, aInitialWidth, window->Initialize(parent, center ? aParent : nullptr, aInitialWidth,
aInitialHeight, aIsHiddenWindow, widgetInitData); aInitialHeight, aIsHiddenWindow, widgetInitData);
@ -689,6 +685,8 @@ nsresult nsAppShellService::JustCreateTopWindow(
// Caller requested a private window // Caller requested a private window
isPrivateBrowsingWindow = true; isPrivateBrowsingWindow = true;
} }
widgetInitData.mIsPrivate = isPrivateBrowsingWindow;
nsCOMPtr<mozIDOMWindowProxy> domWin = do_GetInterface(aParent); nsCOMPtr<mozIDOMWindowProxy> domWin = do_GetInterface(aParent);
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(domWin); nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(domWin);
nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(webNav); nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(webNav);