Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- await @page.exposeFunction('disableFrameWebRTC', () =>
- await @page.waitForSelector('html')
- console.log(">>> Disabling WebRTC")
- await @page.evaluate(() =>
- observer = new MutationObserver((mutations, observer) =>
- [...document.getElementsByTagName("iframe")].forEach((elem) =>
- try
- elem.contentWindow.RTCPeerConnection = null;
- elem.contentWindow.webkitRTCPeerConnection = null;
- console.log('Remove WebRTC from iframe');
- catch err
- console.log('>>> Skip iframe');
- )
- )
- observer.observe(document, {
- attributes: true,
- childList: true,
- characterData: false,
- subtree: true
- })
- )
- )
- await @page.evaluateOnNewDocument(() =>
- console.log("Event 'evaluateOnNewDocument' fired");
- disableFrameWebRTC();
- window.RTCPeerConnection = null;
- window.webkitRTCPeerConnection = null;
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement