<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[38443] trunk/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/38443">38443</a></dd>
<dt>Author</dt> <dd>ap@webkit.org</dd>
<dt>Date</dt> <dd>2008-11-16 01:11:54 -0800 (Sun, 16 Nov 2008)</dd>
</dl>

<h3>Log Message</h3>
<pre>        Reviewed by Maciej Stachowiak.

        https://bugs.webkit.org/show_bug.cgi?id=22266
        Stop using MessagePort for communication with workers

        The current MessagePort specification is not well suited for being implemented in a
        multi-threaded or multi-process environment, and this doesn't appear to be easily fixable.
        This patch implements a simpler Mozilla API for workers instead.

        * WebCore.xcodeproj/project.pbxproj:
        * DerivedSources.make:
        * bindings/js/JSDOMWindowBase.cpp: (jsDOMWindowBaseWorker):
        * bindings/js/JSDedicatedWorkerConstructor.cpp: Removed.
        * bindings/js/JSDedicatedWorkerConstructor.h: Removed.
        * bindings/js/JSDedicatedWorkerCustom.cpp: Removed.
        * bindings/js/JSWorkerConstructor.cpp: Copied from WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp.
        * bindings/js/JSWorkerConstructor.h: Copied from WebCore/bindings/js/JSDedicatedWorkerConstructor.h.
        * bindings/js/JSWorkerCustom.cpp: Copied from WebCore/bindings/js/JSDedicatedWorkerCustom.cpp.
        * dom/DedicatedWorker.cpp: Removed.
        * dom/DedicatedWorker.h: Removed.
        * dom/DedicatedWorker.idl: Removed.
        Renamed DedicatedWorker to Worker to match Mozilla and current WHATWG cpec.

        * bindings/js/JSEventListener.cpp: (WebCore::JSAbstractEventListener::handleEvent):
        Clear worker exceptions to avoid hitting an assertion.

        * dom/EventTarget.cpp: (WebCore::EventTarget::toWorker):
        * dom/EventTarget.h:
        * bindings/js/JSEventTarget.cpp: (WebCore::toJS):
        WorkerContext is now an EventTarget, too.

        * bindings/js/JSWorkerContext.cpp: Removed onconnect, constructors for MessageChannel and
        MessagePort. Added postMessage() and onmessage.

        * dom/ScriptExecutionContext.cpp: (WebCore::performTask): Do not reference ScriptExecutionContext
        when posting a task - this operation is not thread safe. It is also not necessary any more,
        as the context is kept alive by WorkerMessagingProxy.

        * dom/Worker.cpp: Copied from WebCore/dom/DedicatedWorker.cpp.
        (WebCore::Worker::Worker): Start loading the script right away - there is no reason to do
        that on a timer.
        (WebCore::Worker::~Worker): Notify messaging proxy.
        (WebCore::Worker::postMessage): Just ask the proxy to post the message.
        (WebCore::Worker::notifyFinished): Notify messaging proxy when a thread object becomes
        available. Also, it is now safe to unsetPendingActivity(), making the object collectable.
        I'm not sure if this is the right lifetime for workers, as unreachable workers with event
        listeners should probably be kept alive, but it at least lets the object be collected.
        (WebCore::Worker::addEventListener): Added an EventTarget implementation.
        (WebCore::Worker::removeEventListener): Added an EventTarget implementation.
        (WebCore::Worker::dispatchEvent): Added an EventTarget implementation.

        * dom/Worker.h: Copied from WebCore/dom/DedicatedWorker.h.
        * dom/Worker.idl: Copied from WebCore/dom/DedicatedWorker.idl.
        Removed onclose, made an EventListener. Actual messaging is now handled by WorkerMessagingProxy.

        * dom/WorkerContext.cpp:
        (WebCore::WorkerContext::~WorkerContext): Notify messaging proxy that the context was shut
        down successfully.
        (WebCore::WorkerContext::postMessage): Added. Post the message via messaging proxy.

        * dom/WorkerContext.h: Added postMessage and onmessage, removed onconnect.

        * dom/WorkerMessagingProxy.cpp: Added.
        * dom/WorkerMessagingProxy.h: Added.
        This new class implements actual messaging. It is notified when a Worker is garbage collected,
        and asks the thread to shut down. It also owns the thread object, and references script
        execution context, making it safe to post messages to it remotely.

        * dom/WorkerThread.cpp:
        * dom/WorkerThread.h:
        Keep a reference to messaging proxy, not to Worker itself. Also, the thread object no longer
        keeps itself alive - it is now the job of messaging proxy.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoreDerivedSourcesmake">trunk/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkWebCoreWebCorexcodeprojprojectpbxproj">trunk/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkWebCorebindingsjsJSDOMWindowBasecpp">trunk/WebCore/bindings/js/JSDOMWindowBase.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSEventListenercpp">trunk/WebCore/bindings/js/JSEventListener.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSEventTargetcpp">trunk/WebCore/bindings/js/JSEventTarget.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSWorkerContextcpp">trunk/WebCore/bindings/js/JSWorkerContext.cpp</a></li>
<li><a href="#trunkWebCoredomEventTargetcpp">trunk/WebCore/dom/EventTarget.cpp</a></li>
<li><a href="#trunkWebCoredomEventTargeth">trunk/WebCore/dom/EventTarget.h</a></li>
<li><a href="#trunkWebCoredomScriptExecutionContextcpp">trunk/WebCore/dom/ScriptExecutionContext.cpp</a></li>
<li><a href="#trunkWebCoredomWorkerContextcpp">trunk/WebCore/dom/WorkerContext.cpp</a></li>
<li><a href="#trunkWebCoredomWorkerContexth">trunk/WebCore/dom/WorkerContext.h</a></li>
<li><a href="#trunkWebCoredomWorkerThreadcpp">trunk/WebCore/dom/WorkerThread.cpp</a></li>
<li><a href="#trunkWebCoredomWorkerThreadh">trunk/WebCore/dom/WorkerThread.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkWebCorebindingsjsJSWorkerConstructorcpp">trunk/WebCore/bindings/js/JSWorkerConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSWorkerConstructorh">trunk/WebCore/bindings/js/JSWorkerConstructor.h</a></li>
<li><a href="#trunkWebCorebindingsjsJSWorkerCustomcpp">trunk/WebCore/bindings/js/JSWorkerCustom.cpp</a></li>
<li><a href="#trunkWebCoredomWorkercpp">trunk/WebCore/dom/Worker.cpp</a></li>
<li><a href="#trunkWebCoredomWorkerh">trunk/WebCore/dom/Worker.h</a></li>
<li><a href="#trunkWebCoredomWorkeridl">trunk/WebCore/dom/Worker.idl</a></li>
<li><a href="#trunkWebCoredomWorkerMessagingProxycpp">trunk/WebCore/dom/WorkerMessagingProxy.cpp</a></li>
<li><a href="#trunkWebCoredomWorkerMessagingProxyh">trunk/WebCore/dom/WorkerMessagingProxy.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkWebCorebindingsjsJSDedicatedWorkerConstructorcpp">trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSDedicatedWorkerConstructorh">trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.h</a></li>
<li><a href="#trunkWebCorebindingsjsJSDedicatedWorkerCustomcpp">trunk/WebCore/bindings/js/JSDedicatedWorkerCustom.cpp</a></li>
<li><a href="#trunkWebCoredomDedicatedWorkercpp">trunk/WebCore/dom/DedicatedWorker.cpp</a></li>
<li><a href="#trunkWebCoredomDedicatedWorkerh">trunk/WebCore/dom/DedicatedWorker.h</a></li>
<li><a href="#trunkWebCoredomDedicatedWorkeridl">trunk/WebCore/dom/DedicatedWorker.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/ChangeLog        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -1,3 +1,78 @@
</span><ins>+2008-11-14  Alexey Proskuryakov  &lt;ap@webkit.org&gt;
+
+        Reviewed by Maciej Stachowiak.
+
+        https://bugs.webkit.org/show_bug.cgi?id=22266
+        Stop using MessagePort for communication with workers
+
+        The current MessagePort specification is not well suited for being implemented in a
+        multi-threaded or multi-process environment, and this doesn't appear to be easily fixable.
+        This patch implements a simpler Mozilla API for workers instead.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * DerivedSources.make:
+        * bindings/js/JSDOMWindowBase.cpp: (jsDOMWindowBaseWorker):
+        * bindings/js/JSDedicatedWorkerConstructor.cpp: Removed.
+        * bindings/js/JSDedicatedWorkerConstructor.h: Removed.
+        * bindings/js/JSDedicatedWorkerCustom.cpp: Removed.
+        * bindings/js/JSWorkerConstructor.cpp: Copied from WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp.
+        * bindings/js/JSWorkerConstructor.h: Copied from WebCore/bindings/js/JSDedicatedWorkerConstructor.h.
+        * bindings/js/JSWorkerCustom.cpp: Copied from WebCore/bindings/js/JSDedicatedWorkerCustom.cpp.
+        * dom/DedicatedWorker.cpp: Removed.
+        * dom/DedicatedWorker.h: Removed.
+        * dom/DedicatedWorker.idl: Removed.
+        Renamed DedicatedWorker to Worker to match Mozilla and current WHATWG cpec.
+
+        * bindings/js/JSEventListener.cpp: (WebCore::JSAbstractEventListener::handleEvent):
+        Clear worker exceptions to avoid hitting an assertion.
+
+        * dom/EventTarget.cpp: (WebCore::EventTarget::toWorker):
+        * dom/EventTarget.h:
+        * bindings/js/JSEventTarget.cpp: (WebCore::toJS):
+        WorkerContext is now an EventTarget, too.
+
+        * bindings/js/JSWorkerContext.cpp: Removed onconnect, constructors for MessageChannel and
+        MessagePort. Added postMessage() and onmessage.
+
+        * dom/ScriptExecutionContext.cpp: (WebCore::performTask): Do not reference ScriptExecutionContext
+        when posting a task - this operation is not thread safe. It is also not necessary any more,
+        as the context is kept alive by WorkerMessagingProxy.
+
+        * dom/Worker.cpp: Copied from WebCore/dom/DedicatedWorker.cpp.
+        (WebCore::Worker::Worker): Start loading the script right away - there is no reason to do
+        that on a timer.
+        (WebCore::Worker::~Worker): Notify messaging proxy.
+        (WebCore::Worker::postMessage): Just ask the proxy to post the message.
+        (WebCore::Worker::notifyFinished): Notify messaging proxy when a thread object becomes
+        available. Also, it is now safe to unsetPendingActivity(), making the object collectable.
+        I'm not sure if this is the right lifetime for workers, as unreachable workers with event
+        listeners should probably be kept alive, but it at least lets the object be collected.
+        (WebCore::Worker::addEventListener): Added an EventTarget implementation.
+        (WebCore::Worker::removeEventListener): Added an EventTarget implementation.
+        (WebCore::Worker::dispatchEvent): Added an EventTarget implementation.
+
+        * dom/Worker.h: Copied from WebCore/dom/DedicatedWorker.h.
+        * dom/Worker.idl: Copied from WebCore/dom/DedicatedWorker.idl.
+        Removed onclose, made an EventListener. Actual messaging is now handled by WorkerMessagingProxy.
+
+        * dom/WorkerContext.cpp:
+        (WebCore::WorkerContext::~WorkerContext): Notify messaging proxy that the context was shut
+        down successfully.
+        (WebCore::WorkerContext::postMessage): Added. Post the message via messaging proxy.
+
+        * dom/WorkerContext.h: Added postMessage and onmessage, removed onconnect.
+
+        * dom/WorkerMessagingProxy.cpp: Added.
+        * dom/WorkerMessagingProxy.h: Added.
+        This new class implements actual messaging. It is notified when a Worker is garbage collected,
+        and asks the thread to shut down. It also owns the thread object, and references script
+        execution context, making it safe to post messages to it remotely.
+
+        * dom/WorkerThread.cpp:
+        * dom/WorkerThread.h:
+        Keep a reference to messaging proxy, not to Worker itself. Also, the thread object no longer
+        keeps itself alive - it is now the job of messaging proxy.
+
</ins><span class="cx"> 2008-11-15  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rubber stamped by Geoff Garen.
</span></span></pre></div>
<a id="trunkWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/DerivedSources.make (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/DerivedSources.make        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/DerivedSources.make        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -77,7 +77,6 @@
</span><span class="cx">     DOMParser \
</span><span class="cx">     DOMSelection \
</span><span class="cx">     DOMWindow \
</span><del>-    DedicatedWorker \
</del><span class="cx">     Database \
</span><span class="cx">     Document \
</span><span class="cx">     DocumentFragment \
</span><span class="lines">@@ -359,6 +358,7 @@
</span><span class="cx">     WebKitCSSTransformValue \
</span><span class="cx">     WebKitTransitionEvent \
</span><span class="cx">     WheelEvent \
</span><ins>+    Worker \
</ins><span class="cx">     WorkerLocation \
</span><span class="cx">     XMLHttpRequest \
</span><span class="cx">     XMLHttpRequestException \
</span></span></pre></div>
<a id="trunkWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/WebCore.xcodeproj/project.pbxproj (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/WebCore.xcodeproj/project.pbxproj        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/WebCore.xcodeproj/project.pbxproj        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -4148,6 +4148,8 @@
</span><span class="cx">                 E11C9DB00EB3699500E409DB /* ScriptExecutionContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E11C9DAF0EB3699500E409DB /* ScriptExecutionContext.cpp */; };
</span><span class="cx">                 E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = E12EDB7A0B308A78002704B6 /* EventTarget.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E12EDBEA0B308E0B002704B6 /* EventTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E12EDBE90B308E0B002704B6 /* EventTarget.cpp */; };
</span><ins>+                E14799A70ECDE3A400292BF3 /* WorkerMessagingProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = E14799A60ECDE3A400292BF3 /* WorkerMessagingProxy.h */; };
+                E14799B40ECDE9D800292BF3 /* WorkerMessagingProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E14799B30ECDE9D800292BF3 /* WorkerMessagingProxy.cpp */; };
</ins><span class="cx">                 E17A4A1B0D97991D00FC10C6 /* DOMSVGAltGlyphElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 65AA6BAC0D974A00000541AE /* DOMSVGAltGlyphElement.h */; };
</span><span class="cx">                 E17A4A1C0D97991D00FC10C6 /* DOMSVGAltGlyphElementInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 65AA6BAE0D974A00000541AE /* DOMSVGAltGlyphElementInternal.h */; };
</span><span class="cx">                 E1A302BC0DE8370300C52F2C /* StringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A302BB0DE8370300C52F2C /* StringBuilder.h */; };
</span><span class="lines">@@ -4182,13 +4184,13 @@
</span><span class="cx">                 E1C36D350EB0A094007410BC /* JSWorkerContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C36D330EB0A094007410BC /* JSWorkerContext.h */; };
</span><span class="cx">                 E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */; };
</span><span class="cx">                 E1C4DE6E0EA75C650023CCD6 /* ActiveDOMObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */; };
</span><del>-                E1C8BE5D0E8BD15A0064CB7D /* JSDedicatedWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C8BE5C0E8BD15A0064CB7D /* JSDedicatedWorker.cpp */; };
-                E1CA5CA00E8CD73B00E8EF90 /* DedicatedWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CA5C9F0E8CD73B00E8EF90 /* DedicatedWorker.h */; };
-                E1CA5CA50E8CD78500E8EF90 /* DedicatedWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CA40E8CD78500E8EF90 /* DedicatedWorker.cpp */; };
-                E1CA5CBC0E8CDCAF00E8EF90 /* JSDedicatedWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CBB0E8CDCAF00E8EF90 /* JSDedicatedWorkerCustom.cpp */; };
-                E1CA5CD30E8CDE8000E8EF90 /* JSDedicatedWorkerConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CA5CD20E8CDE8000E8EF90 /* JSDedicatedWorkerConstructor.h */; };
-                E1CA5CD60E8CDEE900E8EF90 /* JSDedicatedWorkerConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CD50E8CDEE900E8EF90 /* JSDedicatedWorkerConstructor.cpp */; };
-                E1CAA5C60E8BD23600A73ECA /* JSDedicatedWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CAA5C50E8BD23600A73ECA /* JSDedicatedWorker.h */; };
</del><ins>+                E1C8BE5D0E8BD15A0064CB7D /* JSWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C8BE5C0E8BD15A0064CB7D /* JSWorker.cpp */; };
+                E1CA5CA00E8CD73B00E8EF90 /* Worker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CA5C9F0E8CD73B00E8EF90 /* Worker.h */; };
+                E1CA5CA50E8CD78500E8EF90 /* Worker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CA40E8CD78500E8EF90 /* Worker.cpp */; };
+                E1CA5CBC0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */; };
+                E1CA5CD30E8CDE8000E8EF90 /* JSWorkerConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CA5CD20E8CDE8000E8EF90 /* JSWorkerConstructor.h */; };
+                E1CA5CD60E8CDEE900E8EF90 /* JSWorkerConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CD50E8CDEE900E8EF90 /* JSWorkerConstructor.cpp */; };
+                E1CAA5C60E8BD23600A73ECA /* JSWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CAA5C50E8BD23600A73ECA /* JSWorker.h */; };
</ins><span class="cx">                 E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */; };
</span><span class="cx">                 E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */; };
</span><span class="cx">                 E1EBBBD40AAC9B87001FE8E2 /* CSSCharsetRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EBBBD30AAC9B87001FE8E2 /* CSSCharsetRule.cpp */; };
</span><span class="lines">@@ -8775,6 +8777,8 @@
</span><span class="cx">                 E11C9DAF0EB3699500E409DB /* ScriptExecutionContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptExecutionContext.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E12EDB7A0B308A78002704B6 /* EventTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventTarget.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E12EDBE90B308E0B002704B6 /* EventTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTarget.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                E14799A60ECDE3A400292BF3 /* WorkerMessagingProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerMessagingProxy.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E14799B30ECDE9D800292BF3 /* WorkerMessagingProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerMessagingProxy.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E1A302BB0DE8370300C52F2C /* StringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringBuilder.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1A302C00DE8376900C52F2C /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringBuilder.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannelCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -8809,14 +8813,14 @@
</span><span class="cx">                 E1C36D330EB0A094007410BC /* JSWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerContext.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveDOMObject.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActiveDOMObject.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                E1C8BE440E8BCCBB0064CB7D /* DedicatedWorker.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DedicatedWorker.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E1C8BE5C0E8BD15A0064CB7D /* JSDedicatedWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDedicatedWorker.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E1CA5C9F0E8CD73B00E8EF90 /* DedicatedWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DedicatedWorker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E1CA5CA40E8CD78500E8EF90 /* DedicatedWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DedicatedWorker.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E1CA5CBB0E8CDCAF00E8EF90 /* JSDedicatedWorkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDedicatedWorkerCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E1CA5CD20E8CDE8000E8EF90 /* JSDedicatedWorkerConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDedicatedWorkerConstructor.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E1CA5CD50E8CDEE900E8EF90 /* JSDedicatedWorkerConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDedicatedWorkerConstructor.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E1CAA5C50E8BD23600A73ECA /* JSDedicatedWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDedicatedWorker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                E1C8BE440E8BCCBB0064CB7D /* Worker.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Worker.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1C8BE5C0E8BD15A0064CB7D /* JSWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorker.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1CA5C9F0E8CD73B00E8EF90 /* Worker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Worker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1CA5CA40E8CD78500E8EF90 /* Worker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Worker.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1CA5CD20E8CDE8000E8EF90 /* JSWorkerConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerConstructor.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1CA5CD50E8CDEE900E8EF90 /* JSWorkerConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerConstructor.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1CAA5C50E8BD23600A73ECA /* JSWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLSelectElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = JSHTMLSelectElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1EBBBD30AAC9B87001FE8E2 /* CSSCharsetRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCharsetRule.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -13005,9 +13009,6 @@
</span><span class="cx">                                 1A3417C80CECFF250049CBDE /* JSCustomVoidCallback.cpp */,
</span><span class="cx">                                 1A3417C70CECFF250049CBDE /* JSCustomVoidCallback.h */,
</span><span class="cx">                                 1AE830420CAB0ED1002237AE /* JSDatabaseCustom.cpp */,
</span><del>-                                E1CA5CD20E8CDE8000E8EF90 /* JSDedicatedWorkerConstructor.h */,
-                                E1CA5CD50E8CDEE900E8EF90 /* JSDedicatedWorkerConstructor.cpp */,
-                                E1CA5CBB0E8CDCAF00E8EF90 /* JSDedicatedWorkerCustom.cpp */,
</del><span class="cx">                                 929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */,
</span><span class="cx">                                 BC1DEA4E0E268EB60083A73F /* JSDocumentFragmentCustom.cpp */,
</span><span class="cx">                                 1AC226160DB69F740089B669 /* JSDOMApplicationCacheCustom.cpp */,
</span><span class="lines">@@ -13060,6 +13061,9 @@
</span><span class="cx">                                 B2D3FC890C2212CB00CF3618 /* JSSVGTransformListCustom.cpp */,
</span><span class="cx">                                 1A2C40AA0DEB55AA005AF19E /* JSTextCustom.cpp */,
</span><span class="cx">                                 516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */,
</span><ins>+                                E1CA5CD20E8CDE8000E8EF90 /* JSWorkerConstructor.h */,
+                                E1CA5CD50E8CDEE900E8EF90 /* JSWorkerConstructor.cpp */,
+                                E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */,
</ins><span class="cx">                                 BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */,
</span><span class="cx">                                 BCDFD4910E3056BD009D10AD /* JSXMLHttpRequestUploadCustom.cpp */,
</span><span class="cx">                                 BCEFE1E40DCA5F3300739219 /* JSXSLTProcessorCustom.cpp */,
</span><span class="lines">@@ -13386,8 +13390,8 @@
</span><span class="cx">                 E1C8BE4B0E8BD0D10064CB7D /* Threads */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                E1C8BE5C0E8BD15A0064CB7D /* JSDedicatedWorker.cpp */,
-                                E1CAA5C50E8BD23600A73ECA /* JSDedicatedWorker.h */,
</del><ins>+                                E1C8BE5C0E8BD15A0064CB7D /* JSWorker.cpp */,
+                                E1CAA5C50E8BD23600A73ECA /* JSWorker.h */,
</ins><span class="cx">                                 E1C362EE0EAF2AA9007410BC /* JSWorkerLocation.cpp */,
</span><span class="cx">                                 E1C362ED0EAF2AA9007410BC /* JSWorkerLocation.h */,
</span><span class="cx">                         );
</span><span class="lines">@@ -13891,9 +13895,6 @@
</span><span class="cx">                                 A81872110977D3C0005826D9 /* ContainerNode.h */,
</span><span class="cx">                                 A8C4A7F809D563270003AC8D /* CSSMappedAttributeDeclaration.cpp */,
</span><span class="cx">                                 A8C4A7F709D563270003AC8D /* CSSMappedAttributeDeclaration.h */,
</span><del>-                                E1CA5CA40E8CD78500E8EF90 /* DedicatedWorker.cpp */,
-                                E1CA5C9F0E8CD73B00E8EF90 /* DedicatedWorker.h */,
-                                E1C8BE440E8BCCBB0064CB7D /* DedicatedWorker.idl */,
</del><span class="cx">                                 93EEC1E709C2877700C515D1 /* DocPtr.h */,
</span><span class="cx">                                 A8185F3409765765005826D9 /* Document.cpp */,
</span><span class="cx">                                 A8185F3809765765005826D9 /* Document.h */,
</span><span class="lines">@@ -14056,11 +14057,16 @@
</span><span class="cx">                                 85031B3A0A44EFC700F992E0 /* WheelEvent.cpp */,
</span><span class="cx">                                 85031B3B0A44EFC700F992E0 /* WheelEvent.h */,
</span><span class="cx">                                 93EEC1F709C2877700C515D1 /* WheelEvent.idl */,
</span><ins>+                                E1CA5CA40E8CD78500E8EF90 /* Worker.cpp */,
+                                E1CA5C9F0E8CD73B00E8EF90 /* Worker.h */,
+                                E1C8BE440E8BCCBB0064CB7D /* Worker.idl */,
</ins><span class="cx">                                 E1C2C4410EAD017B007E61FB /* WorkerContext.cpp */,
</span><span class="cx">                                 E1C2C43D0EAD0133007E61FB /* WorkerContext.h */,
</span><span class="cx">                                 E1C363050EAF2D07007410BC /* WorkerLocation.cpp */,
</span><span class="cx">                                 E1C363000EAF2CC6007410BC /* WorkerLocation.h */,
</span><span class="cx">                                 E1C362BB0EAF29FB007410BC /* WorkerLocation.idl */,
</span><ins>+                                E14799B30ECDE9D800292BF3 /* WorkerMessagingProxy.cpp */,
+                                E14799A60ECDE3A400292BF3 /* WorkerMessagingProxy.h */,
</ins><span class="cx">                                 E108224E0EC3156700E93953 /* WorkerTask.cpp */,
</span><span class="cx">                                 E108224A0EC3153A00E93953 /* WorkerTask.h */,
</span><span class="cx">                                 E1C2C4280EACE0E0007E61FB /* WorkerThread.cpp */,
</span><span class="lines">@@ -16158,11 +16164,11 @@
</span><span class="cx">                                 089582560E857A7E00F82C83 /* ImageLoader.h in Headers */,
</span><span class="cx">                                 A8CB413E0E8633FD0032C4F0 /* DashArray.h in Headers */,
</span><span class="cx">                                 930B3BE20E884921009770C5 /* JSCanvasPixelArrayCustom.h in Headers */,
</span><del>-                                E1CAA5C60E8BD23600A73ECA /* JSDedicatedWorker.h in Headers */,
</del><ins>+                                E1CAA5C60E8BD23600A73ECA /* JSWorker.h in Headers */,
</ins><span class="cx">                                 BCF937E70E8B2E95005C7AB7 /* JSDOMWindowBase.lut.h in Headers */,
</span><span class="cx">                                 63F5D4F70E8C4B7100C0BD04 /* ElementRareData.h in Headers */,
</span><del>-                                E1CA5CA00E8CD73B00E8EF90 /* DedicatedWorker.h in Headers */,
-                                E1CA5CD30E8CDE8000E8EF90 /* JSDedicatedWorkerConstructor.h in Headers */,
</del><ins>+                                E1CA5CA00E8CD73B00E8EF90 /* Worker.h in Headers */,
+                                E1CA5CD30E8CDE8000E8EF90 /* JSWorkerConstructor.h in Headers */,
</ins><span class="cx">                                 BC3B7AF40E919CA900D54065 /* JSEventTargetNode.h in Headers */,
</span><span class="cx">                                 BC60901F0E91B8EC000C68B5 /* JSEventTarget.h in Headers */,
</span><span class="cx">                                 BC3BC29C0E91AB0F00835588 /* HostWindow.h in Headers */,
</span><span class="lines">@@ -16214,6 +16220,7 @@
</span><span class="cx">                                 E1A643F20EC0972500779668 /* WorkerScriptController.h in Headers */,
</span><span class="cx">                                 E108224B0EC3153A00E93953 /* WorkerTask.h in Headers */,
</span><span class="cx">                                 0FD723820EC8BD9300CA5DD7 /* FloatQuad.h in Headers */,
</span><ins>+                                E14799A70ECDE3A400292BF3 /* WorkerMessagingProxy.h in Headers */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -18078,10 +18085,10 @@
</span><span class="cx">                                 9350E70D0E87500B00189FFF /* JSHTMLAllCollection.cpp in Sources */,
</span><span class="cx">                                 BCC438780E886CC700533DD5 /* JSHTMLInputElementCustom.cpp in Sources */,
</span><span class="cx">                                 BC2441C40E8B65D00055320F /* ScrollView.cpp in Sources */,
</span><del>-                                E1C8BE5D0E8BD15A0064CB7D /* JSDedicatedWorker.cpp in Sources */,
-                                E1CA5CA50E8CD78500E8EF90 /* DedicatedWorker.cpp in Sources */,
-                                E1CA5CBC0E8CDCAF00E8EF90 /* JSDedicatedWorkerCustom.cpp in Sources */,
-                                E1CA5CD60E8CDEE900E8EF90 /* JSDedicatedWorkerConstructor.cpp in Sources */,
</del><ins>+                                E1C8BE5D0E8BD15A0064CB7D /* JSWorker.cpp in Sources */,
+                                E1CA5CA50E8CD78500E8EF90 /* Worker.cpp in Sources */,
+                                E1CA5CBC0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp in Sources */,
+                                E1CA5CD60E8CDEE900E8EF90 /* JSWorkerConstructor.cpp in Sources */,
</ins><span class="cx">                                 BC3B7AF30E919CA900D54065 /* JSEventTargetNode.cpp in Sources */,
</span><span class="cx">                                 BC3B7B210E91AAF400D54065 /* JSEventTargetNodeCustom.cpp in Sources */,
</span><span class="cx">                                 BC6090200E91B8EC000C68B5 /* JSEventTarget.cpp in Sources */,
</span><span class="lines">@@ -18122,6 +18129,7 @@
</span><span class="cx">                                 E1A643FD0EC097A000779668 /* WorkerScriptController.cpp in Sources */,
</span><span class="cx">                                 E108224F0EC3156700E93953 /* WorkerTask.cpp in Sources */,
</span><span class="cx">                                 0FD723830EC8BD9300CA5DD7 /* FloatQuad.cpp in Sources */,
</span><ins>+                                E14799B40ECDE9D800292BF3 /* WorkerMessagingProxy.cpp in Sources */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSDOMWindowBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSDOMWindowBase.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDOMWindowBase.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/bindings/js/JSDOMWindowBase.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -38,7 +38,6 @@
</span><span class="cx"> #include &quot;HTMLDocument.h&quot;
</span><span class="cx"> #include &quot;InspectorController.h&quot;
</span><span class="cx"> #include &quot;JSAudioConstructor.h&quot;
</span><del>-#include &quot;JSDedicatedWorkerConstructor.h&quot;
</del><span class="cx"> #include &quot;JSDOMWindowCustom.h&quot;
</span><span class="cx"> #include &quot;JSEvent.h&quot;
</span><span class="cx"> #include &quot;JSEventListener.h&quot;
</span><span class="lines">@@ -47,6 +46,7 @@
</span><span class="cx"> #include &quot;JSMessageChannelConstructor.h&quot;
</span><span class="cx"> #include &quot;JSNode.h&quot;
</span><span class="cx"> #include &quot;JSOptionConstructor.h&quot;
</span><ins>+#include &quot;JSWorkerConstructor.h&quot;
</ins><span class="cx"> #include &quot;JSXMLHttpRequestConstructor.h&quot;
</span><span class="cx"> #include &quot;JSXSLTProcessorConstructor.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="lines">@@ -456,7 +456,7 @@
</span><span class="cx"> #if ENABLE(WORKERS)
</span><span class="cx">     if (!static_cast&lt;JSDOMWindowBase*&gt;(asObject(slot.slotBase()))-&gt;allowsAccessFrom(exec))
</span><span class="cx">         return jsUndefined();
</span><del>-    return getDOMConstructor&lt;JSDedicatedWorkerConstructor&gt;(exec);
</del><ins>+    return getDOMConstructor&lt;JSWorkerConstructor&gt;(exec);
</ins><span class="cx"> #else
</span><span class="cx">     return jsUndefined();
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSDedicatedWorkerConstructorcpp"></a>
<div class="delfile"><h4>Deleted: trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -1,74 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include &quot;config.h&quot;
-
-#if ENABLE(WORKERS)
-
-#include &quot;JSDedicatedWorkerConstructor.h&quot;
-
-#include &quot;DedicatedWorker.h&quot;
-#include &quot;Document.h&quot;
-#include &quot;ExceptionCode.h&quot;
-#include &quot;JSDOMWindowCustom.h&quot;
-#include &quot;JSDedicatedWorker.h&quot;
-
-using namespace JSC;
-
-namespace WebCore {
-
-const ClassInfo JSDedicatedWorkerConstructor::s_info = { &quot;DedicatedWorkerConstructor&quot;, 0, 0, 0 };
-
-JSDedicatedWorkerConstructor::JSDedicatedWorkerConstructor(ExecState* exec)
-    : DOMObject(JSDedicatedWorkerConstructor::createStructure(exec-&gt;lexicalGlobalObject()-&gt;objectPrototype()))
-{
-    putDirect(exec-&gt;propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
-}
-
-static JSObject* constructDedicatedWorker(ExecState* exec, JSObject* constructor, const ArgList&amp; args)
-{
-    if (args.size() == 0)
-        return throwError(exec, SyntaxError, &quot;Not enough arguments&quot;);
-
-    UString scriptURL = args.at(exec, 0)-&gt;toString(exec);
-
-    DOMWindow* window = asJSDOMWindow(exec-&gt;lexicalGlobalObject())-&gt;impl();
-    
-    ExceptionCode ec = 0;
-    RefPtr&lt;DedicatedWorker&gt; worker = DedicatedWorker::create(scriptURL, window-&gt;document(), ec);
-    setDOMException(exec, ec);
-
-    return asObject(toJS(exec, worker.release()));
-}
-
-ConstructType JSDedicatedWorkerConstructor::getConstructData(ConstructData&amp; constructData)
-{
-    constructData.native.function = constructDedicatedWorker;
-    return ConstructTypeHost;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
</del></span></pre></div>
<a id="trunkWebCorebindingsjsJSDedicatedWorkerConstructorh"></a>
<div class="delfile"><h4>Deleted: trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.h (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.h        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.h        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -1,51 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef JSDedicatedWorkerConstructor_h
-#define JSDedicatedWorkerConstructor_h
-
-#if ENABLE(WORKERS)
-
-#include &quot;JSDOMBinding.h&quot;
-
-namespace WebCore {
-
-    class JSDedicatedWorkerConstructor : public DOMObject {
-    public:
-        JSDedicatedWorkerConstructor(JSC::ExecState*);
-
-        static const JSC::ClassInfo s_info;
-
-    private:
-        virtual JSC::ConstructType getConstructData(JSC::ConstructData&amp;);
-
-        virtual const JSC::ClassInfo* classInfo() const { return &amp;s_info; }
-    };
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
-
-#endif // JSDedicatedWorkerConstructor_h
</del></span></pre></div>
<a id="trunkWebCorebindingsjsJSDedicatedWorkerCustomcpp"></a>
<div class="delfile"><h4>Deleted: trunk/WebCore/bindings/js/JSDedicatedWorkerCustom.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDedicatedWorkerCustom.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/bindings/js/JSDedicatedWorkerCustom.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -1,67 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include &quot;config.h&quot;
-
-#if ENABLE(WORKERS)
-
-#include &quot;JSDedicatedWorker.h&quot;
-
-#include &quot;DedicatedWorker.h&quot;
-#include &quot;Document.h&quot;
-#include &quot;JSDOMWindowCustom.h&quot;
-#include &quot;JSEventListener.h&quot;
-#include &quot;JSMessagePort.h&quot;
-#include &quot;MessagePort.h&quot;
-
-using namespace JSC;
-
-namespace WebCore {
-    
-void JSDedicatedWorker::mark()
-{
-    DOMObject::mark();
-
-    if (JSUnprotectedEventListener* listener = static_cast&lt;JSUnprotectedEventListener*&gt;(m_impl-&gt;onmessage()))
-        listener-&gt;mark();
-
-    if (JSUnprotectedEventListener* listener = static_cast&lt;JSUnprotectedEventListener*&gt;(m_impl-&gt;onclose()))
-        listener-&gt;mark();
-
-    if (JSUnprotectedEventListener* listener = static_cast&lt;JSUnprotectedEventListener*&gt;(m_impl-&gt;onerror()))
-        listener-&gt;mark();
-}
-
-JSValue* JSDedicatedWorker::connect(ExecState* exec, const ArgList&amp; args)
-{
-    DOMWindow* window = asJSDOMWindow(exec-&gt;lexicalGlobalObject())-&gt;impl();
-    const UString&amp; message = args.at(exec, 0)-&gt;toString(exec);
-
-    return toJS(exec, impl()-&gt;connect(window-&gt;document(), message).get());
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
</del></span></pre></div>
<a id="trunkWebCorebindingsjsJSEventListenercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSEventListener.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSEventListener.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/bindings/js/JSEventListener.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -114,9 +114,10 @@
</span><span class="cx">         globalObject-&gt;setCurrentEvent(savedEvent);
</span><span class="cx"> 
</span><span class="cx">         if (exec-&gt;hadException()) {
</span><del>-            // FIXME: Report exceptions in non-Document contexts.
</del><span class="cx">             if (frame)
</span><span class="cx">                 frame-&gt;domWindow()-&gt;console()-&gt;reportCurrentException(exec);
</span><ins>+            else
+                exec-&gt;clearException(); // FIXME: Report exceptions in non-Document contexts.
</ins><span class="cx">         } else {
</span><span class="cx">             if (!retval-&gt;isUndefinedOrNull() &amp;&amp; event-&gt;storesResultAsString())
</span><span class="cx">                 event-&gt;storeResult(retval-&gt;toString(exec));
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSEventTargetcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSEventTarget.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSEventTarget.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/bindings/js/JSEventTarget.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -30,8 +30,10 @@
</span><span class="cx"> #include &quot;JSEventListener.h&quot;
</span><span class="cx"> #include &quot;JSEventTargetNode.h&quot;
</span><span class="cx"> #include &quot;JSMessagePort.h&quot;
</span><ins>+#include &quot;JSWorker.h&quot;
</ins><span class="cx"> #include &quot;JSWorkerContext.h&quot;
</span><span class="cx"> #include &quot;JSXMLHttpRequestUpload.h&quot;
</span><ins>+#include &quot;Worker.h&quot;
</ins><span class="cx"> #include &quot;WorkerContext.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SVG)
</span><span class="lines">@@ -74,6 +76,9 @@
</span><span class="cx">         return toJS(exec, messagePort);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WORKERS)
</span><ins>+    if (Worker* worker = target-&gt;toWorker())
+        return toJS(exec, worker);
+
</ins><span class="cx">     if (WorkerContext* workerContext = target-&gt;toWorkerContext())
</span><span class="cx">         return toJSDOMGlobalObject(workerContext);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSWorkerConstructorcppfromrev38387trunkWebCorebindingsjsJSDedicatedWorkerConstructorcpp"></a>
<div class="copfile"><h4>Copied: trunk/WebCore/bindings/js/JSWorkerConstructor.cpp (from rev 38387, trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp) (0 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSWorkerConstructor.cpp                                (rev 0)
+++ trunk/WebCore/bindings/js/JSWorkerConstructor.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include &quot;config.h&quot;
+
+#if ENABLE(WORKERS)
+
+#include &quot;JSWorkerConstructor.h&quot;
+
+#include &quot;Document.h&quot;
+#include &quot;ExceptionCode.h&quot;
+#include &quot;JSDOMWindowCustom.h&quot;
+#include &quot;JSWorker.h&quot;
+#include &quot;Worker.h&quot;
+
+using namespace JSC;
+
+namespace WebCore {
+
+const ClassInfo JSWorkerConstructor::s_info = { &quot;WorkerConstructor&quot;, 0, 0, 0 };
+
+JSWorkerConstructor::JSWorkerConstructor(ExecState* exec)
+    : DOMObject(JSWorkerConstructor::createStructure(exec-&gt;lexicalGlobalObject()-&gt;objectPrototype()))
+{
+    putDirect(exec-&gt;propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
+}
+
+static JSObject* constructWorker(ExecState* exec, JSObject* constructor, const ArgList&amp; args)
+{
+    if (args.size() == 0)
+        return throwError(exec, SyntaxError, &quot;Not enough arguments&quot;);
+
+    UString scriptURL = args.at(exec, 0)-&gt;toString(exec);
+
+    DOMWindow* window = asJSDOMWindow(exec-&gt;lexicalGlobalObject())-&gt;impl();
+    
+    ExceptionCode ec = 0;
+    RefPtr&lt;Worker&gt; worker = Worker::create(scriptURL, window-&gt;document(), ec);
+    setDOMException(exec, ec);
+
+    return asObject(toJS(exec, worker.release()));
+}
+
+ConstructType JSWorkerConstructor::getConstructData(ConstructData&amp; constructData)
+{
+    constructData.native.function = constructWorker;
+    return ConstructTypeHost;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
</ins></span></pre></div>
<a id="trunkWebCorebindingsjsJSWorkerConstructorhfromrev38387trunkWebCorebindingsjsJSDedicatedWorkerConstructorh"></a>
<div class="copfile"><h4>Copied: trunk/WebCore/bindings/js/JSWorkerConstructor.h (from rev 38387, trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.h) (0 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSWorkerConstructor.h                                (rev 0)
+++ trunk/WebCore/bindings/js/JSWorkerConstructor.h        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef JSWorkerConstructor_h
+#define JSWorkerConstructor_h
+
+#if ENABLE(WORKERS)
+
+#include &quot;JSDOMBinding.h&quot;
+
+namespace WebCore {
+
+    class JSWorkerConstructor : public DOMObject {
+    public:
+        JSWorkerConstructor(JSC::ExecState*);
+
+        static const JSC::ClassInfo s_info;
+
+    private:
+        virtual JSC::ConstructType getConstructData(JSC::ConstructData&amp;);
+
+        virtual const JSC::ClassInfo* classInfo() const { return &amp;s_info; }
+    };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // JSWorkerConstructor_h
</ins></span></pre></div>
<a id="trunkWebCorebindingsjsJSWorkerContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSWorkerContext.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSWorkerContext.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/bindings/js/JSWorkerContext.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -44,18 +44,15 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+static JSValue* jsWorkerContextPrototypeFunctionPostMessage(ExecState*, JSObject*, JSValue*, const ArgList&amp;);
</ins><span class="cx"> static JSValue* jsWorkerContextPrototypeFunctionAddEventListener(ExecState*, JSObject*, JSValue*, const ArgList&amp;);
</span><span class="cx"> static JSValue* jsWorkerContextPrototypeFunctionRemoveEventListener(ExecState*, JSObject*, JSValue*, const ArgList&amp;);
</span><span class="cx"> static JSValue* jsWorkerContextPrototypeFunctionDispatchEvent(ExecState*, JSObject*, JSValue*, const ArgList&amp;);
</span><span class="cx"> JSValue* jsWorkerContextLocation(ExecState*, const Identifier&amp;, const PropertySlot&amp;);
</span><del>-JSValue* jsWorkerContextOnconnect(ExecState*, const Identifier&amp;, const PropertySlot&amp;);
-void setJSWorkerContextOnconnect(ExecState*, JSObject*, JSValue*);
-JSValue* jsWorkerContextMessageChannel(ExecState*, const Identifier&amp;, const PropertySlot&amp;);
-void setJSWorkerContextMessageChannel(ExecState*, JSObject*, JSValue*);
-JSValue* jsWorkerContextMessagePort(ExecState*, const Identifier&amp;, const PropertySlot&amp;);
</del><ins>+JSValue* jsWorkerContextOnmessage(ExecState*, const Identifier&amp;, const PropertySlot&amp;);
+void setJSWorkerContextOnmessage(ExecState*, JSObject*, JSValue*);
</ins><span class="cx"> void setJSWorkerContextMessageEvent(ExecState*, JSObject*, JSValue*);
</span><span class="cx"> JSValue* jsWorkerContextMessageEvent(ExecState*, const Identifier&amp;, const PropertySlot&amp;);
</span><del>-void setJSWorkerContextMessagePort(ExecState*, JSObject*, JSValue*);
</del><span class="cx"> JSValue* jsWorkerContextWorkerLocation(ExecState*, const Identifier&amp;, const PropertySlot&amp;);
</span><span class="cx"> void setJSWorkerContextWorkerLocation(ExecState*, JSObject*, JSValue*);
</span><span class="cx"> 
</span><span class="lines">@@ -65,25 +62,17 @@
</span><span class="cx"> @begin JSWorkerContextPrototypeTable
</span><span class="cx">   addEventListener               jsWorkerContextPrototypeFunctionAddEventListener              DontDelete|Function 3
</span><span class="cx">   removeEventListener            jsWorkerContextPrototypeFunctionRemoveEventListener           DontDelete|Function 3
</span><del>-  dispatchEvent                  jsWorkerContextPrototypeFunctionDispatchEvent                DontDelete|Function 2
-#  close                          jsWorkerContextPrototypeFunctionClose                         DontDelete|Function 0
-#  MessagePort methods?
</del><ins>+  dispatchEvent                  jsWorkerContextPrototypeFunctionDispatchEvent                 DontDelete|Function 2
+  postMessage                    jsWorkerContextPrototypeFunctionPostMessage                  DontDelete|Function 2
</ins><span class="cx"> @end
</span><span class="cx"> */
</span><span class="cx"> 
</span><span class="cx"> /*
</span><span class="cx"> @begin JSWorkerContextTable
</span><span class="cx">   location                      jsWorkerContextLocation            DontDelete|ReadOnly
</span><del>-#  onclose                       jsWorkerContextOnclose             DontDelete
-  onconnect                     jsWorkerContextOnconnect                     DontDelete
-#  onmessage and other MessagePort attributes?
-#  navigator-like object for browser sniffing?
-  MessageChannel                jsWorkerContextMessageChannel                DontDelete
</del><ins>+  onmessage                     jsWorkerContextOnmessage                     DontDelete
</ins><span class="cx">   MessageEvent                  jsWorkerContextMessageEvent                  DontDelete
</span><del>-  MessagePort                   jsWorkerContextMessagePort                   DontDelete
</del><span class="cx">   WorkerLocation                jsWorkerContextWorkerLocation                DontDelete
</span><del>-#  XMLHttpRequest                jsWorkerContextXMLHttpRequest                DontDelete
-#  Database
</del><span class="cx"> @end
</span><span class="cx"> */
</span><span class="cx"> 
</span><span class="lines">@@ -125,7 +114,7 @@
</span><span class="cx"> 
</span><span class="cx">     markActiveObjectsForContext(*globalData(), scriptExecutionContext());
</span><span class="cx"> 
</span><del>-    if (JSUnprotectedEventListener* listener = static_cast&lt;JSUnprotectedEventListener*&gt;(m_impl-&gt;onconnect()))
</del><ins>+    if (JSUnprotectedEventListener* listener = static_cast&lt;JSUnprotectedEventListener*&gt;(m_impl-&gt;onmessage()))
</ins><span class="cx">         listener-&gt;mark();
</span><span class="cx"> 
</span><span class="cx">     typedef WorkerContext::EventListenersMap EventListenersMap;
</span><span class="lines">@@ -161,6 +150,17 @@
</span><span class="cx">     return getStaticValueSlot&lt;JSWorkerContext, Base&gt;(exec, getJSWorkerContextTable(exec), this, propertyName, slot);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSValue* jsWorkerContextPrototypeFunctionPostMessage(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&amp; args)
+{
+    if (!thisValue-&gt;isObject(&amp;JSWorkerContext::s_info))
+        return throwError(exec, TypeError);
+    JSWorkerContext* workerContext = static_cast&lt;JSWorkerContext*&gt;(asObject(thisValue));
+    const UString&amp; message = args.at(exec, 0)-&gt;toString(exec);
+
+    workerContext-&gt;impl()-&gt;postMessage(message);
+    return jsUndefined();
+}
+
</ins><span class="cx"> JSValue* jsWorkerContextPrototypeFunctionAddEventListener(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&amp; args)
</span><span class="cx"> {
</span><span class="cx">     if (!thisValue-&gt;isObject(&amp;JSWorkerContext::s_info))
</span><span class="lines">@@ -205,40 +205,30 @@
</span><span class="cx">     return toJS(exec, imp-&gt;location());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSValue* jsWorkerContextOnconnect(JSC::ExecState* exec, const Identifier&amp;, const PropertySlot&amp; slot)
</del><ins>+JSValue* jsWorkerContextOnmessage(JSC::ExecState* exec, const Identifier&amp;, const PropertySlot&amp; slot)
</ins><span class="cx"> {
</span><span class="cx">     WorkerContext* imp = static_cast&lt;WorkerContext*&gt;(static_cast&lt;JSWorkerContext*&gt;(asObject(slot.slotBase()))-&gt;impl());
</span><del>-    if (JSUnprotectedEventListener* listener = static_cast&lt;JSUnprotectedEventListener*&gt;(imp-&gt;onconnect())) {
</del><ins>+    if (JSUnprotectedEventListener* listener = static_cast&lt;JSUnprotectedEventListener*&gt;(imp-&gt;onmessage())) {
</ins><span class="cx">         if (JSObject* listenerObj = listener-&gt;listenerObj())
</span><span class="cx">             return listenerObj;
</span><span class="cx">     }
</span><span class="cx">     return jsNull();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void setJSWorkerContextOnconnect(ExecState* exec, JSObject* thisObject, JSValue* value)
</del><ins>+void setJSWorkerContextOnmessage(ExecState* exec, JSObject* thisObject, JSValue* value)
</ins><span class="cx"> {
</span><span class="cx">     WorkerContext* imp = static_cast&lt;WorkerContext*&gt;(static_cast&lt;JSWorkerContext*&gt;(thisObject)-&gt;impl());
</span><span class="cx">     JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp-&gt;scriptExecutionContext());
</span><span class="cx">     if (!globalObject)
</span><span class="cx">         return;
</span><del>-    imp-&gt;setOnconnect(globalObject-&gt;findOrCreateJSUnprotectedEventListener(exec, value, true));
</del><ins>+    imp-&gt;setOnmessage(globalObject-&gt;findOrCreateJSUnprotectedEventListener(exec, value, true));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSValue* jsWorkerContextMessageChannel(ExecState* exec, const Identifier&amp;, const PropertySlot&amp; slot)
-{
-    return getDOMConstructor&lt;JSMessageChannelConstructor&gt;(exec, static_cast&lt;JSWorkerContext*&gt;(asObject(slot.slotBase())));
-}
-
</del><span class="cx"> JSValue* jsWorkerContextMessageEvent(ExecState* exec, const Identifier&amp;, const PropertySlot&amp; slot)
</span><span class="cx"> {
</span><span class="cx">     return JSMessageEvent::getConstructor(exec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSValue* jsWorkerContextMessagePort(ExecState* exec, const Identifier&amp;, const PropertySlot&amp;)
-{
-    return JSMessagePort::getConstructor(exec);
-}
-
</del><span class="cx"> JSValue* jsWorkerContextWorkerLocation(ExecState* exec, const Identifier&amp;, const PropertySlot&amp;)
</span><span class="cx"> {
</span><span class="cx">     return JSWorkerLocation::getConstructor(exec);
</span><span class="lines">@@ -261,22 +251,12 @@
</span><span class="cx">     return getStaticFunctionSlot&lt;JSObject&gt;(exec, getJSWorkerContextPrototypeTable(exec), this, propertyName, slot);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void setJSWorkerContextMessageChannel(ExecState*, JSObject*, JSValue*)
</del><ins>+void setJSWorkerContextMessageEvent(ExecState*, JSObject*, JSValue*)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: Do we need to override put for global constructors, like JSDOMWindowBase does?
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void setJSWorkerContextMessageEvent(ExecState*, JSObject*, JSValue*)
-{
-    ASSERT_NOT_REACHED();
-}
-
-void setJSWorkerContextMessagePort(ExecState*, JSObject*, JSValue*)
-{
-    ASSERT_NOT_REACHED();
-}
-
</del><span class="cx"> void setJSWorkerContextWorkerLocation(ExecState*, JSObject*, JSValue*)
</span><span class="cx"> {
</span><span class="cx">     ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSWorkerCustomcppfromrev38387trunkWebCorebindingsjsJSDedicatedWorkerCustomcpp"></a>
<div class="copfile"><h4>Copied: trunk/WebCore/bindings/js/JSWorkerCustom.cpp (from rev 38387, trunk/WebCore/bindings/js/JSDedicatedWorkerCustom.cpp) (0 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSWorkerCustom.cpp                                (rev 0)
+++ trunk/WebCore/bindings/js/JSWorkerCustom.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include &quot;config.h&quot;
+
+#if ENABLE(WORKERS)
+
+#include &quot;JSWorker.h&quot;
+
+#include &quot;JSDOMGlobalObject.h&quot;
+#include &quot;JSEventListener.h&quot;
+#include &quot;Worker.h&quot;
+
+using namespace JSC;
+
+namespace WebCore {
+    
+void JSWorker::mark()
+{
+    DOMObject::mark();
+
+    if (JSUnprotectedEventListener* listener = static_cast&lt;JSUnprotectedEventListener*&gt;(m_impl-&gt;onmessage()))
+        listener-&gt;mark();
+
+    if (JSUnprotectedEventListener* listener = static_cast&lt;JSUnprotectedEventListener*&gt;(m_impl-&gt;onerror()))
+        listener-&gt;mark();
+
+    typedef Worker::EventListenersMap EventListenersMap;
+    typedef Worker::ListenerVector ListenerVector;
+    EventListenersMap&amp; eventListeners = m_impl-&gt;eventListeners();
+    for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) {
+        for (ListenerVector::iterator vecIter = mapIter-&gt;second.begin(); vecIter != mapIter-&gt;second.end(); ++vecIter) {
+            JSUnprotectedEventListener* listener = static_cast&lt;JSUnprotectedEventListener*&gt;(vecIter-&gt;get());
+            listener-&gt;mark();
+        }
+    }
+}
+
+JSValue* JSWorker::addEventListener(ExecState* exec, const ArgList&amp; args)
+{
+    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()-&gt;scriptExecutionContext());
+    if (!globalObject)
+        return jsUndefined();
+    RefPtr&lt;JSUnprotectedEventListener&gt; listener = globalObject-&gt;findOrCreateJSUnprotectedEventListener(exec, args.at(exec, 1));
+    if (!listener)
+        return jsUndefined();
+    impl()-&gt;addEventListener(args.at(exec, 0)-&gt;toString(exec), listener.release(), args.at(exec, 2)-&gt;toBoolean(exec));
+    return jsUndefined();
+}
+
+JSValue* JSWorker::removeEventListener(ExecState* exec, const ArgList&amp; args)
+{
+    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()-&gt;scriptExecutionContext());
+    if (!globalObject)
+        return jsUndefined();
+    JSUnprotectedEventListener* listener = globalObject-&gt;findJSUnprotectedEventListener(exec, args.at(exec, 1));
+    if (!listener)
+        return jsUndefined();
+    impl()-&gt;removeEventListener(args.at(exec, 0)-&gt;toString(exec), listener, args.at(exec, 2)-&gt;toBoolean(exec));
+    return jsUndefined();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
</ins></span></pre></div>
<a id="trunkWebCoredomDedicatedWorkercpp"></a>
<div class="delfile"><h4>Deleted: trunk/WebCore/dom/DedicatedWorker.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/DedicatedWorker.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/dom/DedicatedWorker.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -1,209 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- */
-
-#include &quot;config.h&quot;
-
-#if ENABLE(WORKERS)
-
-#include &quot;DedicatedWorker.h&quot;
-
-#include &quot;CachedScript.h&quot;
-#include &quot;DOMWindow.h&quot;
-#include &quot;DocLoader.h&quot;
-#include &quot;Document.h&quot;
-#include &quot;Event.h&quot;
-#include &quot;EventException.h&quot;
-#include &quot;EventListener.h&quot;
-#include &quot;EventNames.h&quot;
-#include &quot;ExceptionCode.h&quot;
-#include &quot;FrameLoader.h&quot;
-#include &quot;MessageEvent.h&quot;
-#include &quot;MessagePort.h&quot;
-#include &quot;SecurityOrigin.h&quot;
-#include &quot;Timer.h&quot;
-#include &quot;WorkerContext.h&quot;
-#include &quot;WorkerTask.h&quot;
-#include &quot;WorkerThread.h&quot;
-#include &lt;wtf/MainThread.h&gt;
-
-namespace WebCore {
-
-class WorkerThreadScriptLoadTimer : public TimerBase {
-public:
-    WorkerThreadScriptLoadTimer(PassRefPtr&lt;DedicatedWorker&gt; worker)
-        : m_worker(worker)
-    {
-        ASSERT(m_worker);
-    }
-
-private:
-    virtual void fired()
-    {
-        m_worker-&gt;startLoad();
-        delete this;
-    }
-
-    RefPtr&lt;DedicatedWorker&gt; m_worker;
-};
-
-class WorkerConnectTask : public WorkerTask {
-public:
-    WorkerConnectTask(const String&amp; message, PassRefPtr&lt;MessagePort&gt; port)
-        : m_message(message.copy())
-        , m_port(port)
-    {
-    }
-
-    virtual void performTask(WorkerContext* context)
-    {
-        m_port-&gt;attachToContext(context);
-
-        RefPtr&lt;Event&gt; evt = MessageEvent::create(m_message, &quot;&quot;, &quot;&quot;, 0, m_port);
-
-        if (context-&gt;onconnect()) {
-            evt-&gt;setTarget(context);
-            evt-&gt;setCurrentTarget(context);
-            context-&gt;onconnect()-&gt;handleEvent(evt.get(), false);
-        }
-
-        ExceptionCode ec = 0;
-        context-&gt;dispatchEvent(evt.release(), ec);
-        ASSERT(!ec);
-    }
-
-private:
-    String m_message;
-    RefPtr&lt;MessagePort&gt; m_port;
-};
-
-DedicatedWorker::DedicatedWorker(const String&amp; url, Document* document, ExceptionCode&amp; ec)
-    : ActiveDOMObject(document, this)
-    , m_thread(0)
-{
-    m_scriptURL = document-&gt;completeURL(url);
-    if (!m_scriptURL.isValid()) {
-        ec = SYNTAX_ERR;
-        return;
-    }
-
-    if (!document-&gt;securityOrigin()-&gt;canAccess(SecurityOrigin::create(m_scriptURL).get())) {
-        ec = SECURITY_ERR;
-        return;
-    }
-
-    WorkerThreadScriptLoadTimer* timer = new WorkerThreadScriptLoadTimer(this);
-    timer-&gt;startOneShot(0);
-}
-
-DedicatedWorker::~DedicatedWorker()
-{
-    ASSERT(isMainThread());
-}
-
-Document* DedicatedWorker::document() const
-{
-    ASSERT(scriptExecutionContext()-&gt;isDocument());
-    return static_cast&lt;Document*&gt;(scriptExecutionContext());
-}
-
-PassRefPtr&lt;MessagePort&gt; DedicatedWorker::connect(ScriptExecutionContext* scriptExecutionContext, const String&amp; message)
-{
-    RefPtr&lt;MessagePort&gt; port = MessagePort::create(scriptExecutionContext);
-    RefPtr&lt;MessagePort&gt; otherPort = MessagePort::create(0);
-    MessagePort::entangle(port.get(), otherPort.get());
-    if (m_thread)
-        m_thread-&gt;messageQueue().append(new WorkerConnectTask(message, otherPort));
-    else
-        m_queuedEarlyTasks.append(new WorkerConnectTask(message, otherPort));
-
-    return port;
-}
-
-void DedicatedWorker::close()
-{
-    // Not implemented.
-}
-
-void DedicatedWorker::postMessage(const String&amp; /*message*/, MessagePort* /*port*/)
-{
-    // Not implemented.
-}
-
-void DedicatedWorker::startLoad()
-{
-    // The document may have been destroyed already.
-    // FIXME: Should we explicitly check whether the document has been detached, and cancel loading in that case?
-    if (!document())
-        return;
-
-    m_cachedScript = document()-&gt;docLoader()-&gt;requestScript(m_scriptURL, document()-&gt;charset());
-
-    if (m_cachedScript) {
-        setPendingActivity(this);  // The worker context does not exist while loading, so we much ensure that the worker object is not collected, as well as its event listeners.
-        m_cachedScript-&gt;addClient(this);
-        return;
-    }
-
-    dispatchErrorEvent();
-}
-
-void DedicatedWorker::notifyFinished(CachedResource* resource)
-{
-    ASSERT(resource == m_cachedScript.get());
-    if (m_cachedScript-&gt;errorOccurred()) {
-        dispatchErrorEvent();
-        unsetPendingActivity(this);
-    } else  {
-        // FIXME: When can we unsetPendingActivity()? Currently, worker objects are never collected, and threads never exit.
-
-        RefPtr&lt;WorkerThread&gt; thread = WorkerThread::create(m_scriptURL, m_cachedScript-&gt;script(), this);
-        m_thread = thread.get();
-
-        unsigned taskCount = m_queuedEarlyTasks.size();
-        for (unsigned i = 0; i &lt; taskCount; ++i)
-            m_thread-&gt;messageQueue().append(m_queuedEarlyTasks[i]);
-
-        m_thread-&gt;start();
-    }
-
-    m_queuedEarlyTasks.clear();
-
-    m_cachedScript-&gt;removeClient(this);
-    m_cachedScript = 0;
-}
-
-void DedicatedWorker::dispatchErrorEvent()
-{
-    if (m_onErrorListener) {
-        RefPtr&lt;Event&gt; evt = Event::create(eventNames().errorEvent, false, true);
-        // DedicatedWorker is not an EventTarget, so target and currentTarget remain null.
-        m_onErrorListener-&gt;handleEvent(evt.release().get(), true);
-    }
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
</del></span></pre></div>
<a id="trunkWebCoredomDedicatedWorkerh"></a>
<div class="delfile"><h4>Deleted: trunk/WebCore/dom/DedicatedWorker.h (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/DedicatedWorker.h        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/dom/DedicatedWorker.h        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -1,99 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- */
-
-#ifndef DedicatedWorker_h
-#define DedicatedWorker_h
-
-#if ENABLE(WORKERS)
-
-#include &quot;ActiveDOMObject.h&quot;
-#include &quot;CachedResourceClient.h&quot;
-#include &quot;CachedResourceHandle.h&quot;
-#include &quot;EventListener.h&quot;
-#include &lt;wtf/PassRefPtr.h&gt;
-#include &lt;wtf/RefCounted.h&gt;
-#include &lt;wtf/RefPtr.h&gt;
-
-namespace WebCore {
-
-    class CachedResource;
-    class CachedScript;
-    class Document;
-    class ScriptExecutionContext;
-    class MessagePort;
-    class String;
-    class WorkerTask;
-    class WorkerThread;
-
-    typedef int ExceptionCode;
-
-    class DedicatedWorker : public RefCounted&lt;DedicatedWorker&gt;, public ActiveDOMObject, private CachedResourceClient {
-    public:
-        static PassRefPtr&lt;DedicatedWorker&gt; create(const String&amp; url, Document* document, ExceptionCode&amp; ec) { return adoptRef(new DedicatedWorker(url, document, ec)); }
-        ~DedicatedWorker();
-
-        Document* document() const;
-
-        PassRefPtr&lt;MessagePort&gt; connect(ScriptExecutionContext*, const String&amp; message);
-        void close();
-        void postMessage(const String&amp; message, MessagePort* port = 0);
-
-        void setOnmessage(PassRefPtr&lt;EventListener&gt; eventListener) { m_onMessageListener = eventListener; }
-        EventListener* onmessage() const { return m_onMessageListener.get(); }
-
-        void setOnclose(PassRefPtr&lt;EventListener&gt; eventListener) { m_onCloseListener = eventListener; }
-        EventListener* onclose() const { return m_onCloseListener.get(); }
-
-        void setOnerror(PassRefPtr&lt;EventListener&gt; eventListener) { m_onErrorListener = eventListener; }
-        EventListener* onerror() const { return m_onErrorListener.get(); }
-
-    private:
-        friend class WorkerThreadScriptLoadTimer;
-
-        DedicatedWorker(const String&amp;, Document*, ExceptionCode&amp;);
-
-        void startLoad();
-        virtual void notifyFinished(CachedResource*);
-
-        void dispatchErrorEvent();
-
-        KURL m_scriptURL;
-        CachedResourceHandle&lt;CachedScript&gt; m_cachedScript;
-
-        WorkerThread* m_thread;
-
-        RefPtr&lt;EventListener&gt; m_onMessageListener;
-        RefPtr&lt;EventListener&gt; m_onCloseListener;
-        RefPtr&lt;EventListener&gt; m_onErrorListener;
-
-        Vector&lt;RefPtr&lt;WorkerTask&gt; &gt; m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created.
-    };
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
-
-#endif // DedicatedWorker_h
</del></span></pre></div>
<a id="trunkWebCoredomDedicatedWorkeridl"></a>
<div class="delfile"><h4>Deleted: trunk/WebCore/dom/DedicatedWorker.idl (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/DedicatedWorker.idl        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/dom/DedicatedWorker.idl        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -1,43 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- */
-
-module threads {
-
-    interface [CustomMarkFunction, Conditional=WORKERS] DedicatedWorker {
-
-        // These also used for shared workers.
-        attribute EventListener onclose;
-        attribute EventListener onerror;
-
-        // These are only for dedicated workers.
-        attribute EventListener onmessage;
-        [Custom] MessagePort connect(in DOMString message);
-        void close();
-        void postMessage(in DOMString message, in [Optional] MessagePort port);
-
-    };
-
-}
</del></span></pre></div>
<a id="trunkWebCoredomEventTargetcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/EventTarget.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/EventTarget.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/dom/EventTarget.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -79,6 +79,11 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WORKERS)
</span><ins>+Worker* EventTarget::toWorker()
+{
+    return 0;
+}
+
</ins><span class="cx"> WorkerContext* EventTarget::toWorkerContext()
</span><span class="cx"> {
</span><span class="cx">     return 0;
</span></span></pre></div>
<a id="trunkWebCoredomEventTargeth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/EventTarget.h (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/EventTarget.h        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/dom/EventTarget.h        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     class RegisteredEventListener;
</span><span class="cx">     class ScriptExecutionContext;
</span><span class="cx">     class SVGElementInstance;
</span><ins>+    class Worker;
</ins><span class="cx">     class WorkerContext;
</span><span class="cx">     class XMLHttpRequest;
</span><span class="cx">     class XMLHttpRequestUpload;
</span><span class="lines">@@ -67,6 +68,7 @@
</span><span class="cx">         virtual SVGElementInstance* toSVGElementInstance();
</span><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(WORKERS)
</span><ins>+        virtual Worker* toWorker();
</ins><span class="cx">         virtual WorkerContext* toWorkerContext();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoredomScriptExecutionContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/ScriptExecutionContext.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/ScriptExecutionContext.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/dom/ScriptExecutionContext.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -191,14 +191,14 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;ScriptExecutionContext&gt; scriptExecutionContext;
</del><ins>+    ScriptExecutionContext* scriptExecutionContext; // The context should exist until task execution.
</ins><span class="cx">     RefPtr&lt;ScriptExecutionContext::Task&gt; task;
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> static void performTask(void* ctx)
</span><span class="cx"> {
</span><span class="cx">     PerformTaskContext* ptctx = reinterpret_cast&lt;PerformTaskContext*&gt;(ctx);
</span><del>-    ptctx-&gt;task-&gt;performTask(ptctx-&gt;scriptExecutionContext.get());
</del><ins>+    ptctx-&gt;task-&gt;performTask(ptctx-&gt;scriptExecutionContext);
</ins><span class="cx">     delete ptctx;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoredomWorkercppfromrev38387trunkWebCoredomDedicatedWorkercpp"></a>
<div class="copfile"><h4>Copied: trunk/WebCore/dom/Worker.cpp (from rev 38387, trunk/WebCore/dom/DedicatedWorker.cpp) (0 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Worker.cpp                                (rev 0)
+++ trunk/WebCore/dom/Worker.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -0,0 +1,179 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+#include &quot;config.h&quot;
+
+#if ENABLE(WORKERS)
+
+#include &quot;Worker.h&quot;
+
+#include &quot;CachedScript.h&quot;
+#include &quot;DOMWindow.h&quot;
+#include &quot;DocLoader.h&quot;
+#include &quot;Document.h&quot;
+#include &quot;EventException.h&quot;
+#include &quot;EventListener.h&quot;
+#include &quot;EventNames.h&quot;
+#include &quot;ExceptionCode.h&quot;
+#include &quot;FrameLoader.h&quot;
+#include &quot;MessageEvent.h&quot;
+#include &quot;SecurityOrigin.h&quot;
+#include &quot;WorkerContext.h&quot;
+#include &quot;WorkerMessagingProxy.h&quot;
+#include &quot;WorkerTask.h&quot;
+#include &quot;WorkerThread.h&quot;
+#include &lt;wtf/MainThread.h&gt;
+
+namespace WebCore {
+
+Worker::Worker(const String&amp; url, Document* doc, ExceptionCode&amp; ec)
+    : ActiveDOMObject(doc, this)
+    , m_messagingProxy(new WorkerMessagingProxy(doc, this))
+{
+    m_scriptURL = doc-&gt;completeURL(url);
+    if (!m_scriptURL.isValid()) {
+        ec = SYNTAX_ERR;
+        return;
+    }
+
+    if (!doc-&gt;securityOrigin()-&gt;canAccess(SecurityOrigin::create(m_scriptURL).get())) {
+        ec = SECURITY_ERR;
+        return;
+    }
+
+    m_cachedScript = doc-&gt;docLoader()-&gt;requestScript(m_scriptURL, document()-&gt;charset());
+    if (!m_cachedScript) {
+        dispatchErrorEvent();
+        return;
+    }
+
+    setPendingActivity(this);  // The worker context does not exist while loading, so we much ensure that the worker object is not collected, as well as its event listeners.
+    m_cachedScript-&gt;addClient(this);
+}
+
+Worker::~Worker()
+{
+    ASSERT(isMainThread());
+    ASSERT(scriptExecutionContext()); // The context is protected by messaging proxy, so it cannot be destroyed while a Worker exists.
+    m_messagingProxy-&gt;workerObjectDestroyed();
+}
+
+Document* Worker::document() const
+{
+    ASSERT(scriptExecutionContext()-&gt;isDocument());
+    return static_cast&lt;Document*&gt;(scriptExecutionContext());
+}
+
+void Worker::postMessage(const String&amp; message)
+{
+    m_messagingProxy-&gt;postMessageToWorkerContext(message);
+}
+
+void Worker::notifyFinished(CachedResource* resource)
+{
+    ASSERT(resource == m_cachedScript.get());
+    if (m_cachedScript-&gt;errorOccurred())
+        dispatchErrorEvent();
+    else {
+        RefPtr&lt;WorkerThread&gt; thread = WorkerThread::create(m_scriptURL, m_cachedScript-&gt;script(), m_messagingProxy);
+        m_messagingProxy-&gt;workerThreadCreated(thread);
+        thread-&gt;start();
+    }
+
+    m_cachedScript-&gt;removeClient(this);
+    m_cachedScript = 0;
+
+    unsetPendingActivity(this);
+}
+
+void Worker::dispatchErrorEvent()
+{
+    RefPtr&lt;Event&gt; evt = Event::create(eventNames().errorEvent, false, true);
+    if (m_onErrorListener) {
+        evt-&gt;setTarget(this);
+        evt-&gt;setCurrentTarget(this);
+        m_onErrorListener-&gt;handleEvent(evt.get(), true);
+    }
+
+    ExceptionCode ec = 0;
+    dispatchEvent(evt.release(), ec);
+    ASSERT(!ec);
+}
+
+void Worker::addEventListener(const AtomicString&amp; eventType, PassRefPtr&lt;EventListener&gt; eventListener, bool)
+{
+    EventListenersMap::iterator iter = m_eventListeners.find(eventType);
+    if (iter == m_eventListeners.end()) {
+        ListenerVector listeners;
+        listeners.append(eventListener);
+        m_eventListeners.add(eventType, listeners);
+    } else {
+        ListenerVector&amp; listeners = iter-&gt;second;
+        for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) {
+            if (*listenerIter == eventListener)
+                return;
+        }
+        
+        listeners.append(eventListener);
+        m_eventListeners.add(eventType, listeners);
+    }    
+}
+
+void Worker::removeEventListener(const AtomicString&amp; eventType, EventListener* eventListener, bool useCapture)
+{
+    EventListenersMap::iterator iter = m_eventListeners.find(eventType);
+    if (iter == m_eventListeners.end())
+        return;
+    
+    ListenerVector&amp; listeners = iter-&gt;second;
+    for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) {
+        if (*listenerIter == eventListener) {
+            listeners.remove(listenerIter - listeners.begin());
+            return;
+        }
+    }
+}
+
+bool Worker::dispatchEvent(PassRefPtr&lt;Event&gt; event, ExceptionCode&amp; ec)
+{
+    if (event-&gt;type().isEmpty()) {
+        ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR;
+        return true;
+    }
+
+    ListenerVector listenersCopy = m_eventListeners.get(event-&gt;type());
+    for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) {
+        event-&gt;setTarget(this);
+        event-&gt;setCurrentTarget(this);
+        listenerIter-&gt;get()-&gt;handleEvent(event.get(), false);
+    }
+
+    return !event-&gt;defaultPrevented();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
</ins></span></pre></div>
<a id="trunkWebCoredomWorkerhfromrev38387trunkWebCoredomDedicatedWorkerh"></a>
<div class="copfile"><h4>Copied: trunk/WebCore/dom/Worker.h (from rev 38387, trunk/WebCore/dom/DedicatedWorker.h) (0 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Worker.h                                (rev 0)
+++ trunk/WebCore/dom/Worker.h        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -0,0 +1,107 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+#ifndef Worker_h
+#define Worker_h
+
+#if ENABLE(WORKERS)
+
+#include &quot;AtomicStringHash.h&quot;
+#include &quot;ActiveDOMObject.h&quot;
+#include &quot;CachedResourceClient.h&quot;
+#include &quot;CachedResourceHandle.h&quot;
+#include &quot;EventListener.h&quot;
+#include &quot;EventTarget.h&quot;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+
+namespace WebCore {
+
+    class CachedResource;
+    class CachedScript;
+    class Document;
+    class ScriptExecutionContext;
+    class String;
+    class WorkerMessagingProxy;
+    class WorkerTask;
+
+    typedef int ExceptionCode;
+
+    class Worker : public RefCounted&lt;Worker&gt;, public ActiveDOMObject, private CachedResourceClient, public EventTarget {
+    public:
+        static PassRefPtr&lt;Worker&gt; create(const String&amp; url, Document* document, ExceptionCode&amp; ec) { return adoptRef(new Worker(url, document, ec)); }
+        ~Worker();
+
+        virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
+        Document* document() const;
+
+        virtual Worker* toWorker() { return this; }
+
+        void postMessage(const String&amp; message);
+
+        virtual void addEventListener(const AtomicString&amp; eventType, PassRefPtr&lt;EventListener&gt;, bool useCapture);
+        virtual void removeEventListener(const AtomicString&amp; eventType, EventListener*, bool useCapture);
+        virtual bool dispatchEvent(PassRefPtr&lt;Event&gt;, ExceptionCode&amp;);
+
+        typedef Vector&lt;RefPtr&lt;EventListener&gt; &gt; ListenerVector;
+        typedef HashMap&lt;AtomicString, ListenerVector&gt; EventListenersMap;
+        EventListenersMap&amp; eventListeners() { return m_eventListeners; }
+
+        using RefCounted&lt;Worker&gt;::ref;
+        using RefCounted&lt;Worker&gt;::deref;
+
+        void setOnmessage(PassRefPtr&lt;EventListener&gt; eventListener) { m_onMessageListener = eventListener; }
+        EventListener* onmessage() const { return m_onMessageListener.get(); }
+
+        void setOnerror(PassRefPtr&lt;EventListener&gt; eventListener) { m_onErrorListener = eventListener; }
+        EventListener* onerror() const { return m_onErrorListener.get(); }
+
+    private:
+        Worker(const String&amp;, Document*, ExceptionCode&amp;);
+
+        virtual void notifyFinished(CachedResource*);
+
+        void dispatchErrorEvent();
+
+        virtual void refEventTarget() { ref(); }
+        virtual void derefEventTarget() { deref(); }
+
+        KURL m_scriptURL;
+        CachedResourceHandle&lt;CachedScript&gt; m_cachedScript;
+
+        WorkerMessagingProxy* m_messagingProxy; // The proxy outlives the worker to perform thread shutdown.
+
+        RefPtr&lt;EventListener&gt; m_onMessageListener;
+        RefPtr&lt;EventListener&gt; m_onErrorListener;
+        EventListenersMap m_eventListeners;
+    };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // Worker_h
</ins></span></pre></div>
<a id="trunkWebCoredomWorkeridlfromrev38387trunkWebCoredomDedicatedWorkeridl"></a>
<div class="copfile"><h4>Copied: trunk/WebCore/dom/Worker.idl (from rev 38387, trunk/WebCore/dom/DedicatedWorker.idl) (0 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Worker.idl                                (rev 0)
+++ trunk/WebCore/dom/Worker.idl        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+module threads {
+
+    interface [CustomMarkFunction, Conditional=WORKERS] Worker {
+
+        attribute EventListener onerror;
+        attribute EventListener onmessage;
+        void postMessage(in DOMString message);
+
+        // EventTarget interface
+        [Custom] void addEventListener(in DOMString type, 
+                                       in EventListener listener, 
+                                       in boolean useCapture);
+        [Custom] void removeEventListener(in DOMString type, 
+                                          in EventListener listener, 
+                                          in boolean useCapture);
+        boolean dispatchEvent(in Event evt)
+            raises(EventException);
+    };
+
+}
</ins></span></pre></div>
<a id="trunkWebCoredomWorkerContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/WorkerContext.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/WorkerContext.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/dom/WorkerContext.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -30,11 +30,13 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;WorkerContext.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;DOMWindow.h&quot;
</ins><span class="cx"> #include &quot;Event.h&quot;
</span><span class="cx"> #include &quot;EventException.h&quot;
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="cx"> #include &quot;WorkerLocation.h&quot;
</span><del>-#include &quot;WorkerTask.h&quot;
</del><ins>+#include &quot;WorkerMessagingProxy.h&quot;
+#include &quot;WorkerThread.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -49,6 +51,9 @@
</span><span class="cx"> 
</span><span class="cx"> WorkerContext::~WorkerContext()
</span><span class="cx"> {
</span><ins>+    ASSERT(currentThread() == m_thread-&gt;threadID());
+
+    m_thread-&gt;messagingProxy()-&gt;workerContextDestroyed();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ScriptExecutionContext* WorkerContext::scriptExecutionContext() const
</span><span class="lines">@@ -72,6 +77,11 @@
</span><span class="cx">     return KURL(m_location-&gt;url(), url);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WorkerContext::postMessage(const String&amp; message)
+{
+    m_thread-&gt;messagingProxy()-&gt;postMessageToWorkerObject(message);
+}
+
</ins><span class="cx"> void WorkerContext::addEventListener(const AtomicString&amp; eventType, PassRefPtr&lt;EventListener&gt; eventListener, bool)
</span><span class="cx"> {
</span><span class="cx">     EventListenersMap::iterator iter = m_eventListeners.find(eventType);
</span></span></pre></div>
<a id="trunkWebCoredomWorkerContexth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/WorkerContext.h (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/WorkerContext.h        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/dom/WorkerContext.h        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -69,12 +69,14 @@
</span><span class="cx"> 
</span><span class="cx">         virtual WorkerContext* toWorkerContext() { return this; }
</span><span class="cx"> 
</span><ins>+        void postMessage(const String&amp; message);
+
</ins><span class="cx">         virtual void addEventListener(const AtomicString&amp; eventType, PassRefPtr&lt;EventListener&gt;, bool useCapture);
</span><span class="cx">         virtual void removeEventListener(const AtomicString&amp; eventType, EventListener*, bool useCapture);
</span><span class="cx">         virtual bool dispatchEvent(PassRefPtr&lt;Event&gt;, ExceptionCode&amp;);
</span><span class="cx"> 
</span><del>-        void setOnconnect(PassRefPtr&lt;EventListener&gt; eventListener) { m_onconnectListener = eventListener; }
-        EventListener* onconnect() const { return m_onconnectListener.get(); }
</del><ins>+        void setOnmessage(PassRefPtr&lt;EventListener&gt; eventListener) { m_onmessageListener = eventListener; }
+        EventListener* onmessage() const { return m_onmessageListener.get(); }
</ins><span class="cx"> 
</span><span class="cx">         typedef Vector&lt;RefPtr&lt;EventListener&gt; &gt; ListenerVector;
</span><span class="cx">         typedef HashMap&lt;AtomicString, ListenerVector&gt; EventListenersMap;
</span><span class="lines">@@ -100,7 +102,7 @@
</span><span class="cx">         WorkerScriptController m_script;
</span><span class="cx">         WorkerThread* m_thread;
</span><span class="cx"> 
</span><del>-        RefPtr&lt;EventListener&gt; m_onconnectListener;
</del><ins>+        RefPtr&lt;EventListener&gt; m_onmessageListener;
</ins><span class="cx">         EventListenersMap m_eventListeners;
</span><span class="cx">     };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoredomWorkerMessagingProxycpp"></a>
<div class="addfile"><h4>Added: trunk/WebCore/dom/WorkerMessagingProxy.cpp (0 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/WorkerMessagingProxy.cpp                                (rev 0)
+++ trunk/WebCore/dom/WorkerMessagingProxy.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -0,0 +1,197 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+#include &quot;config.h&quot;
+
+#if ENABLE(WORKERS)
+
+#include &quot;WorkerMessagingProxy.h&quot;
+
+#include &quot;DOMWindow.h&quot;
+#include &quot;Document.h&quot;
+#include &quot;MessageEvent.h&quot;
+#include &quot;Worker.h&quot;
+#include &quot;WorkerContext.h&quot;
+#include &quot;WorkerTask.h&quot;
+#include &quot;WorkerThread.h&quot;
+
+namespace WebCore {
+
+class MessageWorkerContextTask : public WorkerTask {
+public:
+    static PassRefPtr&lt;MessageWorkerContextTask&gt; create(const String&amp; message)
+    {
+        return adoptRef(new MessageWorkerContextTask(message));
+    }
+
+private:
+    MessageWorkerContextTask(const String&amp; message)
+        : m_message(message.copy())
+    {
+    }
+
+    virtual void performTask(WorkerContext* context)
+    {
+        RefPtr&lt;Event&gt; evt = MessageEvent::create(m_message, &quot;&quot;, &quot;&quot;, 0, 0);
+
+        if (context-&gt;onmessage()) {
+            evt-&gt;setTarget(context);
+            evt-&gt;setCurrentTarget(context);
+            context-&gt;onmessage()-&gt;handleEvent(evt.get(), false);
+        }
+
+        ExceptionCode ec = 0;
+        context-&gt;dispatchEvent(evt.release(), ec);
+        ASSERT(!ec);
+    }
+
+private:
+    String m_message;
+};
+
+class MessageWorkerTask : public ScriptExecutionContext::Task {
+public:
+    static PassRefPtr&lt;MessageWorkerTask&gt; create(const String&amp; message, WorkerMessagingProxy* messagingProxy)
+    {
+        return adoptRef(new MessageWorkerTask(message, messagingProxy));
+    }
+
+private:
+    MessageWorkerTask(const String&amp; message, WorkerMessagingProxy* messagingProxy)
+        : m_message(message.copy())
+        , m_messagingProxy(messagingProxy)
+    {
+    }
+
+    virtual void performTask(ScriptExecutionContext* context)
+    {
+        Worker* workerObject = m_messagingProxy-&gt;workerObject();
+        if (!workerObject)
+            return;
+
+        RefPtr&lt;Event&gt; evt = MessageEvent::create(m_message, &quot;&quot;, &quot;&quot;, 0, 0);
+
+        if (workerObject-&gt;onmessage()) {
+            evt-&gt;setTarget(workerObject);
+            evt-&gt;setCurrentTarget(workerObject);
+            workerObject-&gt;onmessage()-&gt;handleEvent(evt.get(), false);
+        }
+
+        ExceptionCode ec = 0;
+        workerObject-&gt;dispatchEvent(evt.release(), ec);
+        ASSERT(!ec);
+    }
+
+private:
+    String m_message;
+    WorkerMessagingProxy* m_messagingProxy;
+};
+
+class WorkerContextDestroyedTask : public ScriptExecutionContext::Task {
+public:
+    static PassRefPtr&lt;WorkerContextDestroyedTask&gt; create(WorkerMessagingProxy* messagingProxy)
+    {
+        return adoptRef(new WorkerContextDestroyedTask(messagingProxy));
+    }
+
+private:
+    WorkerContextDestroyedTask(WorkerMessagingProxy* messagingProxy)
+        : m_messagingProxy(messagingProxy)
+    {
+    }
+
+    virtual void performTask(ScriptExecutionContext* context)
+    {
+        m_messagingProxy-&gt;workerContextDestroyedInternal();
+    }
+
+private:
+    WorkerMessagingProxy* m_messagingProxy;
+};
+
+
+WorkerMessagingProxy::WorkerMessagingProxy(PassRefPtr&lt;ScriptExecutionContext&gt; scriptExecutionContext, Worker* workerObject)
+    : m_scriptExecutionContext(scriptExecutionContext)
+    , m_workerObject(workerObject)
+{
+    ASSERT(m_workerObject);
+    ASSERT((m_scriptExecutionContext-&gt;isDocument() &amp;&amp; isMainThread())
+        || (m_scriptExecutionContext-&gt;isWorkerContext() &amp;&amp; currentThread() == static_cast&lt;WorkerContext*&gt;(m_scriptExecutionContext.get())-&gt;thread()-&gt;threadID()));
+}
+
+WorkerMessagingProxy::~WorkerMessagingProxy()
+{
+    ASSERT(!m_workerObject);
+    ASSERT((m_scriptExecutionContext-&gt;isDocument() &amp;&amp; isMainThread())
+        || (m_scriptExecutionContext-&gt;isWorkerContext() &amp;&amp; currentThread() == static_cast&lt;WorkerContext*&gt;(m_scriptExecutionContext.get())-&gt;thread()-&gt;threadID()));
+}
+
+void WorkerMessagingProxy::postMessageToWorkerObject(const String&amp; message)
+{
+    m_scriptExecutionContext-&gt;postTask(MessageWorkerTask::create(message, this));
+}
+
+void WorkerMessagingProxy::postMessageToWorkerContext(const String&amp; message)
+{
+    if (m_workerThread)
+        m_workerThread-&gt;messageQueue().append(MessageWorkerContextTask::create(message));
+    else
+        m_queuedEarlyTasks.append(MessageWorkerContextTask::create(message));
+}
+
+void WorkerMessagingProxy::workerThreadCreated(PassRefPtr&lt;WorkerThread&gt; workerThread)
+{
+    m_workerThread = workerThread;
+
+    unsigned taskCount = m_queuedEarlyTasks.size();
+    for (unsigned i = 0; i &lt; taskCount; ++i)
+        m_workerThread-&gt;messageQueue().append(m_queuedEarlyTasks[i]);
+    m_queuedEarlyTasks.clear();
+}
+
+void WorkerMessagingProxy::workerObjectDestroyed()
+{
+    m_workerObject = 0;
+    if (m_workerThread)
+        m_workerThread-&gt;messageQueue().kill();
+    else
+        workerContextDestroyedInternal(); // It never existed, just do out cleanup.
+}
+
+void WorkerMessagingProxy::workerContextDestroyed()
+{
+    m_scriptExecutionContext-&gt;postTask(WorkerContextDestroyedTask::create(this));
+    // Will execute workerContextDestroyedInternal() on context's thread.
+}
+
+void WorkerMessagingProxy::workerContextDestroyedInternal()
+{
+    delete this;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
</ins><span class="cx">Property changes on: trunk/WebCore/dom/WorkerMessagingProxy.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkWebCoredomWorkerMessagingProxyh"></a>
<div class="addfile"><h4>Added: trunk/WebCore/dom/WorkerMessagingProxy.h (0 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/WorkerMessagingProxy.h                                (rev 0)
+++ trunk/WebCore/dom/WorkerMessagingProxy.h        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+#ifndef WorkerMessagingProxy_h
+#define WorkerMessagingProxy_h
+
+#if ENABLE(WORKERS)
+
+#include &lt;wtf/Noncopyable.h&gt;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebCore {
+
+    class ScriptExecutionContext;
+    class String;
+    class Worker;
+    class WorkerTask;
+    class WorkerThread;
+
+    class WorkerMessagingProxy : Noncopyable {
+    public:
+        WorkerMessagingProxy(PassRefPtr&lt;ScriptExecutionContext&gt;, Worker*);
+
+        void postMessageToWorkerObject(const String&amp; message);
+        void postMessageToWorkerContext(const String&amp; message);
+
+        void workerThreadCreated(PassRefPtr&lt;WorkerThread&gt;);
+        void workerObjectDestroyed();
+        void workerContextDestroyed();
+
+    private:
+        friend class MessageWorkerTask;
+        friend class WorkerContextDestroyedTask;
+
+        ~WorkerMessagingProxy();
+
+        void workerContextDestroyedInternal();
+        Worker* workerObject() const { return m_workerObject; }
+
+        RefPtr&lt;ScriptExecutionContext&gt; m_scriptExecutionContext;
+        Worker* m_workerObject;
+        RefPtr&lt;WorkerThread&gt; m_workerThread;
+
+        Vector&lt;RefPtr&lt;WorkerTask&gt; &gt; m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created.
+    };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // WorkerMessagingProxy_h
</ins><span class="cx">Property changes on: trunk/WebCore/dom/WorkerMessagingProxy.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkWebCoredomWorkerThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/WorkerThread.cpp (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/WorkerThread.cpp        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/dom/WorkerThread.cpp        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -30,8 +30,8 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;WorkerThread.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;DedicatedWorker.h&quot;
</del><span class="cx"> #include &quot;JSWorkerContext.h&quot;
</span><ins>+#include &quot;Worker.h&quot;
</ins><span class="cx"> #include &quot;WorkerContext.h&quot;
</span><span class="cx"> #include &quot;WorkerTask.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -39,25 +39,28 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;WorkerThread&gt; WorkerThread::create(const KURL&amp; scriptURL, const String&amp; sourceCode, PassRefPtr&lt;DedicatedWorker&gt; workerObject)
</del><ins>+PassRefPtr&lt;WorkerThread&gt; WorkerThread::create(const KURL&amp; scriptURL, const String&amp; sourceCode, WorkerMessagingProxy* messagingProxy)
</ins><span class="cx"> {
</span><del>-    return adoptRef(new WorkerThread(scriptURL, sourceCode, workerObject));
</del><ins>+    return adoptRef(new WorkerThread(scriptURL, sourceCode, messagingProxy));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-WorkerThread::WorkerThread(const KURL&amp; scriptURL, const String&amp; sourceCode, PassRefPtr&lt;DedicatedWorker&gt; workerObject)
</del><ins>+WorkerThread::WorkerThread(const KURL&amp; scriptURL, const String&amp; sourceCode, WorkerMessagingProxy* messagingProxy)
</ins><span class="cx">     : m_threadID(0)
</span><span class="cx">     , m_scriptURL(scriptURL.string().copy())
</span><span class="cx">     , m_sourceCode(sourceCode.copy())
</span><del>-    , m_workerObject(workerObject)
</del><ins>+    , m_messagingProxy(messagingProxy)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+WorkerThread::~WorkerThread()
+{
+}
+
</ins><span class="cx"> bool WorkerThread::start()
</span><span class="cx"> {
</span><span class="cx">     if (m_threadID)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    ref();
</del><span class="cx">     m_threadID = createThread(WorkerThread::workerThreadStart, this, &quot;WebCore::Worker&quot;);
</span><span class="cx"> 
</span><span class="cx">     return m_threadID;
</span><span class="lines">@@ -83,10 +86,9 @@
</span><span class="cx">         task-&gt;performTask(workerContext.get());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    workerContext = 0;
</del><ins>+    workerContext = 0; // Destroying the context will notify messaging proxy.
</ins><span class="cx">     m_threadID = 0;
</span><span class="cx"> 
</span><del>-    deref();
</del><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoredomWorkerThreadh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/WorkerThread.h (38442 => 38443)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/WorkerThread.h        2008-11-16 06:04:12 UTC (rev 38442)
+++ trunk/WebCore/dom/WorkerThread.h        2008-11-16 09:11:54 UTC (rev 38443)
</span><span class="lines">@@ -30,26 +30,29 @@
</span><span class="cx"> #if ENABLE(WORKERS)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;PlatformString.h&quot;
</span><del>-#include &quot;WorkerTask.h&quot;
</del><span class="cx"> #include &lt;wtf/MessageQueue.h&gt;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class DedicatedWorker;
</del><span class="cx">     class KURL;
</span><ins>+    class WorkerMessagingProxy;
+    class WorkerTask;
</ins><span class="cx"> 
</span><del>-    class WorkerThread : public ThreadSafeShared&lt;WorkerThread&gt; {
</del><ins>+    class WorkerThread : public RefCounted&lt;WorkerThread&gt; {
</ins><span class="cx">     public:
</span><del>-        static PassRefPtr&lt;WorkerThread&gt; create(const KURL&amp; scriptURL, const String&amp; sourceCode, PassRefPtr&lt;DedicatedWorker&gt;);
</del><ins>+        static PassRefPtr&lt;WorkerThread&gt; create(const KURL&amp; scriptURL, const String&amp; sourceCode, WorkerMessagingProxy*);
+        ~WorkerThread();
</ins><span class="cx"> 
</span><span class="cx">         bool start();
</span><span class="cx"> 
</span><span class="cx">         ThreadIdentifier threadID() const { return m_threadID; }
</span><span class="cx">         MessageQueue&lt;RefPtr&lt;WorkerTask&gt; &gt;&amp; messageQueue() { return m_messageQueue; }
</span><span class="cx"> 
</span><ins>+        WorkerMessagingProxy* messagingProxy() const { return m_messagingProxy; }
+
</ins><span class="cx">     private:
</span><del>-        WorkerThread(const KURL&amp;, const String&amp; sourceCode, PassRefPtr&lt;DedicatedWorker&gt;);
</del><ins>+        WorkerThread(const KURL&amp;, const String&amp; sourceCode, WorkerMessagingProxy*);
</ins><span class="cx"> 
</span><span class="cx">         static void* workerThreadStart(void*);
</span><span class="cx">         void* workerThread();
</span><span class="lines">@@ -58,7 +61,7 @@
</span><span class="cx"> 
</span><span class="cx">         String m_scriptURL;
</span><span class="cx">         String m_sourceCode;
</span><del>-        RefPtr&lt;DedicatedWorker&gt; m_workerObject;
</del><ins>+        WorkerMessagingProxy* m_messagingProxy;
</ins><span class="cx"> 
</span><span class="cx">         MessageQueue&lt;RefPtr&lt;WorkerTask&gt; &gt; m_messageQueue;
</span><span class="cx">     };
</span></span></pre>
</div>
</div>

</body>
</html>