mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 16:58:38 +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,80 @@
|
|||
/* -*- 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/ */
|
||||
|
||||
/**
|
||||
* Tests that large files are treated differently in the debugger:
|
||||
* 1) No parsing to determine current symbol is attempted when
|
||||
* starting a search
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_function-search.html";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_function-search-01.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gDebuggee = aDebuggee;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
const Filtering = gDebugger.DebuggerView.Filtering;
|
||||
|
||||
// Setting max size so that code_function-search-01.js will be
|
||||
// considered a large file on first load
|
||||
gDebugger.DebuggerView.LARGE_FILE_SIZE = 1;
|
||||
|
||||
function testLargeFile() {
|
||||
ok(gEditor.getText().length > gDebugger.DebuggerView.LARGE_FILE_SIZE,
|
||||
"First source is considered a large file.");
|
||||
is(gEditor.getMode().name, "javascript",
|
||||
"Editor is syntax highlighting.");
|
||||
ok(gEditor.getText().includes("First source!"),
|
||||
"Editor text contents appears to be correct.");
|
||||
|
||||
// Press ctrl+f with the cursor in a token
|
||||
gEditor.focus();
|
||||
gEditor.setCursor({ line: 3, ch: 10});
|
||||
synthesizeKeyFromKeyTag(gDebugger.document.getElementById("tokenSearchKey"));
|
||||
is(Filtering._searchbox.value, "#",
|
||||
"Search box is NOT prefilled with current token");
|
||||
}
|
||||
|
||||
function testSmallFile() {
|
||||
ok(gEditor.getText().length < gDebugger.DebuggerView.LARGE_FILE_SIZE,
|
||||
"Second source is considered a small file.");
|
||||
is(gEditor.getMode().name, "javascript",
|
||||
"Editor is syntax highlighting.");
|
||||
ok(gEditor.getText().includes("First source!"),
|
||||
"Editor text contents appears to be correct.");
|
||||
|
||||
// Press ctrl+f with the cursor in a token
|
||||
gEditor.focus();
|
||||
gEditor.setCursor({ line: 3, ch: 10});
|
||||
synthesizeKeyFromKeyTag(gDebugger.document.getElementById("tokenSearchKey"));
|
||||
is(Filtering._searchbox.value, "#test",
|
||||
"Search box is prefilled with current token");
|
||||
}
|
||||
|
||||
Task.spawn(function* () {
|
||||
yield testLargeFile();
|
||||
|
||||
info("Making it appear as a small file and then reselecting 01.js");
|
||||
gDebugger.DebuggerView.LARGE_FILE_SIZE = 1000;
|
||||
gSources.selectedIndex = 1;
|
||||
yield waitForSourceShown(gPanel, "-02.js");
|
||||
gSources.selectedIndex = 0;
|
||||
yield waitForSourceShown(gPanel, "-01.js");
|
||||
|
||||
yield testSmallFile();
|
||||
|
||||
closeDebuggerAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue