Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
/**
* Represents a window in a possible chain of iframes
@@ -15,13 +14,13 @@ export interface IWindowChainElement {
/**
* The iframe element inside the window.parent corresponding to window
*/
iframeElement: HTMLIFrameElement;
iframeElement: HTMLIFrameElement | null;
}
let hasDifferentOriginAncestorFlag: boolean = false;
let sameOriginWindowChainCache: IWindowChainElement[] = null;
let sameOriginWindowChainCache: IWindowChainElement[] | null = null;
function getParentWindowIfSameOrigin(w: Window): Window {
function getParentWindowIfSameOrigin(w: Window): Window | null {
if (!w.parent || w.parent === w) {
return null;
}
@@ -42,7 +41,7 @@ function getParentWindowIfSameOrigin(w: Window): Window {
return w.parent;
}
function findIframeElementInParentWindow(parentWindow: Window, childWindow: Window): HTMLIFrameElement {
function findIframeElementInParentWindow(parentWindow: Window, childWindow: Window): HTMLIFrameElement | null {
let parentWindowIframes = parentWindow.document.getElementsByTagName('iframe');
let iframe: HTMLIFrameElement;
for (let i = 0, len = parentWindowIframes.length; i < len; i++) {
@@ -64,7 +63,8 @@ export class IframeUtils {
public static getSameOriginWindowChain(): IWindowChainElement[] {
if (!sameOriginWindowChainCache) {
sameOriginWindowChainCache = [];
let w = window, parent: Window;
let w: Window | null = window;
let parent: Window | null;
do {
parent = getParentWindowIfSameOrigin(w);
if (parent) {