@@ -174,6 +174,7 @@ enum {
174174 PROP_MEDIA_CONTENT_TYPES_REQUIRING_HARDWARE_SUPPORT,
175175 PROP_ENABLE_WEBRTC,
176176 PROP_DISABLE_WEB_SECURITY,
177+ PROP_ALLOW_SCRIPTS_TO_CLOSE_WINDOWS,
177178 N_PROPERTIES,
178179};
179180
@@ -409,6 +410,9 @@ ALLOW_DEPRECATED_DECLARATIONS_BEGIN
409410 case PROP_DISABLE_WEB_SECURITY:
410411 webkit_settings_set_disable_web_security (settings, g_value_get_boolean (value));
411412 break ;
413+ case PROP_ALLOW_SCRIPTS_TO_CLOSE_WINDOWS:
414+ webkit_settings_set_allow_scripts_to_close_windows (settings, g_value_get_boolean (value));
415+ break ;
412416 default :
413417 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, paramSpec);
414418 break ;
@@ -617,6 +621,9 @@ ALLOW_DEPRECATED_DECLARATIONS_BEGIN
617621 case PROP_DISABLE_WEB_SECURITY:
618622 g_value_set_boolean (value, webkit_settings_get_disable_web_security (settings));
619623 break ;
624+ case PROP_ALLOW_SCRIPTS_TO_CLOSE_WINDOWS:
625+ g_value_set_boolean (value, webkit_settings_get_allow_scripts_to_close_windows (settings));
626+ break ;
620627 default :
621628 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, paramSpec);
622629 break ;
@@ -1618,6 +1625,19 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass)
16181625 FALSE ,
16191626 readWriteConstructParamFlags);
16201627
1628+ /* *
1629+ * WebKitSettings:allow-scripts-to-close-windows:
1630+ *
1631+ * Allow scripts to close windows they didn't open.
1632+ *
1633+ */
1634+ sObjProperties [PROP_ALLOW_SCRIPTS_TO_CLOSE_WINDOWS] = g_param_spec_boolean (
1635+ " allow-scripts-to-close-windows" ,
1636+ _ (" Allow scripts to close windows" ),
1637+ _ (" Whether scripts can close windows they didn't open." ),
1638+ FALSE ,
1639+ readWriteConstructParamFlags);
1640+
16211641 g_object_class_install_properties (gObjectClass , N_PROPERTIES, sObjProperties );
16221642}
16231643
@@ -4131,3 +4151,39 @@ WebKitFeatureList* webkit_settings_get_development_features(void)
41314151{
41324152 return webkitFeatureListCreate (WebPreferences::internalDebugFeatures ());
41334153}
4154+
4155+ /* *
4156+ * webkit_settings_get_allow_scripts_to_close_windows:
4157+ * @settings: a #WebKitSettings
4158+ *
4159+ * Get the #WebKitSettings:allow-scripts-to-close-windows property.
4160+ *
4161+ * Returns: %TRUE If script can close windows not opened by them or %FALSE otherwise.
4162+ */
4163+ gboolean webkit_settings_get_allow_scripts_to_close_windows (WebKitSettings *settings)
4164+ {
4165+ g_return_val_if_fail (WEBKIT_IS_SETTINGS (settings), FALSE );
4166+
4167+ return settings->priv ->preferences ->allowScriptsToCloseWindows ();
4168+ }
4169+
4170+ /* *
4171+ * webkit_settings_set_allow_scripts_to_close_windows
4172+ * @settings: a #WebKitSettings
4173+ * @allowed: Value to be set
4174+ *
4175+ * Set the #WebKitSettings:allow-scripts-to-close-windows property.
4176+ */
4177+ WEBKIT_API void
4178+ webkit_settings_set_allow_scripts_to_close_windows (WebKitSettings *settings, gboolean allowed)
4179+ {
4180+ g_return_if_fail (WEBKIT_IS_SETTINGS (settings));
4181+
4182+ WebKitSettingsPrivate* priv = settings->priv ;
4183+ bool currentValue = priv->preferences ->allowScriptsToCloseWindows ();
4184+ if (currentValue == allowed)
4185+ return ;
4186+
4187+ priv->preferences ->setAllowScriptsToCloseWindows (allowed);
4188+ g_object_notify (G_OBJECT (settings), " allow-scripts-to-close-windows" );
4189+ }
0 commit comments