mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,41 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Checks if self-closing <script/> tags are parsed by Parser.jsm
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser } = Cu.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
let source = [
|
||||
'<script type="text/javascript" src="chrome://foo.js"/>',
|
||||
'<script type="application/javascript;version=1.8" src="chrome://baz.js"/>',
|
||||
'<script async defer src="chrome://foobar.js"/>',
|
||||
'<script type="application/javascript"/>"hello third"',
|
||||
'<script type="application/javascript">"hello fourth"</script>',
|
||||
].join("\n");
|
||||
let parser = new Parser();
|
||||
let parsed = parser.get(source);
|
||||
|
||||
is(parser.errors.length, 0,
|
||||
"There should be no errors logged when parsing.");
|
||||
is(parsed.scriptCount, 5,
|
||||
"There should be 5 scripts parsed in the parent HTML source.");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("foo.js\"/>") + 1).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"the first script is empty");
|
||||
is(parsed.getScriptInfo(source.indexOf("baz.js\"/>") + 1).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"the second script is empty");
|
||||
is(parsed.getScriptInfo(source.indexOf("foobar.js\"/>") + 1).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"the third script is empty");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("hello third!")).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"Inline script on self-closing tag not considered a script");
|
||||
is(parsed.getScriptInfo(source.indexOf("hello fourth")).toSource(), "({start:267, length:14, index:4})",
|
||||
"The fourth script was located correctly.");
|
||||
|
||||
finish();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue