Description<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.
Committed: https://crrev.com/40341e4ab145e7e4daa57de8ea1152f6018233b6
Cr-Commit-Position: refs/heads/master@{#294053}
Patch Set 1 #
Total comments: 2
Patch Set 2 : add tests for attach/discard call after opener destruction #
Total comments: 7
Patch Set 3 : address nits #Patch Set 4 : fix setTimeout call #
Messages
Total messages: 10 (2 generated)
|