# HG changeset patch # User Alexandre Poirot # Date 1512652963 18000 # Thu Dec 07 08:22:43 2017 -0500 # Node ID 412a612a30d09fdf0d7c04a23de3c0c78337a81b # Parent e51c557a5c6ebb9d61911c951100773c31a8ba3c Bug 1408708 - Fetch stylesheet content via stylesheet window instead of top level content window. r=pbro MozReview-Commit-ID: AKXQLNAwy8t diff --git a/devtools/client/styleeditor/test/browser.ini b/devtools/client/styleeditor/test/browser.ini --- a/devtools/client/styleeditor/test/browser.ini +++ b/devtools/client/styleeditor/test/browser.ini @@ -1,16 +1,19 @@ [DEFAULT] tags = devtools subsuite = devtools support-files = autocomplete.html browser_styleeditor_cmd_edit.html + bug_1405342_serviceworker_iframes.html four.html head.js + iframe_with_service_worker.html + iframe_service_worker.js import.css import.html import2.css inline-1.html inline-2.html longload.html media-small.css media.html @@ -62,16 +65,17 @@ support-files = !/devtools/client/shared/test/test-actor.js [browser_styleeditor_autocomplete.js] [browser_styleeditor_autocomplete-disabled.js] [browser_styleeditor_bom.js] [browser_styleeditor_bug_740541_iframes.js] [browser_styleeditor_bug_851132_middle_click.js] [browser_styleeditor_bug_870339.js] +[browser_styleeditor_bug_1405342_serviceworker_iframes.js] [browser_styleeditor_cmd_edit.js] [browser_styleeditor_enabled.js] [browser_styleeditor_fetch-from-cache.js] [browser_styleeditor_filesave.js] [browser_styleeditor_highlight-selector.js] [browser_styleeditor_import.js] [browser_styleeditor_import_rule.js] [browser_styleeditor_init.js] diff --git a/devtools/client/styleeditor/test/browser_styleeditor_bug_1405342_serviceworker_iframes.js b/devtools/client/styleeditor/test/browser_styleeditor_bug_1405342_serviceworker_iframes.js new file mode 100644 --- /dev/null +++ b/devtools/client/styleeditor/test/browser_styleeditor_bug_1405342_serviceworker_iframes.js @@ -0,0 +1,23 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +// Test that sheets inside cross origin iframes, served from a service worker +// are correctly fetched via the service worker in the stylesheet editor. + +add_task(async function () { + const TEST_URL = "https://test1.example.com/browser/devtools/client/styleeditor/test/bug_1405342_serviceworker_iframes.html"; + let { ui } = await openStyleEditorForURL(TEST_URL); + + if (ui.editors.length != 1) { + info("Stylesheet isn't available immediately, waiting for it"); + await ui.once("editor-added"); + } + is(ui.editors.length, 1, "Got the iframe stylesheet"); + + await ui.selectStyleSheet(ui.editors[0].styleSheet); + let editor = await ui.editors[0].getSourceEditor(); + let text = editor.sourceEditor.getText(); + is(text, "* { color: green; }", + "stylesheet content is the one served by the service worker"); +}); diff --git a/devtools/client/styleeditor/test/bug_1405342_serviceworker_iframes.html b/devtools/client/styleeditor/test/bug_1405342_serviceworker_iframes.html new file mode 100644 --- /dev/null +++ b/devtools/client/styleeditor/test/bug_1405342_serviceworker_iframes.html @@ -0,0 +1,10 @@ + + + + + Bug 1405342 + + +