diff --git a/devtools/client/netmonitor/test/browser_net_brotli.js b/devtools/client/netmonitor/test/browser_net_brotli.js index 0f17df410b49..b038cc0dc191 100644 --- a/devtools/client/netmonitor/test/browser_net_brotli.js +++ b/devtools/client/netmonitor/test/browser_net_brotli.js @@ -45,26 +45,19 @@ add_task(function* () { time: true }); - wait = waitForDOM(document, "#response-panel .editor-mount iframe"); + wait = waitForDOM(document, ".CodeMirror-code"); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".network-details-panel-toggle")); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector("#response-tab")); - let [editorFrame] = yield wait; - - yield once(editorFrame, "DOMContentLoaded"); - yield waitForDOM(editorFrame.contentDocument, ".CodeMirror-code"); + yield wait; yield testResponse("br"); - yield teardown(monitor); function* testResponse(type) { switch (type) { case "br": { - let text = editorFrame.contentDocument - .querySelector(".CodeMirror-line").textContent; - - is(text, "X".repeat(64), + is(document.querySelector(".CodeMirror-line").textContent, "X".repeat(64), "The text shown in the source editor is incorrect for the brotli request."); break; } diff --git a/devtools/client/netmonitor/test/browser_net_complex-params.js b/devtools/client/netmonitor/test/browser_net_complex-params.js index fdfd18d191c8..e6e8c2dcbcc2 100644 --- a/devtools/client/netmonitor/test/browser_net_complex-params.js +++ b/devtools/client/netmonitor/test/browser_net_complex-params.js @@ -58,12 +58,10 @@ add_task(function* () { // Wait for all tree sections and editor updated by react let waitSections = waitForDOM(document, "#params-panel .tree-section", 2); - let waitEditor = waitForDOM(document, "#params-panel .editor-mount iframe"); + let waitSourceEditor = waitForDOM(document, "#params-panel .CodeMirror-code"); EventUtils.sendMouseEvent({ type: "mousedown" }, document.querySelectorAll(".request-list-item")[5]); - let [, editorFrames] = yield Promise.all([waitSections, waitEditor]); - yield once(editorFrames[0], "DOMContentLoaded"); - yield waitForDOM(editorFrames[0].contentDocument, ".CodeMirror-code"); + yield Promise.all([waitSections, waitSourceEditor]); testParamsTab2("a", "b", "?foo=bar", "text"); EventUtils.sendMouseEvent({ type: "mousedown" }, @@ -85,7 +83,7 @@ add_task(function* () { ok(tabpanel.querySelector(".treeTable"), "The request params box should be displayed."); - ok(tabpanel.querySelector(".editor-mount") === null, + ok(tabpanel.querySelector(".CodeMirror-code") === null, "The request post data editor should not be displayed."); let treeSections = tabpanel.querySelectorAll(".tree-section"); @@ -126,7 +124,7 @@ add_task(function* () { ok(tabpanel.querySelector(".treeTable"), "The request params box should be displayed."); - is(tabpanel.querySelector(".editor-mount") === null, + is(tabpanel.querySelector(".CodeMirror-code") === null, isJSON, "The request post data editor should be not displayed."); @@ -161,8 +159,7 @@ add_task(function* () { "JSON property value " + i + " should be displayed correctly"); } } else { - let editor = editorFrames[0].contentDocument.querySelector(".CodeMirror-code"); - ok(editor.textContent.includes(requestPayload), + ok(document.querySelector(".CodeMirror-code").textContent.includes(requestPayload), "The text shown in the source editor is incorrect."); } } @@ -179,7 +176,7 @@ add_task(function* () { ok(!tabpanel.querySelector(".treeTable"), "The request params box should be hidden."); - ok(!tabpanel.querySelector(".editor-mount iframe"), + ok(!tabpanel.querySelector(".CodeMirror-code"), "The request post data editor should be hidden."); } }); diff --git a/devtools/client/netmonitor/test/browser_net_content-type.js b/devtools/client/netmonitor/test/browser_net_content-type.js index 99fb9e88c841..7be0b64fd96a 100644 --- a/devtools/client/netmonitor/test/browser_net_content-type.js +++ b/devtools/client/netmonitor/test/browser_net_content-type.js @@ -135,25 +135,25 @@ add_task(function* () { } ); - yield selectIndexAndWaitForEditor(0); + yield selectIndexAndWaitForSourceEditor(0); yield testResponseTab("xml"); - yield selectIndexAndWaitForEditor(1); + yield selectIndexAndWaitForSourceEditor(1); yield testResponseTab("css"); - yield selectIndexAndWaitForEditor(2); + yield selectIndexAndWaitForSourceEditor(2); yield testResponseTab("js"); yield selectIndexAndWaitForJSONView(3); yield testResponseTab("json"); - yield selectIndexAndWaitForEditor(4); + yield selectIndexAndWaitForSourceEditor(4); yield testResponseTab("html"); yield selectIndexAndWaitForImageView(5); yield testResponseTab("png"); - yield selectIndexAndWaitForEditor(6); + yield selectIndexAndWaitForSourceEditor(6); yield testResponseTab("gzip"); yield teardown(monitor); @@ -169,7 +169,7 @@ add_task(function* () { is(jsonView.textContent !== L10N.getStr("jsonScopeName"), box != "json", "The response json view doesn't display"); - is(tabpanel.querySelector(".editor-mount") === null, + is(tabpanel.querySelector(".CodeMirror-code") === null, box != "textarea", "The response editor doesn't display"); is(tabpanel.querySelector(".response-image-box") === null, @@ -181,8 +181,7 @@ add_task(function* () { case "xml": { checkVisibility("textarea"); - let editor = tabpanel.querySelector(".editor-mount iframe"); - let text = editor.contentDocument .querySelector(".CodeMirror-line").textContent; + let text = document .querySelector(".CodeMirror-line").textContent; is(text, "", "The text shown in the source editor is incorrect for the xml request."); @@ -191,8 +190,7 @@ add_task(function* () { case "css": { checkVisibility("textarea"); - let editor = tabpanel.querySelector(".editor-mount iframe"); - let text = editor.contentDocument.querySelector(".CodeMirror-line").textContent; + let text = document.querySelector(".CodeMirror-line").textContent; is(text, "body:pre { content: 'Hello CSS!' }", "The text shown in the source editor is incorrect for the css request."); @@ -201,8 +199,7 @@ add_task(function* () { case "js": { checkVisibility("textarea"); - let editor = tabpanel.querySelector(".editor-mount iframe"); - let text = editor.contentDocument.querySelector(".CodeMirror-line").textContent; + let text = document.querySelector(".CodeMirror-line").textContent; is(text, "function() { return 'Hello JS!'; }", "The text shown in the source editor is incorrect for the js request."); @@ -234,8 +231,7 @@ add_task(function* () { case "html": { checkVisibility("textarea"); - let editor = document.querySelector(".editor-mount iframe"); - let text = editor.contentDocument.querySelector(".CodeMirror-line").textContent; + let text = document.querySelector(".CodeMirror-line").textContent; is(text, "", "The text shown in the source editor is incorrect for the html request."); @@ -258,8 +254,7 @@ add_task(function* () { case "gzip": { checkVisibility("textarea"); - let editor = tabpanel.querySelector(".editor-mount iframe"); - let text = editor.contentDocument.querySelector(".CodeMirror-line").textContent; + let text = document.querySelector(".CodeMirror-line").textContent; is(text, new Array(1000).join("Hello gzip!"), "The text shown in the source editor is incorrect for the gzip request."); @@ -268,19 +263,18 @@ add_task(function* () { } } - function* selectIndexAndWaitForEditor(index) { - let editor = document.querySelector("#response-panel .editor-mount iframe"); + function* selectIndexAndWaitForSourceEditor(index) { + let editor = document.querySelector("#response-panel .CodeMirror-code"); if (!editor) { - let waitDOM = waitForDOM(document, "#response-panel .editor-mount iframe"); - gStore.dispatch(Actions.selectRequestByIndex(index)); + let waitDOM = waitForDOM(document, "#response-panel .CodeMirror-code"); + EventUtils.sendMouseEvent({ type: "mousedown" }, + document.querySelectorAll(".request-list-item")[index]); document.querySelector("#response-tab").click(); - [editor] = yield waitDOM; - yield once(editor, "DOMContentLoaded"); + yield waitDOM; } else { - gStore.dispatch(Actions.selectRequestByIndex(index)); + EventUtils.sendMouseEvent({ type: "mousedown" }, + document.querySelectorAll(".request-list-item")[index]); } - - yield waitForDOM(editor.contentDocument, ".CodeMirror-code"); } function* selectIndexAndWaitForJSONView(index) { diff --git a/devtools/client/netmonitor/test/browser_net_cyrillic-01.js b/devtools/client/netmonitor/test/browser_net_cyrillic-01.js index f16e87f757cc..10035434b0c6 100644 --- a/devtools/client/netmonitor/test/browser_net_cyrillic-01.js +++ b/devtools/client/netmonitor/test/browser_net_cyrillic-01.js @@ -42,17 +42,14 @@ add_task(function* () { EventUtils.sendMouseEvent({ type: "mousedown" }, document.querySelectorAll(".request-list-item")[0]); yield wait; - wait = waitForDOM(document, "#response-panel .editor-mount iframe"); + wait = waitForDOM(document, "#response-panel .CodeMirror-code"); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector("#response-tab")); - let [editor] = yield wait; - yield once(editor, "DOMContentLoaded"); - yield waitForDOM(editor.contentDocument, ".CodeMirror-code"); - let text = editor.contentDocument - .querySelector(".CodeMirror-line").textContent; + yield wait; + let text = document.querySelector(".CodeMirror-line").textContent; ok(text.includes("\u0411\u0440\u0430\u0442\u0430\u043d"), "The text shown in the source editor is correct."); - yield teardown(monitor); + return teardown(monitor); }); diff --git a/devtools/client/netmonitor/test/browser_net_cyrillic-02.js b/devtools/client/netmonitor/test/browser_net_cyrillic-02.js index 1bef1c33d42a..7ccfd737f667 100644 --- a/devtools/client/netmonitor/test/browser_net_cyrillic-02.js +++ b/devtools/client/netmonitor/test/browser_net_cyrillic-02.js @@ -37,14 +37,11 @@ add_task(function* () { EventUtils.sendMouseEvent({ type: "mousedown" }, document.querySelectorAll(".request-list-item")[0]); yield wait; - wait = waitForDOM(document, "#response-panel .editor-mount iframe"); + wait = waitForDOM(document, "#response-panel .CodeMirror-code"); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector("#response-tab")); - let [editor] = yield wait; - yield once(editor, "DOMContentLoaded"); - yield waitForDOM(editor.contentDocument, ".CodeMirror-code"); - let text = editor.contentDocument - .querySelector(".CodeMirror-code").textContent; + yield wait; + let text = document.querySelector(".CodeMirror-lines").textContent; ok(text.includes("\u0411\u0440\u0430\u0442\u0430\u043d"), "The text shown in the source editor is correct."); diff --git a/devtools/client/netmonitor/test/browser_net_json-b64.js b/devtools/client/netmonitor/test/browser_net_json-b64.js index a84a59f948f7..323f18026649 100644 --- a/devtools/client/netmonitor/test/browser_net_json-b64.js +++ b/devtools/client/netmonitor/test/browser_net_json-b64.js @@ -37,7 +37,7 @@ add_task(function* () { let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {}; is(jsonView.textContent === L10N.getStr("jsonScopeName"), true, "The response json view has the intended visibility."); - is(tabpanel.querySelector(".editor-mount iframe") === null, true, + is(tabpanel.querySelector(".CodeMirror-code") === null, true, "The response editor doesn't have the intended visibility."); is(tabpanel.querySelector(".response-image-box") === null, true, "The response image box doesn't have the intended visibility."); diff --git a/devtools/client/netmonitor/test/browser_net_json-long.js b/devtools/client/netmonitor/test/browser_net_json-long.js index fc0b8060e2d6..ec70eb379162 100644 --- a/devtools/client/netmonitor/test/browser_net_json-long.js +++ b/devtools/client/netmonitor/test/browser_net_json-long.js @@ -67,7 +67,7 @@ add_task(function* () { let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {}; is(jsonView.textContent === L10N.getStr("jsonScopeName"), true, "The response json view has the intended visibility."); - is(tabpanel.querySelector(".editor-mount iframe") === null, true, + is(tabpanel.querySelector(".CodeMirror-code") === null, true, "The response editor doesn't have the intended visibility."); is(tabpanel.querySelector(".response-image-box") === null, true, "The response image box doesn't have the intended visibility."); diff --git a/devtools/client/netmonitor/test/browser_net_json-malformed.js b/devtools/client/netmonitor/test/browser_net_json-malformed.js index 7e15ea06268b..79987d175d47 100644 --- a/devtools/client/netmonitor/test/browser_net_json-malformed.js +++ b/devtools/client/netmonitor/test/browser_net_json-malformed.js @@ -40,14 +40,12 @@ add_task(function* () { fullMimeType: "text/json; charset=utf-8" }); - wait = waitForDOM(document, "#response-panel .editor-mount iframe"); + wait = waitForDOM(document, "#response-panel .CodeMirror-code"); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".network-details-panel-toggle")); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector("#response-tab")); - let [editor] = yield wait; - yield once(editor, "DOMContentLoaded"); - yield waitForDOM(editor.contentDocument, ".CodeMirror-code"); + yield wait; let tabpanel = document.querySelector("#response-panel"); is(tabpanel.querySelector(".response-error-header") === null, false, @@ -63,16 +61,13 @@ add_task(function* () { let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {}; is(jsonView.textContent === L10N.getStr("jsonScopeName"), false, "The response json view doesn't have the intended visibility."); - is(tabpanel.querySelector(".editor-mount iframe") === null, false, + is(tabpanel.querySelector(".CodeMirror-code") === null, false, "The response editor doesn't have the intended visibility."); is(tabpanel.querySelector(".response-image-box") === null, true, "The response image box doesn't have the intended visibility."); - // Strip CodeMirror line number through slice(1) - let text = editor.contentDocument - .querySelector(".CodeMirror-line").textContent; - - is(text, "{ \"greeting\": \"Hello malformed JSON!\" },", + is(document.querySelector(".CodeMirror-line").textContent, + "{ \"greeting\": \"Hello malformed JSON!\" },", "The text shown in the source editor is incorrect."); yield teardown(monitor); diff --git a/devtools/client/netmonitor/test/browser_net_json-null.js b/devtools/client/netmonitor/test/browser_net_json-null.js index a8b602607312..07ebccb387b3 100644 --- a/devtools/client/netmonitor/test/browser_net_json-null.js +++ b/devtools/client/netmonitor/test/browser_net_json-null.js @@ -55,7 +55,7 @@ add_task(function* () { let jsonView = panel.querySelector(".tree-section .treeLabel") || {}; is(jsonView.textContent === L10N.getStr("jsonScopeName"), true, "The response json view has the intended visibility."); - is(panel.querySelector(".editor-mount iframe") === null, true, + is(panel.querySelector(".CodeMirror-code") === null, true, "The response editor doesn't have the intended visibility."); is(panel.querySelector(".response-image-box") === null, true, "The response image box doesn't have the intended visibility."); diff --git a/devtools/client/netmonitor/test/browser_net_json_custom_mime.js b/devtools/client/netmonitor/test/browser_net_json_custom_mime.js index 80a68716d7b3..7df645d33903 100644 --- a/devtools/client/netmonitor/test/browser_net_json_custom_mime.js +++ b/devtools/client/netmonitor/test/browser_net_json_custom_mime.js @@ -61,7 +61,7 @@ add_task(function* () { let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {}; is(jsonView.textContent === L10N.getStr("jsonScopeName"), true, "The response json view has the intended visibility."); - is(tabpanel.querySelector(".editor-mount iframe") === null, true, + is(tabpanel.querySelector(".CodeMirror-code") === null, true, "The response editor doesn't have the intended visibility."); is(tabpanel.querySelector(".response-image-box") === null, true, "The response image box doesn't have the intended visibility."); diff --git a/devtools/client/netmonitor/test/browser_net_json_text_mime.js b/devtools/client/netmonitor/test/browser_net_json_text_mime.js index 299dfc23f8f7..1fa0d867eb3d 100644 --- a/devtools/client/netmonitor/test/browser_net_json_text_mime.js +++ b/devtools/client/netmonitor/test/browser_net_json_text_mime.js @@ -62,7 +62,7 @@ add_task(function* () { let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {}; is(jsonView.textContent === L10N.getStr("jsonScopeName"), true, "The response json view has the intended visibility."); - is(tabpanel.querySelector(".editor-mount iframe") === null, true, + is(tabpanel.querySelector(".CodeMirror-code") === null, true, "The response editor doesn't have the intended visibility."); is(tabpanel.querySelector(".response-image-box") === null, true, "The response image box doesn't have the intended visibility."); diff --git a/devtools/client/netmonitor/test/browser_net_jsonp.js b/devtools/client/netmonitor/test/browser_net_jsonp.js index 0bbef78eab24..c191f735d2da 100644 --- a/devtools/client/netmonitor/test/browser_net_jsonp.js +++ b/devtools/client/netmonitor/test/browser_net_jsonp.js @@ -83,7 +83,7 @@ add_task(function* () { is(tabpanel.querySelector(".tree-section .treeLabel").textContent, L10N.getFormatStr("jsonpScopeName", func), "The response json view has the intened visibility and correct title."); - is(tabpanel.querySelector(".editor-mount iframe") === null, true, + is(tabpanel.querySelector(".CodeMirror-code") === null, true, "The response editor doesn't have the intended visibility."); is(tabpanel.querySelector(".responseImageBox") === null, true, "The response image box doesn't have the intended visibility."); diff --git a/devtools/client/netmonitor/test/browser_net_large-response.js b/devtools/client/netmonitor/test/browser_net_large-response.js index 6fe9cefc696e..a22c84d8a1f2 100644 --- a/devtools/client/netmonitor/test/browser_net_large-response.js +++ b/devtools/client/netmonitor/test/browser_net_large-response.js @@ -43,17 +43,14 @@ add_task(function* () { statusText: "OK" }); - let waitDOM = waitForDOM(document, "#response-panel .editor-mount iframe"); + wait = waitForDOM(document, "#response-panel .CodeMirror-code"); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".network-details-panel-toggle")); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector("#response-tab")); - let [editor] = yield waitDOM; - yield once(editor, "DOMContentLoaded"); - yield waitForDOM(editor.contentDocument, ".CodeMirror-code"); + yield wait; - let text = editor.contentDocument - .querySelector(".CodeMirror-line").textContent; + let text = document.querySelector(".CodeMirror-line").textContent; ok(text.match(/^
/), "The text shown in the source editor is incorrect."); diff --git a/devtools/client/netmonitor/test/browser_net_post-data-01.js b/devtools/client/netmonitor/test/browser_net_post-data-01.js index 07da1efb1287..09e1b814e5e3 100644 --- a/devtools/client/netmonitor/test/browser_net_post-data-01.js +++ b/devtools/client/netmonitor/test/browser_net_post-data-01.js @@ -73,12 +73,10 @@ add_task(function* () { // Wait for all tree sections and editor updated by react let waitForSections = waitForDOM(document, "#params-panel .tree-section", 2); - let waitForEditor = waitForDOM(document, "#params-panel .editor-mount iframe"); + let waitForSourceEditor = waitForDOM(document, "#params-panel .CodeMirror-code"); EventUtils.sendMouseEvent({ type: "mousedown" }, document.querySelectorAll(".request-list-item")[1]); - let [, editorFrames] = yield Promise.all([waitForSections, waitForEditor]); - yield once(editorFrames[0], "DOMContentLoaded"); - yield waitForDOM(editorFrames[0].contentDocument, ".CodeMirror-code"); + yield Promise.all([waitForSections, waitForSourceEditor]); yield testParamsTab("multipart"); return teardown(monitor); @@ -89,7 +87,7 @@ add_task(function* () { function checkVisibility(box) { is(!tabpanel.querySelector(".treeTable"), !box.includes("params"), "The request params doesn't have the indended visibility."); - is(tabpanel.querySelector(".editor-mount") === null, + is(tabpanel.querySelector(".CodeMirror-code") === null, !box.includes("editor"), "The request post data doesn't have the indended visibility."); } @@ -133,8 +131,7 @@ add_task(function* () { is(labels.length, 3, "There should be 3 param values displayed in this tabpanel."); - let text = editorFrames[0].contentDocument.querySelector(".CodeMirror-code") - .textContent; + let text = document.querySelector(".CodeMirror-code").textContent; ok(text.includes("Content-Disposition: form-data; name=\"text\""), "The text shown in the source editor is incorrect (1.1)."); diff --git a/devtools/client/netmonitor/test/browser_net_streaming-response.js b/devtools/client/netmonitor/test/browser_net_streaming-response.js index 6eb10f89eb7d..0ca80a3d31d7 100644 --- a/devtools/client/netmonitor/test/browser_net_streaming-response.js +++ b/devtools/client/netmonitor/test/browser_net_streaming-response.js @@ -57,39 +57,32 @@ add_task(function* () { gStore.dispatch(Actions.selectRequest(null)); - yield selectIndexAndWaitForEditor(0); + yield selectIndexAndWaitForSourceEditor(0); // the hls-m3u8 part testEditorContent(REQUESTS[0]); - yield selectIndexAndWaitForEditor(1); + yield selectIndexAndWaitForSourceEditor(1); // the mpeg-dash part testEditorContent(REQUESTS[1]); return teardown(monitor); - function* selectIndexAndWaitForEditor(index) { - let editor = document.querySelector("#response-panel .editor-mount iframe"); + function* selectIndexAndWaitForSourceEditor(index) { + let editor = document.querySelector("#response-panel .CodeMirror-code"); if (!editor) { - let waitDOM = waitForDOM(document, "#response-panel .editor-mount iframe"); + let waitDOM = waitForDOM(document, "#response-panel .CodeMirror-code"); EventUtils.sendMouseEvent({ type: "mousedown" }, document.querySelectorAll(".request-list-item")[index]); document.querySelector("#response-tab").click(); - [editor] = yield waitDOM; - yield once(editor, "DOMContentLoaded"); + yield waitDOM; } else { EventUtils.sendMouseEvent({ type: "mousedown" }, document.querySelectorAll(".request-list-item")[index]); } - - yield waitForDOM(editor.contentDocument, ".CodeMirror-code"); } function testEditorContent([ fmt, textRe ]) { - let editor = document.querySelector("#response-panel .editor-mount iframe"); - let text = editor.contentDocument - .querySelector(".CodeMirror-line").textContent; - - ok(text.match(textRe), + ok(document.querySelector(".CodeMirror-line").textContent.match(textRe), "The text shown in the source editor for " + fmt + " is correct."); } });