Changeset 127902 in webkit


Ignore:
Timestamp:
Sep 7, 2012 11:51:37 AM (12 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: [REGRESSION] Content is not available for dynamically loaded script sometimes.
https://bugs.webkit.org/show_bug.cgi?id=95954

Reviewed by Yury Semikhatsky.

Source/WebCore:

Resource now loads content from request when it is available.
Content was loaded from PageAgent before where it might be not available if the resource was already GCed.

Test: http/tests/inspector/resource-tree/resource-request-content-after-loading-and-clearing-cache.html

  • inspector/front-end/Resource.js:

(WebInspector.Resource.prototype._innerRequestContent.contentLoaded):
(WebInspector.Resource.prototype._innerRequestContent.resourceContentLoaded):
(WebInspector.Resource.prototype._innerRequestContent):

LayoutTests:

  • http/tests/inspector/resource-tree/resource-request-content-after-loading-and-clearing-cache-expected.txt: Added.
  • http/tests/inspector/resource-tree/resource-request-content-after-loading-and-clearing-cache.html: Added.
  • http/tests/inspector/resource-tree/resources/dynamic-script.js: Added.

(foo):

  • http/tests/inspector/resources-test.js:
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r127900 r127902  
     12012-09-06  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: [REGRESSION] Content is not available for dynamically loaded script sometimes.
     4        https://bugs.webkit.org/show_bug.cgi?id=95954
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * http/tests/inspector/resource-tree/resource-request-content-after-loading-and-clearing-cache-expected.txt: Added.
     9        * http/tests/inspector/resource-tree/resource-request-content-after-loading-and-clearing-cache.html: Added.
     10        * http/tests/inspector/resource-tree/resources/dynamic-script.js: Added.
     11        (foo):
     12        * http/tests/inspector/resources-test.js:
     13
    1142012-09-07  Dominic Mazzoni  <dmazzoni@google.com>
    215
  • trunk/LayoutTests/http/tests/inspector/resources-test.js

    r121746 r127902  
    8383}
    8484
    85 InspectorTest.resourceMatchingURL = function(resourceURL, callback)
     85InspectorTest.resourceMatchingURL = function(resourceURL)
    8686{
    8787    var result = null;
  • trunk/Source/WebCore/ChangeLog

    r127899 r127902  
     12012-09-06  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: [REGRESSION] Content is not available for dynamically loaded script sometimes.
     4        https://bugs.webkit.org/show_bug.cgi?id=95954
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Resource now loads content from request when it is available.
     9        Content was loaded from PageAgent before where it might be not available if the resource was already GCed.
     10
     11        Test: http/tests/inspector/resource-tree/resource-request-content-after-loading-and-clearing-cache.html
     12
     13        * inspector/front-end/Resource.js:
     14        (WebInspector.Resource.prototype._innerRequestContent.contentLoaded):
     15        (WebInspector.Resource.prototype._innerRequestContent.resourceContentLoaded):
     16        (WebInspector.Resource.prototype._innerRequestContent):
     17
    1182012-09-07  Adam Barth  <abarth@webkit.org>
    219
  • trunk/Source/WebCore/inspector/front-end/Resource.js

    r122603 r127902  
    312312
    313313        /**
    314          * @param {?Protocol.Error} error
    315314         * @param {string} content
    316315         * @param {boolean} contentEncoded
    317316         */
    318         function callback(error, content, contentEncoded)
     317        function contentLoaded(content, contentEncoded)
    319318        {
    320             this._content = error ? null : content;
     319            this._content = content;
    321320            this._contentEncoded = contentEncoded;
    322321            var callbacks = this._pendingContentCallbacks.slice();
     
    326325            delete this._contentRequested;
    327326        }
    328         PageAgent.getResourceContent(this.frameId, this.url, callback.bind(this));
     327
     328        /**
     329         * @param {?Protocol.Error} error
     330         * @param {string} content
     331         * @param {boolean} contentEncoded
     332         */
     333        function resourceContentLoaded(error, content, contentEncoded)
     334        {
     335            if (error)
     336                console.error("Resource content request failed: " + error);
     337            contentLoaded.call(this, error ? null : content, contentEncoded);
     338        }
     339       
     340        if (this.request) {
     341            /**
     342             * @param {string} content
     343             * @param {boolean} contentEncoded
     344             * @param {string} mimeType
     345             */
     346            function requestContentLoaded(content, contentEncoded, mimeType)
     347            {
     348                contentLoaded.call(this, content, contentEncoded);
     349            }
     350           
     351            this.request.requestContent(requestContentLoaded.bind(this));
     352            return;
     353        }
     354        PageAgent.getResourceContent(this.frameId, this.url, resourceContentLoaded.bind(this));
    329355    },
    330356
Note: See TracChangeset for help on using the changeset viewer.