<!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>[46435] 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/46435">46435</a></dd>
<dt>Author</dt> <dd>dglazkov@chromium.org</dd>
<dt>Date</dt> <dd>2009-07-27 15:40:06 -0700 (Mon, 27 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>2009-07-27  Dimitri Glazkov  &lt;dglazkov@chromium.org&gt;

        Reviewed by Dave Levin.

        [V8] Remove parameterless frame/window retrieval methods from V8Proxy.
        https://bugs.webkit.org/show_bug.cgi?id=27737

        Refactoring, no new behavior, covered by existing tests.

        * bindings/v8/ScriptCallStack.cpp:
        (WebCore::ScriptCallStack::ScriptCallStack):
        * bindings/v8/V8NPUtils.cpp:
        (convertV8ObjectToNPVariant): Ditto.
        * bindings/v8/V8Proxy.cpp:
        (WebCore::V8Proxy::retrieve): Ditto.
        (WebCore::V8Proxy::canAccessPrivate): Ditto.
        * bindings/v8/V8Proxy.h: Removed parameterless retrieveWindow/retrieveProxy decls.
        * bindings/v8/custom/V8DatabaseCustom.cpp:
        (WebCore::CALLBACK_FUNC_DECL): Changed to use V8Proxy::retrieveFrameForCurrentContext().
        * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp:
        (WebCore::CALLBACK_FUNC_DECL): Ditto.
        * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
        (WebCore::CALLBACK_FUNC_DECL): Ditto.
        * bindings/v8/custom/V8HTMLOptionElementConstructor.cpp:
        (WebCore::CALLBACK_FUNC_DECL): Ditto.
        * bindings/v8/custom/V8MessageChannelConstructor.cpp:
        (WebCore::CALLBACK_FUNC_DECL): Ditto.
        * bindings/v8/custom/V8SQLTransactionCustom.cpp:
        (WebCore::CALLBACK_FUNC_DECL): Ditto.
        * bindings/v8/custom/V8WorkerCustom.cpp:
        (WebCore::CALLBACK_FUNC_DECL): Ditto.
        * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp:
        (WebCore::CALLBACK_FUNC_DECL): Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorebindingsv8ScriptCallStackcpp">trunk/WebCore/bindings/v8/ScriptCallStack.cpp</a></li>
<li><a href="#trunkWebCorebindingsv8V8NPUtilscpp">trunk/WebCore/bindings/v8/V8NPUtils.cpp</a></li>
<li><a href="#trunkWebCorebindingsv8V8Proxycpp">trunk/WebCore/bindings/v8/V8Proxy.cpp</a></li>
<li><a href="#trunkWebCorebindingsv8V8Proxyh">trunk/WebCore/bindings/v8/V8Proxy.h</a></li>
<li><a href="#trunkWebCorebindingsv8customV8DatabaseCustomcpp">trunk/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp</a></li>
<li><a href="#trunkWebCorebindingsv8customV8HTMLAudioElementConstructorcpp">trunk/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsv8customV8HTMLImageElementConstructorcpp">trunk/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsv8customV8HTMLOptionElementConstructorcpp">trunk/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsv8customV8MessageChannelConstructorcpp">trunk/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsv8customV8SQLTransactionCustomcpp">trunk/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp</a></li>
<li><a href="#trunkWebCorebindingsv8customV8WorkerCustomcpp">trunk/WebCore/bindings/v8/custom/V8WorkerCustom.cpp</a></li>
<li><a href="#trunkWebCorebindingsv8customV8XMLHttpRequestConstructorcpp">trunk/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/ChangeLog        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2009-07-27  Dimitri Glazkov  &lt;dglazkov@chromium.org&gt;
+
+        Reviewed by Dave Levin.
+
+        [V8] Remove parameterless frame/window retrieval methods from V8Proxy.
+        https://bugs.webkit.org/show_bug.cgi?id=27737
+
+        Refactoring, no new behavior, covered by existing tests.
+
+        * bindings/v8/ScriptCallStack.cpp:
+        (WebCore::ScriptCallStack::ScriptCallStack):
+        * bindings/v8/V8NPUtils.cpp:
+        (convertV8ObjectToNPVariant): Ditto.
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::retrieve): Ditto.
+        (WebCore::V8Proxy::canAccessPrivate): Ditto.
+        * bindings/v8/V8Proxy.h: Removed parameterless retrieveWindow/retrieveProxy decls.
+        * bindings/v8/custom/V8DatabaseCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL): Changed to use V8Proxy::retrieveFrameForCurrentContext().
+        * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL): Ditto.
+        * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL): Ditto.
+        * bindings/v8/custom/V8HTMLOptionElementConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL): Ditto.
+        * bindings/v8/custom/V8MessageChannelConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL): Ditto.
+        * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL): Ditto.
+        * bindings/v8/custom/V8WorkerCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL): Ditto.
+        * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL): Ditto.
+
</ins><span class="cx"> 2009-07-27  Nikolas Zimmermann  &lt;nikolas.zimmermann@torchmobile.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by George Staikos.
</span></span></pre></div>
<a id="trunkWebCorebindingsv8ScriptCallStackcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/ScriptCallStack.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/ScriptCallStack.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/ScriptCallStack.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> 
</span><span class="cx"> ScriptCallStack::ScriptCallStack(const v8::Arguments&amp; arguments, unsigned skipArgumentCount)
</span><span class="cx">     : m_lastCaller(String(), V8Proxy::sourceName(), V8Proxy::sourceLineNumber() + 1, arguments, skipArgumentCount)
</span><del>-    , m_scriptState(new ScriptState(V8Proxy::retrieveFrame()))
</del><ins>+    , m_scriptState(new ScriptState(V8Proxy::retrieveFrameForCurrentContext()))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorebindingsv8V8NPUtilscpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/V8NPUtils.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/V8NPUtils.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/V8NPUtils.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">         char* utf8_chars = strdup(*utf8);
</span><span class="cx">         STRINGN_TO_NPVARIANT(utf8_chars, utf8.length(), *result);
</span><span class="cx">     } else if (object-&gt;IsObject()) {
</span><del>-        WebCore::DOMWindow* window = WebCore::V8Proxy::retrieveWindow();
</del><ins>+        WebCore::DOMWindow* window = WebCore::V8Proxy::retrieveWindow(WebCore::V8Proxy::currentContext());
</ins><span class="cx">         NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle&lt;v8::Object&gt;::Cast(object), window);
</span><span class="cx">         if (npobject)
</span><span class="cx">             _NPN_RegisterObject(npobject, owner);
</span></span></pre></div>
<a id="trunkWebCorebindingsv8V8Proxycpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/V8Proxy.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/V8Proxy.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/V8Proxy.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -493,14 +493,6 @@
</span><span class="cx">     return !m_context.IsEmpty();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-DOMWindow* V8Proxy::retrieveWindow()
-{
-    // FIXME: This seems very fragile. How do we know that the global object
-    // from the current context is something sensible? Do we need to use the
-    // last entered here? Who calls this?
-    return retrieveWindow(v8::Context::GetCurrent());
-}
-
</del><span class="cx"> DOMWindow* V8Proxy::retrieveWindow(v8::Handle&lt;v8::Context&gt; context)
</span><span class="cx"> {
</span><span class="cx">     v8::Handle&lt;v8::Object&gt; global = context-&gt;Global();
</span><span class="lines">@@ -539,15 +531,9 @@
</span><span class="cx">     return retrieveFrame(context);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Frame* V8Proxy::retrieveFrame()
-{
-    DOMWindow* window = retrieveWindow();
-    return window ? window-&gt;frame() : 0;
-}
-
</del><span class="cx"> V8Proxy* V8Proxy::retrieve()
</span><span class="cx"> {
</span><del>-    DOMWindow* window = retrieveWindow();
</del><ins>+    DOMWindow* window = retrieveWindow(currentContext());
</ins><span class="cx">     ASSERT(window);
</span><span class="cx">     return retrieve(window-&gt;frame());
</span><span class="cx"> }
</span><span class="lines">@@ -820,7 +806,7 @@
</span><span class="cx"> 
</span><span class="cx">     String message;
</span><span class="cx"> 
</span><del>-    DOMWindow* originWindow = retrieveWindow();
</del><ins>+    DOMWindow* originWindow = retrieveWindow(currentContext());
</ins><span class="cx">     if (originWindow == targetWindow)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorebindingsv8V8Proxyh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/V8Proxy.h (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/V8Proxy.h        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/V8Proxy.h        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -237,8 +237,6 @@
</span><span class="cx">         // This is faster than going through the full object creation process.
</span><span class="cx">         v8::Local&lt;v8::Object&gt; createWrapperFromCache(V8ClassIndex::V8WrapperType);
</span><span class="cx"> 
</span><del>-        // Returns the window object of the currently executing context.
-        static DOMWindow* retrieveWindow();
</del><span class="cx">         // Returns the window object associated with a context.
</span><span class="cx">         static DOMWindow* retrieveWindow(v8::Handle&lt;v8::Context&gt;);
</span><span class="cx">         // Returns V8Proxy object of the currently executing context.
</span><span class="lines">@@ -248,9 +246,6 @@
</span><span class="cx">         // Returns V8Proxy object associated with a script execution context.
</span><span class="cx">         static V8Proxy* retrieve(ScriptExecutionContext*);
</span><span class="cx"> 
</span><del>-        // Returns the frame object of the window object associated
-        // with the currently executing context.
-        static Frame* retrieveFrame();
</del><span class="cx">         // Returns the frame object of the window object associated with
</span><span class="cx">         // a context.
</span><span class="cx">         static Frame* retrieveFrame(v8::Handle&lt;v8::Context&gt;);
</span></span></pre></div>
<a id="trunkWebCorebindingsv8customV8DatabaseCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -52,37 +52,33 @@
</span><span class="cx"> {
</span><span class="cx">     INC_STATS(&quot;DOM.Database.transaction()&quot;);
</span><span class="cx"> 
</span><del>-    if (args.Length() == 0) {
-        V8Proxy::throwError(V8Proxy::SyntaxError, &quot;Transaction callback is required.&quot;);
-        return v8::Undefined();
-    }
</del><ins>+    if (!args.Length())
+        return throwError(&quot;Transaction callback is required.&quot;, V8Proxy::SyntaxError);
</ins><span class="cx"> 
</span><del>-    if (!args[0]-&gt;IsObject()) {
-        V8Proxy::throwError(V8Proxy::TypeError, &quot;Transaction callback must be of valid type.&quot;);
-        return v8::Undefined();
-    }
</del><ins>+    if (!args[0]-&gt;IsObject())
+        return throwError(&quot;Transaction callback must be of valid type.&quot;);
</ins><span class="cx"> 
</span><span class="cx">     Database* database = V8DOMWrapper::convertToNativeObject&lt;Database&gt;(V8ClassIndex::DATABASE, args.Holder());
</span><span class="cx"> 
</span><del>-    Frame* frame = V8Proxy::retrieveFrame();
</del><ins>+    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
+    if (!frame)
+        return v8::Undefined();
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;V8CustomSQLTransactionCallback&gt; callback = V8CustomSQLTransactionCallback::create(args[0], frame);
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;V8CustomSQLTransactionErrorCallback&gt; errorCallback;
</span><span class="cx">     if (args.Length() &gt; 1) {
</span><del>-        if (!args[1]-&gt;IsObject()) {
-            V8Proxy::throwError(V8Proxy::TypeError, &quot;Transaction error callback must be of valid type.&quot;);
-            return v8::Undefined();
-        }
</del><ins>+        if (!args[1]-&gt;IsObject())
+            return throwError(&quot;Transaction error callback must be of valid type.&quot;);
+
</ins><span class="cx">         errorCallback = V8CustomSQLTransactionErrorCallback::create(args[1], frame);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;V8CustomVoidCallback&gt; successCallback;
</span><span class="cx">     if (args.Length() &gt; 2) {
</span><del>-        if (!args[1]-&gt;IsObject()) {
-            V8Proxy::throwError(V8Proxy::TypeError, &quot;Transaction success callback must be of valid type.&quot;);
-            return v8::Undefined();
-        }
</del><ins>+        if (!args[1]-&gt;IsObject())
+            return throwError(&quot;Transaction success callback must be of valid type.&quot;);
+
</ins><span class="cx">         successCallback = V8CustomVoidCallback::create(args[2], frame);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorebindingsv8customV8HTMLAudioElementConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -49,7 +49,11 @@
</span><span class="cx">     if (!args.IsConstructCall())
</span><span class="cx">         return throwError(&quot;DOM object constructor cannot be called as a function.&quot;);
</span><span class="cx"> 
</span><del>-    Document* document = V8Proxy::retrieveFrame()-&gt;document();
</del><ins>+    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
+    if (!frame)
+        return throwError(&quot;Audio constructor associated frame is unavailable&quot;, V8Proxy::ReferenceError);
+
+    Document* document = frame-&gt;document();
</ins><span class="cx">     if (!document)
</span><span class="cx">         return throwError(&quot;Audio constructor associated document is unavailable&quot;, V8Proxy::ReferenceError);
</span><span class="cx"> 
</span><span class="lines">@@ -57,7 +61,7 @@
</span><span class="cx">     // may end up being the only node in the map and get garbage-ccollected prematurely.
</span><span class="cx">     V8DOMWrapper::convertNodeToV8Object(document);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;HTMLAudioElement&gt; audio = new HTMLAudioElement(HTMLNames::audioTag, V8Proxy::retrieveFrame()-&gt;document());
</del><ins>+    RefPtr&lt;HTMLAudioElement&gt; audio = new HTMLAudioElement(HTMLNames::audioTag, document);
</ins><span class="cx">     if (args.Length() &gt; 0)
</span><span class="cx">         audio-&gt;setSrc(toWebCoreString(args[0]));
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorebindingsv8customV8HTMLImageElementConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -49,7 +49,11 @@
</span><span class="cx">     if (!args.IsConstructCall())
</span><span class="cx">         return throwError(&quot;DOM object constructor cannot be called as a function.&quot;);
</span><span class="cx"> 
</span><del>-    Document* document = V8Proxy::retrieveFrame()-&gt;document();
</del><ins>+    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
+    if (!frame)
+        return throwError(&quot;Image constructor associated frame is unavailable&quot;, V8Proxy::ReferenceError);
+
+    Document* document = frame-&gt;document();
</ins><span class="cx">     if (!document)
</span><span class="cx">         return throwError(&quot;Image constructor associated document is unavailable&quot;, V8Proxy::ReferenceError);
</span><span class="cx"> 
</span><span class="lines">@@ -57,7 +61,7 @@
</span><span class="cx">     // may end up being the only node in the map and get garbage-ccollected prematurely.
</span><span class="cx">     V8DOMWrapper::convertNodeToV8Object(document);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;HTMLImageElement&gt; image = new HTMLImageElement(HTMLNames::imgTag, V8Proxy::retrieveFrame()-&gt;document());
</del><ins>+    RefPtr&lt;HTMLImageElement&gt; image = new HTMLImageElement(HTMLNames::imgTag, document);
</ins><span class="cx">     if (args.Length() &gt; 0) {
</span><span class="cx">         image-&gt;setWidth(toInt32(args[0]));
</span><span class="cx">         if (args.Length() &gt; 1)
</span></span></pre></div>
<a id="trunkWebCorebindingsv8customV8HTMLOptionElementConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -50,11 +50,15 @@
</span><span class="cx">     if (!args.IsConstructCall())
</span><span class="cx">         return throwError(&quot;DOM object constructor cannot be called as a function.&quot;);
</span><span class="cx"> 
</span><del>-    Document* document = V8Proxy::retrieveFrame()-&gt;document();
</del><ins>+    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
+    if (!frame)
+        return throwError(&quot;Option constructor associated frame is unavailable&quot;, V8Proxy::ReferenceError);
+
+    Document* document = frame-&gt;document();
</ins><span class="cx">     if (!document)
</span><span class="cx">         return throwError(&quot;Option constructor associated document is unavailable&quot;, V8Proxy::ReferenceError);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;HTMLOptionElement&gt; option = new HTMLOptionElement(HTMLNames::optionTag, V8Proxy::retrieveFrame()-&gt;document());
</del><ins>+    RefPtr&lt;HTMLOptionElement&gt; option = new HTMLOptionElement(HTMLNames::optionTag, document);
</ins><span class="cx"> 
</span><span class="cx">     ExceptionCode ec = 0;
</span><span class="cx">     RefPtr&lt;Text&gt; text = document-&gt;createTextNode(&quot;&quot;);
</span></span></pre></div>
<a id="trunkWebCorebindingsv8customV8MessageChannelConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">     if (proxy)
</span><span class="cx">         context = proxy-&gt;workerContext();
</span><span class="cx">     else {
</span><del>-        Frame* frame = V8Proxy::retrieveFrame();
</del><ins>+        Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
</ins><span class="cx">         if (!frame)
</span><span class="cx">             return v8::Undefined();
</span><span class="cx">         context = frame-&gt;document();
</span></span></pre></div>
<a id="trunkWebCorebindingsv8customV8SQLTransactionCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx"> 
</span><span class="cx">     SQLTransaction* transaction = V8DOMWrapper::convertToNativeObject&lt;SQLTransaction&gt;(V8ClassIndex::SQLTRANSACTION, args.Holder());
</span><span class="cx"> 
</span><del>-    Frame* frame = V8Proxy::retrieveFrame();
</del><ins>+    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;SQLStatementCallback&gt; callback;
</span><span class="cx">     if (args.Length() &gt; 2) {
</span></span></pre></div>
<a id="trunkWebCorebindingsv8customV8WorkerCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/custom/V8WorkerCustom.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/custom/V8WorkerCustom.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/custom/V8WorkerCustom.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     if (proxy)
</span><span class="cx">         context = proxy-&gt;workerContext();
</span><span class="cx">     else {
</span><del>-        Frame* frame = V8Proxy::retrieveFrame();
</del><ins>+        Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
</ins><span class="cx">         if (!frame)
</span><span class="cx">             return v8::Undefined();
</span><span class="cx">         context = frame-&gt;document();
</span></span></pre></div>
<a id="trunkWebCorebindingsv8customV8XMLHttpRequestConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp (46434 => 46435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp        2009-07-27 22:36:12 UTC (rev 46434)
+++ trunk/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp        2009-07-27 22:40:06 UTC (rev 46435)
</span><span class="lines">@@ -55,9 +55,15 @@
</span><span class="cx">     WorkerContextExecutionProxy* proxy = WorkerContextExecutionProxy::retrieve();
</span><span class="cx">     if (proxy)
</span><span class="cx">         context = proxy-&gt;workerContext();
</span><del>-    else
</del><ins>+    else {
</ins><span class="cx"> #endif
</span><del>-        context = V8Proxy::retrieveFrame()-&gt;document();
</del><ins>+        Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
+        if (!frame)
+            return throwError(&quot;XMLHttpRequest constructor's associated frame is not available&quot;, V8Proxy::ReferenceError);
+        context = frame-&gt;document();
+#if ENABLE(WORKERS)
+    }
+#endif
</ins><span class="cx">     RefPtr&lt;XMLHttpRequest&gt; xmlHttpRequest = XMLHttpRequest::create(context);
</span><span class="cx">     V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::XMLHTTPREQUEST), xmlHttpRequest.get());
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>