Bug 147096

Summary: Web Inspector: start using Promises to handle asynchronous steps in protocol tests
Product: WebKit Reporter: Brian Burg <burg>
Component: Web InspectorAssignee: Brian Burg <burg>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, graouts, joepeck, jonowells, mattbaker, nvasilyev, rniwa, timothy, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 147093, 147097    
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews102 for mac-mavericks
none
Archive of layout-test-results from ews104 for mac-mavericks-wk2
none
PFR (fixed test result)
none
PFR (address comments) joepeck: review+

Brian Burg
Reported 2015-07-19 14:59:09 PDT
.
Attachments
Patch (39.71 KB, patch)
2015-07-19 18:29 PDT, Brian Burg
no flags
Archive of layout-test-results from ews102 for mac-mavericks (541.30 KB, application/zip)
2015-07-19 19:02 PDT, Build Bot
no flags
Archive of layout-test-results from ews104 for mac-mavericks-wk2 (593.41 KB, application/zip)
2015-07-19 19:08 PDT, Build Bot
no flags
PFR (fixed test result) (41.12 KB, patch)
2015-07-19 20:03 PDT, Brian Burg
no flags
PFR (address comments) (41.06 KB, patch)
2015-07-20 16:12 PDT, Brian Burg
joepeck: review+
Radar WebKit Bug Importer
Comment 1 2015-07-19 14:59:24 PDT
Brian Burg
Comment 2 2015-07-19 18:29:02 PDT
Build Bot
Comment 3 2015-07-19 19:02:29 PDT
Comment on attachment 257070 [details] Patch Attachment 257070 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/4606950234914816 New failing tests: inspector-protocol/sync-test-suite.html
Build Bot
Comment 4 2015-07-19 19:02:32 PDT
Created attachment 257072 [details] Archive of layout-test-results from ews102 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-mavericks Platform: Mac OS X 10.9.5
Build Bot
Comment 5 2015-07-19 19:07:57 PDT
Comment on attachment 257070 [details] Patch Attachment 257070 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5118500704092160 New failing tests: inspector-protocol/sync-test-suite.html
Build Bot
Comment 6 2015-07-19 19:08:00 PDT
Created attachment 257073 [details] Archive of layout-test-results from ews104 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Brian Burg
Comment 7 2015-07-19 20:03:47 PDT
Created attachment 257074 [details] PFR (fixed test result)
Joseph Pecoraro
Comment 8 2015-07-20 15:28:17 PDT
Comment on attachment 257074 [details] PFR (fixed test result) View in context: https://bugs.webkit.org/attachment.cgi?id=257074&action=review > LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js:200 > + result.catch(function(e) { return result.catch(...) instead of result? > LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js:324 > + if (this.forceSyncDebugLogging) > + this.debugLog(formattedMessage); > + else > + this.log(formattedMessage); This can just call log() which will handle forceSyncDebugLogging for us. > LayoutTests/inspector-protocol/runtime/getProperties.html:54 > + InspectorTest.awaitCommand({ > + method: "Runtime.evaluate", > + params: {expression} > + }) > + .then(function(reply) { > + var objectId = reply.result.objectId; > + if (objectId === undefined) > + throw new Error("objectId is expected"); > + > + return InspectorTest.awaitCommand({ > + method: "Runtime.getProperties", > + params: {objectId, ownProperties: true} > + }); > + }) > + .then(function(reply) { > + dumpGetPropertiesResult(reply); > + resolve(); > + }); If some exception is triggered inside the awaitCommand's callbacks, that doesn't appear to propagate to anything. I have a feeling, that somehow there should be an: .catch(reject) I'm not sure if you could return the chain (see below) because here we are actually calling resolve() on our own... return InspectorTest.awaitCommand(...) .then(...) .then(...); But maybe it would work if it returned Promise.resolve() instead of calling resolve(). return InspectorTest.awaitCommand(...) .then(...) .then(function() { ... return Promise.resolve() }) That seems messier though. Thoughts?
Brian Burg
Comment 9 2015-07-20 16:12:38 PDT
Created attachment 257140 [details] PFR (address comments)
Joseph Pecoraro
Comment 10 2015-07-20 16:29:51 PDT
Comment on attachment 257140 [details] PFR (address comments) r=me
Brian Burg
Comment 11 2015-07-20 16:37:11 PDT
Note You need to log in before you can comment on or make changes to this bug.