How to use openee_token method in wpt

Best JavaScript code snippet using wpt

test-access-property.js

Source:test-access-property.js Github

copy

Full Screen

1const directory = "/html/cross-origin-opener-policy/reporting";2const executor_path = directory + "/resources/executor.html?pipe=";3const coep_header = '|header(Cross-Origin-Embedder-Policy,require-corp)';4const same_origin = get_host_info().HTTPS_ORIGIN;5const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN;6const origin = [7 ["same-origin" , same_origin ],8 ["cross-origin", cross_origin],9];10let escapeComma = url => url.replace(/,/g, '\\,');11let testAccessProperty = (property, op, message) => {12 origin.forEach(([origin_name, origin]) => {13 promise_test(async t => {14 const this_window_token = token();15 // The opener window:16 const opener_token = token();17 const opener_url = get_host_info().HTTP_ORIGIN + executor_path +18 `&uuid=${opener_token}`;19 // The openee window:20 const openee_token = token();21 const openee_report_token = token();22 const openee_report_to = reportToHeaders(openee_report_token);23 const openee_url = origin + executor_path + openee_report_to.header +24 openee_report_to.coopReportOnlySameOriginHeader + coep_header +25 `&uuid=${openee_token}`;26 t.add_cleanup(() => {27 send(opener_token, "window.close()")28 send(openee_token, "window.close()")29 });30 // Open the two windows. Wait for them to be loaded.31 window.open(opener_url);32 send(opener_token, `33 window.openee = window.open('${escapeComma(openee_url)}');34 `);35 send(openee_token, `send("${this_window_token}", "Ready");`);36 assert_equals(await receive(this_window_token), "Ready");37 // 2. Try to access the openee.38 send(opener_token, `(${op})(openee);`);39 // 3. Check a reports is sent to the opener.40 let report = await receiveReport(openee_report_token,41 "access-to-coop-page-from-opener");42 assert_equals(report.body.property, property);43 }, `${origin_name} > ${op}`);44 })...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful