<webview>: Fix an issue with destroying an opener that has unattached guests.
This CL also adds a test that exercises the code path and makes sure destroying an opener that has unattached window doesn't cause any undesired side effects. If we destroy an opener that had a pending newwindow, the newwindow's GC would try to setPermission to deny the newwindow later. But the opener is gone and its guestInstanceId isn't valid anymore, this would throw a JavaScript exception b/c we call webViewInternal.setPermission with undefined instance id: "Uncaught Error: Invocation of form ..." The fix is to ignore calling webViewInternal.setPermission in this case. Note that the added test doesn't necessarily check for the above exception because GC can be delayed arbitrarily. The test checks the regular code path. BUG=406616 Test=See the test added in newwindow/embedder.js for details. Open a chrome app window that has a <webview>. Add a newwindow event listener to the <webview>. Now trigger a new window from the <webview> so the listener fires. In the listener, destroy the <webview>. Every thing should work fine and should not exhibit any bad behavior. Without this change it would throw a JavaScript exception. Review URL: https://codereview.chromium.org/558813002 Cr-Commit-Position: refs/heads/master@{#294053}
Showing
Please register or sign in to comment