Changeset 83707 in webkit


Ignore:
Timestamp:
Apr 13, 2011 12:22:34 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

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):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83706 r83707  
     12011-04-13  Pavel Feldman  <pfeldman@google.com>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: requestDocument can result in race condition in DOMAgent.js
     6        https://bugs.webkit.org/show_bug.cgi?id=58415
     7
     8        * inspector/front-end/DOMAgent.js:
     9        (WebInspector.DOMAgent.prototype.requestDocument.onDocumentAvailable):
     10        (WebInspector.DOMAgent.prototype.requestDocument):
     11
    1122011-04-12  Pavel Feldman  <pfeldman@google.com>
    213
  • trunk/Source/WebCore/inspector/front-end/DOMAgent.js

    r82818 r83707  
    351351        }
    352352
     353        if (this._pendingDocumentRequestCallbacks) {
     354            this._pendingDocumentRequestCallbacks.push(callback);
     355            return;
     356        }
     357
     358        this._pendingDocumentRequestCallbacks = [callback];
     359
    353360        function onDocumentAvailable(error, root)
    354361        {
     
    356363                this._setDocument(root);
    357364
    358             if (callback)
    359                 callback(this._document);
    360         }
     365            for (var i = 0; i < this._pendingDocumentRequestCallbacks.length; ++i) {
     366                var callback = this._pendingDocumentRequestCallbacks[i];
     367                if (callback)
     368                    callback(this._document);
     369            }
     370            delete this._pendingDocumentRequestCallbacks;
     371        }
     372
    361373        DOMAgent.getDocument(onDocumentAvailable.bind(this));
    362374    },
Note: See TracChangeset for help on using the changeset viewer.