Skip to content

Commit 256b56d

Browse files
tcl3awesomekling
authored andcommitted
UI/AppKit: Disable popup blocking on startup if --allow-popups is set
1 parent 74e12a9 commit 256b56d

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Ladybird/AppKit/Application/ApplicationDelegate.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ - (nonnull TabController*)createNewTab:(Web::HTML::ActivateTab)activate_tab
188188
}
189189

190190
[self.managed_tabs addObject:controller];
191+
[controller onCreateNewTab];
191192
return controller;
192193
}
193194

Ladybird/AppKit/UI/TabController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ struct TabSettings {
3535

3636
- (void)onTitleChange:(ByteString const&)title;
3737

38+
- (void)onCreateNewTab;
39+
3840
- (void)navigateBack:(id)sender;
3941
- (void)navigateForward:(id)sender;
4042
- (void)reload:(id)sender;
4143
- (void)clearHistory;
4244

45+
- (void)setPopupBlocking:(BOOL)block_popups;
4346
- (void)debugRequest:(ByteString const&)request argument:(ByteString const&)argument;
4447

4548
- (void)focusLocationToolbarItem;

Ladybird/AppKit/UI/TabController.mm

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ - (void)onTitleChange:(ByteString const&)title
139139
m_title = title;
140140
}
141141

142+
- (void)onCreateNewTab
143+
{
144+
[self setPopupBlocking:m_settings.block_popups];
145+
}
146+
142147
- (void)zoomIn:(id)sender
143148
{
144149
[[[self tab] web_view] zoomIn];
@@ -348,7 +353,12 @@ - (void)toggleScripting:(id)sender
348353
- (void)togglePopupBlocking:(id)sender
349354
{
350355
m_settings.block_popups = !m_settings.block_popups;
351-
[self debugRequest:"block-pop-ups" argument:m_settings.block_popups ? "on" : "off"];
356+
[self setPopupBlocking:m_settings.block_popups];
357+
}
358+
359+
- (void)setPopupBlocking:(BOOL)block_popups
360+
{
361+
[self debugRequest:"block-pop-ups" argument:block_popups ? "on" : "off"];
352362
}
353363

354364
- (void)toggleSameOriginPolicy:(id)sender

0 commit comments

Comments
 (0)