Title: [135058] trunk/Source/WebCore
Revision
135058
Author
e...@webkit.org
Date
2012-11-17 19:37:49 -0800 (Sat, 17 Nov 2012)

Log Message

Add ScriptWrappable to more WebCore classes which are commonly JS-wrapped
https://bugs.webkit.org/show_bug.cgi?id=102601

Reviewed by Adam Barth.

>From my investigations all of these classes exist only to be exposed
to the web (via _javascript_) and are not used internally by WebCore.
I beleive all of them always have wrappers.
These were found using this code:
https://bugs.webkit.org/show_bug.cgi?id=102539#c2

Geolocation -- navigator.geolocation
WebKitCSSMatrix -- represent matrixes in JS through various APIs
DOMStringMap, NamedNodeMap, NodeIterator, TreeWalker -- exclusively for the DOM API
Blob, FileList - used by the File, Clipboard and XHR, also exclusively as API
ValidityState -- formControl.validity
CanvasRenderingContext -- canvas.getContext()
DOMApplicationCache -- window.appcache
Screen -- window.screen
DOMMimeTypeArray -- navigator.mimetypes
DOMPlugin -- navigator.plugins[0]
DOMPluginArray -- navigator.plugins

* Modules/geolocation/Geolocation.h:
* css/WebKitCSSMatrix.h:
* dom/DOMStringMap.h:
* dom/NamedNodeMap.h:
* dom/NodeIterator.h:
* dom/TreeWalker.h:
* fileapi/Blob.h:
* fileapi/FileList.h: (had to un-indent to make check-webkit-style happy)
(FileList):
(WebCore::FileList::create):
(WebCore::FileList::length):
(WebCore::FileList::isEmpty):
(WebCore::FileList::clear):
(WebCore::FileList::append):
* html/ValidityState.h:
* html/canvas/CanvasRenderingContext.h:
* loader/appcache/DOMApplicationCache.h:
* page/Screen.h:
* platform/graphics/wince/MediaPlayerProxy.cpp:
(WebCore::WebMediaPlayerProxy::initEngine): This code was wrong, fixed to use internal APIs.
* plugins/DOMMimeTypeArray.h:
* plugins/DOMPlugin.h:
* plugins/DOMPluginArray.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135057 => 135058)


--- trunk/Source/WebCore/ChangeLog	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/ChangeLog	2012-11-18 03:37:49 UTC (rev 135058)
@@ -1,3 +1,52 @@
+2012-11-17  Eric Seidel  <e...@webkit.org>
+
+        Add ScriptWrappable to more WebCore classes which are commonly JS-wrapped
+        https://bugs.webkit.org/show_bug.cgi?id=102601
+
+        Reviewed by Adam Barth.
+
+        From my investigations all of these classes exist only to be exposed
+        to the web (via _javascript_) and are not used internally by WebCore.
+        I beleive all of them always have wrappers.
+        These were found using this code:
+        https://bugs.webkit.org/show_bug.cgi?id=102539#c2
+
+        Geolocation -- navigator.geolocation
+        WebKitCSSMatrix -- represent matrixes in JS through various APIs
+        DOMStringMap, NamedNodeMap, NodeIterator, TreeWalker -- exclusively for the DOM API
+        Blob, FileList - used by the File, Clipboard and XHR, also exclusively as API
+        ValidityState -- formControl.validity
+        CanvasRenderingContext -- canvas.getContext()
+        DOMApplicationCache -- window.appcache
+        Screen -- window.screen
+        DOMMimeTypeArray -- navigator.mimetypes
+        DOMPlugin -- navigator.plugins[0]
+        DOMPluginArray -- navigator.plugins
+
+        * Modules/geolocation/Geolocation.h:
+        * css/WebKitCSSMatrix.h:
+        * dom/DOMStringMap.h:
+        * dom/NamedNodeMap.h:
+        * dom/NodeIterator.h:
+        * dom/TreeWalker.h:
+        * fileapi/Blob.h:
+        * fileapi/FileList.h: (had to un-indent to make check-webkit-style happy)
+        (FileList):
+        (WebCore::FileList::create):
+        (WebCore::FileList::length):
+        (WebCore::FileList::isEmpty):
+        (WebCore::FileList::clear):
+        (WebCore::FileList::append):
+        * html/ValidityState.h:
+        * html/canvas/CanvasRenderingContext.h:
+        * loader/appcache/DOMApplicationCache.h:
+        * page/Screen.h:
+        * platform/graphics/wince/MediaPlayerProxy.cpp:
+        (WebCore::WebMediaPlayerProxy::initEngine): This code was wrong, fixed to use internal APIs.
+        * plugins/DOMMimeTypeArray.h:
+        * plugins/DOMPlugin.h:
+        * plugins/DOMPluginArray.h:
+
 2012-11-17  Alexandru Chiculita  <ach...@adobe.com>
 
         [Texmap][CSS Shaders] Reuse the precompiled shader for custom filters in TextureMapperGL

Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.h (135057 => 135058)


--- trunk/Source/WebCore/Modules/geolocation/Geolocation.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -35,6 +35,7 @@
 #include "PositionError.h"
 #include "PositionErrorCallback.h"
 #include "PositionOptions.h"
+#include "ScriptWrappable.h"
 #include "Timer.h"
 
 namespace WebCore {
@@ -47,7 +48,7 @@
 class Page;
 class ScriptExecutionContext;
 
-class Geolocation : public RefCounted<Geolocation>, public ActiveDOMObject
+class Geolocation : public ScriptWrappable, public RefCounted<Geolocation>, public ActiveDOMObject
 {
 public:
     static PassRefPtr<Geolocation> create(ScriptExecutionContext*);

Modified: trunk/Source/WebCore/css/WebKitCSSMatrix.h (135057 => 135058)


--- trunk/Source/WebCore/css/WebKitCSSMatrix.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/css/WebKitCSSMatrix.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -26,6 +26,7 @@
 #ifndef WebKitCSSMatrix_h
 #define WebKitCSSMatrix_h
 
+#include "ScriptWrappable.h"
 #include "TransformationMatrix.h"
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
@@ -35,7 +36,7 @@
 
 typedef int ExceptionCode;
 
-class WebKitCSSMatrix : public RefCounted<WebKitCSSMatrix> {
+class WebKitCSSMatrix : public ScriptWrappable, public RefCounted<WebKitCSSMatrix> {
 public:
     static PassRefPtr<WebKitCSSMatrix> create(const TransformationMatrix& m)
     {

Modified: trunk/Source/WebCore/dom/DOMStringMap.h (135057 => 135058)


--- trunk/Source/WebCore/dom/DOMStringMap.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/dom/DOMStringMap.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -26,6 +26,7 @@
 #ifndef DOMStringMap_h
 #define DOMStringMap_h
 
+#include "ScriptWrappable.h"
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
@@ -35,7 +36,7 @@
 class Element;
 typedef int ExceptionCode;
 
-class DOMStringMap {
+class DOMStringMap : public ScriptWrappable {
     WTF_MAKE_NONCOPYABLE(DOMStringMap); WTF_MAKE_FAST_ALLOCATED;
 public:
     virtual ~DOMStringMap();

Modified: trunk/Source/WebCore/dom/NamedNodeMap.h (135057 => 135058)


--- trunk/Source/WebCore/dom/NamedNodeMap.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/dom/NamedNodeMap.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -25,6 +25,7 @@
 #ifndef NamedNodeMap_h
 #define NamedNodeMap_h
 
+#include "ScriptWrappable.h"
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
@@ -36,7 +37,7 @@
 
 typedef int ExceptionCode;
 
-class NamedNodeMap {
+class NamedNodeMap : public ScriptWrappable {
     WTF_MAKE_FAST_ALLOCATED;
     friend class Element;
 public:

Modified: trunk/Source/WebCore/dom/NodeIterator.h (135057 => 135058)


--- trunk/Source/WebCore/dom/NodeIterator.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/dom/NodeIterator.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -26,6 +26,7 @@
 #define NodeIterator_h
 
 #include "NodeFilter.h"
+#include "ScriptWrappable.h"
 #include "Traversal.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -34,7 +35,7 @@
 
     typedef int ExceptionCode;
 
-    class NodeIterator : public RefCounted<NodeIterator>, public Traversal {
+    class NodeIterator : public ScriptWrappable, public RefCounted<NodeIterator>, public Traversal {
     public:
         static PassRefPtr<NodeIterator> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences)
         {

Modified: trunk/Source/WebCore/dom/TreeWalker.h (135057 => 135058)


--- trunk/Source/WebCore/dom/TreeWalker.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/dom/TreeWalker.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -26,6 +26,7 @@
 #define TreeWalker_h
 
 #include "NodeFilter.h"
+#include "ScriptWrappable.h"
 #include "Traversal.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -34,7 +35,7 @@
 
     typedef int ExceptionCode;
 
-    class TreeWalker : public RefCounted<TreeWalker>, public Traversal {
+    class TreeWalker : public ScriptWrappable, public RefCounted<TreeWalker>, public Traversal {
     public:
         static PassRefPtr<TreeWalker> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences)
         {

Modified: trunk/Source/WebCore/fileapi/Blob.h (135057 => 135058)


--- trunk/Source/WebCore/fileapi/Blob.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/fileapi/Blob.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -33,6 +33,7 @@
 
 #include "BlobData.h"
 #include "KURL.h"
+#include "ScriptWrappable.h"
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -43,7 +44,7 @@
 
 class ScriptExecutionContext;
 
-class Blob : public RefCounted<Blob> {
+class Blob : public ScriptWrappable, public RefCounted<Blob> {
 public:
     static PassRefPtr<Blob> create()
     {

Modified: trunk/Source/WebCore/fileapi/FileList.h (135057 => 135058)


--- trunk/Source/WebCore/fileapi/FileList.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/fileapi/FileList.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -27,6 +27,7 @@
 #define FileList_h
 
 #include "File.h"
+#include "ScriptWrappable.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
@@ -34,26 +35,26 @@
 
 namespace WebCore {
 
-    class FileList : public RefCounted<FileList> {
-    public:
-        static PassRefPtr<FileList> create()
-        {
-            return adoptRef(new FileList);
-        }
+class FileList : public ScriptWrappable, public RefCounted<FileList> {
+public:
+    static PassRefPtr<FileList> create()
+    {
+        return adoptRef(new FileList);
+    }
 
-        unsigned length() const { return m_files.size(); }
-        File* item(unsigned index) const;
+    unsigned length() const { return m_files.size(); }
+    File* item(unsigned index) const;
 
-        bool isEmpty() const { return m_files.isEmpty(); }
-        void clear() { m_files.clear(); }
-        void append(PassRefPtr<File> file) { m_files.append(file); }
-        Vector<String> paths() const;
+    bool isEmpty() const { return m_files.isEmpty(); }
+    void clear() { m_files.clear(); }
+    void append(PassRefPtr<File> file) { m_files.append(file); }
+    Vector<String> paths() const;
 
-    private:
-        FileList();
+private:
+    FileList();
 
-        Vector<RefPtr<File> > m_files;
-    };
+    Vector<RefPtr<File> > m_files;
+};
 
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/html/ValidityState.h (135057 => 135058)


--- trunk/Source/WebCore/html/ValidityState.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/html/ValidityState.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -25,11 +25,12 @@
 #define ValidityState_h
 
 #include "FormAssociatedElement.h"
+#include "ScriptWrappable.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
-class ValidityState {
+class ValidityState : public ScriptWrappable {
     WTF_MAKE_NONCOPYABLE(ValidityState); WTF_MAKE_FAST_ALLOCATED;
 public:
     static PassOwnPtr<ValidityState> create(FormAssociatedElement* control)

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h (135057 => 135058)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -28,6 +28,7 @@
 
 #include "GraphicsLayer.h"
 #include "HTMLCanvasElement.h"
+#include "ScriptWrappable.h"
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/text/StringHash.h>
@@ -41,7 +42,7 @@
 class KURL;
 class WebGLObject;
 
-class CanvasRenderingContext {
+class CanvasRenderingContext : public ScriptWrappable {
     WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); WTF_MAKE_FAST_ALLOCATED;
 public:
     virtual ~CanvasRenderingContext() { }

Modified: trunk/Source/WebCore/loader/appcache/DOMApplicationCache.h (135057 => 135058)


--- trunk/Source/WebCore/loader/appcache/DOMApplicationCache.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/loader/appcache/DOMApplicationCache.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -30,6 +30,7 @@
 #include "DOMWindowProperty.h"
 #include "EventNames.h"
 #include "EventTarget.h"
+#include "ScriptWrappable.h"
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
@@ -42,7 +43,7 @@
 class Frame;
 class KURL;
 
-class DOMApplicationCache : public RefCounted<DOMApplicationCache>, public EventTarget, public DOMWindowProperty {
+class DOMApplicationCache : public ScriptWrappable, public RefCounted<DOMApplicationCache>, public EventTarget, public DOMWindowProperty {
 public:
     static PassRefPtr<DOMApplicationCache> create(Frame* frame) { return adoptRef(new DOMApplicationCache(frame)); }
     ~DOMApplicationCache() { ASSERT(!m_frame); }

Modified: trunk/Source/WebCore/page/Screen.h (135057 => 135058)


--- trunk/Source/WebCore/page/Screen.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/page/Screen.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -31,6 +31,7 @@
 #define Screen_h
 
 #include "DOMWindowProperty.h"
+#include "ScriptWrappable.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
@@ -38,7 +39,7 @@
 
     class Frame;
 
-    class Screen : public RefCounted<Screen>, public DOMWindowProperty {
+    class Screen : public ScriptWrappable, public RefCounted<Screen>, public DOMWindowProperty {
     public:
         static PassRefPtr<Screen> create(Frame *frame) { return adoptRef(new Screen(frame)); }
 

Modified: trunk/Source/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp (135057 => 135058)


--- trunk/Source/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp	2012-11-18 03:37:49 UTC (rev 135058)
@@ -101,9 +101,9 @@
     String serviceType;
 
     // add all attributes set on the embed object
-    if (NamedNodeMap* attributes = element->attributes()) {
-        for (unsigned i = 0; i < attributes->length(); ++i) {
-            Attribute* it = attributes->attributeItem(i);
+    if (element->hasAttributes()) {
+        for (unsigned i = 0; i < element->attributeCount(); ++i) {
+            Attribute* it = element->attributeItem(i);
             paramNames.append(it->name().localName().string());
             paramValues.append(it->value().string());
         }

Modified: trunk/Source/WebCore/plugins/DOMMimeTypeArray.h (135057 => 135058)


--- trunk/Source/WebCore/plugins/DOMMimeTypeArray.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/plugins/DOMMimeTypeArray.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -23,6 +23,7 @@
 
 #include "DOMMimeType.h"
 #include "DOMWindowProperty.h"
+#include "ScriptWrappable.h"
 #include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -33,7 +34,7 @@
 class Frame;
 class PluginData;
 
-class DOMMimeTypeArray : public RefCounted<DOMMimeTypeArray>, public DOMWindowProperty {
+class DOMMimeTypeArray : public ScriptWrappable, public RefCounted<DOMMimeTypeArray>, public DOMWindowProperty {
 public:
     static PassRefPtr<DOMMimeTypeArray> create(Frame* frame) { return adoptRef(new DOMMimeTypeArray(frame)); }
     ~DOMMimeTypeArray();

Modified: trunk/Source/WebCore/plugins/DOMPlugin.h (135057 => 135058)


--- trunk/Source/WebCore/plugins/DOMPlugin.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/plugins/DOMPlugin.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -22,6 +22,7 @@
 
 #include "FrameDestructionObserver.h"
 #include "DOMMimeType.h"
+#include "ScriptWrappable.h"
 #include <wtf/Forward.h>
 #include <wtf/RefPtr.h>
 #include <wtf/RefCounted.h>
@@ -31,7 +32,7 @@
 class Plugin;
 class PluginData;
 
-class DOMPlugin : public RefCounted<DOMPlugin>, public FrameDestructionObserver {
+class DOMPlugin : public ScriptWrappable, public RefCounted<DOMPlugin>, public FrameDestructionObserver {
 public:
     static PassRefPtr<DOMPlugin> create(PluginData* pluginData, Frame* frame, unsigned index) { return adoptRef(new DOMPlugin(pluginData, frame, index)); }
     ~DOMPlugin();

Modified: trunk/Source/WebCore/plugins/DOMPluginArray.h (135057 => 135058)


--- trunk/Source/WebCore/plugins/DOMPluginArray.h	2012-11-18 03:37:04 UTC (rev 135057)
+++ trunk/Source/WebCore/plugins/DOMPluginArray.h	2012-11-18 03:37:49 UTC (rev 135058)
@@ -23,6 +23,7 @@
 
 #include "DOMPlugin.h"
 #include "DOMWindowProperty.h"
+#include "ScriptWrappable.h"
 #include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -33,7 +34,7 @@
 class Frame;
 class PluginData;
 
-class DOMPluginArray : public RefCounted<DOMPluginArray>, public DOMWindowProperty {
+class DOMPluginArray : public ScriptWrappable, public RefCounted<DOMPluginArray>, public DOMWindowProperty {
 public:
     static PassRefPtr<DOMPluginArray> create(Frame* frame) { return adoptRef(new DOMPluginArray(frame)); }
     ~DOMPluginArray();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to