browser_net_decode-url.js (1139B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Tests if "Request URL" containing "#" in its query is correctly decoded. 8 */ 9 add_task(async function () { 10 const { tab, monitor } = await initNetMonitor(POST_RAW_URL_WITH_HASH, { 11 requestCount: 1, 12 }); 13 info("Starting test... "); 14 15 const { document, store, windowRequire } = monitor.panelWin; 16 const Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); 17 store.dispatch(Actions.batchEnable(false)); 18 19 // Execute request. 20 await performRequests(monitor, tab, 1); 21 22 // Wait until the url preview ihas loaded 23 const wait = waitUntil(() => 24 document.querySelector("#headers-panel .url-preview") 25 ); 26 27 EventUtils.sendMouseEvent( 28 { type: "mousedown" }, 29 document.querySelectorAll(".request-list-item")[0] 30 ); 31 32 await wait; 33 34 const requestURL = document.querySelector("#headers-panel .url-preview .url"); 35 is( 36 requestURL.textContent.endsWith("foo # bar"), 37 true, 38 "\"Request URL\" containing '#' is correctly decoded." 39 ); 40 41 return teardown(monitor); 42 });