(win, url, target, opt_features)
| 16 | * @return {?Window} |
| 17 | */ |
| 18 | export function openWindowDialog(win, url, target, opt_features) { |
| 19 | // Try first with the specified target. If we're inside the WKWebView or |
| 20 | // a similar environments, this method is expected to fail by default for |
| 21 | // all targets except `_top`. |
| 22 | let res; |
| 23 | try { |
| 24 | res = win.open(url, target, opt_features); |
| 25 | } catch (e) { |
| 26 | dev().error('DOM', 'Failed to open url on target: ', target, e); |
| 27 | } |
| 28 | |
| 29 | // Then try with `_top` target. |
| 30 | if (!res && target != '_top' && !includes(opt_features || '', 'noopener')) { |
| 31 | res = win.open(url, '_top'); |
| 32 | } |
| 33 | return res; |
| 34 | } |
no test coverage detected