Skip to content

Commit

Permalink
Add a flag for headless: --block_new_web_contents.
Browse files Browse the repository at this point in the history
It's an alternative to specifying the option via the
options builder.

Change-Id: I6a0034048dea433c59f1164beac96d1d3b059d7c
Reviewed-on: https://chromium-review.googlesource.com/1081275
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563792}
  • Loading branch information
Johannes Henkel authored and Commit Bot committed Jun 1, 2018
1 parent b84d1dc commit 0fb6097
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions headless/app/headless_shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,9 @@ int HeadlessShellMain(int argc, const char** argv) {
}
}

if (command_line.HasSwitch(switches::kBlockNewWebContents))
builder.SetBlockNewWebContents(true);

return HeadlessBrowserMain(
builder.Build(),
base::BindOnce(&HeadlessShell::OnStart, base::Unretained(&shell)));
Expand Down
2 changes: 2 additions & 0 deletions headless/app/headless_shell_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,7 @@ const char kAuthServerWhitelist[] = "auth-server-whitelist";
// Possible values: none|slight|medium|full|max. Default: full.
const char kFontRenderHinting[] = "font-render-hinting";

// If true, then all pop-ups and calls to window.open will fail.
const char kBlockNewWebContents[] = "block-new-web-contents";
} // namespace switches
} // namespace headless
1 change: 1 addition & 0 deletions headless/app/headless_shell_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extern const char kVirtualTimeBudget[];
extern const char kWindowSize[];
extern const char kAuthServerWhitelist[];
extern const char kFontRenderHinting[];
extern const char kBlockNewWebContents[];

// Switches which are replicated from content.
using ::switches::kRemoteDebuggingPort;
Expand Down

0 comments on commit 0fb6097

Please sign in to comment.