LayoutTests/ChangeLog

 12011-05-11 Yuta Kitamura <yutak@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 WebSocket add new event: CloseEvent
 6 https://bugs.webkit.org/show_bug.cgi?id=35573
 7
 8 Original patch was written by Fumitoshi Ukai <ukai@chromium.org>.
 9 I modified the test close-event.html slightly so that it passes on Chromium.
 10 I also updated a few test results that are affected by this change.
 11
 12 * fast/dom/Window/window-properties-expected.txt:
 13 * fast/dom/Window/window-property-descriptors-expected.txt:
 14 * fast/dom/prototype-inheritance-expected.txt:
 15 * fast/js/global-constructors-expected.txt:
 16 * http/tests/websocket/tests/close-event-expected.txt: Added.
 17 * http/tests/websocket/tests/close-event.html: Added.
 18 * platform/chromium/fast/dom/prototype-inheritance-expected.txt:
 19
1202011-05-10 Abhishek Arya <inferno@chromium.org>
221
322 Reviewed by Simon Fraser.

LayoutTests/fast/dom/Window/window-properties-expected.txt

@@window.Clipboard.prototype.clearData [function]
479479window.Clipboard.prototype.getData [function]
480480window.Clipboard.prototype.setData [function]
481481window.Clipboard.prototype.setDragImage [function]
 482window.CloseEvent [object CloseEventConstructor]
 483window.CloseEvent.prototype [object CloseEventPrototype]
 484window.CloseEvent.prototype.AT_TARGET [number]
 485window.CloseEvent.prototype.BLUR [number]
 486window.CloseEvent.prototype.BUBBLING_PHASE [number]
 487window.CloseEvent.prototype.CAPTURING_PHASE [number]
 488window.CloseEvent.prototype.CHANGE [number]
 489window.CloseEvent.prototype.CLICK [number]
 490window.CloseEvent.prototype.DBLCLICK [number]
 491window.CloseEvent.prototype.DRAGDROP [number]
 492window.CloseEvent.prototype.FOCUS [number]
 493window.CloseEvent.prototype.KEYDOWN [number]
 494window.CloseEvent.prototype.KEYPRESS [number]
 495window.CloseEvent.prototype.KEYUP [number]
 496window.CloseEvent.prototype.MOUSEDOWN [number]
 497window.CloseEvent.prototype.MOUSEDRAG [number]
 498window.CloseEvent.prototype.MOUSEMOVE [number]
 499window.CloseEvent.prototype.MOUSEOUT [number]
 500window.CloseEvent.prototype.MOUSEOVER [number]
 501window.CloseEvent.prototype.MOUSEUP [number]
 502window.CloseEvent.prototype.SELECT [number]
 503window.CloseEvent.prototype.initCloseEvent [function]
 504window.CloseEvent.prototype.initEvent [function]
 505window.CloseEvent.prototype.preventDefault [function]
 506window.CloseEvent.prototype.stopImmediatePropagation [function]
 507window.CloseEvent.prototype.stopPropagation [function]
482508window.Comment [object CommentConstructor]
483509window.Comment.prototype [printed above as window.CharacterData.prototype]
484510window.Counter [object CounterConstructor]

LayoutTests/fast/dom/Window/window-property-descriptors-expected.txt

@@PASS typeof Object.getOwnPropertyDescriptor(window, 'CharacterData') is 'object'
3030PASS typeof Object.getOwnPropertyDescriptor(window, 'ClientRect') is 'object'
3131PASS typeof Object.getOwnPropertyDescriptor(window, 'ClientRectList') is 'object'
3232PASS typeof Object.getOwnPropertyDescriptor(window, 'Clipboard') is 'object'
 33PASS typeof Object.getOwnPropertyDescriptor(window, 'CloseEvent') is 'object'
3334PASS typeof Object.getOwnPropertyDescriptor(window, 'Comment') is 'object'
3435PASS typeof Object.getOwnPropertyDescriptor(window, 'Counter') is 'object'
3536PASS typeof Object.getOwnPropertyDescriptor(window, 'DOMException') is 'object'

LayoutTests/fast/dom/prototype-inheritance-expected.txt

@@PASS inner.ClientRectList.isInner is true
5757PASS inner.ClientRectList.constructor.isInner is true
5858PASS inner.Clipboard.isInner is true
5959PASS inner.Clipboard.constructor.isInner is true
 60PASS inner.CloseEvent.isInner is true
 61PASS inner.CloseEvent.constructor.isInner is true
6062PASS inner.Comment.isInner is true
6163PASS inner.Comment.constructor.isInner is true
6264PASS inner.Counter.isInner is true

LayoutTests/fast/js/global-constructors-expected.txt

@@PASS CharacterData.toString() is '[object CharacterDataConstructor]'
2828PASS ClientRect.toString() is '[object ClientRectConstructor]'
2929PASS ClientRectList.toString() is '[object ClientRectListConstructor]'
3030PASS Clipboard.toString() is '[object ClipboardConstructor]'
 31PASS CloseEvent.toString() is '[object CloseEventConstructor]'
3132PASS Comment.toString() is '[object CommentConstructor]'
3233PASS Counter.toString() is '[object CounterConstructor]'
3334PASS DOMException.toString() is '[object DOMExceptionConstructor]'

LayoutTests/http/tests/websocket/tests/close-event-expected.txt

 1Make sure WebSocket fires CloseEvent when closed.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5WebSocket is open
 6Received: 'Hello from Simple WSH.'
 7Closed
 8PASS closeEventType is "close"
 9PASS 'wasClean' in closeEvent is true
 10PASS Object.getPrototypeOf(closeEvent) === CloseEvent.prototype is true
 11PASS Object.getPrototypeOf(closeEvent) !== Event.prototype is true
 12PASS successfullyParsed is true
 13
 14TEST COMPLETE
 15

LayoutTests/http/tests/websocket/tests/close-event.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="../../../js-test-resources/js-test-style.css">
 5<script src="../../../js-test-resources/js-test-pre.js"></script>
 6<script src="../../../js-test-resources/js-test-post-function.js"></script>
 7</head>
 8<body>
 9<div id="description"></div>
 10<div id="console"></div>
 11<script type="text/javascript">
 12description("Make sure WebSocket fires CloseEvent when closed.");
 13
 14if (window.layoutTestController)
 15 layoutTestController.waitUntilDone();
 16
 17function endTest()
 18{
 19 isSuccessfullyParsed();
 20 if (window.layoutTestController)
 21 layoutTestController.notifyDone();
 22}
 23
 24var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/simple");
 25
 26ws.onopen = function()
 27{
 28 debug("WebSocket is open");
 29};
 30
 31ws.onmessage = function(messageEvent)
 32{
 33 debug("Received: '" + messageEvent.data + "'");
 34};
 35
 36var closeEvent;
 37var closeEventType;
 38ws.onclose = function(event)
 39{
 40 debug("Closed");
 41 closeEvent = event;
 42 closeEventType = closeEvent.type;
 43 shouldBe("closeEventType", '"close"')
 44 shouldBeTrue("'wasClean' in closeEvent");
 45 shouldBeTrue("Object.getPrototypeOf(closeEvent) === CloseEvent.prototype");
 46 shouldBeTrue("Object.getPrototypeOf(closeEvent) !== Event.prototype");
 47 endTest();
 48};
 49
 50var successfullyParsed = true;
 51</script>
 52</body>
 53</html>

LayoutTests/platform/chromium/fast/dom/prototype-inheritance-expected.txt

@@PASS inner.ClientRectList.isInner is true
5757PASS inner.ClientRectList.constructor.isInner is true
5858PASS inner.Clipboard.isInner is true
5959PASS inner.Clipboard.constructor.isInner is true
 60PASS inner.CloseEvent.isInner is true
 61PASS inner.CloseEvent.constructor.isInner is true
6062PASS inner.Comment.isInner is true
6163PASS inner.Comment.constructor.isInner is true
6264PASS inner.Counter.isInner is true

Source/WebCore/CMakeLists.txt

@@SET(WebCore_IDL_FILES
400400 webaudio/LowPass2FilterNode.idl
401401 webaudio/RealtimeAnalyserNode.idl
402402
 403 websockets/CloseEvent.idl
403404 websockets/WebSocket.idl
404405
405406 workers/AbstractWorker.idl

Source/WebCore/ChangeLog

 12011-05-11 Yuta Kitamura <yutak@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 WebSocket add new event: CloseEvent
 6 https://bugs.webkit.org/show_bug.cgi?id=35573
 7
 8 Original patch was written by Fumitoshi Ukai <ukai@chromium.org>.
 9 I added CloseEvent constructor to DOMWindow, so it can be referred
 10 in the new test (close-event.html).
 11
 12 Test: http/tests/websocket/tests/close-event.html
 13
 14 * CMakeLists.txt:
 15 * CodeGenerators.pri:
 16 * DerivedSources.cpp:
 17 * DerivedSources.make:
 18 * GNUmakefile.list.am:
 19 * WebCore.gypi:
 20 * WebCore.pro:
 21 * WebCore.vcproj/WebCore.vcproj:
 22 * WebCore.xcodeproj/project.pbxproj:
 23 * bindings/js/JSEventCustom.cpp:
 24 (WebCore::toJS):
 25 * bindings/v8/custom/V8EventCustom.cpp:
 26 (WebCore::toV8):
 27 * dom/Event.cpp:
 28 (WebCore::Event::isCloseEvent):
 29 * dom/Event.h:
 30 * page/DOMWindow.idl: Add CloseEvent constructor.
 31 * websockets/CloseEvent.h: Added.
 32 (WebCore::CloseEvent::isCloseEvent):
 33 (WebCore::CloseEvent::create):
 34 (WebCore::CloseEvent::initCloseEvent):
 35 (WebCore::CloseEvent::wasClean):
 36 (WebCore::CloseEvent::CloseEvent):
 37 * websockets/CloseEvent.idl: Added.
 38 * websockets/WebSocket.cpp:
 39 (WebCore::WebSocket::didClose):
 40
1412011-05-06 Brett Wilson <brettw@chromium.org>
242
343 Reviewed by Adam Barth.

Source/WebCore/CodeGenerators.pri

@@IDL_BINDINGS += \
529529 webaudio/JavaScriptAudioNode.idl \
530530 webaudio/LowPass2FilterNode.idl \
531531 webaudio/RealtimeAnalyserNode.idl \
 532 websockets/CloseEvent.idl \
532533 websockets/WebSocket.idl \
533534 workers/AbstractWorker.idl \
534535 workers/DedicatedWorkerContext.idl \

Source/WebCore/DerivedSources.cpp

4646#include "JSClientRect.cpp"
4747#include "JSClientRectList.cpp"
4848#include "JSClipboard.cpp"
 49#include "JSCloseEvent.cpp"
4950#include "JSComment.cpp"
5051#include "JSCompositionEvent.cpp"
5152#include "JSConsole.cpp"

Source/WebCore/DerivedSources.make

@@DOM_CLASSES = \
122122 ClientRect \
123123 ClientRectList \
124124 Clipboard \
 125 CloseEvent \
125126 Comment \
126127 CompositionEvent \
127128 Console \

Source/WebCore/GNUmakefile.list.am

@@webcore_sources += \
35513551 Source/WebCore/svg/SVGZoomEvent.cpp \
35523552 Source/WebCore/svg/SVGZoomEvent.h \
35533553 Source/WebCore/WebCorePrefix.h \
 3554 Source/WebCore/websockets/CloseEvent.h \
35543555 Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h \
35553556 Source/WebCore/websockets/ThreadableWebSocketChannel.cpp \
35563557 Source/WebCore/websockets/ThreadableWebSocketChannel.h \

@@endif
44534454# ----
44544455if ENABLE_WEB_SOCKETS
44554456webcore_built_sources += \
 4457 DerivedSources/WebCore/JSCloseEvent.cpp \
 4458 DerivedSources/WebCore/JSCloseEvent.h \
44564459 DerivedSources/WebCore/JSWebSocket.cpp \
44574460 DerivedSources/WebCore/JSWebSocket.h
44584461endif # END ENABLE_WEB_SOCKETS

Source/WebCore/WebCore.gypi

14091409 'webaudio/LowPass2FilterNode.idl',
14101410 'webaudio/OfflineAudioCompletionEvent.idl',
14111411 'webaudio/RealtimeAnalyserNode.idl',
 1412 'websockets/CloseEvent.idl',
14121413 'websockets/WebSocket.idl',
14131414 'workers/AbstractWorker.idl',
14141415 'workers/DedicatedWorkerContext.idl',

59525953 'webaudio/RealtimeAnalyser.h',
59535954 'webaudio/RealtimeAnalyserNode.cpp',
59545955 'webaudio/RealtimeAnalyserNode.h',
 5956 'websockets/CloseEvent.h',
59555957 'websockets/ThreadableWebSocketChannel.cpp',
59565958 'websockets/ThreadableWebSocketChannel.h',
59575959 'websockets/ThreadableWebSocketChannelClientWrapper.h',

Source/WebCore/WebCore.pro

@@SOURCES += \
33723372
33733373contains(DEFINES, ENABLE_WEB_SOCKETS=1) {
33743374 HEADERS += \
 3375 websockets/CloseEvent.h \
33753376 websockets/ThreadableWebSocketChannel.h \
33763377 websockets/ThreadableWebSocketChannelClientWrapper.h \
33773378 websockets/WebSocket.h \

Source/WebCore/WebCore.vcproj/WebCore.vcproj

6706667066 Name="websockets"
6706767067 >
6706867068 <File
 67069 RelativePath="..\websockets\CloseEvent.h"
 67070 >
 67071 </File>
 67072 <File
6706967073 RelativePath="..\websockets\ThreadableWebSocketChannel.cpp"
6707067074 >
6707167075 </File>

Source/WebCore/WebCore.xcodeproj/project.pbxproj

13611361 521D46F611AEC98100514613 /* KillRingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 521D46F511AEC98100514613 /* KillRingMac.mm */; };
13621362 521D46F811AEC9B100514613 /* KillRing.h in Headers */ = {isa = PBXBuildFile; fileRef = 521D46F711AEC9B100514613 /* KillRing.h */; };
13631363 54C50F7B0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */; };
 1364 51FB54F5113E364200821176 /* CloseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FB54F4113E364200821176 /* CloseEvent.h */; };
13641365 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
13651366 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
13661367 5905ADBF1302F3CE00F116DF /* XMLTreeViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */; };

14151416 5D88EE9211407FF400BC3ABC /* DOMSVGFEMorphologyElementInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 8422418B107E786F00766A87 /* DOMSVGFEMorphologyElementInternal.h */; };
14161417 5D925B670F64D4DD00B847F0 /* ScrollBehavior.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */; };
14171418 5D925B680F64D4DD00B847F0 /* ScrollBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1419 51FB5505113E3E9100821176 /* JSCloseEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FB5503113E3E9100821176 /* JSCloseEvent.cpp */; };
 1420 51FB5504113E3E9100821176 /* JSCloseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FB5502113E3E9100821176 /* JSCloseEvent.h */; };
14181421 5DA5E0FC102B953800088CF9 /* JSWebSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DA5E0FA102B953800088CF9 /* JSWebSocket.cpp */; };
14191422 5DA5E0FD102B953800088CF9 /* JSWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DA5E0FB102B953800088CF9 /* JSWebSocket.h */; };
14201423 5DB1BC6A10715A6400EFAA49 /* TransformSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DB1BC6810715A6400EFAA49 /* TransformSource.h */; };

78807883 521D46F511AEC98100514613 /* KillRingMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KillRingMac.mm; sourceTree = "<group>"; };
78817884 521D46F711AEC9B100514613 /* KillRing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KillRing.h; sourceTree = "<group>"; };
78827885 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLDocumentParserLibxml2.cpp; sourceTree = "<group>"; };
 7886 51FB54F4113E364200821176 /* CloseEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CloseEvent.h; sourceTree = "<group>"; };
 7887 51FB54F6113E365900821176 /* CloseEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CloseEvent.idl; sourceTree = "<group>"; };
78837888 550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
78847889 550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
78857890 5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTreeViewer.cpp; sourceTree = "<group>"; };

79357940 5D87BB8211E3ED8600702B6F /* ExportFileGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExportFileGenerator.cpp; path = DerivedSources/WebCore/ExportFileGenerator.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
79367941 5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollBehavior.cpp; sourceTree = "<group>"; };
79377942 5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollBehavior.h; sourceTree = "<group>"; };
 7943 51FB5503113E3E9100821176 /* JSCloseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSCloseEvent.cpp; path = JSCloseEvent.cpp; sourceTree = "<group>"; };
 7944 51FB5502113E3E9100821176 /* JSCloseEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCloseEvent.h; path = JSCloseEvent.h; sourceTree = "<group>"; };
79387945 5DA5E0FA102B953800088CF9 /* JSWebSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebSocket.cpp; sourceTree = "<group>"; };
79397946 5DA5E0FB102B953800088CF9 /* JSWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebSocket.h; sourceTree = "<group>"; };
79407947 5DB1BC6810715A6400EFAA49 /* TransformSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TransformSource.h; sourceTree = "<group>"; };

1376813775 518A34BD1026C831001B6896 /* websockets */ = {
1376913776 isa = PBXGroup;
1377013777 children = (
 13778 51FB54F4113E364200821176 /* CloseEvent.h */,
 13779 51FB54F6113E365900821176 /* CloseEvent.idl */,
1377113780 5112247110CFB8C6008099D7 /* ThreadableWebSocketChannel.cpp */,
1377213781 5112247310CFB8D8008099D7 /* ThreadableWebSocketChannel.h */,
1377313782 5112247510CFB8E8008099D7 /* ThreadableWebSocketChannelClientWrapper.h */,

1383413843 5DA5E0F9102B950400088CF9 /* WebSockets */ = {
1383513844 isa = PBXGroup;
1383613845 children = (
 13846 51FB5503113E3E9100821176 /* JSCloseEvent.cpp */,
 13847 51FB5502113E3E9100821176 /* JSCloseEvent.h */,
1383713848 5DA5E0FA102B953800088CF9 /* JSWebSocket.cpp */,
1383813849 5DA5E0FB102B953800088CF9 /* JSWebSocket.h */,
1383913850 );

1985119862 4B8AF4AA0B1CE02B00687690 /* ClipboardAccessPolicy.h in Headers */,
1985219863 85031B400A44EFC700F992E0 /* ClipboardEvent.h in Headers */,
1985319864 93F199E708245E59001E9ABC /* ClipboardMac.h in Headers */,
 19865 51FB54F5113E364200821176 /* CloseEvent.h in Headers */,
1985419866 C0C054CB1118C8E400CE2636 /* CodeGenerator.pm in Headers */,
1985519867 BC5EB5DF0E81B9AB00B25965 /* CollapsedBorderValue.h in Headers */,
1985619868 93C441F00F813A1A00C1A634 /* CollectionCache.h in Headers */,

2126421276 BCC065880F3CE2A700CD2D87 /* JSClientRect.h in Headers */,
2126521277 BCC0658A0F3CE2A700CD2D87 /* JSClientRectList.h in Headers */,
2126621278 BCA83E500D7CE1E9003421A8 /* JSClipboard.h in Headers */,
 21279 51FB5504113E3E9100821176 /* JSCloseEvent.h in Headers */,
2126721280 93F9B6E10BA0FB7200854064 /* JSComment.h in Headers */,
2126821281 79AC9219109945C80021266E /* JSCompositionEvent.h in Headers */,
2126921282 BC98543E0CD3D98C00069BC1 /* JSConsole.h in Headers */,

2405624069 BCC065890F3CE2A700CD2D87 /* JSClientRectList.cpp in Sources */,
2405724070 BCA83E4F0D7CE1E9003421A8 /* JSClipboard.cpp in Sources */,
2405824071 BCA83E520D7CE205003421A8 /* JSClipboardCustom.cpp in Sources */,
 24072 51FB5505113E3E9100821176 /* JSCloseEvent.cpp in Sources */,
2405924073 93F9B6E00BA0FB7200854064 /* JSComment.cpp in Sources */,
2406024074 79AC9218109945C80021266E /* JSCompositionEvent.cpp in Sources */,
2406124075 BC98543D0CD3D98B00069BC1 /* JSConsole.cpp in Sources */,

Source/WebCore/bindings/js/JSEventCustom.cpp

105105#include "OfflineAudioCompletionEvent.h"
106106#endif
107107
 108#if ENABLE(WEB_SOCKETS)
 109#include "CloseEvent.h"
 110#include "JSCloseEvent.h"
 111#endif
 112
108113using namespace JSC;
109114
110115namespace WebCore {

@@JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
199204 else if (event->isSpeechInputEvent())
200205 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, SpeechInputEvent, event);
201206#endif
 207#if ENABLE(WEB_SOCKETS)
 208 else if (event->isCloseEvent())
 209 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CloseEvent, event);
 210#endif
202211 else
203212 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, Event, event);
204213

Source/WebCore/bindings/v8/custom/V8EventCustom.cpp

3838#include "V8BeforeLoadEvent.h"
3939#include "V8Binding.h"
4040#include "V8Clipboard.h"
 41#include "V8CloseEvent.h"
4142#include "V8CompositionEvent.h"
4243#include "V8CustomEvent.h"
4344#include "V8DeviceMotionEvent.h"

@@v8::Handle<v8::Value> toV8(Event* impl)
179180#endif
180181 if (impl->isCustomEvent())
181182 return toV8(static_cast<CustomEvent*>(impl));
 183#if ENABLE(WEB_SOCKETS)
 184 if (impl->isCloseEvent())
 185 return toV8(static_cast<CloseEvent*>(impl));
 186#endif
182187 return V8Event::wrap(impl);
183188}
184189} // namespace WebCore

Source/WebCore/dom/Event.cpp

@@bool Event::isSpeechInputEvent() const
243243}
244244#endif
245245
 246#if ENABLE(WEB_SOCKETS)
 247bool Event::isCloseEvent() const
 248{
 249 return false;
 250}
 251#endif
 252
246253bool Event::fromUserGesture()
247254{
248255 if (!UserGestureIndicator::processingUserGesture())

Source/WebCore/dom/Event.h

@@namespace WebCore {
144144#if ENABLE(INPUT_SPEECH)
145145 virtual bool isSpeechInputEvent() const;
146146#endif
 147#if ENABLE(WEB_SOCKETS)
 148 virtual bool isCloseEvent() const;
 149#endif
147150 bool fromUserGesture();
148151
149152 bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; }

Source/WebCore/page/DOMWindow.idl

@@module window {
577577
578578#if defined(ENABLE_WEB_SOCKETS) && ENABLE_WEB_SOCKETS
579579 attribute [JSCCustomGetter,EnabledAtRuntime] WebSocketConstructor WebSocket; // Usable with the new operator
 580 attribute CloseEventConstructor CloseEvent;
580581#endif
581582
582583 attribute DOMPluginConstructor Plugin;

Source/WebCore/websockets/CloseEvent.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions are
 6 * met:
 7 *
 8 * * Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * * Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer
 12 * in the documentation and/or other materials provided with the
 13 * distribution.
 14 * * Neither the name of Google Inc. nor the names of its
 15 * contributors may be used to endorse or promote products derived from
 16 * this software without specific prior written permission.
 17 *
 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 29 */
 30
 31#ifndef CloseEvent_h
 32#define CloseEvent_h
 33
 34#if ENABLE(WEB_SOCKETS)
 35
 36#include "Event.h"
 37#include "EventNames.h"
 38
 39namespace WebCore {
 40
 41class CloseEvent : public Event {
 42public:
 43 virtual bool isCloseEvent() const { return true; }
 44
 45 static PassRefPtr<CloseEvent> create(bool wasClean)
 46 {
 47 return adoptRef(new CloseEvent(wasClean));
 48 }
 49
 50 void initCloseEvent(const AtomicString& type, bool canBubble, bool cancelable, bool wasClean)
 51 {
 52 if (dispatched())
 53 return;
 54
 55 initEvent(type, canBubble, cancelable);
 56
 57 m_wasClean = wasClean;
 58 }
 59
 60 bool wasClean() const { return m_wasClean; }
 61
 62private:
 63 CloseEvent(bool wasClean)
 64 : Event(eventNames().closeEvent, false, false)
 65 , m_wasClean(wasClean)
 66 { }
 67
 68 bool m_wasClean;
 69};
 70
 71} // namespace WebCore
 72
 73#endif // ENABLE(WEB_SOCKETS)
 74
 75#endif // CloseEvent_h

Source/WebCore/websockets/CloseEvent.idl

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions are
 6 * met:
 7 *
 8 * * Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * * Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer
 12 * in the documentation and/or other materials provided with the
 13 * distribution.
 14 * * Neither the name of Google Inc. nor the names of its
 15 * contributors may be used to endorse or promote products derived from
 16 * this software without specific prior written permission.
 17 *
 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 29 */
 30
 31module events {
 32
 33interface CloseEvent : Event {
 34 readonly attribute boolean wasClean;
 35 void initCloseEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in boolean wasCleanArg);
 36};
 37
 38}

Source/WebCore/websockets/WebSocket.cpp

3434
3535#include "WebSocket.h"
3636
 37#include "CloseEvent.h"
3738#include "DOMWindow.h"
3839#include "Event.h"
3940#include "EventException.h"

@@void WebSocket::didClose(unsigned long unhandledBufferedAmount)
284285 m_state = CLOSED;
285286 m_bufferedAmountAfterClose += unhandledBufferedAmount;
286287 ASSERT(scriptExecutionContext());
287  dispatchEvent(Event::create(eventNames().closeEvent, false, false));
 288 RefPtr<CloseEvent> event = CloseEvent::create(false);
 289 event->initCloseEvent(eventNames().closeEvent, false, false, false);
 290 dispatchEvent(event);
288291 if (m_channel) {
289292 m_channel->disconnect();
290293 m_channel = 0;