mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Add dom.allow_scripts_to_close_windows
pref. (#33187)
It's also present in firefox: https://searchfox.org/mozilla-central/search?q=allow_scripts_to_close_windows Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
0e6b55c71d
commit
4397d8a021
3 changed files with 6 additions and 1 deletions
|
@ -238,6 +238,7 @@ mod gen {
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
allow_scripts_to_close_windows: bool,
|
||||||
canvas_capture: {
|
canvas_capture: {
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
},
|
},
|
||||||
|
|
|
@ -60,6 +60,7 @@ use script_traits::{
|
||||||
use selectors::attr::CaseSensitivity;
|
use selectors::attr::CaseSensitivity;
|
||||||
use servo_arc::Arc as ServoArc;
|
use servo_arc::Arc as ServoArc;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
use servo_config::pref;
|
||||||
use servo_geometry::{f32_rect_to_au_rect, MaxRect};
|
use servo_geometry::{f32_rect_to_au_rect, MaxRect};
|
||||||
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
||||||
use style::dom::OpaqueNode;
|
use style::dom::OpaqueNode;
|
||||||
|
@ -757,7 +758,9 @@ impl WindowMethods for Window {
|
||||||
let is_auxiliary = window_proxy.is_auxiliary();
|
let is_auxiliary = window_proxy.is_auxiliary();
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#script-closable
|
// https://html.spec.whatwg.org/multipage/#script-closable
|
||||||
let is_script_closable = (self.is_top_level() && history_length == 1) || is_auxiliary;
|
let is_script_closable = (self.is_top_level() && history_length == 1) ||
|
||||||
|
is_auxiliary ||
|
||||||
|
pref!(dom.allow_scripts_to_close_windows);
|
||||||
|
|
||||||
// TODO: rest of Step 3:
|
// TODO: rest of Step 3:
|
||||||
// Is the incumbent settings object's responsible browsing context familiar with current?
|
// Is the incumbent settings object's responsible browsing context familiar with current?
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"devtools.server.enabled": false,
|
"devtools.server.enabled": false,
|
||||||
"devtools.server.port": 0,
|
"devtools.server.port": 0,
|
||||||
|
"dom.allow_scripts_to_close_windows": false,
|
||||||
"dom.bluetooth.enabled": false,
|
"dom.bluetooth.enabled": false,
|
||||||
"dom.bluetooth.testing.enabled": false,
|
"dom.bluetooth.testing.enabled": false,
|
||||||
"dom.canvas_capture.enabled": false,
|
"dom.canvas_capture.enabled": false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue