Skip to content
Permalink
Browse files
2011-04-13 Pavel Feldman <pfeldman@google.com>
        Reviewed by Yury Semikhatsky.

        Web Inspector: requestDocument can result in race condition in DOMAgent.js
        https://bugs.webkit.org/show_bug.cgi?id=58415

        * inspector/front-end/DOMAgent.js:
        (WebInspector.DOMAgent.prototype.requestDocument.onDocumentAvailable):
        (WebInspector.DOMAgent.prototype.requestDocument):

Canonical link: https://commits.webkit.org/73464@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83707 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pavelfeldman committed Apr 13, 2011
1 parent a21aa30 commit 2a073da7c42af653e7f5e1cee68434056517a2e7
Showing with 25 additions and 2 deletions.
  1. +11 −0 Source/WebCore/ChangeLog
  2. +14 −2 Source/WebCore/inspector/front-end/DOMAgent.js
@@ -1,3 +1,14 @@
2011-04-13 Pavel Feldman <pfeldman@google.com>

Reviewed by Yury Semikhatsky.

Web Inspector: requestDocument can result in race condition in DOMAgent.js
https://bugs.webkit.org/show_bug.cgi?id=58415

* inspector/front-end/DOMAgent.js:
(WebInspector.DOMAgent.prototype.requestDocument.onDocumentAvailable):
(WebInspector.DOMAgent.prototype.requestDocument):

2011-04-12 Pavel Feldman <pfeldman@google.com>

Reviewed by Yury Semikhatsky.
@@ -350,14 +350,26 @@ WebInspector.DOMAgent.prototype = {
return;
}

if (this._pendingDocumentRequestCallbacks) {
this._pendingDocumentRequestCallbacks.push(callback);
return;
}

this._pendingDocumentRequestCallbacks = [callback];

function onDocumentAvailable(error, root)
{
if (!error)
this._setDocument(root);

if (callback)
callback(this._document);
for (var i = 0; i < this._pendingDocumentRequestCallbacks.length; ++i) {
var callback = this._pendingDocumentRequestCallbacks[i];
if (callback)
callback(this._document);
}
delete this._pendingDocumentRequestCallbacks;
}

DOMAgent.getDocument(onDocumentAvailable.bind(this));
},

0 comments on commit 2a073da

Please sign in to comment.