Some completion events of InspectorFileSystemAgent commands are fired too early on error case. We should wait the command passes its request ID to JS.
Created attachment 158228 [details] Patch
Let me add explanation for this patch. In short, we shouldn't call Frontend::directoryContentReceived in Agent::requestDirectoryContent. For example, the process flow of requestDirectoryContent is as follows: 1. front-end calls Agent::requestDirectoryContent, 2. Agent kicks DirectoryContentRequest task, 3. Agent returns requestId to front-end through requestAccepted, 4. front-end associates requestId with callback, 5. Agent fires directoryContentReceived event with requestId. 6. front-end fires the callback according to requestId. That is, requestId is not associated with callback at 2., so if we fire directoryContentReceived in 2. before Agent::requestDirectoryContent returns, front-end can't find which callback should be called.
To be more concrete, if front-end calls requestDirectoryContent with invalid URL, directoryContentReceived will be fired before requestAccepted.
Created attachment 159029 [details] Patch
Comment on attachment 159029 [details] Patch Clearing flags on attachment: 159029 Committed r126195: <http://trac.webkit.org/changeset/126195>
All reviewed patches have been landed. Closing bug.