Changeset 36891 in webkit


Ignore:
Timestamp:
Sep 25, 2008 3:15:11 AM (16 years ago)
Author:
ap@webkit.org
Message:

Reviewed by Sam Weinig, Anders Carlsson, and (unofficially) Adam Barth.

https://bugs.webkit.org/show_bug.cgi?id=20879
Implement HTML5 channel messaging

Tests: fast/events/message-channel-gc.html

fast/events/message-port-deleted-document.html
fast/events/message-port-deleted-frame.html
fast/events/message-port-inactive-document.html
fast/events/message-port.html
http/tests/security/MessagePort/event-listener-context.html

  • Configurations/WebCore.xcconfig: Removed unused ENABLE_CROSS_DOCUMENT_MESSAGING macro.
  • DerivedSources.make: Added MessageChannel and MessagePort.
  • WebCore.pro: Made MessageEvent compilation unconditional, as it could not possibly be turmed off anyway. Added new files.
  • GNUmakefile.am:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • WebCoreSources.bkl: Added new files.
  • bindings/js/JSDOMWindowBase.h:
  • bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::getValueProperty): Added suport for window.MessageChannel constructor.
  • bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::postMessage):
  • page/DOMWindow.cpp: (WebCore::DOMWindow::postMessage):
  • page/DOMWindow.h:
  • page/DOMWindow.idl: Added support for three-argument postMessage (that posts a MessagePort).
  • dom/EventTarget.cpp: (WebCore::EventTarget::toMessagePort):
  • dom/EventTarget.h:
  • bindings/js/JSEventTargetBase.cpp: (WebCore::toJS): Added MessagePort as yet another EventTarget variant.
  • bindings/js/JSMessageChannelConstructor.h:
  • bindings/js/JSMessageChannelConstructor.cpp: Added a custom constructor, so that it could take a browsing context (document) parameter.
  • bindings/js/JSMessageChannelCustom.cpp: Added. (WebCore::JSMessageChannel::mark): JSMessageChannel uses a custom mark function to mark port1 and port2 that it owns.
  • bindings/js/JSMessagePortCustom.cpp: Added. (WebCore::JSMessagePort::startConversation): (WebCore::JSMessagePort::addEventListener): (WebCore::JSMessagePort::removeEventListener): (WebCore::JSMessagePort::dispatchEvent): (WebCore::JSMessagePort::setOnmessage): (WebCore::JSMessagePort::onmessage): (WebCore::JSMessagePort::setOnclose): (WebCore::JSMessagePort::onclose): (WebCore::JSMessagePort::mark):
  • dom/MessagePort.cpp: Added.
  • dom/MessagePort.h: Added.
  • dom/MessagePort.idl: Added. Added a MessagePort implementation. Currently, it is not thread-safe at all, and only works with Documents as contexts, but in the future, it will be used for communication with worker threads.
  • bindings/objc/DOMInternal.h: Include "DOMMessagePortInternal.h". The new APIs do not really have Obj-C bindings, as they are far from being final, but a MessagePort stub is needed for MessageEvent.
  • bindings/scripts/CodeGeneratorJS.pm: Include PlatformString.h for MessagePort happiness.
  • dom/Document.cpp: (WebCore::MessagePortTimer::MessagePortTimer): (WebCore::MessagePortTimer::fired): (WebCore::Document::processMessagePortMessagesSoon): (WebCore::Document::~Document): (WebCore::Document::dispatchMessagePortEvents): (WebCore::Document::createdMessagePort): (WebCore::Document::destroyedMessagePort):
  • dom/Document.h: Document keeps track of all MessagePort objects that were created when it was fully active in its context.
  • dom/EventNames.h: Added closeEvent.
  • dom/MessageChannel.cpp: Added. (WebCore::MessageChannel::MessageChannel): (WebCore::MessageChannel::~MessageChannel):
  • dom/MessageChannel.h: Added. (WebCore::MessageChannel::create): (WebCore::MessageChannel::port1): (WebCore::MessageChannel::port2):
  • dom/MessageChannel.idl: Added. Addded JSMessageChannel implementation.
  • dom/MessageEvent.cpp: (WebCore::MessageEvent::MessageEvent): (WebCore::MessageEvent::initMessageEvent):
  • dom/MessageEvent.h: (WebCore::MessageEvent::create): (WebCore::MessageEvent::messagePort):
  • dom/MessageEvent.idl: MessageEvent has a MessagePort member now, making it possible to pass ports across documents.
Location:
trunk
Files:
27 added
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r36890 r36891  
     12008-09-24  Alexey Proskuryakov  <ap@webkit.org>
     2
     3        Reviewed by Sam Weinig, Anders Carlsson, and (unofficially) Adam Barth.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=20879
     6        Implement HTML5 channel messaging
     7
     8        * fast/dom/Window/window-properties-expected.txt:
     9        * fast/events/message-channel-gc-expected.txt: Added.
     10        * fast/events/message-channel-gc.html: Added.
     11        * fast/events/message-port-deleted-document-expected.txt: Added.
     12        * fast/events/message-port-deleted-document.html: Added.
     13        * fast/events/message-port-deleted-frame-expected.txt: Added.
     14        * fast/events/message-port-deleted-frame.html: Added.
     15        * fast/events/message-port-expected.txt: Added.
     16        * fast/events/message-port-inactive-document-expected.txt: Added.
     17        * fast/events/message-port-inactive-document.html: Added.
     18        * fast/events/message-port.html: Added.
     19        * fast/events/resources/message-port-iframe.html: Added.
     20        * http/tests/security/MessagePort: Added.
     21        * http/tests/security/MessagePort/event-listener-context-expected.txt: Added.
     22        * http/tests/security/MessagePort/event-listener-context.html: Added.
     23        * http/tests/security/MessagePort/resources: Added.
     24        * http/tests/security/MessagePort/resources/attacker-frame.html: Added.
     25        * http/tests/security/MessagePort/resources/banking-site.html: Added.
     26
    1272008-09-25  David Smith  <catfish.man@gmail.com>
    228
  • trunk/LayoutTests/fast/dom/Window/window-properties-expected.txt

    r36287 r36891  
    902902window.MediaList.prototype.deleteMedium [function]
    903903window.MediaList.prototype.item [function]
     904window.MessageChannel [object MessageChannelConstructor]
     905window.MessageChannel.prototype [object MessageChannelPrototype]
    904906window.MessageEvent [object MessageEventConstructor]
    905907window.MessageEvent.prototype [printed above as window.Event.prototype]
  • trunk/WebCore/ChangeLog

    r36890 r36891  
     12008-09-24  Alexey Proskuryakov  <ap@webkit.org>
     2
     3        Reviewed by Sam Weinig, Anders Carlsson, and (unofficially) Adam Barth.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=20879
     6        Implement HTML5 channel messaging
     7
     8        Tests: fast/events/message-channel-gc.html
     9               fast/events/message-port-deleted-document.html
     10               fast/events/message-port-deleted-frame.html
     11               fast/events/message-port-inactive-document.html
     12               fast/events/message-port.html
     13               http/tests/security/MessagePort/event-listener-context.html
     14
     15        * Configurations/WebCore.xcconfig:
     16        Removed unused  ENABLE_CROSS_DOCUMENT_MESSAGING macro.
     17
     18        * DerivedSources.make:
     19        Added MessageChannel and MessagePort.
     20
     21        * WebCore.pro: Made MessageEvent compilation unconditional, as it could not possibly be
     22        turmed off anyway. Added new files.
     23
     24        * GNUmakefile.am:
     25        * WebCore.pro:
     26        * WebCore.vcproj/WebCore.vcproj:
     27        * WebCore.xcodeproj/project.pbxproj:
     28        * WebCoreSources.bkl:
     29        Added new files.
     30
     31        * bindings/js/JSDOMWindowBase.h:
     32        * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::getValueProperty):
     33        Added suport for window.MessageChannel constructor.
     34
     35        * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::postMessage):
     36        * page/DOMWindow.cpp:
     37        (WebCore::DOMWindow::postMessage):
     38        * page/DOMWindow.h:
     39        * page/DOMWindow.idl:
     40        Added support for three-argument postMessage (that posts a MessagePort).
     41
     42        * dom/EventTarget.cpp:
     43        (WebCore::EventTarget::toMessagePort):
     44        * dom/EventTarget.h:
     45        * bindings/js/JSEventTargetBase.cpp: (WebCore::toJS): Added MessagePort as yet another
     46        EventTarget variant.
     47
     48        * bindings/js/JSMessageChannelConstructor.h:
     49        * bindings/js/JSMessageChannelConstructor.cpp: Added a custom constructor, so that it could
     50        take a browsing context (document) parameter.
     51
     52        * bindings/js/JSMessageChannelCustom.cpp: Added.
     53        (WebCore::JSMessageChannel::mark): JSMessageChannel uses a custom mark function to mark
     54        port1 and port2 that it owns.
     55
     56        * bindings/js/JSMessagePortCustom.cpp: Added.
     57        (WebCore::JSMessagePort::startConversation):
     58        (WebCore::JSMessagePort::addEventListener):
     59        (WebCore::JSMessagePort::removeEventListener):
     60        (WebCore::JSMessagePort::dispatchEvent):
     61        (WebCore::JSMessagePort::setOnmessage):
     62        (WebCore::JSMessagePort::onmessage):
     63        (WebCore::JSMessagePort::setOnclose):
     64        (WebCore::JSMessagePort::onclose):
     65        (WebCore::JSMessagePort::mark):
     66        * dom/MessagePort.cpp: Added.
     67        * dom/MessagePort.h: Added.
     68        * dom/MessagePort.idl: Added.
     69        Added a MessagePort implementation. Currently, it is not thread-safe at all, and only works
     70        with Documents as contexts, but in the future, it will be used for communication with worker
     71        threads.
     72
     73        * bindings/objc/DOMInternal.h: Include "DOMMessagePortInternal.h". The new APIs do not
     74        really have Obj-C bindings, as they are far from being final, but a MessagePort stub is
     75        needed for MessageEvent.
     76
     77        * bindings/scripts/CodeGeneratorJS.pm: Include PlatformString.h for MessagePort happiness.
     78
     79        * dom/Document.cpp:
     80        (WebCore::MessagePortTimer::MessagePortTimer):
     81        (WebCore::MessagePortTimer::fired):
     82        (WebCore::Document::processMessagePortMessagesSoon):
     83        (WebCore::Document::~Document):
     84        (WebCore::Document::dispatchMessagePortEvents):
     85        (WebCore::Document::createdMessagePort):
     86        (WebCore::Document::destroyedMessagePort):
     87        * dom/Document.h:
     88        Document keeps track of all MessagePort objects that were created when it was fully active
     89        in its context.
     90
     91        * dom/EventNames.h: Added closeEvent.
     92
     93        * dom/MessageChannel.cpp: Added.
     94        (WebCore::MessageChannel::MessageChannel):
     95        (WebCore::MessageChannel::~MessageChannel):
     96        * dom/MessageChannel.h: Added.
     97        (WebCore::MessageChannel::create):
     98        (WebCore::MessageChannel::port1):
     99        (WebCore::MessageChannel::port2):
     100        * dom/MessageChannel.idl: Added.
     101        Addded JSMessageChannel implementation.
     102
     103        * dom/MessageEvent.cpp:
     104        (WebCore::MessageEvent::MessageEvent):
     105        (WebCore::MessageEvent::initMessageEvent):
     106        * dom/MessageEvent.h:
     107        (WebCore::MessageEvent::create):
     108        (WebCore::MessageEvent::messagePort):
     109        * dom/MessageEvent.idl:
     110        MessageEvent has a MessagePort member now, making it possible to pass ports across
     111        documents.
     112
    11132008-09-25  David Smith  <catfish.man@gmail.com>
    2114
  • trunk/WebCore/Configurations/WebCore.xcconfig

    r36102 r36891  
    1616
    1717// This needs to be kept sorted, and in sync with FEATURE_DEFINES in JavaScriptCore.xcconfig, WebKit.xcconfig and the default settings of build-webkit.
    18 FEATURE_DEFINES = ENABLE_CROSS_DOCUMENT_MESSAGING ENABLE_DATABASE ENABLE_DOM_STORAGE ENABLE_ICONDATABASE ENABLE_OFFLINE_WEB_APPLICATIONS ENABLE_SVG ENABLE_SVG_ANIMATION ENABLE_SVG_AS_IMAGE ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_USE ENABLE_VIDEO ENABLE_XPATH ENABLE_XSLT;
     18FEATURE_DEFINES = ENABLE_DATABASE ENABLE_DOM_STORAGE ENABLE_ICONDATABASE ENABLE_OFFLINE_WEB_APPLICATIONS ENABLE_SVG ENABLE_SVG_ANIMATION ENABLE_SVG_AS_IMAGE ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_USE ENABLE_VIDEO ENABLE_XPATH ENABLE_XSLT;
    1919
    2020SQLITE3_LIBRARY = $(SQLITE3_LIBRARY_$(MAC_OS_X_VERSION_MAJOR));
  • trunk/WebCore/DerivedSources.cpp

    r36091 r36891  
    142142#include "JSMediaError.cpp"
    143143#include "JSMediaList.cpp"
     144#include "JSMessageChannel.cpp"
    144145#include "JSMessageEvent.cpp"
     146#include "JSMessagePort.cpp"
    145147#include "JSMimeType.cpp"
    146148#include "JSMimeTypeArray.cpp"
  • trunk/WebCore/DerivedSources.make

    r36787 r36891  
    161161    MediaError \
    162162    MediaList \
     163    MessageChannel \
    163164    MessageEvent \
     165    MessagePort \
    164166    MimeType \
    165167    MimeTypeArray \
  • trunk/WebCore/GNUmakefile.am

    r36886 r36891  
    283283        DerivedSources/JSMediaList.cpp \
    284284        DerivedSources/JSMediaList.h \
     285        DerivedSources/JSMessageChannel.cpp \
     286        DerivedSources/JSMessageChannel.h \
    285287        DerivedSources/JSMessageEvent.cpp \
    286288        DerivedSources/JSMessageEvent.h \
     289        DerivedSources/JSMessagePort.cpp \
     290        DerivedSources/JSMessagePort.h \
    287291        DerivedSources/JSMimeType.cpp \
    288292        DerivedSources/JSMimeType.h \
     
    407411        WebCore/dom/EventException.idl \
    408412        WebCore/dom/KeyboardEvent.idl \
     413        WebCore/dom/MessageChannel.idl \
    409414        WebCore/dom/MessageEvent.idl \
     415        WebCore/dom/MessagePort.idl \
    410416        WebCore/dom/MouseEvent.idl \
    411417        WebCore/dom/MutationEvent.idl \
     
    675681        WebCore/bindings/js/JSLocationCustom.cpp \
    676682        WebCore/bindings/js/JSLocationCustom.h \
     683        WebCore/bindings/js/JSMessageChannelConstructor.cpp \
     684        WebCore/bindings/js/JSMessageChannelConstructor.h \
     685        WebCore/bindings/js/JSMessageChannelCustom.cpp \
     686        WebCore/bindings/js/JSMessagePortCustom.cpp \
    677687        WebCore/bindings/js/JSMimeTypeArrayCustom.cpp \
    678688        WebCore/bindings/js/JSNSResolver.cpp \
     
    938948        WebCore/dom/MappedAttribute.h \
    939949        WebCore/dom/MappedAttributeEntry.h \
     950        WebCore/dom/MessageChannel.cpp \
     951        WebCore/dom/MessageChannel.h \
    940952        WebCore/dom/MessageEvent.cpp \
    941953        WebCore/dom/MessageEvent.h \
     954        WebCore/dom/MessagePort.cpp \
     955        WebCore/dom/MessagePort.h \
    942956        WebCore/dom/MouseEvent.cpp \
    943957        WebCore/dom/MouseEvent.h \
  • trunk/WebCore/WebCore.pro

    r36886 r36891  
    5959
    6060# Optional components (look for defs in config.h and included files!)
    61 !contains(DEFINES, ENABLE_CROSS_DOCUMENT_MESSAGING=.): DEFINES += ENABLE_CROSS_DOCUMENT_MESSAGING=1
    6261!contains(DEFINES, ENABLE_DASHBOARD_SUPPORT=.): DEFINES += ENABLE_DASHBOARD_SUPPORT=0
    6362!contains(DEFINES, ENABLE_DATABASE=.): DEFINES += ENABLE_DATABASE=1
     
    247246    dom/KeyboardEvent.idl \
    248247    dom/MouseEvent.idl \
     248    dom/MessageChannel.idl \
     249    dom/MessageEvent.idl \
     250    dom/MessagePort.idl \
    249251    dom/MutationEvent.idl \
    250252    dom/NamedNodeMap.idl \
     
    420422    bindings/js/JSPluginCustom.cpp \
    421423    bindings/js/JSPluginArrayCustom.cpp \
     424    bindings/js/JSMessageChannelConstructor.cpp \
     425    bindings/js/JSMessageChannelCustom.cpp \
     426    bindings/js/JSMessagePortCustom.cpp \
    422427    bindings/js/JSMimeTypeArrayCustom.cpp \
    423428    bindings/js/JSDOMBinding.cpp \
     
    525530    dom/KeyboardEvent.cpp \
    526531    dom/MappedAttribute.cpp \
     532    dom/MessageChannel.cpp \
     533    dom/MessageEvent.cpp \
     534    dom/MessagePort.cpp \
    527535    dom/MouseEvent.cpp \
    528536    dom/MouseRelatedEvent.cpp \
     
    11231131}
    11241132
    1125 contains(DEFINES, ENABLE_CROSS_DOCUMENT_MESSAGING=1) {
    1126     FEATURE_DEFINES_JAVASCRIPT += ENABLE_CROSS_DOCUMENT_MESSAGING=1
    1127 
    1128     SOURCES += \
    1129         dom/MessageEvent.cpp
    1130 
    1131     IDL_BINDINGS += \
    1132         dom/MessageEvent.idl
    1133 }
    1134 
    11351133contains(DEFINES, ENABLE_DASHBOARD_SUPPORT=0) {
    11361134    DASHBOARDSUPPORTCSSPROPERTIES -= $$PWD/css/DashboardSupportCSSPropertyNames.in
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r36886 r36891  
    22<VisualStudioProject
    33        ProjectType="Visual C++"
    4         Version="8.00"
     4        Version="8,00"
    55        Name="WebCore"
    66        ProjectGUID="{1C16337B-ACF3-4D03-AA90-851C5B5EADA6}"
     
    985985                        </File>
    986986                        <File
     987                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMessageChannel.h"
     988                                >
     989                        </File>
     990                        <File
    987991                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMessageEvent.h"
     992                                >
     993                        </File>
     994                        <File
     995                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMessagePort.h"
    988996                                >
    989997                        </File>
     
    33543362                        <File
    33553363                                RelativePath="..\platform\ScrollTypes.h"
    3356                                 >
    3357                         </File>
    3358                         <File
    3359                                 RelativePath="..\platform\ScrollView.cpp"
    33603364                                >
    33613365                        </File>
     
    54615465                                        </File>
    54625466                                        <File
     5467                                                RelativePath="..\platform\network\cf\DNSCFNet.cpp"
     5468                                                >
     5469                                                <FileConfiguration
     5470                                                        Name="Debug_Cairo|Win32"
     5471                                                        ExcludedFromBuild="true"
     5472                                                        >
     5473                                                        <Tool
     5474                                                                Name="VCCLCompilerTool"
     5475                                                        />
     5476                                                </FileConfiguration>
     5477                                                <FileConfiguration
     5478                                                        Name="Release_Cairo|Win32"
     5479                                                        ExcludedFromBuild="true"
     5480                                                        >
     5481                                                        <Tool
     5482                                                                Name="VCCLCompilerTool"
     5483                                                        />
     5484                                                </FileConfiguration>
     5485                                        </File>
     5486                                        <File
    54635487                                                RelativePath="..\platform\network\cf\FormDataStreamCFNet.cpp"
    54645488                                                >
     
    55825606                                        <File
    55835607                                                RelativePath="..\platform\network\cf\ResourceRequestCFNet.cpp"
    5584                                                 >
    5585                                                 <FileConfiguration
    5586                                                         Name="Debug_Cairo|Win32"
    5587                                                         ExcludedFromBuild="true"
    5588                                                         >
    5589                                                         <Tool
    5590                                                                 Name="VCCLCompilerTool"
    5591                                                         />
    5592                                                 </FileConfiguration>
    5593                                                 <FileConfiguration
    5594                                                         Name="Release_Cairo|Win32"
    5595                                                         ExcludedFromBuild="true"
    5596                                                         >
    5597                                                         <Tool
    5598                                                                 Name="VCCLCompilerTool"
    5599                                                         />
    5600                                                 </FileConfiguration>
    5601                                         </File>
    5602                                         <File
    5603                                                 RelativePath="..\platform\network\cf\DNSCFNet.cpp"
    56045608                                                >
    56055609                                                <FileConfiguration
     
    1075510759                        </File>
    1075610760                        <File
     10761                                RelativePath="..\dom\MessageChannel.cpp"
     10762                                >
     10763                        </File>
     10764                        <File
     10765                                RelativePath="..\dom\MessageChannel.h"
     10766                                >
     10767                        </File>
     10768                        <File
    1075710769                                RelativePath="..\dom\MessageEvent.cpp"
    1075810770                                >
     
    1077110783                        </File>
    1077210784                        <File
     10785                                RelativePath="..\dom\MessagePort.cpp"
     10786                                >
     10787                        </File>
     10788                        <File
     10789                                RelativePath="..\dom\MessagePort.h"
     10790                                >
     10791                        </File>
     10792                        <File
    1077310793                                RelativePath="..\dom\MouseEvent.cpp"
    1077410794                                >
     
    1134711367                        </File>
    1134811368                        <File
     11369                                RelativePath="..\dom\XMLTokenizer.h"
     11370                                >
     11371                        </File>
     11372                        <File
    1134911373                                RelativePath="..\dom\XMLTokenizerLibxml2.cpp"
    1135011374                                >
     
    1135711381                                        />
    1135811382                                </FileConfiguration>
    11359                         </File>
    11360                         <File
    11361                                 RelativePath="..\dom\XMLTokenizer.h"
    11362                                 >
    1136311383                        </File>
    1136411384                </Filter>
     
    1341013430                                </File>
    1341113431                                <File
     13432                                        RelativePath="..\bindings\js\JSHTMLAllCollection.cpp"
     13433                                        >
     13434                                </File>
     13435                                <File
    1341213436                                        RelativePath="..\bindings\js\JSHTMLAllCollection.h"
    1341313437                                        >
    1341413438                                </File>
    1341513439                                <File
    13416                                         RelativePath="..\bindings\js\JSHTMLAllCollection.cpp"
    13417                                         >
    13418                                 </File>
    13419                                 <File
    1342013440                                        RelativePath="..\bindings\js\JSHTMLAppletElementCustom.cpp"
    1342113441                                        >
     
    1351513535                                <File
    1351613536                                        RelativePath="..\bindings\js\JSLocationCustom.cpp"
     13537                                        >
     13538                                </File>
     13539                                <File
     13540                                        RelativePath="..\bindings\js\JSMessageChannelConstructor.cpp"
     13541                                        >
     13542                                </File>
     13543                                <File
     13544                                        RelativePath="..\bindings\js\JSMessageChannelConstructor.h"
     13545                                        >
     13546                                </File>
     13547                                <File
     13548                                        RelativePath="..\bindings\js\JSMessageChannelCustom.cpp"
     13549                                        >
     13550                                </File>
     13551                                <File
     13552                                        RelativePath="..\bindings\js\JSMessagePortCustom.cpp"
    1351713553                                        >
    1351813554                                </File>
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r36886 r36891  
    41144114                DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CCE0A1989CA007FB8C5 /* CSSUnknownRule.h */; };
    41154115                DDE63ED50B7D45A800226998 /* DOMTextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A14750B7D1BAF00A53FFD /* DOMTextEvent.h */; };
     4116                E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */; };
     4117                E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = E107400C0E77BDC00033AF24 /* JSMessageChannel.h */; };
     4118                E10743240E7835830033AF24 /* JSMessageChannelConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E10743230E7835830033AF24 /* JSMessageChannelConstructor.cpp */; };
     4119                E10743270E7835A50033AF24 /* JSMessageChannelConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E10743260E7835A50033AF24 /* JSMessageChannelConstructor.h */; };
    41164120                E10B937C0B73C00A003ED890 /* JSCustomXPathNSResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */; };
    41174121                E10B93C30B73C291003ED890 /* JSCustomXPathNSResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E10B93C20B73C291003ED890 /* JSCustomXPathNSResolver.cpp */; };
     
    41264130                E1A302BC0DE8370300C52F2C /* StringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A302BB0DE8370300C52F2C /* StringBuilder.h */; };
    41274131                E1A302C10DE8376900C52F2C /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A302C00DE8376900C52F2C /* StringBuilder.cpp */; };
     4132                E1A5F99B0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */; };
     4133                E1ACAF4C0E791AAF0087D12B /* DOMMessagePort.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1ACAF4A0E791AAF0087D12B /* DOMMessagePort.mm */; };
     4134                E1ACAF4D0E791AAF0087D12B /* DOMMessagePort.h in Headers */ = {isa = PBXBuildFile; fileRef = E1ACAF4B0E791AAF0087D12B /* DOMMessagePort.h */; };
     4135                E1ADECBF0E76ACF1004A1A5E /* MessagePort.h in Headers */ = {isa = PBXBuildFile; fileRef = E1ADECBD0E76ACF1004A1A5E /* MessagePort.h */; };
     4136                E1ADECC00E76ACF1004A1A5E /* MessagePort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1ADECBE0E76ACF1004A1A5E /* MessagePort.cpp */; };
     4137                E1ADECC70E76AD1F004A1A5E /* MessagePort.idl in Resources */ = {isa = PBXBuildFile; fileRef = E1ADECC60E76AD1F004A1A5E /* MessagePort.idl */; };
     4138                E1ADECCE0E76AD8B004A1A5E /* MessageChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = E1ADECCC0E76AD8B004A1A5E /* MessageChannel.h */; };
     4139                E1ADECCF0E76AD8B004A1A5E /* MessageChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1ADECCD0E76AD8B004A1A5E /* MessageChannel.cpp */; };
     4140                E1ADECD10E76ADAB004A1A5E /* MessageChannel.idl in Resources */ = {isa = PBXBuildFile; fileRef = E1ADECD00E76ADAB004A1A5E /* MessageChannel.idl */; };
     4141                E1ADED470E76B8DD004A1A5E /* JSMessagePortCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1ADED460E76B8DD004A1A5E /* JSMessagePortCustom.cpp */; };
     4142                E1ADEDD50E76BD60004A1A5E /* DOMMessagePortInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = E1ADEDD40E76BD60004A1A5E /* DOMMessagePortInternal.h */; };
     4143                E1ADEDDA0E76BD93004A1A5E /* JSMessagePort.h in Headers */ = {isa = PBXBuildFile; fileRef = E1ADEDD80E76BD93004A1A5E /* JSMessagePort.h */; };
     4144                E1ADEDDB0E76BD93004A1A5E /* JSMessagePort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1ADEDD90E76BD93004A1A5E /* JSMessagePort.cpp */; };
    41284145                E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1BE512B0CF6C512002EA959 /* XSLTUnicodeSort.cpp */; };
    41294146                E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */ = {isa = PBXBuildFile; fileRef = E1BE512C0CF6C512002EA959 /* XSLTUnicodeSort.h */; };
     
    86548671                DD05FE0C0B8BA3C6009ACDFE /* WebCoreObjCExtras.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = WebCoreObjCExtras.c; sourceTree = "<group>"; };
    86558672                DD763BB10992C2C900740B8E /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = "<absolute>"; };
     8673                E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannel.cpp; sourceTree = "<group>"; };
     8674                E107400C0E77BDC00033AF24 /* JSMessageChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessageChannel.h; sourceTree = "<group>"; };
     8675                E10743230E7835830033AF24 /* JSMessageChannelConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannelConstructor.cpp; sourceTree = "<group>"; };
     8676                E10743260E7835A50033AF24 /* JSMessageChannelConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessageChannelConstructor.h; sourceTree = "<group>"; };
    86568677                E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomXPathNSResolver.h; sourceTree = "<group>"; };
    86578678                E10B93C20B73C291003ED890 /* JSCustomXPathNSResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomXPathNSResolver.cpp; sourceTree = "<group>"; };
     
    86648685                E1A302BB0DE8370300C52F2C /* StringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringBuilder.h; sourceTree = "<group>"; };
    86658686                E1A302C00DE8376900C52F2C /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringBuilder.cpp; sourceTree = "<group>"; };
     8687                E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannelCustom.cpp; sourceTree = "<group>"; };
     8688                E1ACAF4A0E791AAF0087D12B /* DOMMessagePort.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMMessagePort.mm; sourceTree = "<group>"; };
     8689                E1ACAF4B0E791AAF0087D12B /* DOMMessagePort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMMessagePort.h; sourceTree = "<group>"; };
     8690                E1ADECBD0E76ACF1004A1A5E /* MessagePort.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = MessagePort.h; sourceTree = "<group>"; };
     8691                E1ADECBE0E76ACF1004A1A5E /* MessagePort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MessagePort.cpp; sourceTree = "<group>"; };
     8692                E1ADECC60E76AD1F004A1A5E /* MessagePort.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MessagePort.idl; sourceTree = "<group>"; };
     8693                E1ADECCC0E76AD8B004A1A5E /* MessageChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageChannel.h; sourceTree = "<group>"; };
     8694                E1ADECCD0E76AD8B004A1A5E /* MessageChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MessageChannel.cpp; sourceTree = "<group>"; };
     8695                E1ADECD00E76ADAB004A1A5E /* MessageChannel.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MessageChannel.idl; sourceTree = "<group>"; };
     8696                E1ADED460E76B8DD004A1A5E /* JSMessagePortCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessagePortCustom.cpp; sourceTree = "<group>"; };
     8697                E1ADEDD40E76BD60004A1A5E /* DOMMessagePortInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMMessagePortInternal.h; sourceTree = "<group>"; };
     8698                E1ADEDD80E76BD93004A1A5E /* JSMessagePort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessagePort.h; sourceTree = "<group>"; };
     8699                E1ADEDD90E76BD93004A1A5E /* JSMessagePort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessagePort.cpp; sourceTree = "<group>"; };
    86668700                E1BE512B0CF6C512002EA959 /* XSLTUnicodeSort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTUnicodeSort.cpp; sourceTree = "<group>"; };
    86678701                E1BE512C0CF6C512002EA959 /* XSLTUnicodeSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSLTUnicodeSort.h; sourceTree = "<group>"; };
     
    1028910323                                75793ED00D0CE85B007FC0AC /* DOMMessageEvent.h */,
    1029010324                                75793ED10D0CE85B007FC0AC /* DOMMessageEvent.mm */,
     10325                                E1ACAF4A0E791AAF0087D12B /* DOMMessagePort.mm */,
     10326                                E1ACAF4B0E791AAF0087D12B /* DOMMessagePort.h */,
    1029110327                                857E0B230AB043460036E447 /* DOMMouseEvent.h */,
    1029210328                                857E0B240AB043460036E447 /* DOMMouseEvent.mm */,
     
    1058010616                                85E711820AC5D5350053270F /* DOMMediaListInternal.h */,
    1058110617                                75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */,
     10618                                E1ADEDD40E76BD60004A1A5E /* DOMMessagePortInternal.h */,
    1058210619                                85989DC60ACC8BBD00A0BC51 /* DOMMouseEventInternal.h */,
    1058310620                                85989DC70ACC8BBD00A0BC51 /* DOMMutationEventInternal.h */,
     
    1171811755                                A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */,
    1171911756                                A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */,
     11757                                E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */,
     11758                                E107400C0E77BDC00033AF24 /* JSMessageChannel.h */,
    1172011759                                75793EC60D0CE72D007FC0AC /* JSMessageEvent.cpp */,
    1172111760                                75793EC70D0CE72D007FC0AC /* JSMessageEvent.h */,
     11761                                E1ADEDD80E76BD93004A1A5E /* JSMessagePort.h */,
     11762                                E1ADEDD90E76BD93004A1A5E /* JSMessagePort.cpp */,
    1172211763                                A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */,
    1172311764                                A86629CB09DA2B47009633A5 /* JSMouseEvent.h */,
     
    1267212713                                C09158860DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp */,
    1267312714                                C09158870DB4209200E55AF4 /* JSInspectorCallbackWrapper.h */,
     12715                                E10743230E7835830033AF24 /* JSMessageChannelConstructor.cpp */,
     12716                                E10743260E7835A50033AF24 /* JSMessageChannelConstructor.h */,
    1267412717                                BCD9C26C0C17AA81005C90A2 /* JSNamedNodesCollection.cpp */,
    1267512718                                BCD9C26D0C17AA81005C90A2 /* JSNamedNodesCollection.h */,
     
    1279112834                                1C5FAEE60DCFDA6800D58F78 /* JSJavaScriptCallFrameCustom.cpp */,
    1279212835                                BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */,
     12836                                E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */,
     12837                                E1ADED460E76B8DD004A1A5E /* JSMessagePortCustom.cpp */,
    1279312838                                A9C6E6460D7465CA006442E9 /* JSMimeTypeArrayCustom.cpp */,
    1279412839                                BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */,
     
    1367313718                                A8C4A7F309D563270003AC8D /* MappedAttribute.h */,
    1367413719                                A8C4A84B09D5649D0003AC8D /* MappedAttributeEntry.h */,
     13720                                E1ADECCD0E76AD8B004A1A5E /* MessageChannel.cpp */,
     13721                                E1ADECCC0E76AD8B004A1A5E /* MessageChannel.h */,
     13722                                E1ADECD00E76ADAB004A1A5E /* MessageChannel.idl */,
    1367513723                                75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */,
    1367613724                                75793E810D0CE0B3007FC0AC /* MessageEvent.h */,
    1367713725                                75793E820D0CE0B3007FC0AC /* MessageEvent.idl */,
     13726                                E1ADECBE0E76ACF1004A1A5E /* MessagePort.cpp */,
     13727                                E1ADECBD0E76ACF1004A1A5E /* MessagePort.h */,
     13728                                E1ADECC60E76AD1F004A1A5E /* MessagePort.idl */,
    1367813729                                85031B2F0A44EFC700F992E0 /* MouseEvent.cpp */,
    1367913730                                85031B300A44EFC700F992E0 /* MouseEvent.h */,
     
    1581715868                                7284ADDE0E6FEB31002EEFBD /* UserStyleSheetLoader.h in Headers */,
    1581815869                                E47B4BE80E71241600038854 /* CachedResourceHandle.h in Headers */,
     15870                                E1ADECBF0E76ACF1004A1A5E /* MessagePort.h in Headers */,
     15871                                E1ADECCE0E76AD8B004A1A5E /* MessageChannel.h in Headers */,
     15872                                E1ADEDD50E76BD60004A1A5E /* DOMMessagePortInternal.h in Headers */,
     15873                                E1ADEDDA0E76BD93004A1A5E /* JSMessagePort.h in Headers */,
     15874                                E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */,
     15875                                E10743270E7835A50033AF24 /* JSMessageChannelConstructor.h in Headers */,
     15876                                E1ACAF4D0E791AAF0087D12B /* DOMMessagePort.h in Headers */,
    1581915877                                63D7B32D0E78CD3F00F7617C /* NodeRenderStyle.h in Headers */,
    1582015878                                63459C650E79CD33008ADFAF /* CSSNthSelector.h in Headers */,
     
    1598516043                                1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
    1598616044                                BCEF45400E676AC1001C1287 /* TextMetrics.idl in Resources */,
     16045                                E1ADECC70E76AD1F004A1A5E /* MessagePort.idl in Resources */,
     16046                                E1ADECD10E76ADAB004A1A5E /* MessageChannel.idl in Resources */,
    1598716047                        );
    1598816048                        runOnlyForDeploymentPostprocessing = 0;
     
    1766917729                                7284ADDD0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp in Sources */,
    1767017730                                E47B4BE90E71241600038854 /* CachedResourceHandle.cpp in Sources */,
     17731                                E1ADECC00E76ACF1004A1A5E /* MessagePort.cpp in Sources */,
     17732                                E1ADECCF0E76AD8B004A1A5E /* MessageChannel.cpp in Sources */,
     17733                                E1ADED470E76B8DD004A1A5E /* JSMessagePortCustom.cpp in Sources */,
     17734                                E1ADEDDB0E76BD93004A1A5E /* JSMessagePort.cpp in Sources */,
     17735                                E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */,
     17736                                E10743240E7835830033AF24 /* JSMessageChannelConstructor.cpp in Sources */,
     17737                                E1ACAF4C0E791AAF0087D12B /* DOMMessagePort.mm in Sources */,
     17738                                E1A5F99B0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp in Sources */,
    1767117739                                63459C660E79CD33008ADFAF /* CSSNthSelector.cpp in Sources */,
    1767217740                                29FFBB820E7C5A3D00407730 /* AccessibilityList.cpp in Sources */,
  • trunk/WebCore/WebCoreSources.bkl

    r36886 r36891  
    8282        bindings/js/JSJavaScriptCallFrameCustom.cpp
    8383        bindings/js/JSLocationCustom.cpp
     84        bindings/js/JSMessageChannelConstructor.cpp
     85        bindings/js/JSMessageChannelCustom.cpp
     86        bindings/js/JSMessagePortCustom.cpp
    8487        bindings/js/JSMimeTypeArrayCustom.cpp
    8588        bindings/js/JSNamedNodeMapCustom.cpp
     
    303306        DerivedSources/WebCore/JSLocation.cpp
    304307        DerivedSources/WebCore/JSMediaList.cpp
     308        DerivedSources/WebCore/JSMessageChannel.cpp
    305309        DerivedSources/WebCore/JSMessageEvent.cpp
     310        DerivedSources/WebCore/JSMessagePort.cpp
    306311        DerivedSources/WebCore/JSMimeType.cpp
    307312        DerivedSources/WebCore/JSMimeTypeArray.cpp
     
    392397        dom/KeyboardEvent.cpp
    393398        dom/MappedAttribute.cpp
     399        dom/MessageChannel.cpp
    394400        dom/MessageEvent.cpp
     401        dom/MessagePort.cpp
    395402        dom/MouseEvent.cpp
    396403        dom/MouseRelatedEvent.cpp
  • trunk/WebCore/bindings/js/JSDOMWindowBase.cpp

    r36877 r36891  
    4646#include "JSHTMLOptionElementConstructor.h"
    4747#include "JSImageConstructor.h"
     48#include "JSMessageChannelConstructor.h"
    4849#include "JSNode.h"
    4950#include "JSXMLHttpRequestConstructor.h"
     
    189190  Audio                 WebCore::JSDOMWindowBase::Audio              DontDelete
    190191  Image                 WebCore::JSDOMWindowBase::Image              DontDelete
     192  MessageChannel        WebCore::JSDOMWindowBase::MessageChannel     DontDelete
    191193  Option                WebCore::JSDOMWindowBase::Option             DontDelete
    192194  XMLHttpRequest        WebCore::JSDOMWindowBase::XMLHttpRequest     DontDelete
     
    451453        // time
    452454        return new (exec) JSImageConstructor(exec, impl()->frame()->document());
     455    case MessageChannel:
     456        if (!allowsAccessFrom(exec))
     457            return jsUndefined();
     458        return new (exec) JSMessageChannelConstructor(exec, impl()->frame()->document());
    453459    case Option:
    454460        if (!allowsAccessFrom(exec))
  • trunk/WebCore/bindings/js/JSDOMWindowBase.h

    r36675 r36891  
    148148
    149149            // Constructors
    150             Audio, Image, Option, XMLHttpRequest, XSLTProcessor
     150            Audio, Image, MessageChannel, Option, XMLHttpRequest, XSLTProcessor
    151151        };
    152152
  • trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r36675 r36891  
    2929#include "FrameTree.h"
    3030#include "JSDOMWindowShell.h"
     31#include "JSMessagePort.h"
     32#include "MessagePort.h"
    3133#include "Settings.h"
    3234#include "ScriptController.h"
     
    176178        return jsUndefined();
    177179
    178     String targetOrigin = valueToStringWithUndefinedOrNullCheck(exec, args.at(exec, 1));
     180    MessagePort* messagePort = (args.size() == 2) ? 0 : toMessagePort(args.at(exec, 1));
     181
     182    String targetOrigin = valueToStringWithUndefinedOrNullCheck(exec, args.at(exec, (args.size() == 2) ? 1 : 2));
    179183    if (exec->hadException())
    180184        return jsUndefined();
    181185
    182186    ExceptionCode ec = 0;
    183     window->postMessage(message, targetOrigin, source, ec);
     187    window->postMessage(message, messagePort, targetOrigin, source, ec);
    184188    setDOMException(exec, ec);
    185189
  • trunk/WebCore/bindings/js/JSEventTargetBase.cpp

    r36816 r36891  
    3232#include "JSEventListener.h"
    3333#include "JSEventTargetNode.h"
     34#include "JSMessagePort.h"
    3435#include "JSXMLHttpRequestUpload.h"
    3536#include <kjs/Error.h>
     
    295296        return getCachedDOMObjectWrapper(cache);
    296297#endif
     298
     299    if (MessagePort* messagePort = target->toMessagePort())
     300        return toJS(exec, messagePort);
    297301   
    298302    ASSERT_NOT_REACHED();
  • trunk/WebCore/bindings/objc/DOMInternal.h

    r36263 r36891  
    11/*
    2  * Copyright (C) 2004-2006 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple, Inc.  All rights reserved.
    33 * Copyright (C) 2006 James G. Speth (speth@end.com)
    44 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
     
    130130#import "DOMKeyboardEventInternal.h"
    131131#import "DOMMediaListInternal.h"
     132#import "DOMMessagePortInternal.h"
    132133#import "DOMMouseEventInternal.h"
    133134#import "DOMMutationEventInternal.h"
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r36816 r36891  
    196196    }
    197197
    198     if ($type eq "CanvasGradient" or $type eq "XPathNSResolver") {
     198    if ($type eq "CanvasGradient" or $type eq "XPathNSResolver" or $type eq "MessagePort") {
    199199        $implIncludes{"PlatformString.h"} = 1;
    200200    }
  • trunk/WebCore/dom/Document.cpp

    r36820 r36891  
    7676#include "Logging.h"
    7777#include "MessageEvent.h"
     78#include "MessagePort.h"
    7879#include "MouseEvent.h"
    7980#include "MouseEventWithHitTestResults.h"
     
    262263static HashSet<Document*>* changedDocuments = 0;
    263264
     265class MessagePortTimer : public TimerBase {
     266public:
     267    MessagePortTimer(PassRefPtr<Document> document)
     268        : m_document(document)
     269    {
     270    }
     271
     272private:
     273    virtual void fired()
     274    {
     275        m_document->dispatchMessagePortEvents();
     276        delete this;
     277    }
     278
     279    RefPtr<Document> m_document;
     280};
     281
    264282Document::Document(Frame* frame, bool isXHTML)
    265283    : ContainerNode(0)
     
    275293    , m_xmlVersion("1.0")
    276294    , m_xmlStandalone(false)
     295    , m_firedMessagePortTimer(false)
    277296#if ENABLE(XBL)
    278297    , m_bindingManager(new XBLBindingManager(this))
     
    448467    if (m_styleSheets)
    449468        m_styleSheets->documentDestroyed();
     469
     470    HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end();
     471    for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != m_messagePorts.end(); ++iter) {
     472        ASSERT((*iter)->document() == this);
     473        (*iter)->contextDestroyed();
     474        if ((*iter)->entangledPort()) {
     475            RefPtr<MessagePort> survivingPort = (*iter)->entangledPort();
     476            (*iter)->unentangle();
     477            if (survivingPort->document() != this) // Otherwise, survivingPort won't really survive.
     478                survivingPort->queueCloseEvent();
     479        }
     480    }
    450481
    451482    m_document = 0;
     
    43414372}
    43424373
     4374void Document::processMessagePortMessagesSoon()
     4375{
     4376    if (m_firedMessagePortTimer)
     4377        return;
     4378
     4379    MessagePortTimer* timer = new MessagePortTimer(this);
     4380    timer->startOneShot(0);
     4381
     4382    m_firedMessagePortTimer = true;
     4383}
     4384
     4385void Document::dispatchMessagePortEvents()
     4386{
     4387    RefPtr<Document> protect(this);
     4388
     4389    // Make a frozen copy.
     4390    Vector<MessagePort*> ports;
     4391    copyToVector(m_messagePorts, ports);
     4392
     4393    m_firedMessagePortTimer = false;
     4394
     4395    unsigned portCount = ports.size();
     4396    for (unsigned i = 0; i < portCount; ++i) {
     4397        MessagePort* port = ports[i];
     4398        if (m_messagePorts.contains(port) && port->queueIsOpen())
     4399            port->dispatchMessages();
     4400    }
     4401}
     4402
     4403void Document::createdMessagePort(MessagePort* port)
     4404{
     4405    ASSERT(port);
     4406    m_messagePorts.add(port);
     4407}
     4408
     4409void Document::destroyedMessagePort(MessagePort* port)
     4410{
     4411    ASSERT(port);
     4412    m_messagePorts.remove(port);
     4413}
     4414
    43434415void Document::initDNSPrefetch()
    43444416{
  • trunk/WebCore/dom/Document.h

    r36820 r36891  
    8686    class IntPoint;
    8787    class JSNode;
     88    class MessagePort;
    8889    class MouseEventWithHitTestResults;
    8990    class NodeFilter;
     
    763764    CanvasRenderingContext2D* getCSSCanvasContext(const String& type, const String& name, int width, int height);
    764765    HTMLCanvasElement* getCSSCanvasElement(const String& name);
    765    
     766
     767    void processMessagePortMessagesSoon();
     768    void dispatchMessagePortEvents();
     769    void createdMessagePort(MessagePort*);
     770    void destroyedMessagePort(MessagePort*);
     771
    766772    bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; }
    767773    void initDNSPrefetch();
     
    921927    String m_contentLanguage;
    922928
     929    bool m_firedMessagePortTimer;
     930    HashSet<MessagePort*> m_messagePorts;
     931
    923932public:
    924933    bool inPageCache();
  • trunk/WebCore/dom/EventNames.h

    r35545 r36891  
    3939    macro(checking) \
    4040    macro(click) \
     41    macro(close) \
    4142    macro(contextmenu) \
    4243    macro(copy) \
  • trunk/WebCore/dom/EventTarget.cpp

    r36820 r36891  
    7474#endif
    7575
     76MessagePort* EventTarget::toMessagePort()
     77{
     78    return 0;
     79}
     80
    7681#ifndef NDEBUG
    7782void forbidEventDispatch()
  • trunk/WebCore/dom/EventTarget.h

    r36820 r36891  
    4242    class EventListener;
    4343    class EventTargetNode;
     44    class MessagePort;
     45    class RegisteredEventListener;
    4446    class SVGElementInstance;
    4547    class XMLHttpRequest;
    46     class RegisteredEventListener;
    4748    class XMLHttpRequestUpload;
    4849
     
    5455    class EventTarget {
    5556    public:
     57        virtual MessagePort* toMessagePort();
    5658        virtual EventTargetNode* toNode();
    5759        virtual XMLHttpRequest* toXMLHttpRequest();
  • trunk/WebCore/dom/MessageEvent.cpp

    r34536 r36891  
    4040}
    4141
    42 MessageEvent::MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source)
     42MessageEvent::MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassRefPtr<MessagePort> messagePort)
    4343    : Event(messageEvent, false, true)
    4444    , m_data(data)
     
    4646    , m_lastEventId(lastEventId)
    4747    , m_source(source)
     48    , m_messagePort(messagePort)
    4849{
    4950}
     
    5354}
    5455
    55 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source)
     56void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort* messagePort)
    5657{
    5758    if (dispatched())
     
    6465    m_lastEventId = lastEventId;
    6566    m_source = source;
     67    m_messagePort = messagePort;
    6668}
    6769
  • trunk/WebCore/dom/MessageEvent.h

    r34536 r36891  
    3030
    3131#include "Event.h"
     32#include "MessagePort.h"
    3233
    3334namespace WebCore {
     
    4142            return adoptRef(new MessageEvent);
    4243        }
    43         static PassRefPtr<MessageEvent> create(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source)
     44        static PassRefPtr<MessageEvent> create(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassRefPtr<MessagePort> messagePort)
    4445        {
    45             return adoptRef(new MessageEvent(data, origin, lastEventId, source));
     46            return adoptRef(new MessageEvent(data, origin, lastEventId, source, messagePort));
    4647        }
    4748        virtual ~MessageEvent();
    4849
    49         void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source);
     50        void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort*);
    5051       
    5152        const String& data() const { return m_data; }
     
    5354        const String& lastEventId() const { return m_lastEventId; }
    5455        DOMWindow* source() const { return m_source.get(); }
     56        MessagePort* messagePort() const { return m_messagePort.get(); }
    5557       
    5658        virtual bool isMessageEvent() const;
     
    5860    private:   
    5961        MessageEvent();
    60         MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source);
     62        MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassRefPtr<MessagePort> messagePort);
    6163
    6264        String m_data;
     
    6466        String m_lastEventId;
    6567        RefPtr<DOMWindow> m_source;
     68        RefPtr<MessagePort> m_messagePort;
    6669    };
    6770
  • trunk/WebCore/dom/MessageEvent.idl

    r33009 r36891  
    3535        readonly attribute DOMString lastEventId;
    3636        readonly attribute DOMWindow source;
     37        readonly attribute MessagePort messagePort;
    3738       
    38         void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg);
     39        void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg, in MessagePort messagePort);
    3940
    4041    };
  • trunk/WebCore/page/DOMWindow.cpp

    r36560 r36891  
    348348#endif
    349349
    350 void DOMWindow::postMessage(const String& message, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec)
     350void DOMWindow::postMessage(const String& message, MessagePort* messagePort, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec)
    351351{
    352352    if (!m_frame)
     
    364364    }
    365365
     366    RefPtr<MessagePort> newMessagePort;
     367    if (messagePort)
     368        newMessagePort = messagePort->clone(document(), ec);
     369    if (ec)
     370        return;
     371
    366372    // Capture the source of the message.  We need to do this synchronously
    367373    // in order to capture the source of the message correctly.
     
    372378
    373379    // Schedule the message.
    374     PostMessageTimer* timer = new PostMessageTimer(this, MessageEvent::create(message, sourceOrigin, "", source), target.get());
     380    PostMessageTimer* timer = new PostMessageTimer(this, MessageEvent::create(message, sourceOrigin, "", source, newMessagePort), target.get());
    375381    timer->startOneShot(0);
    376382}
  • trunk/WebCore/page/DOMWindow.h

    r33009 r36891  
    4848    class History;
    4949    class Location;
     50    class MessagePort;
    5051    class Navigator;
    5152    class PostMessageTimer;
     
    176177#endif
    177178
    178         void postMessage(const String& message, const String& targetOrigin, DOMWindow* source, ExceptionCode&);
     179        void postMessage(const String& message, MessagePort*, const String& targetOrigin, DOMWindow* source, ExceptionCode&);
    179180        void postMessageTimerFired(PostMessageTimer*);
    180181
  • trunk/WebCore/page/DOMWindow.idl

    r36675 r36891  
    152152
    153153        // cross-document messaging
    154         [DoNotCheckDomainSecurity, Custom] void postMessage(in DOMString message, in DOMString targetOrigin)
     154        [DoNotCheckDomainSecurity, Custom] void postMessage(in DOMString message, in [Optional] MessagePort messagePort, in DOMString targetOrigin)
    155155            raises(DOMException);
    156156
Note: See TracChangeset for help on using the changeset viewer.