tabId is sometimes -1 in webRequest.onErrorOccurred event |
|||
Issue descriptionAfter adding some tests ( issue 572930 ), I found that the (locally) the insertMultipleOriginFramesAndImmediatelyRemoveFrames test in test_unload6.js fails quite often due to tabId being -1. ./browser_tests --gtest_filter=ExtensionWebRequestApiTest.WebRequestUnloadImmediately -- The test does the following: 1. Open new page at origin A and wait until it's loaded. 2. Insert a frame at origin A and another frame at origin B (different from A!!!). 3. Remove frame A and B (synchronously after the previous step). 4. Wait for two onErrorOccurred events, and check the result. When the test fails, this happens: [FAIL] insertMultipleOriginFramesAndImmediatelyRemoveFrames: API Test Error in insertMultipleOriginFramesAndImmediatelyRemoveFrames Actual: [{"error":"net::ERR_ABORTED","frameId":1,"fromCache":false,"method":"GET","parentFrameId":0,"tabId":12,"type":"sub_frame"},{"error":"net::ERR_ABORTED","frameId":2,"fromCache":false,"method":"GET","parentFrameId":0,"tabId":-1,"type":"sub_frame"}] Expected: [{"method":"GET","frameId":1,"parentFrameId":0,"tabId":12,"type":"sub_frame","fromCache":false,"error":"net::ERR_ABORTED"},{"method":"GET","frameId":2,"parentFrameId":0,"tabId":12,"type":"sub_frame","fromCache":false,"error":"net::ERR_ABORTED"}] Often only the second tabId is -1; occasionally (rarely), even the first tabId is also -1. This happens with and without --site-per-process. And in the ~50 times that I ran the test locally, I found that the next test failed too (insertCrossOriginFrameAndImmediatelyRemoveFrame = insert 1 cross-origin frame and remove it). In all cases, frameId and parentFrameId had meaningful values. Devlin, this bug might be caused by the 0.15% failures to look up the data on the IO thread, per 1790e82aac659c28dfbd9aac82f1feb4a839f405. I'm going to address this by putting the tabId retrieval logic together with the frameId retrieval logic (where an optional thread hop may occur), you might want to investigate further why tabId is -1 at this point.
,
May 21 2016
My suggested approach seems to work. I'll tidy up the patch and upload a CL tomorrow. A possible explanation is that the resource request IPC (renderer->browser, IO thread) is somehow processed before the RenderFrameHost is registered (in the browser, UI thread, hop to IO thread). I didn't verify this, but it seems plausible.
,
May 24 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1b8747c4fed55e7fde4344eb0a71463855096502 commit 1b8747c4fed55e7fde4344eb0a71463855096502 Author: rob <rob@robwu.nl> Date: Mon May 23 23:57:50 2016 webRequest: reliably determine tabId BUG= 613718 TEST=Provided by https://codereview.chromium.org/2003593002/. Tested locally with N=50 that the tests don't fail any more (see bug report for details). Review-Url: https://codereview.chromium.org/2002763003 Cr-Commit-Position: refs/heads/master@{#395471} [modify] https://crrev.com/1b8747c4fed55e7fde4344eb0a71463855096502/extensions/browser/api/web_request/web_request_api.cc [modify] https://crrev.com/1b8747c4fed55e7fde4344eb0a71463855096502/extensions/browser/api/web_request/web_request_event_details.cc [modify] https://crrev.com/1b8747c4fed55e7fde4344eb0a71463855096502/extensions/browser/api/web_request/web_request_event_details.h [modify] https://crrev.com/1b8747c4fed55e7fde4344eb0a71463855096502/extensions/browser/extension_api_frame_id_map.cc [modify] https://crrev.com/1b8747c4fed55e7fde4344eb0a71463855096502/extensions/browser/extension_api_frame_id_map.h
,
May 24 2016
The work-around works, but there is another issue with tabId, see bug 614391. I suggest to continue the discussion (from comment 1) in the other bug. |
|||
►
Sign in to add a comment |
|||
Comment 1 by rdevlin....@chromium.org
, May 20 2016