michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: // get title directly michael@0: self.postMessage(["equal", document.title, "Page Worker test", michael@0: "Correct page title accessed directly"]); michael@0: michael@0: // get
directly michael@0: let p = document.getElementById("paragraph"); michael@0: self.postMessage(["ok", !!p, "
can be accessed directly"]); michael@0: self.postMessage(["equal", p.firstChild.nodeValue, michael@0: "Lorem ipsum dolor sit amet.", michael@0: "Correct text node expected"]); michael@0: michael@0: // Modify page michael@0: let div = document.createElement("div"); michael@0: div.setAttribute("id", "block"); michael@0: div.appendChild(document.createTextNode("Test text created")); michael@0: document.body.appendChild(div); michael@0: michael@0: // Check back the modification michael@0: div = document.getElementById("block"); michael@0: self.postMessage(["ok", !!div, "