echo-cookie.html (1105B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset=utf-8> 5 <title>helper iframe for matching cookie path tests</title> 6 <meta name=help href="http://tools.ietf.org/html/rfc6265#section-5.1.4"> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 <script src="/cookies/resources/cookie-test.js"></script> 10 </head> 11 <body> 12 <script> 13 window.setCookie = function (name, path) { 14 document.cookie = name + '=1; Path=' + path + ';'; 15 }; 16 window.fetchCookieThen = function (name, path) { 17 return fetch("/cookies/resources/set-cookie.py?name=" + encodeURIComponent(name) + "&path=" + encodeURIComponent(path), {'credentials': 'include'}); 18 }; 19 window.isCookieSet = function (name, path) { 20 return document.cookie.match(name + '=1'); 21 }; 22 // Note: this function has a dependency on testdriver.js. Any test files calling 23 // it should include testdriver.js and testdriver-vendor.js 24 window.expireCookies = async () => { 25 setTestContextUsingRootWindow(); 26 await test_driver.delete_all_cookies(); 27 }; 28 window.getCookies = () => document.cookie; 29 </script> 30 </body> 31 </html>