Title: [93833] trunk/Source/WebKit/efl
Revision
93833
Author
[email protected]
Date
2011-08-25 16:08:34 -0700 (Thu, 25 Aug 2011)

Log Message

[EFL] Add API to allow scripts to close windows automatically via _javascript_.
https://bugs.webkit.org/show_bug.cgi?id=66777

Patch by Raphael Kubo da Costa <[email protected]> on 2011-08-25
Reviewed by Antonio Gomes.

Make it possible to allow or prevent scripts from closing windows
automatically (via window.close, for example).

Besides being useful in general, this is required by DRT.

* ewk/ewk_view.cpp:
(_ewk_view_priv_new):
(ewk_view_setting_scripts_can_close_windows_get):
(ewk_view_setting_scripts_can_close_windows_set):
* ewk/ewk_view.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (93832 => 93833)


--- trunk/Source/WebKit/efl/ChangeLog	2011-08-25 23:08:11 UTC (rev 93832)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-08-25 23:08:34 UTC (rev 93833)
@@ -1,5 +1,23 @@
 2011-08-25  Raphael Kubo da Costa  <[email protected]>
 
+        [EFL] Add API to allow scripts to close windows automatically via _javascript_.
+        https://bugs.webkit.org/show_bug.cgi?id=66777
+
+        Reviewed by Antonio Gomes.
+
+        Make it possible to allow or prevent scripts from closing windows
+        automatically (via window.close, for example).
+
+        Besides being useful in general, this is required by DRT.
+
+        * ewk/ewk_view.cpp:
+        (_ewk_view_priv_new):
+        (ewk_view_setting_scripts_can_close_windows_get):
+        (ewk_view_setting_scripts_can_close_windows_set):
+        * ewk/ewk_view.h:
+
+2011-08-25  Raphael Kubo da Costa  <[email protected]>
+
         [EFL] Implement FrameLoaderClient::didTransferChildFrameToNewDocument
         https://bugs.webkit.org/show_bug.cgi?id=66690
 

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (93832 => 93833)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-08-25 23:08:11 UTC (rev 93832)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-08-25 23:08:34 UTC (rev 93833)
@@ -135,6 +135,7 @@
         Eina_Bool enable_frame_flattening:1;
         Eina_Bool encoding_detector:1;
         Eina_Bool scripts_window_open:1;
+        Eina_Bool scripts_can_close_windows:1;
         Eina_Bool resizable_textareas:1;
         Eina_Bool private_browsing:1;
         Eina_Bool caret_browsing:1;
@@ -634,6 +635,7 @@
     priv->settings.enable_plugins = priv->page_settings->arePluginsEnabled();
     priv->settings.enable_frame_flattening = priv->page_settings->frameFlatteningEnabled();
     priv->settings.scripts_window_open = priv->page_settings->_javascript_CanOpenWindowsAutomatically();
+    priv->settings.scripts_can_close_windows = priv->page_settings->allowScriptsToCloseWindows();
     priv->settings.resizable_textareas = priv->page_settings->textAreasAreResizable();
     priv->settings.private_browsing = priv->page_settings->privateBrowsingEnabled();
     priv->settings.caret_browsing = priv->page_settings->caretBrowsingEnabled();
@@ -1946,6 +1948,25 @@
     return EINA_TRUE;
 }
 
+Eina_Bool ewk_view_setting_scripts_can_close_windows_get(const Evas_Object *o)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
+    EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
+    return priv->settings.scripts_can_close_windows;
+}
+
+Eina_Bool ewk_view_setting_scripts_can_close_windows_set(Evas_Object *o, Eina_Bool allow)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
+    EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
+    allow = !!allow;
+    if (priv->settings.scripts_can_close_windows != allow) {
+        priv->page_settings->setAllowScriptsToCloseWindows(allow);
+        priv->settings.scripts_can_close_windows = allow;
+    }
+    return EINA_TRUE;
+}
+
 Eina_Bool ewk_view_setting_resizable_textareas_get(const Evas_Object *o)
 {
     EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (93832 => 93833)


--- trunk/Source/WebKit/efl/ewk/ewk_view.h	2011-08-25 23:08:11 UTC (rev 93832)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h	2011-08-25 23:08:34 UTC (rev 93833)
@@ -1397,6 +1397,27 @@
 EAPI Eina_Bool    ewk_view_setting_scripts_window_open_set(Evas_Object *o, Eina_Bool allow);
 
 /**
+ * Returns whether scripts can close windows automatically.
+ *
+ * @param o View whose settings to check.
+ *
+ * @return @c EINA_TRUE if scripts can close windows, @c EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool    ewk_view_setting_scripts_can_close_windows_get(const Evas_Object *o);
+
+/**
+ * Sets whether scripts are allowed to close windows automatically.
+ *
+ * @param o View whose settings to change.
+ * @param allow @c EINA_TRUE to allow scripts to close windows,
+ *              @c EINA_FALSE otherwise.
+ *
+ * @return @c EINA_TRUE if the setting could be changed successfully,
+ *         @c EINA_FALSE in case an error occurred.
+ */
+EAPI Eina_Bool    ewk_view_setting_scripts_can_close_windows_set(Evas_Object *o, Eina_Bool allow);
+
+/**
  * Queries if HTML elements @c textarea can be resizable.
  *
  * @param o view object to query if the textarea elements can be resizable
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to