Commit 1eb742e5 authored by Christopher Lam's avatar Christopher Lam Committed by Commit Bot

[chrome.app.window] Patch custom bindings to ignore broken windows.

This CL fixes and issue where it was assumed that all Chrome App Windows
have the chrome.app.window API. Some broken corner cases don't have this
API and it caused chrome.app.window.getAll() calls to fail.

This CL filters out broken windows before returning to the caller.

Bug: 1021014
Change-Id: Ia3f09b1393c62bd3e2dfc88de36c8f4cc9417910
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2029397Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Commit-Queue: calamity <calamity@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738074}
parent 790b51a1
...@@ -180,6 +180,11 @@ apiBridge.registerCustomHook(function(bindingsAPI) { ...@@ -180,6 +180,11 @@ apiBridge.registerCustomHook(function(bindingsAPI) {
apiFunctions.setHandleRequest('getAll', function() { apiFunctions.setHandleRequest('getAll', function() {
var views = runtimeNatives.GetExtensionViews(-1, -1, 'APP_WINDOW'); var views = runtimeNatives.GetExtensionViews(-1, -1, 'APP_WINDOW');
// In certain corner cases, renderers may not load correctly, and are
// missing the chrome.app bindings. Filter these views out so that the next
// lines don't crash.
// See https://crbug.com/1021014.
views = $Array.filter(views, (w) => w.chrome.app);
return $Array.map(views, function(win) { return $Array.map(views, function(win) {
return win.chrome.app.window.current(); return win.chrome.app.window.current();
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment