Title: [89812] trunk/Source/WebKit/efl
Revision
89812
Author
[email protected]
Date
2011-06-27 03:45:55 -0700 (Mon, 27 Jun 2011)

Log Message

2011-06-27  Jongseok Yang  <[email protected]>

        Reviewed by Kent Tamura.

        [EFL] Use accept attribute when executing the file picker for input element
        https://bugs.webkit.org/show_bug.cgi?id=63063

        This patch:
        - remove the argument "suggested_filenames" from ewk_view_run_open_panel
        - add the argument "accept" to ewk_view_run_open_panel
        - get the accept attribute and pass to ewk_view_run_open_panel within runOpenPanel

        * WebCoreSupport/ChromeClientEfl.cpp:
        (WebCore::ChromeClientEfl::runOpenPanel):
        * ewk/ewk_view.cpp:
        (ewk_view_run_open_panel):
        * ewk/ewk_view.h

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (89811 => 89812)


--- trunk/Source/WebKit/efl/ChangeLog	2011-06-27 10:44:40 UTC (rev 89811)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-06-27 10:45:55 UTC (rev 89812)
@@ -1,3 +1,21 @@
+2011-06-27  Jongseok Yang  <[email protected]>
+
+        Reviewed by Kent Tamura.
+
+        [EFL] Use accept attribute when executing the file picker for input element
+        https://bugs.webkit.org/show_bug.cgi?id=63063
+
+        This patch:
+        - remove the argument "suggested_filenames" from ewk_view_run_open_panel
+        - add the argument "accept" to ewk_view_run_open_panel
+        - get the accept attribute and pass to ewk_view_run_open_panel within runOpenPanel
+
+        * WebCoreSupport/ChromeClientEfl.cpp:
+        (WebCore::ChromeClientEfl::runOpenPanel):
+        * ewk/ewk_view.cpp:
+        (ewk_view_run_open_panel):
+        * ewk/ewk_view.h
+
 2011-06-27  Gyuyoung Kim  <[email protected]>
 
         Unreviewed. Fix style error.

Modified: trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp (89811 => 89812)


--- trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2011-06-27 10:44:40 UTC (rev 89811)
+++ trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2011-06-27 10:45:55 UTC (rev 89812)
@@ -422,20 +422,12 @@
     RefPtr<FileChooser> chooser = prpFileChooser;
     bool confirm;
     Eina_List* selectedFilenames = 0;
-    Eina_List* suggestedFilenames = 0;
     void* filename;
     Vector<String> filenames;
 
-    for (unsigned i = 0; i < chooser->settings().selectedFiles.size(); i++) {
-        CString str = chooser->settings().selectedFiles[i].utf8();
-        filename = strdup(str.data());
-        suggestedFilenames = eina_list_append(suggestedFilenames, filename);
-    }
+    CString accept = chooser->settings().acceptTypes.utf8();
+    confirm = ewk_view_run_open_panel(m_view, kit(frame), chooser->settings().allowsMultipleFiles, accept.data(), &selectedFilenames);
 
-    confirm = ewk_view_run_open_panel(m_view, kit(frame), chooser->settings().allowsMultipleFiles, suggestedFilenames, &selectedFilenames);
-    EINA_LIST_FREE(suggestedFilenames, filename)
-        free(filename);
-
     if (!confirm)
         return;
 

Modified: trunk/Source/WebKit/efl/ewk/ewk_private.h (89811 => 89812)


--- trunk/Source/WebKit/efl/ewk/ewk_private.h	2011-06-27 10:44:40 UTC (rev 89811)
+++ trunk/Source/WebKit/efl/ewk/ewk_private.h	2011-06-27 10:45:55 UTC (rev 89812)
@@ -96,7 +96,7 @@
 Eina_Bool ewk_view_should_interrupt_javascript(Evas_Object *o);
 uint64_t ewk_view_exceeded_database_quota(Evas_Object *o, Evas_Object *frame, const char *databaseName, uint64_t current_size, uint64_t expected_size);
 
-Eina_Bool ewk_view_run_open_panel(Evas_Object *o, Evas_Object *frame, Eina_Bool allows_multiple_files, const Eina_List *suggested_filenames, Eina_List **selected_filenames);
+Eina_Bool ewk_view_run_open_panel(Evas_Object* o, Evas_Object* frame, Eina_Bool allows_multiple_files, const char* accept_types, Eina_List** selected_filenames);
 
 void ewk_view_repaint(Evas_Object *o, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
 void ewk_view_scroll(Evas_Object *o, Evas_Coord dx, Evas_Coord dy, Evas_Coord sx, Evas_Coord sy, Evas_Coord sw, Evas_Coord sh, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch, Eina_Bool main_frame);

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (89811 => 89812)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-06-27 10:44:40 UTC (rev 89811)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-06-27 10:45:55 UTC (rev 89812)
@@ -4006,13 +4006,12 @@
  * @param frame Frame in which operation is required.
  * @param allows_multiple_files @c EINA_TRUE when more than one file may be
  * selected, @c EINA_FALSE otherwise
- * @suggested_filenames List of suggested files to select. It's advisable to
- * just ignore this value, since it's a source of security flaw.
+ * @param accept_types accept mime types
  * @selected_filenames List of files selected.
  *
  * @return @EINA_FALSE if user canceled file selection; @EINA_TRUE if confirmed.
  */
-Eina_Bool ewk_view_run_open_panel(Evas_Object* o, Evas_Object* frame, Eina_Bool allows_multiple_files, const Eina_List* suggested_filenames, Eina_List** selected_filenames)
+Eina_Bool ewk_view_run_open_panel(Evas_Object* o, Evas_Object* frame, Eina_Bool allows_multiple_files, const char* accept_types, Eina_List** selected_filenames)
 {
     DBG("o=%p frame=%p allows_multiple_files=%d", o, frame, allows_multiple_files);
     EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
@@ -4024,7 +4023,7 @@
 
     *selected_filenames = 0;
 
-    confirm = sd->api->run_open_panel(sd, frame, allows_multiple_files, suggested_filenames, selected_filenames);
+    confirm = sd->api->run_open_panel(sd, frame, allows_multiple_files, accept_types, selected_filenames);
     if (!confirm && *selected_filenames)
         ERR("Canceled file selection, but selected filenames != 0. Free names before return.");
     return confirm;

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (89811 => 89812)


--- trunk/Source/WebKit/efl/ewk/ewk_view.h	2011-06-27 10:44:40 UTC (rev 89811)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h	2011-06-27 10:45:55 UTC (rev 89812)
@@ -138,7 +138,7 @@
     Eina_Bool (*should_interrupt_javascript)(Ewk_View_Smart_Data *sd);
     uint64_t (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *databaseName, uint64_t current_size, uint64_t expected_size);
 
-    Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Eina_Bool allows_multiple_files, const Eina_List *suggested_filenames, Eina_List **selected_filenames);
+    Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Eina_Bool allows_multiple_files, const char *accept_types, Eina_List **selected_filenames);
 
     Eina_Bool (*navigation_policy_decision)(Ewk_View_Smart_Data *sd, Ewk_Frame_Resource_Request *request);
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to