Conditionalize cross-document messaging support
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2008 16:36:07 +0000 (16:36 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2008 16:36:07 +0000 (16:36 +0000)
 top level:

         Conditionalize cross-document messaging support

         The cross-document messaging parts of HTML 5 are in flux and we want
         ports to be able to turn off the support as needed.

         Note that the support is turned off by default right now. A subsequent
         commit will turn it on by default.

         Reviewed by Darin.

         * configure.ac:

 WebCore:

         Conditionalize cross-document messaging support

         The cross-document messaging parts of HTML 5 are in flux and we want
         ports to be able to turn off the support as needed.

         Note that the support is turned off by default right now. A subsequent
         commit will turn it on by default.

         Reviewed by Darin.

         * GNUmakefile.am:
         * WebCore.vcproj/build-generated-files.sh:
         * bindings/js/JSDOMWindowCustom.cpp:
         (WebCore::JSDOMWindow::customGetOwnPropertySlot):
         * bindings/js/JSEventCustom.cpp:
         (WebCore::toJS):
         * dom/Event.cpp:
         (WebCore::Event::isMessageEvent):
         * dom/Event.h:
         * dom/MessageEvent.cpp:
         * dom/MessageEvent.h:
         * dom/MessageEvent.idl:
         * page/DOMWindow.cpp:
         (WebCore::DOMWindow::postMessage):
         * page/DOMWindow.h:
         * page/DOMWindow.idl:

 WebKitTools:

         Conditionalize cross-document messaging support

         The cross-document messaging parts of HTML 5 are in flux and we want
         ports to be able to turn off the support as needed.

         Note that the support is turned off by default right now. A subsequent
         commit will turn it on by default.

         Reviewed by Darin.

         * Scripts/build-webkit:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30269 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
ChangeLog
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.vcproj/build-generated-files.sh
WebCore/bindings/js/JSDOMWindowCustom.cpp
WebCore/bindings/js/JSEventCustom.cpp
WebCore/dom/Event.cpp
WebCore/dom/Event.h
WebCore/dom/MessageEvent.cpp
WebCore/dom/MessageEvent.h
WebCore/dom/MessageEvent.idl
WebCore/page/DOMWindow.cpp
WebCore/page/DOMWindow.h
WebCore/page/DOMWindow.idl
WebKitTools/ChangeLog
WebKitTools/Scripts/build-webkit
configure.ac

index 908b518..d84e14e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-02-14  Adam Roben  <aroben@apple.com>
+
+        Conditionalize cross-document messaging support
+
+        The cross-document messaging parts of HTML 5 are in flux and we want
+        ports to be able to turn off the support as needed.
+
+        Note that the support is turned off by default right now. A subsequent
+        commit will turn it on by default.
+
+        Reviewed by Darin.
+
+        * configure.ac:
+
 2008-02-12  Rodney Dawes  <dobey@wayofthemonkey.com>
 
         Reviewed by Alp Toker.
index a51a234..87d69f8 100644 (file)
 
 2008-02-14  Adam Roben  <aroben@apple.com>
 
+        Conditionalize cross-document messaging support
+
+        The cross-document messaging parts of HTML 5 are in flux and we want
+        ports to be able to turn off the support as needed.
+
+        Note that the support is turned off by default right now. A subsequent
+        commit will turn it on by default.
+
+        Reviewed by Darin.
+
+        * GNUmakefile.am:
+        * WebCore.vcproj/build-generated-files.sh:
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::customGetOwnPropertySlot):
+        * bindings/js/JSEventCustom.cpp:
+        (WebCore::toJS):
+        * dom/Event.cpp:
+        (WebCore::Event::isMessageEvent):
+        * dom/Event.h:
+        * dom/MessageEvent.cpp:
+        * dom/MessageEvent.h:
+        * dom/MessageEvent.idl:
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::postMessage):
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+
+2008-02-14  Adam Roben  <aroben@apple.com>
+
         Improve the efficiency of SecurityOriginHash
 
         Reviewed by Alexey.
index 86dfbf0..1744c85 100644 (file)
@@ -1001,6 +1001,25 @@ webcore_sources += \
 endif # END USE_CURL
 
 # ----
+# Cross-document messaging support
+# ----
+
+if ENABLE_CROSS_DOCUMENT_MESSAGING
+FEATURE_DEFINES_JAVASCRIPT += ENABLE_CROSS_DOCUMENT_MESSAGING=1
+
+webcore_built_sources += \
+       DerivedSources/JSMessageEvent.h
+       DerivedSources/JSMessageEvent.cpp
+
+IDL_BINDINGS += \
+       WebCore/dom/MessageEvent.idl
+
+webcore_cppflags += \
+       -DENABLE_CROSS_DOCUMENT_MESSAGING=1
+
+endif # END ENABLE_CROSS_DOCUMENT_MESSAGING
+
+# ----
 # Database Support
 # ----
 if ENABLE_DATABASE
index eef4b0d..217efa4 100644 (file)
@@ -65,5 +65,5 @@ mkdir -p "${BUILT_PRODUCTS_DIR}/DerivedSources"
 cd "${BUILT_PRODUCTS_DIR}/DerivedSources"
 
 export WebCore="${XSRCROOT}"
-export FEATURE_DEFINES="ENABLE_DATABASE ENABLE_ICONDATABASE ENABLE_XPATH ENABLE_SVG ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_AS_IMAGE ENABLE_SVG_USE ENABLE_VIDEO"
+export FEATURE_DEFINES="ENABLE_CROSS_DOCUMENT_MESSAGING ENABLE_DATABASE ENABLE_ICONDATABASE ENABLE_XPATH ENABLE_SVG ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_AS_IMAGE ENABLE_SVG_USE ENABLE_VIDEO"
 make -f "$WebCore/DerivedSources.make" -j ${NUMCPUS} || exit 1
index 31a7865..4c1ae6a 100644 (file)
@@ -86,7 +86,10 @@ bool JSDOMWindow::customGetOwnPropertySlot(ExecState* exec, const Identifier& pr
                 && (entry->value.functionValue == jsDOMWindowPrototypeFunctionBlur
                     || entry->value.functionValue == jsDOMWindowPrototypeFunctionClose
                     || entry->value.functionValue == jsDOMWindowPrototypeFunctionFocus
-                    || entry->value.functionValue == jsDOMWindowPrototypeFunctionPostMessage)) {
+#if ENABLE(CROSS_DOCUMENT_MESSAGING)
+                    || entry->value.functionValue == jsDOMWindowPrototypeFunctionPostMessage
+#endif
+                    )) {
             if (!allowsAccess) {
                 slot.setStaticEntry(this, entry, nonCachingStaticFunctionGetter);
                 return true;
@@ -143,6 +146,7 @@ bool JSDOMWindow::customGetPropertyNames(ExecState* exec, PropertyNameArray&)
     return false;
 }
 
+#if ENABLE(CROSS_DOCUMENT_MESSAGING)
 JSValue* JSDOMWindow::postMessage(ExecState* exec, const List& args)
 {
     DOMWindow* window = impl();
@@ -159,5 +163,6 @@ JSValue* JSDOMWindow::postMessage(ExecState* exec, const List& args)
     
     return jsUndefined();
 }
+#endif
 
 } // namespace WebCore
index 55a5f1d..4ba7f96 100644 (file)
@@ -86,8 +86,10 @@ JSValue* toJS(ExecState* exec, Event* event)
         ret = new JSMutationEvent(JSMutationEventPrototype::self(exec), static_cast<MutationEvent*>(event));
     else if (event->isOverflowEvent())
         ret = new JSOverflowEvent(JSOverflowEventPrototype::self(exec), static_cast<OverflowEvent*>(event));
+#if ENABLE(CROSS_DOCUMENT_MESSAGING)
     else if (event->isMessageEvent())
         ret = new JSMessageEvent(JSMessageEventPrototype::self(exec), static_cast<MessageEvent*>(event));
+#endif
     else if (event->isProgressEvent())
         ret = new JSProgressEvent(JSProgressEventPrototype::self(exec), static_cast<ProgressEvent*>(event));
     else
index f41692e..543dfff 100644 (file)
@@ -112,10 +112,12 @@ bool Event::isWheelEvent() const
     return false;
 }
 
+#if ENABLE(CROSS_DOCUMENT_MESSAGING)
 bool Event::isMessageEvent() const
 {
     return false;
 }
+#endif
 
 bool Event::isBeforeTextInsertedEvent() const
 {
index 993682b..b74bc16 100644 (file)
@@ -101,7 +101,9 @@ namespace WebCore {
         virtual bool isTextEvent() const;
         virtual bool isDragEvent() const; // a subset of mouse events
         virtual bool isClipboardEvent() const;
+#if ENABLE(CROSS_DOCUMENT_MESSAGING)
         virtual bool isMessageEvent() const;
+#endif
         virtual bool isWheelEvent() const;
         virtual bool isBeforeTextInsertedEvent() const;
         virtual bool isOverflowEvent() const;
index 863b133..06f253d 100644 (file)
@@ -27,6 +27,8 @@
 
 #include "config.h"
 
+#if ENABLE(CROSS_DOCUMENT_MESSAGING)
+
 #include "DOMWindow.h"
 #include "EventNames.h"
 #include "MessageEvent.h"
@@ -71,3 +73,5 @@ bool MessageEvent::isMessageEvent() const
 }
 
 } // namespace WebCore
+
+#endif // ENABLE(CROSS_DOCUMENT_MESSAGING)
index c7fc53d..f8b5f78 100644 (file)
@@ -28,6 +28,8 @@
 #ifndef MessageEvent_h
 #define MessageEvent_h
 
+#if ENABLE(CROSS_DOCUMENT_MESSAGING)
+
 #include "Event.h"
 
 namespace WebCore {
@@ -58,4 +60,6 @@ namespace WebCore {
 
 } // namespace WebCore
 
+#endif // ENABLE(CROSS_DOCUMENT_MESSAGING)
+
 #endif // MessageEvent_h
index bbb71c8..22f5262 100644 (file)
@@ -26,7 +26,7 @@
 
 module events {
 
-    interface [GenerateConstructor] MessageEvent : Event {
+    interface [Conditional=CROSS_DOCUMENT_MESSAGING,GenerateConstructor] MessageEvent : Event {
 
         readonly attribute DOMString data;
         readonly attribute DOMString domain;
index 3997d87..a0523bc 100644 (file)
@@ -220,11 +220,13 @@ Console* DOMWindow::console() const
     return m_console.get();
 }
 
+#if ENABLE(CROSS_DOCUMENT_MESSAGING)
 void DOMWindow::postMessage(const String& message, const String& domain, const String& uri, DOMWindow* source) const
 {
    ExceptionCode ec;
    document()->dispatchEvent(new MessageEvent(message, domain, uri, source), ec, true);
 }
+#endif
 
 DOMSelection* DOMWindow::getSelection()
 {
index 3f5b544..05fdc4f 100644 (file)
@@ -142,7 +142,9 @@ namespace WebCore {
 
         Console* console() const;
         
+#if ENABLE(CROSS_DOCUMENT_MESSAGING)
         void postMessage(const String& message, const String& domain, const String& uri, DOMWindow* source) const;
+#endif
 
         void scrollBy(int x, int y) const;
         void scrollTo(int x, int y) const;
index 142eee0..655d6ab 100644 (file)
@@ -134,8 +134,10 @@ module window {
 
                  attribute [Replaceable] Console console;
 
+#if defined(ENABLE_CROSS_DOCUMENT_MESSAGING)
         // cross-document messaging
         [DoNotCheckDomainSecurity, Custom] void postMessage(in DOMString message);
+#endif
 
 #if defined(LANGUAGE_JAVASCRIPT)
         // Global constructors
@@ -252,7 +254,6 @@ module window {
         attribute HTMLUListElementConstructor HTMLUListElement;
 
         attribute EventConstructor Event;
-        attribute MessageEventConstructor MessageEvent;
         attribute KeyboardEventConstructor KeyboardEvent;
         attribute MouseEventConstructor MouseEvent;
         attribute MutationEventConstructor MutationEvent;
@@ -276,6 +277,10 @@ module window {
 
         attribute XMLHttpRequestExceptionConstructor XMLHttpRequestException;
 
+#if defined(ENABLE_CROSS_DOCUMENT_MESSAGING)
+        attribute MessageEventConstructor MessageEvent;
+#endif
+
 #if defined(ENABLE_VIDEO)
         attribute HTMLAudioElementConstructor HTMLAudioElement;
         attribute HTMLMediaElementConstructor HTMLMediaElement;
index f76e9d6..693c7d1 100644 (file)
@@ -1,3 +1,17 @@
+2008-02-14  Adam Roben  <aroben@apple.com>
+
+        Conditionalize cross-document messaging support
+
+        The cross-document messaging parts of HTML 5 are in flux and we want
+        ports to be able to turn off the support as needed.
+
+        Note that the support is turned off by default right now. A subsequent
+        commit will turn it on by default.
+
+        Reviewed by Darin.
+
+        * Scripts/build-webkit:
+
 2008-02-14  Darin Adler  <darin@apple.com>
 
        - fix Windows build
index 4cd8817..2ef5c3d 100755 (executable)
@@ -39,6 +39,7 @@ use POSIX;
 
 my $originalWorkingDirectory = getcwd();
 
+my $crossDocumentMessagingSupport = 0;
 my $databaseSupport = 1;
 my $iconDatabaseSupport = 1;
 my $svgSupport = 1;
@@ -60,6 +61,7 @@ my $programName = basename($0);
 my $usage = <<EOF;
 Usage: $programName [options] [options to pass to build system]
   --help                        Show this help message
+  --[no-]cross-document-messaging   Toggle cross-document messaging support (default: $crossDocumentMessagingSupport)
   --[no-]database               Toggle Database Support (default: $databaseSupport)
   --[no-]icon-database          Toggle Icon database support (default: $iconDatabaseSupport)
   --[no-]svg                    Toggle SVG support (default: $svgSupport)
@@ -77,7 +79,8 @@ Usage: $programName [options] [options to pass to build system]
   --[no-]coverage               Toggle code coverage support (default: $coverageSupport)
 EOF
 
-GetOptions('database!' => \$databaseSupport,
+GetOptions('cross-document-messaging!' => \$crossDocumentMessagingSupport,
+           'database!' => \$databaseSupport,
            'icon-database!' => \$iconDatabaseSupport,
            'svg!' => \$svgSupport,
            'svg-experimental!' => \$svgExperimentalSupport,
@@ -140,6 +143,7 @@ if (isWx()) {
 my $productDir = productDir();
 my @overrideFeatureDefinesOption = ();
 
+push @overrideFeatureDefinesOption, "ENABLE_CROSS_DOCUMENT_MESSAGIN" if $crossDocumentMessagingSupport;
 push @overrideFeatureDefinesOption, "ENABLE_DATABASE" if $databaseSupport;
 push @overrideFeatureDefinesOption, "ENABLE_ICONDATABASE" if $iconDatabaseSupport;
 push @overrideFeatureDefinesOption, "ENABLE_SVG" if $svgSupport;
@@ -181,6 +185,7 @@ if ($clean && isOSX()) {
 
 # enable autotool options accordingly
 if ($ENV{WEBKITAUTOTOOLS}) {
+    push @options, autotoolsFlag($crossDocumentMessagingSupport, "cross-document-messaging");
     push @options, autotoolsFlag($databaseSupport, "database");
     push @options, autotoolsFlag($iconDatabaseSupport, "icon-database");
     push @options, autotoolsFlag($svgSupport, "svg");
index 1cfd2df..ce3ca36 100644 (file)
@@ -222,6 +222,14 @@ AC_ARG_ENABLE(debug,
               [],[enable_debug="no"])
 AC_MSG_RESULT([$enable_debug])
 
+# check whether to build with cross-document messaging support
+AC_MSG_CHECKING([whether to enable HTML5 client-side storage support])
+AC_ARG_ENABLE(cross_document_messaging,
+              AC_HELP_STRING([--enable-cross-document-messaging],
+                             [enable HTML5 cross-document messaging support [default=no]]),
+              [],[enable_cross_document_messaging="no"])
+AC_MSG_RESULT([$enable_cross_document_messaging])
+
 # check whether to build with database support
 AC_MSG_CHECKING([whether to enable HTML5 client-side storage support])
 AC_ARG_ENABLE(database,
@@ -431,6 +439,7 @@ AM_CONDITIONAL([USE_CURL], [test "$http_backend" = "curl"])
 
 # WebKit feature conditionals
 AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug" = "yes"])
+AM_CONDITIONAL([ENABLE_CROSS_DOCUMENT_MESSAGING],[test "$enable_cross_document_messaging" = "yes"])
 AM_CONDITIONAL([ENABLE_DATABASE],[test "$enable_database" = "yes"])
 AM_CONDITIONAL([ENABLE_ICONDATABASE],[test "$enable_icon_database" = "yes"])
 AM_CONDITIONAL([ENABLE_XPATH],[test "$enable_xpath" = "yes"])
@@ -464,6 +473,7 @@ WebKit was configured with the following options:
  Enable debug                      : $enable_debug
  Code coverage support             : $enable_coverage
  Optimized memory allocator        : $enable_fast_malloc
+ HTML5 cross-document messaging    : $enable_cross_document_messaging
  HTML5 client-side storage support : $enable_database
  HTML5 video element support       : $enable_video
  Icon database support             : $enable_icon_database