How to use the cross-domain-utils/src.assertSameDomain 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 / post-robot / src / bridge / child.js View on Github external
return ZalgoPromise.try(() => {
            const frame = getFrameByName(win, getBridgeName(getDomain()));

            if (!frame) {
                return;
            }

            if (isSameDomain(frame) && getGlobal(assertSameDomain(frame))) {
                return frame;
            }

            return new ZalgoPromise(resolve => {

                let interval;
                let timeout; // eslint-disable-line prefer-const

                interval = setInterval(() => { // eslint-disable-line prefer-const
                    if (frame && isSameDomain(frame) && getGlobal(assertSameDomain(frame))) {
                        clearInterval(interval);
                        clearTimeout(timeout);
                        return resolve(frame);
                    }
                }, 100);
github paypal / paypal-checkout-components / src / zoid / native / component.jsx View on Github external
const renderSpinner = (win) => {
                try {
                    win = assertSameDomain(win);
                    const doc = win.document;

                    writeElementToWindow(win, (
                        
                    ).render(dom({ doc })));
                } catch (err) {
                    // pass
                }
            };
github krakenjs / zoid / dist / module / component / parent / drivers.js View on Github external
return ZalgoPromise['try'](function () {
                if (isSameDomain(win)) {
                    return assertSameDomain(win);
                }
            });
        },
github krakenjs / post-robot / src / serialize / window.js View on Github external
getName:       () => winPromise.then(win => {
            if (isWindowClosed(win)) {
                return;
            }

            if (isSameDomain(win)) {
                return assertSameDomain(win).name;
            }

            return windowNamePromise;
        }),
        focus:   () => winPromise.then(win => {
github krakenjs / zoid / dist / module / component / parent / drivers.js View on Github external
return awaitFrameLoad(prerenderIframe).then(function () {
            var prerenderFrameWindow = prerenderIframe.contentWindow;

            _this2.clean.register('destroyPrerender', function () {
                destroyElement(prerenderIframe);
            });

            return assertSameDomain(prerenderFrameWindow);
        });
    },
github paypal / paypal-checkout-components / src / zoid / buttons / prerender.jsx View on Github external
const handleClick = (event, { fundingSource, card } : {| fundingSource : $Values, card : ?$Values |}) => {
        if (supportsPopups()) {
            const win = assertSameDomain(popup('', {
                width:  DEFAULT_POPUP_SIZE.WIDTH,
                height: DEFAULT_POPUP_SIZE.HEIGHT
            }));

            const doc = window.document;

            const spinner = (
                
            ).render(dom({ doc }));

            writeElementToWindow(win, spinner);

            onRenderCheckout({ win, fundingSource, card });

        } else {
            onRenderCheckout({ fundingSource, card });
github krakenjs / post-robot / src / serialize / window.js View on Github external
setName: (name) => winPromise.then(win => {
            if (__POST_ROBOT__.__IE_POPUP_SUPPORT__) {
                linkWindow({ win, name });
            }

            const sameDomain = isSameDomain(win);
            const frame = getFrameForWindow(win);

            if (!sameDomain) {
                throw new Error(`Can not set name for cross-domain window: ${ name }`);
            }

            assertSameDomain(win).name = name;
            if (frame) {
                frame.setAttribute('name', name);
            }

            windowNamePromise = ZalgoPromise.resolve(name);
        })
    };
github krakenjs / zoid / src / parent / drivers.js View on Github external
return awaitFrameWindow(prerenderFrame).then(prerenderFrameWindow => {
                return assertSameDomain(prerenderFrameWindow);
            }).then(win => {
                return toProxyWindow(win);
github krakenjs / zoid / src / parent / index.js View on Github external
return ZalgoPromise.try(() => {
            const prerenderTemplate = this.component.prerenderTemplate;

            if (!prerenderTemplate) {
                return;
            }

            let prerenderWindow = proxyPrerenderWin.getWindow();

            if (!prerenderWindow || !isSameDomain(prerenderWindow) || !isBlankDomain(prerenderWindow)) {
                return;
            }

            prerenderWindow = assertSameDomain(prerenderWindow);
    
            const doc = prerenderWindow.document;
            const el = this.renderTemplate(prerenderTemplate, { context, uid, doc });

            if (!el) {
                return;
            }

            if (el.ownerDocument !== doc) {
                throw new Error(`Expected prerender template to have been created with document from child window`);
            }

            writeElementToWindow(prerenderWindow, el);

            let { width = false, height = false, element = 'body' } = this.component.autoResize || {};
            element = getElementSafe(element, doc);