How to use the cross-domain-utils/src.getOpener function in cross-domain-utils

To help you get started, we’ve selected a few cross-domain-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github krakenjs / zoid / dist / module / component / child / index.js View on Github external
ChildComponent.prototype.getWindowByRef = function getWindowByRef(ref) {
        var type = ref.type;

        var result = void 0;

        if (type === WINDOW_REFERENCES.OPENER) {
            result = getOpener(window);
        } else if (type === WINDOW_REFERENCES.TOP) {
            result = getTop(window);
        } else if (type === WINDOW_REFERENCES.PARENT) {
            // $FlowFixMe
            var distance = ref.distance;


            if (distance) {
                result = getNthParentFromTop(window, distance);
            } else {
                result = getParent(window);
            }
        }

        if (type === WINDOW_REFERENCES.GLOBAL) {
            // $FlowFixMe
github krakenjs / zoid / src / child / index.js View on Github external
getParentComponentWindow(ref : WindowRef) : CrossDomainWindowType {
        const { type } = ref;
    
        if (type === WINDOW_REFERENCES.OPENER) {
            return assertExists('opener', getOpener(window));
    
        } else if (type === WINDOW_REFERENCES.PARENT && typeof ref.distance === 'number') {
            return assertExists('parent', getNthParentFromTop(window, ref.distance));

        } else if (type === WINDOW_REFERENCES.GLOBAL && ref.uid && typeof ref.uid === 'string') {
            const { uid } = ref;
            const ancestor = getAncestor(window);

            if (!ancestor) {
                throw new Error(`Can not find ancestor window`);
            }

            for (const frame of getAllFramesInWindow(ancestor)) {
                if (isSameDomain(frame)) {
                    const global = getGlobal(frame);
github krakenjs / post-robot / src / bridge / child.js View on Github external
return ZalgoPromise.try(() => {
        const opener = getOpener(window);
        
        if (!opener || !needsBridge({ win: opener })) {
            return;
        }

        registerRemoteWindow(opener);

        return awaitRemoteBridgeForWindow(opener).then(bridge => {

            if (!bridge) {
                return rejectRemoteSendMessage(opener, new Error(`Can not register with opener: no bridge found in opener`));
            }

            if (!window.name) {
                return rejectRemoteSendMessage(opener, new Error(`Can not register with opener: window does not have a name`));
            }
github krakenjs / post-robot / src / serialize / window.js View on Github external
getType: () => winPromise.then(win => {
            return getOpener(win) ? WINDOW_TYPE.POPUP : WINDOW_TYPE.IFRAME;
        }),
        getInstanceID: memoizePromise(() => winPromise.then(win => getWindowInstanceID(win, { send }))),