зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to graphics
MozReview-Commit-ID: 2CbNs260zlf
This commit is contained in:
Коммит
0a0a696241
|
@ -134,7 +134,6 @@ devtools/server/actors/stylesheets.js
|
|||
devtools/server/tests/browser/storage-*.html
|
||||
!devtools/server/tests/browser/storage-unsecured-iframe.html
|
||||
devtools/server/tests/browser/stylesheets-nested-iframes.html
|
||||
devtools/server/tests/mochitest/**
|
||||
devtools/server/tests/unit/**
|
||||
devtools/shared/platform/content/test/test_clipboard.html
|
||||
devtools/shared/qrcode/tests/mochitest/test_decode.html
|
||||
|
@ -158,6 +157,7 @@ devtools/shared/sprintfjs/*
|
|||
devtools/shared/qrcode/decoder/*
|
||||
devtools/shared/qrcode/encoder/*
|
||||
devtools/client/shared/demangle.js
|
||||
devtools/client/shared/source-map/*
|
||||
devtools/client/shared/vendor/*
|
||||
devtools/client/sourceeditor/codemirror/*.js
|
||||
devtools/client/sourceeditor/codemirror/**/*.js
|
||||
|
|
|
@ -329,20 +329,27 @@ NotificationController::CoalesceMutationEvents()
|
|||
// queue, so we want to use the spot of the event with the higher
|
||||
// generation number, and keep that generation number.
|
||||
if (reorder && reorder->EventGeneration() < event->EventGeneration()) {
|
||||
// There really should be a show or hide event before the first
|
||||
// reorder event.
|
||||
if (reorder->PrevEvent()) {
|
||||
reorder->PrevEvent()->SetNextEvent(reorder->NextEvent());
|
||||
} else {
|
||||
mFirstMutationEvent = reorder->NextEvent();
|
||||
}
|
||||
|
||||
reorder->NextEvent()->SetPrevEvent(reorder->PrevEvent());
|
||||
event->PrevEvent()->SetNextEvent(reorder);
|
||||
reorder->SetPrevEvent(event->PrevEvent());
|
||||
event->SetPrevEvent(reorder);
|
||||
reorder->SetNextEvent(event);
|
||||
reorder->SetEventGeneration(event->EventGeneration());
|
||||
|
||||
// It may be true that reorder was before event, and we coalesced
|
||||
// away all the show / hide events between them. In that case
|
||||
// event is already immediately after reorder in the queue and we
|
||||
// do not need to rearrange the list of events.
|
||||
if (event != reorder->NextEvent()) {
|
||||
// There really should be a show or hide event before the first
|
||||
// reorder event.
|
||||
if (reorder->PrevEvent()) {
|
||||
reorder->PrevEvent()->SetNextEvent(reorder->NextEvent());
|
||||
} else {
|
||||
mFirstMutationEvent = reorder->NextEvent();
|
||||
}
|
||||
|
||||
reorder->NextEvent()->SetPrevEvent(reorder->PrevEvent());
|
||||
event->PrevEvent()->SetNextEvent(reorder);
|
||||
reorder->SetPrevEvent(event->PrevEvent());
|
||||
event->SetPrevEvent(reorder);
|
||||
reorder->SetNextEvent(event);
|
||||
}
|
||||
}
|
||||
DropMutationEvent(event);
|
||||
break;
|
||||
|
|
|
@ -360,8 +360,7 @@ HistoryDownloadElementShell.prototype = {
|
|||
DownloadsCommon.removeAndFinalizeDownload(this.download);
|
||||
}
|
||||
if (this._historyDownload) {
|
||||
let uri = NetUtil.newURI(this.download.source.url);
|
||||
PlacesUtils.bhistory.removePage(uri);
|
||||
PlacesUtils.history.remove(this.download.source.url);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1204,8 +1204,7 @@ DownloadsViewItem.prototype = {
|
|||
|
||||
cmd_delete() {
|
||||
DownloadsCommon.removeAndFinalizeDownload(this.download);
|
||||
PlacesUtils.bhistory.removePage(
|
||||
NetUtil.newURI(this.download.source.url));
|
||||
PlacesUtils.history.remove(this.download.source.url).catch(Cu.reportError);
|
||||
},
|
||||
|
||||
downloadsCmd_unblock() {
|
||||
|
|
|
@ -58,8 +58,10 @@ function getTree(rootGuid, onlyChildren) {
|
|||
let children = root.children || [];
|
||||
return children.map(child => convert(child, root));
|
||||
}
|
||||
let treenode = convert(root, null);
|
||||
treenode.parentId = root.parentGuid;
|
||||
// It seems like the array always just contains the root node.
|
||||
return [convert(root, null)];
|
||||
return [treenode];
|
||||
}).catch(e => Promise.reject({message: e.message}));
|
||||
}
|
||||
|
||||
|
|
|
@ -517,7 +517,7 @@ MenuItem.prototype = {
|
|||
}
|
||||
|
||||
let docPattern = this.documentUrlMatchPattern;
|
||||
let pageURI = Services.io.newURI(contextData.pageUrl);
|
||||
let pageURI = Services.io.newURI(contextData[contextData.inFrame ? "frameUrl" : "pageUrl"]);
|
||||
if (docPattern && !docPattern.matches(pageURI)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ support-files =
|
|||
head_pageAction.js
|
||||
head_sessions.js
|
||||
context.html
|
||||
context_frame.html
|
||||
ctxmenu-image.png
|
||||
context_tabs_onUpdated_page.html
|
||||
context_tabs_onUpdated_iframe.html
|
||||
|
@ -120,6 +121,7 @@ support-files =
|
|||
[browser_ext_tabs_zoom.js]
|
||||
[browser_ext_tabs_update_url.js]
|
||||
[browser_ext_themes_icons.js]
|
||||
[browser_ext_themes_validation.js]
|
||||
[browser_ext_topwindowid.js]
|
||||
[browser_ext_url_overrides_newtab.js]
|
||||
[browser_ext_url_overrides_home.js]
|
||||
|
|
|
@ -52,10 +52,16 @@ add_task(function* () {
|
|||
// Test menu items using documentUrlPatterns.
|
||||
browser.contextMenus.create({
|
||||
title: "documentUrlPatterns-patternMatches-contextAll",
|
||||
documentUrlPatterns: ["*://*/*context.html"],
|
||||
documentUrlPatterns: ["*://*/*context*.html"],
|
||||
contexts: ["all"],
|
||||
});
|
||||
|
||||
browser.contextMenus.create({
|
||||
title: "documentUrlPatterns-patternMatches-contextFrame",
|
||||
documentUrlPatterns: ["*://*/*context_frame.html"],
|
||||
contexts: ["frame"],
|
||||
});
|
||||
|
||||
browser.contextMenus.create({
|
||||
title: "documentUrlPatterns-patternMatches-contextImage",
|
||||
documentUrlPatterns: ["*://*/*context.html", "http://*/url-that-does-not-match"],
|
||||
|
@ -249,6 +255,14 @@ add_task(function* () {
|
|||
yield confirmContextMenuItems(contextMenu, expected);
|
||||
yield closeContextMenu();
|
||||
|
||||
contextMenu = yield openContextMenuInFrame("frame");
|
||||
expected = [
|
||||
["documentUrlPatterns-patternMatches-contextAll", true],
|
||||
["documentUrlPatterns-patternMatches-contextFrame", true],
|
||||
];
|
||||
yield confirmContextMenuItems(contextMenu, expected);
|
||||
yield closeContextMenu();
|
||||
|
||||
yield extension.unload();
|
||||
yield BrowserTestUtils.removeTab(tab1);
|
||||
});
|
||||
|
|
|
@ -116,7 +116,8 @@ add_task(function* testExecuteScript() {
|
|||
}).then(result => {
|
||||
browser.test.fail("Expected error when returning non-structured-clonable object");
|
||||
}, error => {
|
||||
browser.test.assertEq("Script returned non-structured-clonable data",
|
||||
browser.test.assertEq("<anonymous code>", error.fileName, "Got expected fileName");
|
||||
browser.test.assertEq("Script '<anonymous code>' result is non-structured-clonable data",
|
||||
error.message, "Got expected error");
|
||||
}),
|
||||
|
||||
|
@ -125,10 +126,21 @@ add_task(function* testExecuteScript() {
|
|||
}).then(result => {
|
||||
browser.test.fail("Expected error when returning non-structured-clonable object");
|
||||
}, error => {
|
||||
browser.test.assertEq("Script returned non-structured-clonable data",
|
||||
browser.test.assertEq("<anonymous code>", error.fileName, "Got expected fileName");
|
||||
browser.test.assertEq("Script '<anonymous code>' result is non-structured-clonable data",
|
||||
error.message, "Got expected error");
|
||||
}),
|
||||
|
||||
browser.tabs.executeScript({
|
||||
file: "script3.js",
|
||||
}).then(result => {
|
||||
browser.test.fail("Expected error when returning non-structured-clonable object");
|
||||
}, error => {
|
||||
const expected = /Script '.*script3.js' result is non-structured-clonable data/;
|
||||
browser.test.assertTrue(expected.test(error.message), "Got expected error");
|
||||
browser.test.assertTrue(error.fileName.endsWith("script3.js"), "Got expected fileName");
|
||||
}),
|
||||
|
||||
browser.tabs.executeScript({
|
||||
frameId: Number.MAX_SAFE_INTEGER,
|
||||
code: "42",
|
||||
|
@ -236,6 +248,8 @@ add_task(function* testExecuteScript() {
|
|||
},
|
||||
|
||||
"script2.js": "27",
|
||||
|
||||
"script3.js": "window",
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
"use strict";
|
||||
|
||||
add_task(function* setup() {
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.webextensions.themes.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Helper function for testing a theme with invalid properties.
|
||||
* @param {object} invalidProps The invalid properties to load the theme with.
|
||||
*/
|
||||
function* testThemeWithInvalidProperties(invalidProps) {
|
||||
let manifest = {
|
||||
"theme": {},
|
||||
};
|
||||
|
||||
invalidProps.forEach(prop => {
|
||||
// Some properties require additional information:
|
||||
switch (prop) {
|
||||
case "background":
|
||||
manifest[prop] = {"scripts": ["background.js"]};
|
||||
break;
|
||||
case "permissions":
|
||||
manifest[prop] = ["tabs"];
|
||||
break;
|
||||
case "omnibox":
|
||||
manifest[prop] = {"keyword": "test"};
|
||||
break;
|
||||
default:
|
||||
manifest[prop] = {};
|
||||
}
|
||||
});
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({manifest});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
let waitForConsole = new Promise(resolve => {
|
||||
SimpleTest.monitorConsole(resolve, [{
|
||||
message: /Reading manifest: Themes defined in the manifest may only contain static resources/,
|
||||
}]);
|
||||
});
|
||||
|
||||
yield Assert.rejects(extension.startup(), null, "Theme should fail to load if it contains invalid properties");
|
||||
|
||||
SimpleTest.endMonitorConsole();
|
||||
yield waitForConsole;
|
||||
}
|
||||
|
||||
add_task(function* test_that_theme_with_invalid_properties_fails_to_load() {
|
||||
let invalidProps = ["page_action", "browser_action", "background", "permissions", "omnibox", "commands"];
|
||||
for (let prop in invalidProps) {
|
||||
yield testThemeWithInvalidProperties([prop]);
|
||||
}
|
||||
yield testThemeWithInvalidProperties(invalidProps);
|
||||
});
|
|
@ -20,5 +20,6 @@
|
|||
<input type="text" id="edit-me"><br>
|
||||
<input type="password" id="password">
|
||||
</p>
|
||||
<iframe id="frame" src="context_frame.html"/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
Just some text
|
||||
</body>
|
||||
</html>
|
|
@ -16,7 +16,7 @@
|
|||
* getListStyleImage getPanelForNode
|
||||
* awaitExtensionPanel awaitPopupResize
|
||||
* promiseContentDimensions alterContent
|
||||
* promisePrefChangeObserved
|
||||
* promisePrefChangeObserved openContextMenuInFrame
|
||||
*/
|
||||
|
||||
const {AppConstants} = Cu.import("resource://gre/modules/AppConstants.jsm", {});
|
||||
|
@ -232,6 +232,16 @@ function closeBrowserAction(extension, win = window) {
|
|||
return Promise.resolve();
|
||||
}
|
||||
|
||||
async function openContextMenuInFrame(frameId) {
|
||||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
|
||||
let doc = gBrowser.selectedBrowser.contentDocument;
|
||||
let frame = doc.getElementById(frameId);
|
||||
EventUtils.synthesizeMouseAtCenter(frame.contentDocument.body, {type: "contextmenu"}, frame.contentWindow);
|
||||
await popupShownPromise;
|
||||
return contentAreaContextMenu;
|
||||
}
|
||||
|
||||
async function openContextMenu(selector = "#img1") {
|
||||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
|
||||
|
|
|
@ -287,6 +287,7 @@ add_task(async function test_bookmarks() {
|
|||
}).then(results => {
|
||||
browser.test.assertEq(1, results.length, "Expected number of nodes returned by getSubTree");
|
||||
browser.test.assertEq("Mozilla Folder", results[0].title, "Folder has the expected title");
|
||||
browser.test.assertEq(bookmarkGuids.unfiledGuid, results[0].parentId, "Folder has the expected parentId");
|
||||
let children = results[0].children;
|
||||
browser.test.assertEq(4, children.length, "Expected number of bookmarks returned by getSubTree");
|
||||
browser.test.assertEq("Firefox", children[0].title, "Bookmark has the expected title");
|
||||
|
|
|
@ -23,10 +23,6 @@ const RELOAD_ACTION_REMOVE = 2;
|
|||
// rows.
|
||||
const RELOAD_ACTION_MOVE = 3;
|
||||
|
||||
// When removing a bunch of pages we split them in chunks to give some breath
|
||||
// to the main-thread.
|
||||
const REMOVE_PAGES_CHUNKLEN = 300;
|
||||
|
||||
/**
|
||||
* Represents an insertion point within a container where we can insert
|
||||
* items.
|
||||
|
@ -892,7 +888,7 @@ PlacesController.prototype = {
|
|||
PlacesUtils.asQuery(node.parent).queryOptions.queryType ==
|
||||
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
|
||||
// This is a uri node inside an history query.
|
||||
PlacesUtils.bhistory.removePage(NetUtil.newURI(node.uri));
|
||||
PlacesUtils.history.removePage(node.uri).catch(Components.utils.reportError);
|
||||
// History deletes are not undoable, so we don't have a transaction.
|
||||
} else if (node.itemId == -1 &&
|
||||
PlacesUtils.nodeIsQuery(node) &&
|
||||
|
@ -945,21 +941,17 @@ PlacesController.prototype = {
|
|||
}),
|
||||
|
||||
/**
|
||||
* Removes the set of selected ranges from history.
|
||||
* Removes the set of selected ranges from history, asynchronously.
|
||||
*
|
||||
* @note history deletes are not undoable.
|
||||
*/
|
||||
_removeRowsFromHistory: function PC__removeRowsFromHistory() {
|
||||
let nodes = this._view.selectedNodes;
|
||||
let URIs = [];
|
||||
let URIs = new Set();
|
||||
for (let i = 0; i < nodes.length; ++i) {
|
||||
let node = nodes[i];
|
||||
if (PlacesUtils.nodeIsURI(node)) {
|
||||
let uri = NetUtil.newURI(node.uri);
|
||||
// Avoid duplicates.
|
||||
if (URIs.indexOf(uri) < 0) {
|
||||
URIs.push(uri);
|
||||
}
|
||||
URIs.add(node.uri);
|
||||
} else if (PlacesUtils.nodeIsQuery(node) &&
|
||||
PlacesUtils.asQuery(node).queryOptions.queryType ==
|
||||
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
|
||||
|
@ -967,18 +959,7 @@ PlacesController.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
// Do removal in chunks to give some breath to main-thread.
|
||||
function* pagesChunkGenerator(aURIs) {
|
||||
while (aURIs.length) {
|
||||
let URIslice = aURIs.splice(0, REMOVE_PAGES_CHUNKLEN);
|
||||
PlacesUtils.bhistory.removePages(URIslice, URIslice.length);
|
||||
Services.tm.mainThread.dispatch(() => gen.next(),
|
||||
Ci.nsIThread.DISPATCH_NORMAL);
|
||||
yield undefined;
|
||||
}
|
||||
}
|
||||
let gen = pagesChunkGenerator(URIs);
|
||||
gen.next();
|
||||
PlacesUtils.history.remove([...URIs]).catch(Components.utils.reportError);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,6 +41,26 @@
|
|||
* Ensures that history views are updated after deleting entries.
|
||||
*/
|
||||
|
||||
function promiseURIDeleted() {
|
||||
return new Promise(resolve => {
|
||||
let historyObserver = {
|
||||
onBeginUpdateBatch: function PEX_onBeginUpdateBatch() {},
|
||||
onEndUpdateBatch: function PEX_onEndUpdateBatch() {},
|
||||
onClearHistory() {},
|
||||
onVisit() {},
|
||||
onTitleChanged() {},
|
||||
onDeleteURI(aURI, aGUID, aReason) {
|
||||
PlacesUtils.history.removeObserver(historyObserver);
|
||||
resolve();
|
||||
},
|
||||
onPageChanged() {},
|
||||
onDeleteVisits(aURI, aTime) { },
|
||||
};
|
||||
|
||||
PlacesUtils.history.addObserver(historyObserver, false);
|
||||
});
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -106,10 +126,12 @@
|
|||
for (let i = 0; i < rc; i++) {
|
||||
selection.select(0);
|
||||
let node = tree.selectedNode;
|
||||
let promiseDeleted = promiseURIDeleted();
|
||||
tree.controller.remove("Removing page");
|
||||
yield promiseDeleted;
|
||||
ok(treeView.treeIndexForNode(node) == Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE,
|
||||
node.uri + " removed.");
|
||||
ok(treeView.rowCount == rc - i - 1, "Rows count decreased");
|
||||
is(treeView.rowCount, rc - i - 1, "Rows count decreased");
|
||||
}
|
||||
|
||||
// Cleanup.
|
||||
|
|
|
@ -70,6 +70,7 @@ support-files =
|
|||
[browser_async_duplicate_tab.js]
|
||||
[browser_async_flushes.js]
|
||||
run-if = e10s && crashreporter
|
||||
skip-if = debug # bug 1167933
|
||||
[browser_async_remove_tab.js]
|
||||
run-if = e10s
|
||||
[browser_attributes.js]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 1.7.359
|
||||
Current extension version is: 1.7.367
|
||||
|
|
|
@ -3667,8 +3667,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
|
|||
}
|
||||
};
|
||||
}();
|
||||
exports.version = '1.7.359';
|
||||
exports.build = 'd471e356';
|
||||
exports.version = '1.7.367';
|
||||
exports.build = 'f0c45f03';
|
||||
exports.getDocument = getDocument;
|
||||
exports.PDFDataRangeTransport = PDFDataRangeTransport;
|
||||
exports.PDFWorker = PDFWorker;
|
||||
|
@ -4685,8 +4685,8 @@ if (!globalScope.PDFJS) {
|
|||
globalScope.PDFJS = {};
|
||||
}
|
||||
var PDFJS = globalScope.PDFJS;
|
||||
PDFJS.version = '1.7.359';
|
||||
PDFJS.build = 'd471e356';
|
||||
PDFJS.version = '1.7.367';
|
||||
PDFJS.build = 'f0c45f03';
|
||||
PDFJS.pdfBug = false;
|
||||
if (PDFJS.verbosity !== undefined) {
|
||||
sharedUtil.setVerbosityLevel(PDFJS.verbosity);
|
||||
|
@ -7051,7 +7051,7 @@ var TilingPattern = function TilingPatternClosure() {
|
|||
0,
|
||||
0
|
||||
];
|
||||
this.bbox = IR[4];
|
||||
this.bbox = Util.normalizeRect(IR[4]);
|
||||
this.xstep = IR[5];
|
||||
this.ystep = IR[6];
|
||||
this.paintType = IR[7];
|
||||
|
@ -7135,7 +7135,7 @@ var TilingPattern = function TilingPatternClosure() {
|
|||
this.ctx.scale(1 / scale[0], 1 / scale[1]);
|
||||
},
|
||||
clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) {
|
||||
if (bbox && isArray(bbox) && bbox.length === 4) {
|
||||
if (isArray(bbox) && bbox.length === 4) {
|
||||
var bboxWidth = x1 - x0;
|
||||
var bboxHeight = y1 - y0;
|
||||
graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);
|
||||
|
@ -7186,8 +7186,8 @@ exports.TilingPattern = TilingPattern;
|
|||
|
||||
"use strict";
|
||||
|
||||
var pdfjsVersion = '1.7.359';
|
||||
var pdfjsBuild = 'd471e356';
|
||||
var pdfjsVersion = '1.7.367';
|
||||
var pdfjsBuild = 'f0c45f03';
|
||||
var pdfjsSharedUtil = __w_pdfjs_require__(0);
|
||||
var pdfjsDisplayGlobal = __w_pdfjs_require__(8);
|
||||
var pdfjsDisplayAPI = __w_pdfjs_require__(3);
|
||||
|
|
|
@ -19175,7 +19175,7 @@ var CFFParser = function CFFParserClosure() {
|
|||
return cffDict;
|
||||
},
|
||||
parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
|
||||
if (state.callDepth > MAX_SUBR_NESTING) {
|
||||
if (!data || state.callDepth > MAX_SUBR_NESTING) {
|
||||
return false;
|
||||
}
|
||||
var stackSize = state.stackSize;
|
||||
|
@ -19241,7 +19241,7 @@ var CFFParser = function CFFParserClosure() {
|
|||
bias = 1131;
|
||||
}
|
||||
var subrNumber = stack[--stackSize] + bias;
|
||||
if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
|
||||
if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
|
||||
validationCommand = CharstringValidationData[value];
|
||||
warn('Out of bounds subrIndex for ' + validationCommand.id);
|
||||
return false;
|
||||
|
@ -49132,8 +49132,8 @@ exports.Type1Parser = Type1Parser;
|
|||
|
||||
"use strict";
|
||||
|
||||
var pdfjsVersion = '1.7.359';
|
||||
var pdfjsBuild = 'd471e356';
|
||||
var pdfjsVersion = '1.7.367';
|
||||
var pdfjsBuild = 'f0c45f03';
|
||||
var pdfjsCoreWorker = __w_pdfjs_require__(17);
|
||||
;
|
||||
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
|
||||
|
|
|
@ -72,13 +72,13 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||
<div id="mainContainer">
|
||||
<div class="findbar hidden doorHanger" id="findbar">
|
||||
<div id="findbarInputContainer">
|
||||
<input id="findInput" class="toolbarField" title="Find" placeholder="Find in document" tabindex="91" data-l10n-id="find_input">
|
||||
<input id="findInput" class="toolbarField" title="Find" placeholder="Find in document…" tabindex="91" data-l10n-id="find_input">
|
||||
<div class="splitToolbarButton">
|
||||
<button class="toolbarButton findPrevious" title="" id="findPrevious" tabindex="92" data-l10n-id="find_previous">
|
||||
<button id="findPrevious" class="toolbarButton findPrevious" title="Find the previous occurrence of the phrase" tabindex="92" data-l10n-id="find_previous">
|
||||
<span data-l10n-id="find_previous_label">Previous</span>
|
||||
</button>
|
||||
<div class="splitToolbarButtonSeparator"></div>
|
||||
<button class="toolbarButton findNext" title="" id="findNext" tabindex="93" data-l10n-id="find_next">
|
||||
<button id="findNext" class="toolbarButton findNext" title="Find the next occurrence of the phrase" tabindex="93" data-l10n-id="find_next">
|
||||
<span data-l10n-id="find_next_label">Next</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -160,7 +160,7 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||
</button>
|
||||
<div class="toolbarButtonSpacer"></div>
|
||||
<button id="viewFind" class="toolbarButton" title="Find in Document" tabindex="12" data-l10n-id="findbar">
|
||||
<span data-l10n-id="findbar_label">Find</span>
|
||||
<span data-l10n-id="findbar_label">Find</span>
|
||||
</button>
|
||||
<div class="splitToolbarButton hiddenSmallView">
|
||||
<button class="toolbarButton pageUp" title="Previous Page" id="previous" tabindex="13" data-l10n-id="previous">
|
||||
|
|
|
@ -504,10 +504,12 @@ exports.localized = localized;
|
|||
{
|
||||
var pdfjsLib;
|
||||
if (typeof __pdfjsdev_webpack__ === 'undefined') {
|
||||
if (typeof require === 'function') {
|
||||
if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) {
|
||||
pdfjsLib = window['pdfjs-dist/build/pdf'];
|
||||
} else if (typeof require === 'function') {
|
||||
pdfjsLib = require('../build/pdf.js');
|
||||
} else {
|
||||
pdfjsLib = window['pdfjs-dist/build/pdf'];
|
||||
throw new Error('Neither `require` nor `window` found');
|
||||
}
|
||||
}
|
||||
module.exports = pdfjsLib;
|
||||
|
|
|
@ -491,12 +491,13 @@ geolocation.shareWithSite3=Will you allow %S to access your location?
|
|||
geolocation.shareWithFile3=Will you allow this local file to access your location?
|
||||
geolocation.remember=Remember this decision
|
||||
|
||||
webNotifications.remember=Remember this decision
|
||||
webNotifications.rememberForSession=Remember decision for this session
|
||||
webNotifications.allow=Allow Notifications
|
||||
webNotifications.allow.accesskey=A
|
||||
webNotifications.dontAllow=Don’t Allow
|
||||
webNotifications.dontAllow.accesskey=n
|
||||
webNotifications.notNow=Not Now
|
||||
webNotifications.notNow.accesskey=n
|
||||
webNotifications.never=Never Allow
|
||||
webNotifications.neverForSession=Never For This Session
|
||||
webNotifications.never.accesskey=v
|
||||
webNotifications.receiveFromSite2=Will you allow %S to send notifications?
|
||||
# LOCALIZATION NOTE (webNotifications.upgradeTitle): When using native notifications on OS X, the title may be truncated around 32 characters.
|
||||
webNotifications.upgradeTitle=Upgraded notifications
|
||||
|
|
|
@ -301,7 +301,8 @@ this.PermissionPromptPrototype = {
|
|||
if (this.permissionKey) {
|
||||
|
||||
// Permanently store permission.
|
||||
if (state && state.checkboxChecked) {
|
||||
if ((state && state.checkboxChecked) ||
|
||||
promptAction.scope == SitePermissions.SCOPE_PERSISTENT) {
|
||||
let scope = SitePermissions.SCOPE_PERSISTENT;
|
||||
// Only remember permission for session if in PB mode.
|
||||
if (PrivateBrowsingUtils.isBrowserPrivate(this.browser)) {
|
||||
|
@ -539,22 +540,8 @@ DesktopNotificationPermissionPrompt.prototype = {
|
|||
let learnMoreURL =
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL") + "push";
|
||||
|
||||
let checkbox = {
|
||||
show: true,
|
||||
checked: true,
|
||||
label: gBrowserBundle.GetStringFromName("webNotifications.remember")
|
||||
};
|
||||
|
||||
// In PB mode, the "always remember" checkbox should only remember for the
|
||||
// session.
|
||||
if (PrivateBrowsingUtils.isWindowPrivate(this.browser.ownerGlobal)) {
|
||||
checkbox.label =
|
||||
gBrowserBundle.GetStringFromName("webNotifications.rememberForSession");
|
||||
}
|
||||
|
||||
return {
|
||||
learnMoreURL,
|
||||
checkbox,
|
||||
displayURI: false
|
||||
};
|
||||
},
|
||||
|
@ -583,13 +570,23 @@ DesktopNotificationPermissionPrompt.prototype = {
|
|||
accessKey:
|
||||
gBrowserBundle.GetStringFromName("webNotifications.allow.accesskey"),
|
||||
action: SitePermissions.ALLOW,
|
||||
scope: SitePermissions.SCOPE_PERSISTENT,
|
||||
},
|
||||
{
|
||||
label: gBrowserBundle.GetStringFromName("webNotifications.dontAllow"),
|
||||
label: gBrowserBundle.GetStringFromName("webNotifications.notNow"),
|
||||
accessKey:
|
||||
gBrowserBundle.GetStringFromName("webNotifications.dontAllow.accesskey"),
|
||||
gBrowserBundle.GetStringFromName("webNotifications.notNow.accesskey"),
|
||||
action: SitePermissions.BLOCK,
|
||||
},
|
||||
{
|
||||
label: PrivateBrowsingUtils.isBrowserPrivate(this.browser) ?
|
||||
gBrowserBundle.GetStringFromName("webNotifications.neverForSession") :
|
||||
gBrowserBundle.GetStringFromName("webNotifications.never"),
|
||||
accessKey:
|
||||
gBrowserBundle.GetStringFromName("webNotifications.never.accesskey"),
|
||||
action: SitePermissions.BLOCK,
|
||||
scope: SitePermissions.SCOPE_PERSISTENT,
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
|
|
@ -50,8 +50,11 @@ function* testPrompt(Prompt) {
|
|||
let popupNotification = getPopupNotificationNode();
|
||||
popupNotification.checkbox.checked = false;
|
||||
|
||||
Assert.equal(notification.secondaryActions.length, 1,
|
||||
"There should only be 1 secondary action");
|
||||
let isNotificationPrompt = Prompt == PermissionUI.DesktopNotificationPermissionPrompt;
|
||||
|
||||
let expectedSecondaryActionsCount = isNotificationPrompt ? 2 : 1;
|
||||
Assert.equal(notification.secondaryActions.length, expectedSecondaryActionsCount,
|
||||
"There should only be " + expectedSecondaryActionsCount + " secondary action(s)");
|
||||
yield clickSecondaryAction();
|
||||
curPerm = SitePermissions.get(principal.URI, permissionKey, browser);
|
||||
Assert.deepEqual(curPerm, {
|
||||
|
@ -73,13 +76,19 @@ function* testPrompt(Prompt) {
|
|||
TestPrompt.prompt();
|
||||
yield shownPromise;
|
||||
|
||||
// Test denying the permission request with the checkbox checked.
|
||||
// Test denying the permission request with the checkbox checked (for geolocation)
|
||||
// or by clicking the "never" option from the dropdown (for notifications).
|
||||
popupNotification = getPopupNotificationNode();
|
||||
popupNotification.checkbox.checked = true;
|
||||
let secondaryActionToClickIndex = 0;
|
||||
if (isNotificationPrompt) {
|
||||
secondaryActionToClickIndex = 1;
|
||||
} else {
|
||||
popupNotification.checkbox.checked = true;
|
||||
}
|
||||
|
||||
Assert.equal(notification.secondaryActions.length, 1,
|
||||
"There should only be 1 secondary action");
|
||||
yield clickSecondaryAction();
|
||||
Assert.equal(notification.secondaryActions.length, expectedSecondaryActionsCount,
|
||||
"There should only be " + expectedSecondaryActionsCount + " secondary action(s)");
|
||||
yield clickSecondaryAction(secondaryActionToClickIndex);
|
||||
curPerm = SitePermissions.get(principal.URI, permissionKey);
|
||||
Assert.deepEqual(curPerm, {
|
||||
state: SitePermissions.BLOCK,
|
||||
|
|
|
@ -178,16 +178,39 @@ function clickMainAction() {
|
|||
* For an opened PopupNotification, clicks on the secondary action,
|
||||
* and waits for the panel to fully close.
|
||||
*
|
||||
* @param actionIndex (Number)
|
||||
* The index of the secondary action to be clicked. The default
|
||||
* secondary action (the button shown directly in the panel) is
|
||||
* treated as having index 0.
|
||||
*
|
||||
* @return {Promise}
|
||||
* Resolves once the panel has fired the "popuphidden"
|
||||
* event.
|
||||
*/
|
||||
function clickSecondaryAction() {
|
||||
function clickSecondaryAction(actionIndex) {
|
||||
let removePromise =
|
||||
BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popuphidden");
|
||||
let popupNotification = getPopupNotificationNode();
|
||||
popupNotification.secondaryButton.click();
|
||||
return removePromise;
|
||||
if (!actionIndex) {
|
||||
popupNotification.secondaryButton.click();
|
||||
return removePromise;
|
||||
}
|
||||
|
||||
return Task.spawn(function* () {
|
||||
// Click the dropmarker arrow and wait for the menu to show up.
|
||||
let dropdownPromise =
|
||||
BrowserTestUtils.waitForEvent(popupNotification.menupopup, "popupshown");
|
||||
yield EventUtils.synthesizeMouseAtCenter(popupNotification.menubutton, {});
|
||||
yield dropdownPromise;
|
||||
|
||||
// The menuitems in the dropdown are accessible as direct children of the panel,
|
||||
// because they are injected into a <children> node in the XBL binding.
|
||||
// The target action is the menuitem at index actionIndex - 1, because the first
|
||||
// secondary action (index 0) is the button shown directly in the panel.
|
||||
let actionMenuItem = popupNotification.querySelectorAll("menuitem")[actionIndex - 1];
|
||||
yield EventUtils.synthesizeMouseAtCenter(actionMenuItem, {});
|
||||
yield removePromise;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -511,11 +511,10 @@ exports.ToolboxButtons = [
|
|||
osString == "Darwin" ? "Cmd+Opt+M" : "Ctrl+Shift+M"),
|
||||
isTargetSupported: target => target.isLocalTab,
|
||||
onClick(event, toolbox) {
|
||||
let browserWindow = toolbox.win.top;
|
||||
ResponsiveUIManager.handleGcliCommand(browserWindow,
|
||||
browserWindow.gBrowser.selectedTab,
|
||||
"resize toggle",
|
||||
null);
|
||||
let tab = toolbox.target.tab;
|
||||
let browserWindow = tab.ownerDocument.defaultView;
|
||||
ResponsiveUIManager.handleGcliCommand(browserWindow, tab,
|
||||
"resize toggle", null);
|
||||
},
|
||||
isChecked(toolbox) {
|
||||
if (!toolbox.target.tab) {
|
||||
|
|
|
@ -751,7 +751,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
|
||||
// Destroy toolboxes for closed window
|
||||
for (let [target, toolbox] of gDevTools._toolboxes) {
|
||||
if (toolbox.win.top == win) {
|
||||
if (target.tab && target.tab.ownerDocument.defaultView == win) {
|
||||
toolbox.destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ DIRS += [
|
|||
'components',
|
||||
'redux',
|
||||
'shim',
|
||||
'source-map',
|
||||
'vendor',
|
||||
'widgets',
|
||||
]
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
devtools-source-map is maintained on GitHub at:
|
||||
|
||||
https://github.com/devtools-html/devtools-core/tree/master/packages/devtools-source-map
|
||||
|
||||
All the files in this folder are copied from the above repository and
|
||||
should not be modified here.
|
||||
|
||||
For any issue or feature request on devtools-source-map, please log an issue at:
|
||||
|
||||
https://github.com/devtools-html/devtools-core/issues
|
||||
|
||||
and label it with "source-map".
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,10 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DevToolsModules(
|
||||
'index.js',
|
||||
'worker.js',
|
||||
)
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -15,6 +15,7 @@ const {
|
|||
} = require("./utils/markup");
|
||||
const {
|
||||
getCurrentZoom,
|
||||
getDisplayPixelRatio,
|
||||
setIgnoreLayoutChanges,
|
||||
getWindowDimensions,
|
||||
getMaxSurfaceSize,
|
||||
|
@ -28,6 +29,9 @@ const DEFAULT_GRID_COLOR = "#4B0082";
|
|||
const COLUMNS = "cols";
|
||||
const ROWS = "rows";
|
||||
|
||||
const GRID_FONT_SIZE = 10;
|
||||
const GRID_FONT_FAMILY = "sans-serif";
|
||||
|
||||
const GRID_LINES_PROPERTIES = {
|
||||
"edge": {
|
||||
lineDash: [0, 0],
|
||||
|
@ -879,19 +883,21 @@ CssGridHighlighter.prototype = extend(AutoRefreshHighlighter.prototype, {
|
|||
* The grid dimension type which is either the constant COLUMNS or ROWS.
|
||||
*/
|
||||
renderGridLineNumber(lineNumber, linePos, startPos, dimensionType) {
|
||||
let ratio = this.win.devicePixelRatio;
|
||||
let devicePixelRatio = this.win.devicePixelRatio;
|
||||
let displayPixelRatio = getDisplayPixelRatio(this.win);
|
||||
|
||||
linePos = Math.round(linePos * ratio);
|
||||
startPos = Math.round(startPos * ratio);
|
||||
linePos = Math.round(linePos * devicePixelRatio);
|
||||
startPos = Math.round(startPos * devicePixelRatio);
|
||||
|
||||
this.ctx.save();
|
||||
|
||||
let fontSize = (GRID_FONT_SIZE * displayPixelRatio);
|
||||
this.ctx.font = fontSize + "px " + GRID_FONT_FAMILY;
|
||||
|
||||
let textWidth = this.ctx.measureText(lineNumber).width;
|
||||
// Guess the font height based on the measured width
|
||||
let textHeight = textWidth * 2;
|
||||
|
||||
if (dimensionType === COLUMNS) {
|
||||
let yPos = Math.max(startPos, textHeight);
|
||||
let yPos = Math.max(startPos, fontSize);
|
||||
this.ctx.fillText(lineNumber, linePos, yPos);
|
||||
} else {
|
||||
let xPos = Math.max(startPos, textWidth);
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
"use strict";
|
||||
|
||||
// eslint-disable-next-line no-debugger
|
||||
debugger;
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
<head>
|
||||
<!-- Static (not dynamically inserted) inline script. -->
|
||||
<script id='franz'>function franz() { debugger; }</script>
|
||||
<script id='franz'>
|
||||
/* exported franz */
|
||||
"use strict";
|
||||
|
||||
function franz() {
|
||||
// eslint-disable-next-line no-debugger
|
||||
debugger;
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Static out-of-line script element. -->
|
||||
<script id='heinrich' src='Debugger.Source.prototype.element.js'></script>
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
function heinrichFun() { franz(); }
|
||||
/* exported heinrichFun */
|
||||
"use strict";
|
||||
|
||||
function heinrichFun() {
|
||||
franz();
|
||||
}
|
||||
|
|
|
@ -101,8 +101,10 @@
|
|||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = function() {
|
||||
window.opener.postMessage('ready', '*');
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
window.opener.postMessage("ready", "*");
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
var Cu = Components.utils;
|
||||
/* exported DirectorRegistryFront, DirectorManagerFront, Task,
|
||||
newConnectedDebuggerClient, purgeInstalledDirectorScripts */
|
||||
"use strict";
|
||||
|
||||
const Cu = Components.utils;
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {DebuggerClient} = require("devtools/shared/client/main");
|
||||
const {DebuggerServer} = require("devtools/server/main");
|
||||
|
@ -25,12 +29,12 @@ const { Task } = require("devtools/shared/task");
|
|||
**********************************/
|
||||
|
||||
function* newConnectedDebuggerClient(opts) {
|
||||
var transport = DebuggerServer.connectPipe();
|
||||
var client = new DebuggerClient(transport);
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
let client = new DebuggerClient(transport);
|
||||
|
||||
yield client.connect();
|
||||
|
||||
var root = yield client.listTabs();
|
||||
let root = yield client.listTabs();
|
||||
|
||||
return {
|
||||
client: client,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* exported HelloActor */
|
||||
"use strict";
|
||||
|
||||
const protocol = require("devtools/shared/protocol");
|
||||
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Inspector Eyedropper tests</title>
|
||||
<style>
|
||||
html {
|
||||
background: black;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = function() {
|
||||
window.opener.postMessage('ready', '*');
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Inspector Eyedropper tests</title>
|
||||
<style>
|
||||
html {
|
||||
background: black;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
window.opener.postMessage("ready", "*");
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/* exported attachURL, promiseDone, assertOwnershipTrees, checkMissing, checkAvailable,
|
||||
promiseOnce, isSrcChange, isUnretained, isNewRoot, assertSrcChange, assertUnload,
|
||||
assertFrameLoad, assertChildList, waitForMutation, addTest, addAsyncTest,
|
||||
runNextTest */
|
||||
"use strict";
|
||||
|
||||
var Cu = Components.utils;
|
||||
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
|
@ -15,7 +21,6 @@ SimpleTest.registerCleanupFunction(function () {
|
|||
Services.prefs.clearUserPref("devtools.debugger.log");
|
||||
});
|
||||
|
||||
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
|
@ -40,8 +45,8 @@ SimpleTest.registerCleanupFunction(function () {
|
|||
* and disconnect its debugger client.
|
||||
*/
|
||||
function attachURL(url, callback) {
|
||||
var win = window.open(url, "_blank");
|
||||
var client = null;
|
||||
let win = window.open(url, "_blank");
|
||||
let client = null;
|
||||
|
||||
let cleanup = () => {
|
||||
if (client) {
|
||||
|
@ -63,7 +68,8 @@ function attachURL(url, callback) {
|
|||
for (let tab of response.tabs) {
|
||||
if (tab.url === url) {
|
||||
window.removeEventListener("message", loadListener);
|
||||
client.attachTab(tab.actor, function (aResponse, aTabClient) {
|
||||
// eslint-disable-next-line max-nested-callbacks
|
||||
client.attachTab(tab.actor, function (_response, _tabClient) {
|
||||
try {
|
||||
callback(null, client, tab, win.document);
|
||||
} catch (ex) {
|
||||
|
@ -125,15 +131,18 @@ function serverOwnershipTree(walker) {
|
|||
|
||||
return {
|
||||
root: serverOwnershipSubtree(serverWalker, serverWalker.rootDoc),
|
||||
orphaned: [...serverWalker._orphaned].map(o => serverOwnershipSubtree(serverWalker, o.rawNode)),
|
||||
retained: [...serverWalker._retainedOrphans].map(o => serverOwnershipSubtree(serverWalker, o.rawNode))
|
||||
orphaned: [...serverWalker._orphaned]
|
||||
.map(o => serverOwnershipSubtree(serverWalker, o.rawNode)),
|
||||
retained: [...serverWalker._retainedOrphans]
|
||||
.map(o => serverOwnershipSubtree(serverWalker, o.rawNode))
|
||||
};
|
||||
}
|
||||
|
||||
function clientOwnershipSubtree(node) {
|
||||
return {
|
||||
name: node.actorID,
|
||||
children: sortOwnershipChildren(node.treeChildren().map(child => clientOwnershipSubtree(child)))
|
||||
children: sortOwnershipChildren(node.treeChildren()
|
||||
.map(child => clientOwnershipSubtree(child)))
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -156,7 +165,8 @@ function ownershipTreeSize(tree) {
|
|||
function assertOwnershipTrees(walker) {
|
||||
let serverTree = serverOwnershipTree(walker);
|
||||
let clientTree = clientOwnershipTree(walker);
|
||||
is(JSON.stringify(clientTree, null, " "), JSON.stringify(serverTree, null, " "), "Server and client ownership trees should match.");
|
||||
is(JSON.stringify(clientTree, null, " "), JSON.stringify(serverTree, null, " "),
|
||||
"Server and client ownership trees should match.");
|
||||
|
||||
return ownershipTreeSize(clientTree.root);
|
||||
}
|
||||
|
@ -189,14 +199,15 @@ function checkAvailable(client, actorID) {
|
|||
to: actorID,
|
||||
type: "garbageAvailableTest",
|
||||
}, response => {
|
||||
is(response.error, "unrecognizedPacketType", "node list actor should be contactable.");
|
||||
is(response.error, "unrecognizedPacketType",
|
||||
"node list actor should be contactable.");
|
||||
deferred.resolve(undefined);
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function promiseDone(promise) {
|
||||
promise.then(null, err => {
|
||||
function promiseDone(currentPromise) {
|
||||
currentPromise.then(null, err => {
|
||||
ok(false, "Promise failed: " + err);
|
||||
if (err.stack) {
|
||||
dump(err.stack);
|
||||
|
@ -207,10 +218,6 @@ function promiseDone(promise) {
|
|||
|
||||
// Mutation list testing
|
||||
|
||||
function isSrcChange(change) {
|
||||
return (change.type === "attributes" && change.attributeName === "src");
|
||||
}
|
||||
|
||||
function assertAndStrip(mutations, message, test) {
|
||||
let size = mutations.length;
|
||||
mutations = mutations.filter(test);
|
||||
|
@ -245,7 +252,8 @@ function isNewRoot(change) {
|
|||
// Make sure an iframe's src attribute changed and then
|
||||
// strip that mutation out of the list.
|
||||
function assertSrcChange(mutations) {
|
||||
return assertAndStrip(mutations, "Should have had an iframe source change.", isSrcChange);
|
||||
return assertAndStrip(mutations, "Should have had an iframe source change.",
|
||||
isSrcChange);
|
||||
}
|
||||
|
||||
// Make sure there's an unload in the mutation list and strip
|
||||
|
@ -285,7 +293,6 @@ function waitForMutation(walker, test, mutations = []) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
||||
var _tests = [];
|
||||
function addTest(test) {
|
||||
_tests.push(test);
|
||||
|
@ -300,7 +307,7 @@ function runNextTest() {
|
|||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
var fn = _tests.shift();
|
||||
let fn = _tests.shift();
|
||||
try {
|
||||
fn();
|
||||
} catch (ex) {
|
||||
|
|
|
@ -15,8 +15,10 @@
|
|||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = function() {
|
||||
window.opener.postMessage('ready', '*');
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
window.opener.postMessage("ready", "*");
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
|
@ -49,4 +51,4 @@
|
|||
|
||||
<div class="💩" id="💩" 💩="💩"></div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<html>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = () => {
|
||||
window.opener.postMessage('ready', '*')
|
||||
}
|
||||
window.opener.postMessage("ready", "*");
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.inheritable-rule {
|
||||
|
|
|
@ -18,26 +18,27 @@
|
|||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = function() {
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
// Set up a basic shadow DOM
|
||||
var host = document.querySelector('#shadow');
|
||||
let host = document.querySelector("#shadow");
|
||||
if (host.createShadowRoot) {
|
||||
var root = host.createShadowRoot();
|
||||
root.innerHTML = '<h3>Shadow <em>DOM</em></h3><select multiple></select>';
|
||||
let root = host.createShadowRoot();
|
||||
root.innerHTML = "<h3>Shadow <em>DOM</em></h3><select multiple></select>";
|
||||
}
|
||||
|
||||
// Put a copy of the body in an iframe to test frame traversal.
|
||||
var body = document.querySelector("body");
|
||||
var data = "data:text/html,<html>" + body.outerHTML + "<html>";
|
||||
var iframe = document.createElement("iframe");
|
||||
let body = document.querySelector("body");
|
||||
let data = "data:text/html,<html>" + body.outerHTML + "<html>";
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.setAttribute("id", "childFrame");
|
||||
iframe.onload = function() {
|
||||
window.opener.postMessage('ready', '*')
|
||||
iframe.onload = function () {
|
||||
window.opener.postMessage("ready", "*");
|
||||
};
|
||||
iframe.src = data;
|
||||
body.appendChild(iframe);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color:white">
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
<head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
window.onload = function() {
|
||||
window.opener.postMessage('ready', '*');
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
window.opener.postMessage("ready", "*");
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
<img class="small" src="small-image.gif">
|
||||
<img class="data" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAJklEQVRIie3NMREAAAgAoe9fWls4eAzMVM0xoVAoFAqFQqFQ+C9chp4NHvu+4Q4AAAAASUVORK5CYII=">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = () => {
|
||||
var canvas = document.querySelector("canvas"), ctx = canvas.getContext("2d");
|
||||
canvas.width = 1000;
|
||||
|
@ -14,8 +16,8 @@
|
|||
ctx.fillStyle = "red";
|
||||
ctx.fillRect(0, 0, 1000, 2000);
|
||||
|
||||
window.opener.postMessage('ready', '*')
|
||||
}
|
||||
window.opener.postMessage("ready", "*");
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
var Cu = Components.utils;
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
/* exported Task, startServerAndGetSelectedTabMemory, destroyServerAndFinish,
|
||||
waitForTime, waitUntil */
|
||||
"use strict";
|
||||
|
||||
var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const Cu = Components.utils;
|
||||
|
||||
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const Services = require("Services");
|
||||
const { Task } = require("devtools/shared/task");
|
||||
var Services = require("Services");
|
||||
var { DebuggerClient } = require("devtools/shared/client/main");
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
const { DebuggerClient } = require("devtools/shared/client/main");
|
||||
const { DebuggerServer } = require("devtools/server/main");
|
||||
|
||||
var { MemoryFront } = require("devtools/shared/fronts/memory");
|
||||
const { MemoryFront } = require("devtools/shared/fronts/memory");
|
||||
|
||||
// Always log packets when running tests.
|
||||
Services.prefs.setBoolPref("devtools.debugger.log", true);
|
||||
|
@ -19,13 +21,13 @@ SimpleTest.registerCleanupFunction(function () {
|
|||
function startServerAndGetSelectedTabMemory() {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
var client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
|
||||
return client.connect()
|
||||
.then(() => client.listTabs())
|
||||
.then(response => {
|
||||
var form = response.tabs[response.selected];
|
||||
var memory = MemoryFront(client, form, response);
|
||||
let form = response.tabs[response.selected];
|
||||
let memory = MemoryFront(client, form, response);
|
||||
|
||||
return { memory, client };
|
||||
});
|
||||
|
@ -48,5 +50,6 @@ function waitUntil(predicate) {
|
|||
if (predicate()) {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
return new Promise(resolve => setTimeout(() => waitUntil(predicate).then(() => resolve(true)), 10));
|
||||
return new Promise(resolve => setTimeout(() => waitUntil(predicate)
|
||||
.then(() => resolve(true)), 10));
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<script>
|
||||
var xhr = new XMLHttpRequest;
|
||||
"use strict";
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.timeout = 1742;
|
||||
xhr.expando = 'Expando!';
|
||||
xhr.expando = "Expando!";
|
||||
</script>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
const {Cc, Ci} = require("chrome");
|
||||
const cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"].
|
||||
getService(Ci.nsIMessageListenerManager);
|
||||
const cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageListenerManager);
|
||||
const { DebuggerServer } = require("devtools/server/main");
|
||||
|
||||
exports.setupChild = function (a, b, c) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var {Ci} = require("chrome");
|
||||
var Services = require("Services");
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ Debugger.Script.prototype.global should return innerize globals, not WindowProxi
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
||||
addDebuggerToGlobal(this);
|
||||
|
@ -21,27 +22,26 @@ addDebuggerToGlobal(this);
|
|||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.src = "data:text/html,<script>function glorp() { }<\/script>";
|
||||
iframe.onload = firstOnLoadHandler;
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
function firstOnLoadHandler() {
|
||||
var dbg = new Debugger;
|
||||
var iframeDO = dbg.addDebuggee(iframe.contentWindow);
|
||||
let dbg = new Debugger();
|
||||
let iframeDO = dbg.addDebuggee(iframe.contentWindow);
|
||||
|
||||
// For sanity: check that the debuggee global is the inner window,
|
||||
// and that the outer window gets a distinct D.O.
|
||||
var iframeWindowProxyDO = iframeDO.makeDebuggeeValue(iframe.contentWindow);
|
||||
let iframeWindowProxyDO = iframeDO.makeDebuggeeValue(iframe.contentWindow);
|
||||
ok(iframeDO !== iframeWindowProxyDO);
|
||||
|
||||
// The real test: Debugger.Script.prototype.global returns inner windows.
|
||||
ok(iframeDO.getOwnPropertyDescriptor('glorp').value.script.global === iframeDO);
|
||||
ok(iframeDO.getOwnPropertyDescriptor("glorp").value.script.global === iframeDO);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -15,6 +15,7 @@ element to which code is attached (if any), and how.
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
||||
addDebuggerToGlobal(this);
|
||||
|
@ -22,65 +23,65 @@ addDebuggerToGlobal(this);
|
|||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var log = '';
|
||||
var doc, dieter, ulrich, isolde, albrecht;
|
||||
var dbg, iframeDO, DOFor;
|
||||
let log = "";
|
||||
let doc, dieter, ulrich, isolde, albrecht;
|
||||
let dbg, iframeDO, DOFor;
|
||||
|
||||
// Create an iframe to debug.
|
||||
// We can't use a data: URL here, because we want to test script elements
|
||||
// that refer to the JavaScript via 'src' attributes, and data: documents
|
||||
// can't refer to those. So we use a separate HTML document.
|
||||
var iframe = document.createElement("iframe");
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.src = "Debugger.Source.prototype.element.html";
|
||||
iframe.onload = onLoadHandler;
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
function onLoadHandler() {
|
||||
log += 'l';
|
||||
log += "l";
|
||||
|
||||
// Now that the iframe's window has been created, we can add
|
||||
// it as a debuggee.
|
||||
dbg = new Debugger;
|
||||
dbg = new Debugger();
|
||||
dbg.onDebuggerStatement = franzDebuggerHandler;
|
||||
iframeDO = dbg.addDebuggee(iframe.contentWindow);
|
||||
DOFor = iframeDO.makeDebuggeeValue.bind(iframeDO);
|
||||
|
||||
// Send a click event to heidi.
|
||||
doc = iframe.contentWindow.document;
|
||||
doc.getElementById('heidi').dispatchEvent(new Event('click'));
|
||||
doc.getElementById("heidi").dispatchEvent(new Event("click"));
|
||||
}
|
||||
|
||||
function franzDebuggerHandler(frame) {
|
||||
log += 'f';
|
||||
log += "f";
|
||||
|
||||
// The top stack frame should be franz, belonging to the script element.
|
||||
ok(frame.callee.displayName === 'franz', 'top frame is franz');
|
||||
ok(frame.script.source.element === DOFor(doc.getElementById('franz')),
|
||||
'top frame source belongs to element franz');
|
||||
ok(frame.callee.displayName === "franz", "top frame is franz");
|
||||
ok(frame.script.source.element === DOFor(doc.getElementById("franz")),
|
||||
"top frame source belongs to element franz");
|
||||
ok(frame.script.source.elementAttributeName === undefined,
|
||||
"top frame source doesn't belong to an attribute");
|
||||
|
||||
// The second stack frame should belong to heinrich.
|
||||
ok(frame.older.script.source.element === DOFor(doc.getElementById('heinrich')),
|
||||
ok(frame.older.script.source.element === DOFor(doc.getElementById("heinrich")),
|
||||
"second frame source belongs to element heinrich");
|
||||
ok(frame.older.script.source.elementAttributeName === undefined,
|
||||
"second frame source doesn't belong to an attribute");
|
||||
|
||||
// The next stack frame should belong to heidi's onclick handler.
|
||||
ok(frame.older.older.script.source.element === DOFor(doc.getElementById('heidi')),
|
||||
'third frame source belongs to element heidi');
|
||||
ok(frame.older.older.script.source.elementAttributeName === 'onclick',
|
||||
ok(frame.older.older.script.source.element === DOFor(doc.getElementById("heidi")),
|
||||
"third frame source belongs to element heidi");
|
||||
ok(frame.older.older.script.source.elementAttributeName === "onclick",
|
||||
"third frame source belongs to 'onclick' attribute");
|
||||
|
||||
// Try a dynamically inserted inline script element.
|
||||
ulrich = doc.createElement('script');
|
||||
ulrich.text = 'debugger;'
|
||||
ulrich = doc.createElement("script");
|
||||
ulrich.text = "debugger;";
|
||||
dbg.onDebuggerStatement = ulrichDebuggerHandler;
|
||||
doc.body.appendChild(ulrich);
|
||||
}
|
||||
|
||||
function ulrichDebuggerHandler(frame) {
|
||||
log += 'u';
|
||||
log += "u";
|
||||
|
||||
// The top frame should be ulrich's text.
|
||||
ok(frame.script.source.element === DOFor(ulrich),
|
||||
|
@ -89,23 +90,23 @@ window.onload = function () {
|
|||
"top frame is not on an attribute of ulrich");
|
||||
|
||||
// Try a dynamically inserted out-of-line script element.
|
||||
isolde = doc.createElement('script');
|
||||
isolde.setAttribute('src', 'Debugger.Source.prototype.element-2.js');
|
||||
isolde.setAttribute('id', 'idolde, my dear');
|
||||
isolde = doc.createElement("script");
|
||||
isolde.setAttribute("src", "Debugger.Source.prototype.element-2.js");
|
||||
isolde.setAttribute("id", "idolde, my dear");
|
||||
dbg.onDebuggerStatement = isoldeDebuggerHandler;
|
||||
doc.body.appendChild(isolde);
|
||||
}
|
||||
|
||||
function isoldeDebuggerHandler(frame) {
|
||||
log += 'i';
|
||||
log += "i";
|
||||
|
||||
// The top frame should belong to isolde.
|
||||
ok(frame.script.source.element === DOFor(isolde),
|
||||
"top frame belongs to isolde");
|
||||
info("frame.script.source.element is: " + uneval(frame.script.source.element));
|
||||
if (typeof frame.script.source.element.unsafeDereference() == 'object') {
|
||||
info(" toString: " + frame.script.source.element.unsafeDereference());
|
||||
info(" id: " + frame.script.source.element.unsafeDereference().id);
|
||||
if (typeof frame.script.source.element.unsafeDereference() == "object") {
|
||||
info(" toString: " + frame.script.source.element.unsafeDereference());
|
||||
info(" id: " + frame.script.source.element.unsafeDereference().id);
|
||||
}
|
||||
|
||||
ok(frame.script.source.elementAttributeName === undefined,
|
||||
|
@ -114,20 +115,20 @@ window.onload = function () {
|
|||
uneval(frame.script.source.elementAttributeName));
|
||||
|
||||
// Try a dynamically created div element with a handler.
|
||||
dieter = doc.createElement('div');
|
||||
dieter.setAttribute('id', 'dieter');
|
||||
dieter.setAttribute('ondrag', 'debugger;');
|
||||
dieter = doc.createElement("div");
|
||||
dieter.setAttribute("id", "dieter");
|
||||
dieter.setAttribute("ondrag", "debugger;");
|
||||
dbg.onDebuggerStatement = dieterDebuggerHandler;
|
||||
dieter.dispatchEvent(new Event('drag'));
|
||||
}
|
||||
dieter.dispatchEvent(new Event("drag"));
|
||||
}
|
||||
|
||||
function dieterDebuggerHandler(frame) {
|
||||
log += 'd';
|
||||
function dieterDebuggerHandler(frame) {
|
||||
log += "d";
|
||||
|
||||
// The top frame should belong to dieter's ondrag handler.
|
||||
ok(frame.script.source.element === DOFor(dieter),
|
||||
"second event's handler belongs to dieter");
|
||||
ok(frame.script.source.elementAttributeName === 'ondrag',
|
||||
ok(frame.script.source.elementAttributeName === "ondrag",
|
||||
"second event's handler is on dieter's 'ondrag' element");
|
||||
|
||||
// Try sending an 'onresize' event to the window.
|
||||
|
@ -139,43 +140,42 @@ window.onload = function () {
|
|||
// won't affect propagation. Then, the content event only runs its
|
||||
// 'debugger' statement when the event is cancelable. It's a kludge.
|
||||
dbg.onDebuggerStatement = resizeDebuggerHandler;
|
||||
iframe.contentWindow.dispatchEvent(new Event('resize', { cancelable: true }));
|
||||
iframe.contentWindow.dispatchEvent(new Event("resize", { cancelable: true }));
|
||||
}
|
||||
|
||||
function resizeDebuggerHandler(frame) {
|
||||
log += 'e';
|
||||
log += "e";
|
||||
|
||||
// The top frame should belong to the body's 'onresize' handler, even
|
||||
// though we sent the message to the window and it was handled.
|
||||
ok(frame.script.source.element === DOFor(doc.body),
|
||||
"onresize event handler belongs to body element");
|
||||
ok(frame.script.source.elementAttributeName === 'onresize',
|
||||
ok(frame.script.source.elementAttributeName === "onresize",
|
||||
"onresize event handler is on body element's 'onresize' attribute");
|
||||
|
||||
// In SVG, the event and the attribute that holds that event's handler
|
||||
// have different names. Debugger.Source.prototype.elementAttributeName
|
||||
// should report (as one might infer) the attribute name, not the event
|
||||
// name.
|
||||
albrecht = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
||||
albrecht.setAttribute('onload', 'debugger;');
|
||||
albrecht = doc.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
albrecht.setAttribute("onload", "debugger;");
|
||||
dbg.onDebuggerStatement = SVGLoadHandler;
|
||||
albrecht.dispatchEvent(new Event("SVGLoad"));
|
||||
}
|
||||
|
||||
function SVGLoadHandler(frame) {
|
||||
log += 's';
|
||||
log += "s";
|
||||
|
||||
// The top frame's source should be on albrecht's 'onload' attribute.
|
||||
ok(frame.script.source.element === DOFor(albrecht),
|
||||
"SVGLoad event handler belongs to albrecht");
|
||||
ok(frame.script.source.elementAttributeName === 'onload',
|
||||
ok(frame.script.source.elementAttributeName === "onload",
|
||||
"SVGLoad event handler is on albrecht's 'onload' attribute");
|
||||
|
||||
ok(log === 'lfuides', "all tests actually ran");
|
||||
ok(log === "lfuides", "all tests actually ran");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -15,6 +15,7 @@ behave when 'eval' is called with no scripted frames active at all.
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
||||
addDebuggerToGlobal(this);
|
||||
|
@ -22,10 +23,10 @@ addDebuggerToGlobal(this);
|
|||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var dbg, iframeDO, doc, script2DO;
|
||||
let dbg, iframeDO, doc, script2DO;
|
||||
|
||||
// Create an iframe to debug.
|
||||
var iframe = document.createElement("iframe");
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.src = "data:text/html,<div>Hi!</div>";
|
||||
iframe.onload = onLoadHandler;
|
||||
document.body.appendChild(iframe);
|
||||
|
@ -33,11 +34,11 @@ window.onload = function () {
|
|||
function onLoadHandler() {
|
||||
// Now that the iframe's window has been created, we can add
|
||||
// it as a debuggee.
|
||||
dbg = new Debugger;
|
||||
dbg = new Debugger();
|
||||
iframeDO = dbg.addDebuggee(iframe.contentWindow);
|
||||
|
||||
doc = iframe.contentWindow.document;
|
||||
var script = doc.createElement('script');
|
||||
let script = doc.createElement("script");
|
||||
script.text = "setTimeout(eval.bind(null, 'debugger;'), 0);";
|
||||
dbg.onDebuggerStatement = timerHandler;
|
||||
doc.body.appendChild(script);
|
||||
|
@ -46,7 +47,7 @@ window.onload = function () {
|
|||
function timerHandler(frame) {
|
||||
// The top stack frame's source should have an undefined
|
||||
// introduction script and introduction offset.
|
||||
var source = frame.script.source;
|
||||
let source = frame.script.source;
|
||||
ok(source.introductionScript === undefined,
|
||||
"setTimeout eval introductionScript is undefined");
|
||||
ok(source.introductionOffset === undefined,
|
||||
|
@ -55,7 +56,7 @@ window.onload = function () {
|
|||
// Check that the above isn't just some quirk of iframes, or the
|
||||
// browser milieu destroying information: an eval script should indeed
|
||||
// have proper introduction information.
|
||||
var script2 = doc.createElement('script');
|
||||
let script2 = doc.createElement("script");
|
||||
script2.text = "eval('debugger;');";
|
||||
script2DO = iframeDO.makeDebuggeeValue(script2);
|
||||
dbg.onDebuggerStatement = evalHandler;
|
||||
|
@ -65,10 +66,10 @@ window.onload = function () {
|
|||
function evalHandler(frame) {
|
||||
// The top stack frame's source should be introduced by the script that
|
||||
// called eval.
|
||||
var source = frame.script.source;
|
||||
var frame2 = frame.older;
|
||||
let source = frame.script.source;
|
||||
let frame2 = frame.older;
|
||||
|
||||
ok(source.introductionType === 'eval',
|
||||
ok(source.introductionType === "eval",
|
||||
"top frame's source was introduced by 'eval'");
|
||||
ok(source.introductionScript === frame2.script,
|
||||
"eval frame's introduction script is the older frame's script");
|
||||
|
@ -81,7 +82,7 @@ window.onload = function () {
|
|||
// information. (In the future, we certainly could point at the call
|
||||
// that inserted the script element into the document; if that happens,
|
||||
// we can update this test.)
|
||||
ok(frame2.script.source.introductionType === 'scriptElement',
|
||||
ok(frame2.script.source.introductionType === "scriptElement",
|
||||
"older frame has no introduction type");
|
||||
ok(frame2.script.source.introductionScript === undefined,
|
||||
"older frame has no introduction script");
|
||||
|
@ -90,7 +91,7 @@ window.onload = function () {
|
|||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -16,13 +16,14 @@ JavaScrip appearing in an inline event handler attribute.
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
||||
addDebuggerToGlobal(this);
|
||||
|
||||
var dbg;
|
||||
var iframeDO, doc;
|
||||
var Tootles, TootlesDO;
|
||||
let dbg;
|
||||
let iframeDO, doc;
|
||||
let Tootles, TootlesDO;
|
||||
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -31,7 +32,7 @@ window.onload = function () {
|
|||
|
||||
addTest(function setup() {
|
||||
// Create an iframe to debug.
|
||||
var iframe = document.createElement("iframe");
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.src = "data:text/html," +
|
||||
"<div id='Tootles' onclick='debugger;'>I'm a DIV!</div>" +
|
||||
"<script id='Auddie'>function auddie() { debugger; }<\/script>";
|
||||
|
@ -41,88 +42,84 @@ addTest(function setup() {
|
|||
function onLoadHandler() {
|
||||
// Now that the iframe's window has been created, we can add
|
||||
// it as a debuggee.
|
||||
dbg = new Debugger;
|
||||
dbg = new Debugger();
|
||||
iframeDO = dbg.addDebuggee(iframe.contentWindow);
|
||||
doc = iframe.contentWindow.document;
|
||||
Tootles = doc.getElementById('Tootles');
|
||||
Tootles = doc.getElementById("Tootles");
|
||||
TootlesDO = iframeDO.makeDebuggeeValue(Tootles);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Check the introduction type of in-markup event handler code.
|
||||
// Send a click event to Tootles, whose handler has a 'debugger' statement,
|
||||
// and check that script's introduction type.
|
||||
addTest(function ClickOnTootles() {
|
||||
dbg.onDebuggerStatement = TootlesClickDebugger;
|
||||
Tootles.dispatchEvent(new Event('click'));
|
||||
Tootles.dispatchEvent(new Event("click"));
|
||||
|
||||
function TootlesClickDebugger(frame) {
|
||||
// some sanity checks
|
||||
ok(frame.script.source.element === TootlesDO,
|
||||
"top frame source belongs to element 'Tootles'");
|
||||
is(frame.script.source.elementAttributeName, 'onclick',
|
||||
is(frame.script.source.elementAttributeName, "onclick",
|
||||
"top frame source belongs to 'onclick' attribute");
|
||||
|
||||
// And, the actual point of this test:
|
||||
is(frame.script.source.introductionType, 'eventHandler',
|
||||
is(frame.script.source.introductionType, "eventHandler",
|
||||
"top frame source's introductionType is 'eventHandler'");
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Check the introduction type of dynamically added event handler code.
|
||||
// Add a drag event handler to Tootles as a string, and then send
|
||||
// Tootles a drag event.
|
||||
addTest(function DragTootles() {
|
||||
dbg.onDebuggerStatement = TootlesDragDebugger;
|
||||
Tootles.setAttribute('ondrag', 'debugger;');
|
||||
Tootles.dispatchEvent(new Event('drag'));
|
||||
Tootles.setAttribute("ondrag", "debugger;");
|
||||
Tootles.dispatchEvent(new Event("drag"));
|
||||
|
||||
function TootlesDragDebugger(frame) {
|
||||
// sanity checks
|
||||
ok(frame.script.source.element === TootlesDO,
|
||||
"top frame source belongs to element 'Tootles'");
|
||||
is(frame.script.source.elementAttributeName, 'ondrag',
|
||||
is(frame.script.source.elementAttributeName, "ondrag",
|
||||
"top frame source belongs to 'ondrag' attribute");
|
||||
|
||||
// And, the actual point of this test:
|
||||
is(frame.script.source.introductionType, 'eventHandler',
|
||||
is(frame.script.source.introductionType, "eventHandler",
|
||||
"top frame source's introductionType is 'eventHandler'");
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Check the introduction type of an in-markup script element.
|
||||
addTest(function checkAuddie() {
|
||||
var fnDO = iframeDO.getOwnPropertyDescriptor('auddie').value;
|
||||
var AuddieDO = iframeDO.makeDebuggeeValue(doc.getElementById('Auddie'));
|
||||
let fnDO = iframeDO.getOwnPropertyDescriptor("auddie").value;
|
||||
let AuddieDO = iframeDO.makeDebuggeeValue(doc.getElementById("Auddie"));
|
||||
|
||||
is(fnDO.class, 'Function',
|
||||
is(fnDO.class, "Function",
|
||||
"Script element 'Auddie' defined function 'auddie'.");
|
||||
ok(fnDO.script.source.element === AuddieDO,
|
||||
"Function auddie's script belongs to script element 'Auddie'");
|
||||
is(fnDO.script.source.elementAttributeName, undefined,
|
||||
"Function auddie's script doesn't belong to any attribute of 'Auddie'");
|
||||
is(fnDO.script.source.introductionType, 'scriptElement',
|
||||
is(fnDO.script.source.introductionType, "scriptElement",
|
||||
"Function auddie's script's source was introduced by a script element");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
// Check the introduction type of a dynamically inserted script element.
|
||||
addTest(function InsertRover() {
|
||||
dbg.onDebuggerStatement = RoverDebugger;
|
||||
var rover = doc.createElement('script');
|
||||
var roverDO = iframeDO.makeDebuggeeValue(rover);
|
||||
rover.text = 'debugger;';
|
||||
let rover = doc.createElement("script");
|
||||
let roverDO = iframeDO.makeDebuggeeValue(rover);
|
||||
rover.text = "debugger;";
|
||||
doc.body.appendChild(rover);
|
||||
|
||||
function RoverDebugger(frame) {
|
||||
|
@ -133,17 +130,16 @@ addTest(function InsertRover() {
|
|||
"Rover script doesn't belong to an attribute of Rover");
|
||||
|
||||
// Check the introduction type.
|
||||
ok(frame.script.source.introductionType === 'scriptElement',
|
||||
ok(frame.script.source.introductionType === "scriptElement",
|
||||
"Rover script's introduction type is 'scriptElement'");
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Create a XUL document with a script element, and check its introduction type.
|
||||
addTest(function XULDocumentScript() {
|
||||
var xulFrame = document.createElement('iframe');
|
||||
let xulFrame = document.createElement("iframe");
|
||||
xulFrame.src = "data:application/vnd.mozilla.xul+xml;charset=utf-8," +
|
||||
"<?xml version=\"1.0\"?>" +
|
||||
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'>" +
|
||||
|
@ -155,12 +151,10 @@ addTest(function XULDocumentScript() {
|
|||
|
||||
function xulLoaded() {
|
||||
info("Loaded XUL document");
|
||||
var xulFrameDO = dbg.addDebuggee(xulFrame.contentWindow);
|
||||
var xulDoc = xulFrame.contentWindow.document;
|
||||
var xulieDO = xulFrameDO.makeDebuggeeValue(xulDoc.getElementById('xulie'));
|
||||
var xulFnDO = xulFrameDO.getOwnPropertyDescriptor('xulScriptFunc').value;
|
||||
is(typeof xulFnDO, 'object', "XUL script element defined 'xulScriptFunc'");
|
||||
is(xulFnDO.class, 'Function',
|
||||
let xulFrameDO = dbg.addDebuggee(xulFrame.contentWindow);
|
||||
let xulFnDO = xulFrameDO.getOwnPropertyDescriptor("xulScriptFunc").value;
|
||||
is(typeof xulFnDO, "object", "XUL script element defined 'xulScriptFunc'");
|
||||
is(xulFnDO.class, "Function",
|
||||
"XUL global 'xulScriptFunc' is indeed a function");
|
||||
|
||||
// A XUL document's script elements' code gets shared amongst all
|
||||
|
@ -169,12 +163,11 @@ addTest(function XULDocumentScript() {
|
|||
is(xulFnDO.script.source.element, undefined,
|
||||
"XUL script code should not be attributed to any individual element");
|
||||
|
||||
is(xulFnDO.script.source.introductionType, 'scriptElement',
|
||||
is(xulFnDO.script.source.introductionType, "scriptElement",
|
||||
"xulScriptFunc's introduction type is 'scriptElement'");
|
||||
runNextTest();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -11,67 +11,65 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1247243
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
window.onload = function() {
|
||||
const Ci = Components.interfaces;
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
const {AnimationsFront} = require("devtools/shared/fronts/animation");
|
||||
const {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let gWalker = null;
|
||||
let gClient = null;
|
||||
let animationsFront = null;
|
||||
|
||||
addTest(function setup() {
|
||||
info ("Setting up inspector and animation actors.");
|
||||
info("Setting up inspector and animation actors.");
|
||||
|
||||
let url = document.getElementById("animationContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
let inspector = InspectorFront(client, tab);
|
||||
|
||||
animationsFront = new AnimationsFront(client, tab);
|
||||
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
addAsyncTest(function* testActorLifetime() {
|
||||
|
||||
info ("Testing animated node actor");
|
||||
info("Testing animated node actor");
|
||||
let animatedNodeActor = yield gWalker.querySelector(gWalker.rootNode,
|
||||
".animated");
|
||||
yield animationsFront.getAnimationPlayersForNode(animatedNodeActor);
|
||||
|
||||
let animationsActor = DebuggerServer._searchAllConnectionsForActor(animationsFront.actorID);
|
||||
let animationsActor = DebuggerServer
|
||||
._searchAllConnectionsForActor(animationsFront.actorID);
|
||||
|
||||
is(animationsActor.actors.length, 1,
|
||||
"AnimationActor have 1 AnimationPlayerActors");
|
||||
|
||||
info ("Testing AnimationPlayerActors release");
|
||||
info("Testing AnimationPlayerActors release");
|
||||
let stillNodeActor = yield gWalker.querySelector(gWalker.rootNode,
|
||||
".still");
|
||||
yield animationsFront.getAnimationPlayersForNode(stillNodeActor);
|
||||
is(animationsActor.actors.length, 0,
|
||||
"AnimationActor does not have any AnimationPlayerActors anymore");
|
||||
|
||||
info ("Testing multi animated node actor");
|
||||
info("Testing multi animated node actor");
|
||||
let multiNodeActor = yield gWalker.querySelector(gWalker.rootNode,
|
||||
".multi");
|
||||
yield animationsFront.getAnimationPlayersForNode(multiNodeActor);
|
||||
is(animationsActor.actors.length, 2,
|
||||
"AnimationActor has now 2 AnimationPlayerActors");
|
||||
|
||||
info ("Testing single animated node actor");
|
||||
info("Testing single animated node actor");
|
||||
yield animationsFront.getAnimationPlayersForNode(animatedNodeActor);
|
||||
is(animationsActor.actors.length, 1,
|
||||
"AnimationActor has only one AnimationPlayerActors");
|
||||
|
||||
info ("Testing AnimationPlayerActors release again");
|
||||
info("Testing AnimationPlayerActors release again");
|
||||
yield animationsFront.getAnimationPlayersForNode(stillNodeActor);
|
||||
is(animationsActor.actors.length, 0,
|
||||
"AnimationActor does not have any AnimationPlayerActors anymore");
|
||||
|
@ -79,7 +77,6 @@ window.onload = function() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
runNextTest();
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<SDOCTYPv HTM.>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Bug 966991 - Test DebuggerServer.connectToChild
|
||||
|
@ -12,16 +12,16 @@ Bug 966991 - Test DebuggerServer.connectToChild
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
let Cu = Components.utils;
|
||||
let Cc = Components.classes;
|
||||
let Ci = Components.interfaces;
|
||||
|
||||
let { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
let { DebuggerClient } = require("devtools/shared/client/main");
|
||||
let { DebuggerServer } = require("devtools/server/main");
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv({
|
||||
|
@ -31,7 +31,7 @@ window.onload = function() {
|
|||
["dom.mozBrowserFramesEnabled", true]
|
||||
]
|
||||
}, runTests);
|
||||
}
|
||||
};
|
||||
|
||||
function runTests() {
|
||||
// Create a minimal iframe with a message manager
|
||||
|
@ -44,14 +44,18 @@ function runTests() {
|
|||
// Register a test actor in the child process so that we can know if and when
|
||||
// this fake actor is destroyed.
|
||||
mm.loadFrameScript("data:text/javascript,new " + function FrameScriptScope() {
|
||||
/* eslint-disable no-shadow */
|
||||
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const { DebuggerServer } = require("devtools/server/main");
|
||||
/* eslint-enable no-shadow */
|
||||
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
}
|
||||
|
||||
function TestActor() {dump("instanciate test actor\n");}
|
||||
function TestActor() {
|
||||
dump("instanciate test actor\n");
|
||||
}
|
||||
TestActor.prototype = {
|
||||
actorPrefix: "test",
|
||||
|
||||
|
@ -59,7 +63,7 @@ function runTests() {
|
|||
sendAsyncMessage("test-actor-destroyed", null);
|
||||
},
|
||||
hello: function () {
|
||||
return {msg:"world"};
|
||||
return {msg: "world"};
|
||||
}
|
||||
};
|
||||
TestActor.prototype.requestTypes = {
|
||||
|
@ -90,7 +94,6 @@ function runTests() {
|
|||
to: actor.testActor,
|
||||
type: "hello",
|
||||
}, function (response) {
|
||||
|
||||
// Then close the client. That should end up cleaning our test actor
|
||||
client.close();
|
||||
|
||||
|
@ -113,7 +116,8 @@ function runTests() {
|
|||
let client = new DebuggerClient(transport);
|
||||
DebuggerServer.connectToChild(conn, iframe).then(actor => {
|
||||
ok(actor.testActor, "Got a test actor for the second connection");
|
||||
isnot(actor.testActor, firstActor, "We get different actor instances between two connections");
|
||||
isnot(actor.testActor, firstActor,
|
||||
"We get different actor instances between two connections");
|
||||
|
||||
client.close(cleanup);
|
||||
});
|
||||
|
@ -122,12 +126,11 @@ function runTests() {
|
|||
function cleanup() {
|
||||
DebuggerServer.destroy();
|
||||
iframe.remove();
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
firstClient();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -12,70 +12,89 @@ Bug 898485 - [app manager] Implement an abstract connection manager
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var Cu = Components.utils;
|
||||
const Cu = Components.utils;
|
||||
|
||||
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
var {DebuggerServer} = require("devtools/server/main");
|
||||
var Services = require("Services");
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {DebuggerServer} = require("devtools/server/main");
|
||||
const Services = require("Services");
|
||||
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
}
|
||||
|
||||
var {ConnectionManager, Connection} = require("devtools/shared/client/connection-manager");
|
||||
const {
|
||||
ConnectionManager,
|
||||
Connection
|
||||
} = require("devtools/shared/client/connection-manager");
|
||||
|
||||
var orgCount = ConnectionManager.connections.length;
|
||||
let orgCount = ConnectionManager.connections.length;
|
||||
|
||||
ConnectionManager.once("new", (event, c) => {
|
||||
is(ConnectionManager.connections[orgCount], c, "new event fired, with correct connection");
|
||||
is(ConnectionManager.connections[orgCount], c,
|
||||
"new event fired, with correct connection");
|
||||
});
|
||||
|
||||
var c1 = ConnectionManager.createConnection();
|
||||
var c2 = ConnectionManager.createConnection();
|
||||
let c1 = ConnectionManager.createConnection();
|
||||
let c2 = ConnectionManager.createConnection();
|
||||
|
||||
is(ConnectionManager.connections[orgCount], c1, "Connection 1 registered");
|
||||
is(ConnectionManager.connections[orgCount + 1], c2, "Connection 2 registered");
|
||||
|
||||
c1.once(Connection.Events.DESTROYED, function() {
|
||||
c1.once(Connection.Events.DESTROYED, function () {
|
||||
is(ConnectionManager.connections.length, orgCount + 1, "Connection 1 destroyed");
|
||||
|
||||
var c = c2;
|
||||
let c = c2;
|
||||
|
||||
var eventsRef = "connecting connected disconnecting disconnected host-changed disconnected timeout destroyed";
|
||||
var events = [];
|
||||
let eventsRef = "connecting connected disconnecting disconnected host-changed"
|
||||
+ " disconnected timeout destroyed";
|
||||
let events = [];
|
||||
|
||||
var s = Connection.Status;
|
||||
let s = Connection.Status;
|
||||
|
||||
is(c.status, s.DISCONNECTED, "disconnected");
|
||||
|
||||
c.once(Connection.Events.CONNECTING, function(e) { events.push(e); is(c.status, s.CONNECTING, "connecting"); });
|
||||
c.once(Connection.Events.CONNECTED, function(e) { events.push(e); is(c.status, s.CONNECTED, "connected"); c.disconnect()});
|
||||
c.once(Connection.Events.DISCONNECTING, function(e) { events.push(e); is(c.status, s.DISCONNECTING, "disconnecting"); });
|
||||
c.once(Connection.Events.DISCONNECTED, function(e) { events.push(e); is(c.status, s.DISCONNECTED, "disconnected"); testError()});
|
||||
c.once(Connection.Events.DESTROYED, function(e) { events.push(e); is(c.status, s.DESTROYED, "destroyed"); finish()});
|
||||
c.once(Connection.Events.CONNECTING, function (e) {
|
||||
events.push(e);
|
||||
is(c.status, s.CONNECTING, "connecting");
|
||||
});
|
||||
|
||||
c.once(Connection.Events.CONNECTED, function (e) {
|
||||
events.push(e);
|
||||
is(c.status, s.CONNECTED, "connected");
|
||||
c.disconnect();
|
||||
});
|
||||
|
||||
c.once(Connection.Events.DISCONNECTING, function (e) {
|
||||
events.push(e);
|
||||
is(c.status, s.DISCONNECTING, "disconnecting");
|
||||
});
|
||||
|
||||
c.once(Connection.Events.DISCONNECTED, function (e) {
|
||||
events.push(e);
|
||||
is(c.status, s.DISCONNECTED, "disconnected");
|
||||
testError();
|
||||
});
|
||||
|
||||
c.once(Connection.Events.DESTROYED, function (e) {
|
||||
events.push(e);
|
||||
is(c.status, s.DESTROYED, "destroyed");
|
||||
finish();
|
||||
});
|
||||
|
||||
c.connect();
|
||||
|
||||
function testStore() {
|
||||
c.store.on("set", function(e,path) {
|
||||
if (path.join(".") == "device.width") {
|
||||
is(c.store.object.device.width, window.screen.width, "Store is fed with valid data");
|
||||
c.disconnect();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function testError() {
|
||||
c.once(Connection.Events.DISCONNECTED, function(e) {
|
||||
c.once(Connection.Events.DISCONNECTED, function (e) {
|
||||
events.push(e);
|
||||
testKeepConnecting();
|
||||
});
|
||||
c.once(Connection.Events.HOST_CHANGED, function(e) {
|
||||
c.once(Connection.Events.HOST_CHANGED, function (e) {
|
||||
events.push(e);
|
||||
c.connect();
|
||||
});
|
||||
|
@ -86,16 +105,17 @@ window.onload = function() {
|
|||
function testKeepConnecting() {
|
||||
// ensure that keepConnecting keep trying connecting
|
||||
// until the connection attempts timeout
|
||||
var originalTimeout = Services.prefs.getIntPref("devtools.debugger.remote-timeout");
|
||||
let prefRemoteTimeout = "devtools.debugger.remote-timeout";
|
||||
let originalTimeout = Services.prefs.getIntPref(prefRemoteTimeout);
|
||||
Services.prefs.setIntPref("devtools.debugger.remote-timeout", 1000);
|
||||
c.once("timeout", function (e) {
|
||||
events.push(e);
|
||||
Services.prefs.setIntPref("devtools.debugger.remote-timeout", originalTimeout);
|
||||
Services.prefs.setIntPref(prefRemoteTimeout, originalTimeout);
|
||||
ConnectionManager.destroyConnection(c);
|
||||
});
|
||||
c.keepConnecting = true;
|
||||
var port = ConnectionManager.getFreeTCPPort();
|
||||
ok(parseInt(port), "Free TCP port looks like a port number");
|
||||
let port = ConnectionManager.getFreeTCPPort();
|
||||
ok(parseInt(port, 10), "Free TCP port looks like a port number");
|
||||
c.port = port;
|
||||
c.host = "locahost";
|
||||
c.connect();
|
||||
|
@ -106,13 +126,10 @@ window.onload = function() {
|
|||
DebuggerServer.destroy();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ConnectionManager.destroyConnection(c1);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -25,14 +25,15 @@ Test that css-logic handles media-queries correctly
|
|||
<body>
|
||||
<div></div>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
var { classes: Cc, utils: Cu, interfaces: Ci } = Components;
|
||||
window.onload = function () {
|
||||
const { classes: Cc, utils: Cu, interfaces: Ci } = Components;
|
||||
const DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"]
|
||||
.getService(Ci.inIDOMUtils);
|
||||
|
||||
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
var Services = require("Services");
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const Services = require("Services");
|
||||
const {CssLogic} = require("devtools/server/css-logic");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -55,8 +56,7 @@ Test that css-logic handles media-queries correctly
|
|||
"rule.source gives correct output for rule 2");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -10,9 +10,10 @@ Test that css-logic calculates CSS specificity properly
|
|||
</head>
|
||||
<body style="background:blue;">
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
var {utils: Cu, classes: Cc, interfaces: Ci} = Components;
|
||||
window.onload = function () {
|
||||
const {utils: Cu, classes: Cc, interfaces: Ci} = Components;
|
||||
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {CssLogic, CssSelector} = require("devtools/server/css-logic");
|
||||
|
@ -58,7 +59,7 @@ Test that css-logic calculates CSS specificity properly
|
|||
let cssRule = cssSheet.domSheet.cssRules[0];
|
||||
let selectors = CssLogic.getSelectors(cssRule);
|
||||
|
||||
info("Iterating over the test selectors")
|
||||
info("Iterating over the test selectors");
|
||||
for (let i = 0; i < selectors.length; i++) {
|
||||
let selectorText = selectors[i];
|
||||
info("Testing selector " + selectorText);
|
||||
|
@ -66,7 +67,7 @@ Test that css-logic calculates CSS specificity properly
|
|||
let selector = new CssSelector(cssRule, selectorText, i);
|
||||
let expected = getExpectedSpecificity(selectorText);
|
||||
let specificity = DOMUtils.getSpecificity(selector.cssRule,
|
||||
selector.selectorIndex)
|
||||
selector.selectorIndex);
|
||||
is(specificity, expected,
|
||||
'Selector "' + selectorText + '" has a specificity of ' + expected);
|
||||
}
|
||||
|
@ -77,8 +78,7 @@ Test that css-logic calculates CSS specificity properly
|
|||
"Element styles have specificity of 0x01000000 (16777216).");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -11,49 +11,51 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
const {CssLogic} = require("devtools/server/css-logic");
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
addTest(function getComputedStyle() {
|
||||
let node = document.querySelector("#computed-style");
|
||||
is (CssLogic.getComputedStyle(node).getPropertyValue("width"),
|
||||
is(CssLogic.getComputedStyle(node).getPropertyValue("width"),
|
||||
"50px", "Computed style on a normal node works (width)");
|
||||
is (CssLogic.getComputedStyle(node).getPropertyValue("height"),
|
||||
is(CssLogic.getComputedStyle(node).getPropertyValue("height"),
|
||||
"10px", "Computed style on a normal node works (height)");
|
||||
|
||||
let firstChild = new _documentWalker(node, window).firstChild();
|
||||
is (CssLogic.getComputedStyle(firstChild).getPropertyValue("content"),
|
||||
"\"before\"", "Computed style on a ::before node works (content)");
|
||||
is(CssLogic.getComputedStyle(firstChild).getPropertyValue("content"),
|
||||
"\"before\"", "Computed style on a ::before node works (content)");
|
||||
let lastChild = new _documentWalker(node, window).lastChild();
|
||||
is (CssLogic.getComputedStyle(lastChild).getPropertyValue("content"),
|
||||
"\"after\"", "Computed style on a ::after node works (content)");
|
||||
is(CssLogic.getComputedStyle(lastChild).getPropertyValue("content"),
|
||||
"\"after\"", "Computed style on a ::after node works (content)");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addTest(function getBindingElementAndPseudo() {
|
||||
let node = document.querySelector("#computed-style");
|
||||
var {bindingElement, pseudo} = CssLogic.getBindingElementAndPseudo(node);
|
||||
let {bindingElement, pseudo} = CssLogic.getBindingElementAndPseudo(node);
|
||||
|
||||
is (bindingElement, node,
|
||||
"Binding element is the node itself for a normal node");
|
||||
ok (!pseudo, "Pseudo is null for a normal node");
|
||||
is(bindingElement, node,
|
||||
"Binding element is the node itself for a normal node");
|
||||
ok(!pseudo, "Pseudo is null for a normal node");
|
||||
|
||||
let firstChild = new _documentWalker(node, window).firstChild();
|
||||
var {bindingElement, pseudo} = CssLogic.getBindingElementAndPseudo(firstChild);
|
||||
is (bindingElement, node,
|
||||
"Binding element is the parent for a pseudo node");
|
||||
is (pseudo, ":before", "Pseudo is correct for a ::before node");
|
||||
({ bindingElement, pseudo } = CssLogic.getBindingElementAndPseudo(firstChild));
|
||||
is(bindingElement, node,
|
||||
"Binding element is the parent for a pseudo node");
|
||||
is(pseudo, ":before", "Pseudo is correct for a ::before node");
|
||||
|
||||
let lastChild = new _documentWalker(node, window).lastChild();
|
||||
var {bindingElement, pseudo} = CssLogic.getBindingElementAndPseudo(lastChild);
|
||||
is (bindingElement, node,
|
||||
"Binding element is the parent for a pseudo node");
|
||||
is (pseudo, ":after", "Pseudo is correct for a ::after node");
|
||||
({ bindingElement, pseudo } = CssLogic.getBindingElementAndPseudo(lastChild));
|
||||
is(bindingElement, node,
|
||||
"Binding element is the parent for a pseudo node");
|
||||
is(pseudo, ":after", "Pseudo is correct for a ::after node");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
|
|
@ -10,19 +10,21 @@ Bug 1265798 - Replace inIDOMUtils.cssPropertyIsShorthand
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
window.onload = function() {
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
const { initCssProperties, getCssProperties } =
|
||||
require("devtools/shared/fronts/css-properties");
|
||||
|
||||
function promiseAttachUrl (url) {
|
||||
function promiseAttachUrl(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
resolve({client, tab, doc});
|
||||
return resolve({client, tab, doc});
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function toSortedString(array) {
|
||||
|
@ -63,7 +65,7 @@ window.onload = function() {
|
|||
is(cssProperties, cssPropertiesA,
|
||||
"Multiple calls with the same toolbox returns the same object.");
|
||||
isnot(cssProperties, cssPropertiesB,
|
||||
"Multiple calls with the different toolboxes return different "+
|
||||
"Multiple calls with the different toolboxes return different " +
|
||||
" objects.");
|
||||
|
||||
ok(cssProperties.isKnown("border"),
|
||||
|
@ -81,13 +83,13 @@ window.onload = function() {
|
|||
ok(!cssProperties.isKnown("--foo bar"),
|
||||
"A CSS variable with spaces fails");
|
||||
|
||||
is(toSortedString(cssProperties.getValues('margin')),
|
||||
toSortedString(["auto","calc","inherit","initial","unset"]),
|
||||
is(toSortedString(cssProperties.getValues("margin")),
|
||||
toSortedString(["auto", "calc", "inherit", "initial", "unset"]),
|
||||
"Can get values for the CSS margin.");
|
||||
is(cssProperties.getValues('foobar').length, 0,
|
||||
is(cssProperties.getValues("foobar").length, 0,
|
||||
"Unknown values return an empty array.");
|
||||
|
||||
const bgColorValues = cssProperties.getValues('background-color');
|
||||
const bgColorValues = cssProperties.getValues("background-color");
|
||||
ok(bgColorValues.includes("blanchedalmond"),
|
||||
"A property with color values includes blanchedalmond.");
|
||||
ok(bgColorValues.includes("papayawhip"),
|
||||
|
@ -111,7 +113,7 @@ window.onload = function() {
|
|||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -12,37 +12,38 @@ Bug 895360 - [app manager] Device meta data actor
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
var Cu = Components.utils;
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
window.onload = function () {
|
||||
const Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
var {DebuggerClient} = require("devtools/shared/client/main");
|
||||
var {DebuggerServer} = require("devtools/server/main");
|
||||
var Services = require("Services");
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {DebuggerClient} = require("devtools/shared/client/main");
|
||||
const {DebuggerServer} = require("devtools/server/main");
|
||||
const Services = require("Services");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var {getDeviceFront} = require("devtools/shared/fronts/device");
|
||||
const {getDeviceFront} = require("devtools/shared/fronts/device");
|
||||
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
}
|
||||
|
||||
var client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
client.connect().then(function onConnect() {
|
||||
client.listTabs(function onListTabs(aResponse) {
|
||||
var d = getDeviceFront(client, aResponse);
|
||||
client.listTabs(function onListTabs(response) {
|
||||
let d = getDeviceFront(client, response);
|
||||
|
||||
var desc;
|
||||
var appInfo = Services.appinfo;
|
||||
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
let desc;
|
||||
let appInfo = Services.appinfo;
|
||||
let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
|
||||
|
||||
var localDesc = {
|
||||
let localDesc = {
|
||||
appid: appInfo.ID,
|
||||
vendor: appInfo.vendor,
|
||||
name: appInfo.name,
|
||||
|
@ -53,38 +54,38 @@ window.onload = function() {
|
|||
geckobuildid: appInfo.platformBuildID,
|
||||
geckoversion: appInfo.platformVersion,
|
||||
useragent: window.navigator.userAgent,
|
||||
locale: Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global"),
|
||||
locale: Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global"),
|
||||
os: appInfo.OS,
|
||||
processor: appInfo.XPCOMABI.split("-")[0],
|
||||
compiler: appInfo.XPCOMABI.split("-")[1],
|
||||
dpi: utils.displayDPI,
|
||||
width: window.screen.width,
|
||||
height: window.screen.height
|
||||
}
|
||||
};
|
||||
|
||||
function checkValues() {
|
||||
for (var key in localDesc) {
|
||||
for (let key in localDesc) {
|
||||
is(desc[key], localDesc[key], "valid field (" + key + ")");
|
||||
}
|
||||
|
||||
var currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
var profileDir = currProfD.path;
|
||||
ok(profileDir.indexOf(desc.profile.length > 0 && desc.profile) != -1, "valid profile name");
|
||||
let currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
let profileDir = currProfD.path;
|
||||
ok(profileDir.indexOf(desc.profile.length > 0 && desc.profile) != -1,
|
||||
"valid profile name");
|
||||
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
d.getDescription().then((v) => desc = v)
|
||||
.then(checkValues);
|
||||
|
||||
d.getDescription().then(function (v) {
|
||||
desc = v;
|
||||
}).then(checkValues);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -14,43 +14,45 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<pre id="test">
|
||||
<script type="application/javascript" src="./director-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const WAIT_EVENT_TIMEOUT = 3000;
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
Task.spawn(function* () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var tests = [
|
||||
let tests = [
|
||||
runDirectorRegistryActorTest
|
||||
].map((testCase) => {
|
||||
return function* () {
|
||||
setup();
|
||||
yield testCase().then(null, (e) => {
|
||||
console.error("Exception during testCase run", e);
|
||||
ok(false, "Exception during testCase run: " + [e, e.fileName, e.lineNumber].join("\n\t"));
|
||||
ok(false, "Exception during testCase run: "
|
||||
+ [e, e.fileName, e.lineNumber].join("\n\t"));
|
||||
});
|
||||
|
||||
teardown();
|
||||
};
|
||||
});
|
||||
|
||||
for (var test of tests) {
|
||||
for (let test of tests) {
|
||||
yield test();
|
||||
}
|
||||
}).then(
|
||||
function success() {
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
},
|
||||
function error(e) {
|
||||
console.error("Exception during testCase run", e);
|
||||
ok(false, "Exception during testCase run: " + [e, e.fileName, e.lineNumber].join("\n\t"));
|
||||
ok(false, "Exception during testCase run: "
|
||||
+ [e, e.fileName, e.lineNumber].join("\n\t"));
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var targetWin = null;
|
||||
let targetWin = null;
|
||||
|
||||
function setup() {
|
||||
if (!DebuggerServer.initialized) {
|
||||
|
@ -70,30 +72,26 @@ function teardown() {
|
|||
}
|
||||
}
|
||||
|
||||
/***********************************
|
||||
* test cases
|
||||
**********************************/
|
||||
|
||||
|
||||
function runDirectorRegistryActorTest() {
|
||||
let testDirectorScriptOptions = {
|
||||
scriptCode: "(" + (function() {
|
||||
module.exports = function({port}) {
|
||||
port.onmessage = function(evt) {
|
||||
scriptCode: "(" + (function () {
|
||||
module.exports = function ({port}) {
|
||||
port.onmessage = function (evt) {
|
||||
// echo messages
|
||||
evt.target.postMessage(evt.data);
|
||||
};
|
||||
};
|
||||
}).toString() + ")();",
|
||||
scriptOptions: {}
|
||||
}
|
||||
};
|
||||
|
||||
return Task.spawn(function* () {
|
||||
let { client, root } = yield newConnectedDebuggerClient();
|
||||
|
||||
var directorRegistryClient = new DirectorRegistryFront(client, root);
|
||||
let directorRegistryClient = new DirectorRegistryFront(client, root);
|
||||
|
||||
let installed = yield directorRegistryClient.install("testDirectorScript", testDirectorScriptOptions);
|
||||
let installed = yield directorRegistryClient.install("testDirectorScript",
|
||||
testDirectorScriptOptions);
|
||||
is(installed, true, "DirectorManager.install returns true");
|
||||
|
||||
let list = yield directorRegistryClient.list();
|
||||
|
@ -106,8 +104,6 @@ function runDirectorRegistryActorTest() {
|
|||
yield client.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -14,24 +14,27 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<pre id="test">
|
||||
<script type="application/javascript" src="./director-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
window.onload = function() {
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
Task.spawn(function* () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var tests = [
|
||||
let tests = [
|
||||
runPropagateDirectorScriptsToChildTest,
|
||||
].map((testCase) => {
|
||||
return function* () {
|
||||
setup();
|
||||
yield testCase().then(null, (e) => {
|
||||
ok(false, "Exception during testCase run: " + [e, e.fileName, e.lineNumber].join("\n\t"));
|
||||
ok(false, "Exception during testCase run: "
|
||||
+ [e, e.fileName, e.lineNumber].join("\n\t"));
|
||||
});
|
||||
|
||||
teardown();
|
||||
};
|
||||
});
|
||||
|
||||
for (var test of tests) {
|
||||
for (let test of tests) {
|
||||
yield test();
|
||||
}
|
||||
|
||||
|
@ -43,7 +46,7 @@ function setup() {
|
|||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init(() => true);
|
||||
DebuggerServer.addBrowserActors();
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SimpleTest.registerCleanupFunction(function () {
|
||||
DebuggerServer.destroy();
|
||||
});
|
||||
}
|
||||
|
@ -54,10 +57,6 @@ function teardown() {
|
|||
DebuggerServer.destroy();
|
||||
}
|
||||
|
||||
/***********************************
|
||||
* test cases
|
||||
**********************************/
|
||||
|
||||
function runPropagateDirectorScriptsToChildTest() {
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.mozbrowser = true;
|
||||
|
@ -65,9 +64,9 @@ function runPropagateDirectorScriptsToChildTest() {
|
|||
document.body.appendChild(iframe);
|
||||
|
||||
return Task.spawn(function* () {
|
||||
var { client, root, transport } = yield newConnectedDebuggerClient();
|
||||
let { client, root, transport } = yield newConnectedDebuggerClient();
|
||||
|
||||
var directorRegistryClient = new DirectorRegistryFront(client, root);
|
||||
let directorRegistryClient = new DirectorRegistryFront(client, root);
|
||||
|
||||
// install a director script
|
||||
yield directorRegistryClient.install("testPropagatedDirectorScript", {
|
||||
|
@ -75,19 +74,19 @@ function runPropagateDirectorScriptsToChildTest() {
|
|||
scriptOptions: {}
|
||||
});
|
||||
|
||||
var conn = transport._serverConnection;
|
||||
var childActor = yield DebuggerServer.connectToChild(conn, iframe);
|
||||
let conn = transport._serverConnection;
|
||||
let childActor = yield DebuggerServer.connectToChild(conn, iframe);
|
||||
|
||||
ok(typeof childActor.directorManagerActor !== "undefined",
|
||||
"childActor.directorActor should be defined");
|
||||
|
||||
var childDirectorManagerClient = new DirectorManagerFront(client, childActor);
|
||||
let childDirectorManagerClient = new DirectorManagerFront(client, childActor);
|
||||
|
||||
var directorScriptList = yield childDirectorManagerClient.list();
|
||||
let directorScriptList = yield childDirectorManagerClient.list();
|
||||
|
||||
ok(directorScriptList.installed.length === 1 &&
|
||||
directorScriptList.installed[0] === "testPropagatedDirectorScript",
|
||||
"director scripts propagated correctly")
|
||||
"director scripts propagated correctly");
|
||||
|
||||
yield client.close();
|
||||
});
|
||||
|
|
|
@ -16,6 +16,7 @@ object.
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
||||
addDebuggerToGlobal(this);
|
||||
|
@ -23,46 +24,49 @@ addDebuggerToGlobal(this);
|
|||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.src = "data:text/html,<script>var me = 'page 1';<\/script>";
|
||||
iframe.onload = firstOnLoadHandler;
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
function firstOnLoadHandler() {
|
||||
var dbg = new Debugger;
|
||||
var page1DO = dbg.addDebuggee(iframe.contentWindow);
|
||||
let dbg = new Debugger();
|
||||
let page1DO = dbg.addDebuggee(iframe.contentWindow);
|
||||
iframe.src = "data:text/html,<script>var me = 'page 2';<\/script>";
|
||||
iframe.onload = function () {
|
||||
var page2DO = dbg.addDebuggee(iframe.contentWindow);
|
||||
let page2DO = dbg.addDebuggee(iframe.contentWindow);
|
||||
ok(page1DO !== page2DO, "the two pages' globals get distinct D.O's");
|
||||
ok(page1DO.unsafeDereference() === page2DO.unsafeDereference(),
|
||||
"unwrapping page1DO and page2DO outerizes both, yielding the same outer window");
|
||||
|
||||
is(page1DO.executeInGlobal('me').return, 'page 1', "page1DO continues to refer to original page");
|
||||
is(page2DO.executeInGlobal('me').return, 'page 2', "page2DO refers to current page");
|
||||
is(page1DO.executeInGlobal("me").return,
|
||||
"page 1", "page1DO continues to refer to original page");
|
||||
is(page2DO.executeInGlobal("me").return, "page 2",
|
||||
"page2DO refers to current page");
|
||||
|
||||
is(page1DO.executeInGlobal('this === window').return, true,
|
||||
is(page1DO.executeInGlobal("this === window").return, true,
|
||||
"page 1: Debugger.Object.prototype.executeInGlobal should outerize 'this'");
|
||||
is(page1DO.executeInGlobalWithBindings('this === window', {x:2}).return, true,
|
||||
is(page1DO.executeInGlobalWithBindings("this === window", {x: 2}).return, true,
|
||||
"page 1: Debugger.Object.prototype.executeInGlobal should outerize 'this'");
|
||||
|
||||
is(page2DO.executeInGlobal('this === window').return, true,
|
||||
is(page2DO.executeInGlobal("this === window").return, true,
|
||||
"page 2: Debugger.Object.prototype.executeInGlobal should outerize 'this'");
|
||||
is(page2DO.executeInGlobalWithBindings('this === window', {x:2}).return, true,
|
||||
is(page2DO.executeInGlobalWithBindings("this === window", {x: 2}).return, true,
|
||||
"page 2: Debugger.Object.prototype.executeInGlobal should outerize 'this'");
|
||||
|
||||
// Debugger doesn't let one use outer windows as globals. You have to innerize.
|
||||
var outerDO = page1DO.makeDebuggeeValue(page1DO.unsafeDereference());
|
||||
ok(outerDO !== page1DO, "outer window gets its own D.O, distinct from page 1's global");
|
||||
ok(outerDO !== page2DO, "outer window gets its own D.O, distinct from page 2's global");
|
||||
SimpleTest.doesThrow(function () { outerDO.executeInGlobal('me'); },
|
||||
let outerDO = page1DO.makeDebuggeeValue(page1DO.unsafeDereference());
|
||||
ok(outerDO !== page1DO,
|
||||
"outer window gets its own D.O, distinct from page 1's global");
|
||||
ok(outerDO !== page2DO,
|
||||
"outer window gets its own D.O, distinct from page 2's global");
|
||||
SimpleTest.doesThrow(() => outerDO.executeInGlobal("me"),
|
||||
"outer window D.Os can't be used as globals");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -12,30 +12,29 @@ Bug 1007200 - Create a framerate actor
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
var Cu = Components.utils;
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
window.onload = function () {
|
||||
const Cu = Components.utils;
|
||||
|
||||
var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
var Services = require("Services");
|
||||
var { DebuggerClient } = require("devtools/shared/client/main");
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const Services = require("Services");
|
||||
const { DebuggerClient } = require("devtools/shared/client/main");
|
||||
const { DebuggerServer } = require("devtools/server/main");
|
||||
|
||||
// Always log packets when running tests.
|
||||
Services.prefs.setBoolPref("devtools.debugger.log", true);
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SimpleTest.registerCleanupFunction(function () {
|
||||
Services.prefs.clearUserPref("devtools.debugger.log");
|
||||
});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
const { FramerateFront } = require("devtools/shared/fronts/framerate");
|
||||
|
||||
function plotFPS(ticks, interval = 100, clamp = 60) {
|
||||
var timeline = [];
|
||||
var totalTicks = ticks.length;
|
||||
let timeline = [];
|
||||
let totalTicks = ticks.length;
|
||||
|
||||
// If the refresh driver didn't get a chance to tick before the
|
||||
// recording was stopped, assume framerate was 0.
|
||||
|
@ -45,19 +44,19 @@ window.onload = function() {
|
|||
return timeline;
|
||||
}
|
||||
|
||||
var frameCount = 0;
|
||||
var prevTime = ticks[0];
|
||||
let frameCount = 0;
|
||||
let prevTime = ticks[0];
|
||||
|
||||
for (var i = 1; i < totalTicks; i++) {
|
||||
var currTime = ticks[i];
|
||||
for (let i = 1; i < totalTicks; i++) {
|
||||
let currTime = ticks[i];
|
||||
frameCount++;
|
||||
|
||||
var elapsedTime = currTime - prevTime;
|
||||
let elapsedTime = currTime - prevTime;
|
||||
if (elapsedTime < interval) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var framerate = Math.min(1000 / (elapsedTime / frameCount), clamp);
|
||||
let framerate = Math.min(1000 / (elapsedTime / frameCount), clamp);
|
||||
timeline.push({ delta: prevTime, value: framerate });
|
||||
timeline.push({ delta: currTime, value: framerate });
|
||||
|
||||
|
@ -66,20 +65,21 @@ window.onload = function() {
|
|||
}
|
||||
|
||||
return timeline;
|
||||
};
|
||||
}
|
||||
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
}
|
||||
|
||||
var client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
client.connect().then(function onConnect() {
|
||||
client.listTabs(function onListTabs(aResponse) {
|
||||
var form = aResponse.tabs[aResponse.selected];
|
||||
var front = FramerateFront(client, form);
|
||||
client.listTabs(function onListTabs(response) {
|
||||
let form = response.tabs[response.selected];
|
||||
let front = FramerateFront(client, form);
|
||||
|
||||
window.setTimeout(() => {
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
front.startRecording().then(() => {
|
||||
window.setTimeout(() => {
|
||||
front.stopRecording().then(rawData => {
|
||||
|
@ -87,6 +87,7 @@ window.onload = function() {
|
|||
});
|
||||
}, 1000);
|
||||
});
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
|
@ -94,15 +95,15 @@ window.onload = function() {
|
|||
function onRecordingStopped(front, rawData) {
|
||||
ok(rawData, "There should be a recording available.");
|
||||
|
||||
var timeline = plotFPS(rawData);
|
||||
let timeline = plotFPS(rawData);
|
||||
ok(timeline.length >= 2,
|
||||
"There should be at least one measurement available, with two entries.");
|
||||
|
||||
var prevTimeStart = timeline[0].delta;
|
||||
let prevTimeStart = timeline[0].delta;
|
||||
|
||||
for (var i = 0; i < timeline.length; i += 2) {
|
||||
var currTimeStart = timeline[i].delta;
|
||||
var currTimeEnd = timeline[i + 1].delta;
|
||||
for (let i = 0; i < timeline.length; i += 2) {
|
||||
let currTimeStart = timeline[i].delta;
|
||||
let currTimeEnd = timeline[i + 1].delta;
|
||||
info("Testing delta: " + currTimeStart + " vs. " + currTimeEnd);
|
||||
|
||||
ok(currTimeStart < currTimeEnd,
|
||||
|
@ -113,28 +114,24 @@ window.onload = function() {
|
|||
prevTimeStart = currTimeEnd;
|
||||
}
|
||||
|
||||
var prevFramerateValue = -1;
|
||||
|
||||
for (var i = 0; i < timeline.length; i += 2) {
|
||||
var currFramerateStart = timeline[i].value;
|
||||
var currFramerateEnd = timeline[i + 1].value;
|
||||
for (let i = 0; i < timeline.length; i += 2) {
|
||||
let currFramerateStart = timeline[i].value;
|
||||
let currFramerateEnd = timeline[i + 1].value;
|
||||
info("Testing framerate: " + currFramerateStart);
|
||||
|
||||
is(currFramerateStart, currFramerateEnd,
|
||||
"The start and end framerate values should be equal.");
|
||||
|
||||
is(typeof currFramerateStart, "number", "All values should be numbers.");
|
||||
ok(currFramerateStart <= 60, "All values were correctly clamped.")
|
||||
|
||||
prevFramerateValue = currFramerateStart;
|
||||
ok(currFramerateStart <= 60, "All values were correctly clamped.");
|
||||
}
|
||||
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -12,30 +12,29 @@ Bug 1007200 - Create a framerate actor
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
var Cu = Components.utils;
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
window.onload = function () {
|
||||
const Cu = Components.utils;
|
||||
|
||||
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
var {DebuggerClient} = require("devtools/shared/client/main");
|
||||
var {DebuggerServer} = require("devtools/server/main");
|
||||
var Services = require("Services");
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {DebuggerClient} = require("devtools/shared/client/main");
|
||||
const {DebuggerServer} = require("devtools/server/main");
|
||||
const Services = require("Services");
|
||||
|
||||
// Always log packets when running tests.
|
||||
Services.prefs.setBoolPref("devtools.debugger.log", true);
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SimpleTest.registerCleanupFunction(function () {
|
||||
Services.prefs.clearUserPref("devtools.debugger.log");
|
||||
});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
const {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
|
||||
function plotFPS(ticks, interval = 100, clamp = 60) {
|
||||
var timeline = [];
|
||||
var totalTicks = ticks.length;
|
||||
let timeline = [];
|
||||
let totalTicks = ticks.length;
|
||||
|
||||
// If the refresh driver didn't get a chance to tick before the
|
||||
// recording was stopped, assume framerate was 0.
|
||||
|
@ -45,19 +44,19 @@ window.onload = function() {
|
|||
return timeline;
|
||||
}
|
||||
|
||||
var frameCount = 0;
|
||||
var prevTime = ticks[0];
|
||||
let frameCount = 0;
|
||||
let prevTime = ticks[0];
|
||||
|
||||
for (var i = 1; i < totalTicks; i++) {
|
||||
var currTime = ticks[i];
|
||||
for (let i = 1; i < totalTicks; i++) {
|
||||
let currTime = ticks[i];
|
||||
frameCount++;
|
||||
|
||||
var elapsedTime = currTime - prevTime;
|
||||
let elapsedTime = currTime - prevTime;
|
||||
if (elapsedTime < interval) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var framerate = Math.min(1000 / (elapsedTime / frameCount), clamp);
|
||||
let framerate = Math.min(1000 / (elapsedTime / frameCount), clamp);
|
||||
timeline.push({ delta: prevTime, value: framerate });
|
||||
timeline.push({ delta: currTime, value: framerate });
|
||||
|
||||
|
@ -66,24 +65,24 @@ window.onload = function() {
|
|||
}
|
||||
|
||||
return timeline;
|
||||
};
|
||||
}
|
||||
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
}
|
||||
|
||||
var client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
client.connect().then(function onConnect() {
|
||||
client.listTabs(function onListTabs(aResponse) {
|
||||
var form = aResponse.tabs[aResponse.selected];
|
||||
var front = FramerateFront(client, form);
|
||||
client.listTabs(function onListTabs(response) {
|
||||
let form = response.tabs[response.selected];
|
||||
let front = FramerateFront(client, form);
|
||||
|
||||
front.stopRecording().then(rawData => {
|
||||
ok(rawData, "There should be a recording available.");
|
||||
is(rawData.length, 0, "...but it should be empty.");
|
||||
|
||||
var timeline = plotFPS(rawData);
|
||||
let timeline = plotFPS(rawData);
|
||||
is(timeline.length, 2,
|
||||
"There should be one measurement plotted, with two entries.");
|
||||
|
||||
|
@ -99,14 +98,15 @@ window.onload = function() {
|
|||
is(timeline[1].value, 0,
|
||||
"The last framerate value should be 0.");
|
||||
|
||||
// eslint-disable-next-line max-nested-callbacks
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -12,47 +12,48 @@ Bug 1023018 - Tests whether or not the framerate actor can handle time ranges.
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
var Cu = Components.utils;
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
window.onload = function () {
|
||||
const Cu = Components.utils;
|
||||
|
||||
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
var {DebuggerClient} = require("devtools/shared/client/main");
|
||||
var {DebuggerServer} = require("devtools/server/main");
|
||||
var Services = require("Services");
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {DebuggerClient} = require("devtools/shared/client/main");
|
||||
const {DebuggerServer} = require("devtools/server/main");
|
||||
const Services = require("Services");
|
||||
|
||||
// Always log packets when running tests.
|
||||
Services.prefs.setBoolPref("devtools.debugger.log", true);
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SimpleTest.registerCleanupFunction(function () {
|
||||
Services.prefs.clearUserPref("devtools.debugger.log");
|
||||
});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
var START_TICK = 2000;
|
||||
var STOP_TICK = 3000;
|
||||
var TOTAL_TIME = 5000;
|
||||
const {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
const START_TICK = 2000;
|
||||
const STOP_TICK = 3000;
|
||||
const TOTAL_TIME = 5000;
|
||||
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
}
|
||||
|
||||
var client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
client.connect().then(function onConnect() {
|
||||
client.listTabs(function onListTabs(aResponse) {
|
||||
var form = aResponse.tabs[aResponse.selected];
|
||||
var front = FramerateFront(client, form);
|
||||
client.listTabs(function onListTabs(response) {
|
||||
let form = response.tabs[response.selected];
|
||||
let front = FramerateFront(client, form);
|
||||
|
||||
front.startRecording().then(() => {
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
window.setTimeout(() => {
|
||||
front.stopRecording(START_TICK, STOP_TICK).then(rawData => {
|
||||
onRecordingStopped(front, rawData);
|
||||
});
|
||||
}, TOTAL_TIME);
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -65,17 +66,17 @@ window.onload = function() {
|
|||
ok(!rawData.find(e => e > STOP_TICK),
|
||||
"There should be no tick after 3000ms.");
|
||||
|
||||
for (var tick of rawData) {
|
||||
for (let tick of rawData) {
|
||||
info("Testing tick: " + tick);
|
||||
is(typeof tick, "number", "All values should be numbers.");
|
||||
}
|
||||
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -13,26 +13,28 @@ Bug 1023018 - Tests if the framerate actor keeps recording after navigations.
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
var {TargetFactory} = require("devtools/client/framework/target");
|
||||
const {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
const {TargetFactory} = require("devtools/client/framework/target");
|
||||
|
||||
var url = document.getElementById("testContent").href;
|
||||
let url = document.getElementById("testContent").href;
|
||||
attachURL(url, onTab);
|
||||
|
||||
function onTab(_, client, form, contentDoc) {
|
||||
var contentWin = contentDoc.defaultView;
|
||||
var chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
var selectedTab = chromeWin.gBrowser.selectedTab;
|
||||
let contentWin = contentDoc.defaultView;
|
||||
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let selectedTab = chromeWin.gBrowser.selectedTab;
|
||||
|
||||
var target = TargetFactory.forTab(selectedTab);
|
||||
var front = FramerateFront(client, form);
|
||||
let target = TargetFactory.forTab(selectedTab);
|
||||
let front = FramerateFront(client, form);
|
||||
|
||||
front.startRecording().then(() => {
|
||||
window.setTimeout(() => {
|
||||
front.getPendingTicks().then(firstBatch => {
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
target.once("will-navigate", () => {
|
||||
window.setTimeout(() => {
|
||||
front.stopRecording().then(secondBatch => {
|
||||
|
@ -40,6 +42,7 @@ window.onload = function() {
|
|||
});
|
||||
}, 1000);
|
||||
});
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
contentWin.location.reload();
|
||||
});
|
||||
}, 1000);
|
||||
|
@ -50,7 +53,7 @@ window.onload = function() {
|
|||
ok(firstBatch, "There should be a first batch recording available.");
|
||||
ok(secondBatch, "There should be a second batch recording available.");
|
||||
|
||||
var diff = secondBatch.length - firstBatch.length;
|
||||
let diff = secondBatch.length - firstBatch.length;
|
||||
info("Difference in ticks: " + diff);
|
||||
ok(diff > 0, "More ticks should be recorded in the second batch.");
|
||||
|
||||
|
@ -61,10 +64,10 @@ window.onload = function() {
|
|||
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
<a id="testContent" target="_blank" href="inspector_getImageData.html">Test Document</a>
|
||||
|
|
|
@ -12,37 +12,37 @@ Bug 1034648 - Tests whether a framerate recording can be cancelled.
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
var Cu = Components.utils;
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
window.onload = function () {
|
||||
let Cu = Components.utils;
|
||||
|
||||
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
var {DebuggerClient} = require("devtools/shared/client/main");
|
||||
var {DebuggerServer} = require("devtools/server/main");
|
||||
var Services = require("Services");
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {DebuggerClient} = require("devtools/shared/client/main");
|
||||
const {DebuggerServer} = require("devtools/server/main");
|
||||
const Services = require("Services");
|
||||
|
||||
// Always log packets when running tests.
|
||||
Services.prefs.setBoolPref("devtools.debugger.log", true);
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SimpleTest.registerCleanupFunction(function () {
|
||||
Services.prefs.clearUserPref("devtools.debugger.log");
|
||||
});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
const {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
|
||||
var client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
client.connect().then(function onConnect() {
|
||||
client.listTabs(function onListTabs(aResponse) {
|
||||
var form = aResponse.tabs[aResponse.selected];
|
||||
var front = FramerateFront(client, form);
|
||||
client.listTabs(function onListTabs(response) {
|
||||
let form = response.tabs[response.selected];
|
||||
let front = FramerateFront(client, form);
|
||||
|
||||
front.startRecording().then(() => {
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
window.setTimeout(() => {
|
||||
front.cancelRecording().then(() => {
|
||||
window.setTimeout(() => {
|
||||
|
@ -60,17 +60,18 @@ window.onload = function() {
|
|||
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
}, 1000);
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -13,34 +13,33 @@ Bug 1171489 - Tests if the framerate actor does not record timestamps from multi
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
var {TargetFactory} = require("devtools/client/framework/target");
|
||||
const {FramerateFront} = require("devtools/shared/fronts/framerate");
|
||||
|
||||
var url = document.getElementById("testContent").href;
|
||||
let url = document.getElementById("testContent").href;
|
||||
attachURL(url, onTab);
|
||||
|
||||
function onTab(_, client, form, contentDoc) {
|
||||
var contentWin = contentDoc.defaultView;
|
||||
var chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
var selectedTab = chromeWin.gBrowser.selectedTab;
|
||||
let contentWin = contentDoc.defaultView;
|
||||
|
||||
var target = TargetFactory.forTab(selectedTab);
|
||||
var front = FramerateFront(client, form);
|
||||
let front = FramerateFront(client, form);
|
||||
|
||||
front.startRecording().then(() => {
|
||||
window.setTimeout(() => {
|
||||
// Wait for the iframe to be loaded again
|
||||
window.addEventListener("message", function loaded (event) {
|
||||
window.addEventListener("message", function loaded(event) {
|
||||
if (event.data === "ready") {
|
||||
window.removeEventListener("message", loaded);
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
window.setTimeout(() => {
|
||||
front.stopRecording().then(ticks => {
|
||||
onRecordingStopped(client, ticks);
|
||||
});
|
||||
}, 1000);
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
}
|
||||
});
|
||||
contentWin.location.reload();
|
||||
|
@ -49,13 +48,13 @@ window.onload = function() {
|
|||
}
|
||||
|
||||
function onRecordingStopped(client, ticks) {
|
||||
var diffs = [];
|
||||
let diffs = [];
|
||||
|
||||
info(`Got ${ticks.length} ticks.`);
|
||||
|
||||
for (var i = 1; i < ticks.length; i++) {
|
||||
var prev = ticks[i - 1];
|
||||
var curr = ticks[i];
|
||||
for (let i = 1; i < ticks.length; i++) {
|
||||
let prev = ticks[i - 1];
|
||||
let curr = ticks[i];
|
||||
diffs.push(curr - prev);
|
||||
info(curr + " - " + (curr - prev));
|
||||
}
|
||||
|
@ -64,17 +63,19 @@ window.onload = function() {
|
|||
// when we get ticks from other frames they're usually at diffs of < 1. Sometimes
|
||||
// ticks can still be less than 16ms even on one frame (usually following a very slow
|
||||
// frame), so use a low number (2) to be our threshold
|
||||
var THRESHOLD = 2;
|
||||
ok(ticks.length >= 20, "we should have atleast 20 ticks over the course of two seconds.");
|
||||
var belowThreshold = diffs.filter(v => v <= THRESHOLD);
|
||||
ok(belowThreshold.length <= 10, "we should have very few frames less than the threshold");
|
||||
let THRESHOLD = 2;
|
||||
ok(ticks.length >= 20,
|
||||
"we should have atleast 20 ticks over the course of two seconds.");
|
||||
let belowThreshold = diffs.filter(v => v <= THRESHOLD);
|
||||
ok(belowThreshold.length <= 10,
|
||||
"we should have very few frames less than the threshold");
|
||||
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
<a id="testContent" target="_blank" href="inspector-traversal-data.html">Test Document</a>
|
||||
|
|
|
@ -12,17 +12,16 @@ Bug 1060093 - Test DebuggerServer.getProcess
|
|||
<body>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
let Cu = Components.utils;
|
||||
let Cc = Components.classes;
|
||||
let Ci = Components.interfaces;
|
||||
|
||||
let {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
let {DebuggerClient} = require("devtools/shared/client/main");
|
||||
let {DebuggerServer} = require("devtools/server/main");
|
||||
let Services = require("Services");
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv({
|
||||
|
@ -35,7 +34,7 @@ window.onload = function() {
|
|||
["dom.ipc.processCount", 10],
|
||||
]
|
||||
}, runTests);
|
||||
}
|
||||
};
|
||||
|
||||
function runTests() {
|
||||
// Instantiate a minimal server
|
||||
|
@ -81,13 +80,13 @@ function runTests() {
|
|||
function getProcess() {
|
||||
client.mainRoot.listProcesses(response => {
|
||||
ok(response.processes.length >= 2, "Got at least the parent process and one child");
|
||||
is(response.processes.length, processCount+1 , "Got one additional process on the second call to listProcesses");
|
||||
is(response.processes.length, processCount + 1,
|
||||
"Got one additional process on the second call to listProcesses");
|
||||
|
||||
// Connect to the first content processe available
|
||||
let content = response.processes.filter(p => (!p.parent))[0];
|
||||
|
||||
client.getProcess(content.id).then(response => {
|
||||
let actor = response.form;
|
||||
client.getProcess(content.id).then(({form: actor}) => {
|
||||
ok(actor.consoleActor, "Got the console actor");
|
||||
ok(actor.chromeDebugger, "Got the thread actor");
|
||||
|
||||
|
@ -96,8 +95,8 @@ function runTests() {
|
|||
to: actor.consoleActor,
|
||||
type: "evaluateJS",
|
||||
text: "var a = 42; a"
|
||||
}, function (response) {
|
||||
ok(response.result, 42, "console.eval worked");
|
||||
}, function ({result}) {
|
||||
ok(result, 42, "console.eval worked");
|
||||
|
||||
getProcessAgain(actor, content.id);
|
||||
});
|
||||
|
@ -118,7 +117,7 @@ function runTests() {
|
|||
|
||||
function processScript() {
|
||||
let listener = function () {
|
||||
Services.obs.removeObserver(listener, "sdk:loader:destroy", false);
|
||||
Services.obs.removeObserver(listener, "sdk:loader:destroy");
|
||||
sendAsyncMessage("test:getProcess-destroy", null);
|
||||
};
|
||||
Services.obs.addObserver(listener, "sdk:loader:destroy", false);
|
||||
|
@ -127,10 +126,10 @@ function runTests() {
|
|||
function closeClient() {
|
||||
let onLoaderDestroyed = new Promise(done => {
|
||||
let processListener = function () {
|
||||
Services.ppmm.removeMessageListener("test:getProcess-destroy", processListener)
|
||||
Services.ppmm.removeMessageListener("test:getProcess-destroy", processListener);
|
||||
done();
|
||||
};
|
||||
Services.ppmm.addMessageListener("test:getProcess-destroy", processListener)
|
||||
Services.ppmm.addMessageListener("test:getProcess-destroy", processListener);
|
||||
});
|
||||
let script = "data:,(" + processScript + ")()";
|
||||
Services.ppmm.loadProcessScript(script, true);
|
||||
|
@ -147,7 +146,7 @@ function runTests() {
|
|||
function cleanup() {
|
||||
DebuggerServer.destroy();
|
||||
iframe.remove();
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
connect();
|
||||
|
|
|
@ -11,7 +11,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=777674
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
window.onload = function() {
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
const {InspectorFront} =
|
||||
require("devtools/shared/fronts/inspector");
|
||||
const {_documentWalker} =
|
||||
|
@ -26,51 +28,50 @@ window.onload = function() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let gWalker = null;
|
||||
let gClient = null;
|
||||
let gInspectee = null;
|
||||
|
||||
addTest(function setup() {
|
||||
info ("Setting up inspector and walker actors.");
|
||||
info("Setting up inspector and walker actors.");
|
||||
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
});
|
||||
});
|
||||
|
||||
addAsyncTest(function* testXBLAnonymousInHTMLDocument() {
|
||||
info ("Testing XBL anonymous in an HTML document.");
|
||||
info("Testing XBL anonymous in an HTML document.");
|
||||
let rawToolbarbutton = gInspectee.createElementNS(XUL_NS, "toolbarbutton");
|
||||
gInspectee.documentElement.appendChild(rawToolbarbutton);
|
||||
|
||||
let toolbarbutton = yield gWalker.querySelector(gWalker.rootNode, "toolbarbutton");
|
||||
let children = yield gWalker.children(toolbarbutton);
|
||||
|
||||
is (toolbarbutton.numChildren, 0, "XBL content is not visible in HTML doc");
|
||||
is (children.nodes.length, 0, "XBL content is not returned in HTML doc");
|
||||
is(toolbarbutton.numChildren, 0, "XBL content is not visible in HTML doc");
|
||||
is(children.nodes.length, 0, "XBL content is not returned in HTML doc");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function* testNativeAnonymous() {
|
||||
info ("Testing native anonymous content with walker.");
|
||||
info("Testing native anonymous content with walker.");
|
||||
|
||||
let select = yield gWalker.querySelector(gWalker.rootNode, "select");
|
||||
let children = yield gWalker.children(select);
|
||||
|
||||
is (select.numChildren, 2, "No native anon content for form control");
|
||||
is (children.nodes.length, 2, "No native anon content for form control");
|
||||
is(select.numChildren, 2, "No native anon content for form control");
|
||||
is(children.nodes.length, 2, "No native anon content for form control");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function* testNativeAnonymousStartingNode() {
|
||||
info ("Tests attaching an element that a walker can't see.");
|
||||
info("Tests attaching an element that a walker can't see.");
|
||||
|
||||
let serverWalker = DebuggerServer._searchAllConnectionsForActor(gWalker.actorID);
|
||||
let docwalker = new _documentWalker(
|
||||
|
@ -78,108 +79,109 @@ window.onload = function() {
|
|||
gInspectee.defaultView,
|
||||
nodeFilterConstants.SHOW_ALL,
|
||||
() => {
|
||||
return nodeFilterConstants.FILTER_ACCEPT
|
||||
return nodeFilterConstants.FILTER_ACCEPT;
|
||||
}
|
||||
);
|
||||
let scrollbar = docwalker.lastChild();
|
||||
is (scrollbar.tagName, "scrollbar", "An anonymous child has been fetched");
|
||||
is(scrollbar.tagName, "scrollbar", "An anonymous child has been fetched");
|
||||
|
||||
let node = yield serverWalker.attachElement(scrollbar);
|
||||
|
||||
ok (node, "A response has arrived");
|
||||
ok (node.node, "A node is in the response");
|
||||
is (node.node.rawNode.tagName, "SELECT",
|
||||
ok(node, "A response has arrived");
|
||||
ok(node.node, "A node is in the response");
|
||||
is(node.node.rawNode.tagName, "SELECT",
|
||||
"The node has changed to a parent that the walker recognizes");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function* testPseudoElements() {
|
||||
info ("Testing pseudo elements with walker.");
|
||||
info("Testing pseudo elements with walker.");
|
||||
|
||||
// Markup looks like: <div><::before /><span /><::after /></div>
|
||||
let pseudo = yield gWalker.querySelector(gWalker.rootNode, "#pseudo");
|
||||
let children = yield gWalker.children(pseudo);
|
||||
|
||||
is (pseudo.numChildren, 1, "::before/::after are not counted if there is a child");
|
||||
is (children.nodes.length, 3, "Correct number of children");
|
||||
is(pseudo.numChildren, 1, "::before/::after are not counted if there is a child");
|
||||
is(children.nodes.length, 3, "Correct number of children");
|
||||
|
||||
let before = children.nodes[0];
|
||||
ok (before.isAnonymous, "Child is anonymous");
|
||||
ok (!before._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok (!before._form.isShadowAnonymous, "Child is not shadow anonymous");
|
||||
ok (before._form.isNativeAnonymous, "Child is native anonymous");
|
||||
ok(before.isAnonymous, "Child is anonymous");
|
||||
ok(!before._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok(!before._form.isShadowAnonymous, "Child is not shadow anonymous");
|
||||
ok(before._form.isNativeAnonymous, "Child is native anonymous");
|
||||
|
||||
let span = children.nodes[1];
|
||||
ok (!span.isAnonymous, "Child is not anonymous");
|
||||
ok(!span.isAnonymous, "Child is not anonymous");
|
||||
|
||||
let after = children.nodes[2];
|
||||
ok (after.isAnonymous, "Child is anonymous");
|
||||
ok (!after._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok (!after._form.isShadowAnonymous, "Child is not shadow anonymous");
|
||||
ok (after._form.isNativeAnonymous, "Child is native anonymous");
|
||||
ok(after.isAnonymous, "Child is anonymous");
|
||||
ok(!after._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok(!after._form.isShadowAnonymous, "Child is not shadow anonymous");
|
||||
ok(after._form.isNativeAnonymous, "Child is native anonymous");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function* testEmptyWithPseudo() {
|
||||
info ("Testing elements with no childrent, except for pseudos.");
|
||||
info("Testing elements with no childrent, except for pseudos.");
|
||||
|
||||
info ("Checking an element whose only child is a pseudo element");
|
||||
info("Checking an element whose only child is a pseudo element");
|
||||
let pseudo = yield gWalker.querySelector(gWalker.rootNode, "#pseudo-empty");
|
||||
let children = yield gWalker.children(pseudo);
|
||||
|
||||
is (pseudo.numChildren, 1, "::before/::after are is counted if there are no other children");
|
||||
is (children.nodes.length, 1, "Correct number of children");
|
||||
is(pseudo.numChildren, 1,
|
||||
"::before/::after are is counted if there are no other children");
|
||||
is(children.nodes.length, 1, "Correct number of children");
|
||||
|
||||
let before = children.nodes[0];
|
||||
ok (before.isAnonymous, "Child is anonymous");
|
||||
ok (!before._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok (!before._form.isShadowAnonymous, "Child is not shadow anonymous");
|
||||
ok (before._form.isNativeAnonymous, "Child is native anonymous");
|
||||
ok(before.isAnonymous, "Child is anonymous");
|
||||
ok(!before._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok(!before._form.isShadowAnonymous, "Child is not shadow anonymous");
|
||||
ok(before._form.isNativeAnonymous, "Child is native anonymous");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function* testShadowAnonymous() {
|
||||
info ("Testing shadow DOM content.");
|
||||
info("Testing shadow DOM content.");
|
||||
|
||||
let shadow = yield gWalker.querySelector(gWalker.rootNode, "#shadow");
|
||||
let children = yield gWalker.children(shadow);
|
||||
|
||||
is (shadow.numChildren, 3, "Children of the shadow root are counted");
|
||||
is (children.nodes.length, 3, "Children returned from walker");
|
||||
is(shadow.numChildren, 3, "Children of the shadow root are counted");
|
||||
is(children.nodes.length, 3, "Children returned from walker");
|
||||
|
||||
let before = children.nodes[0];
|
||||
ok (before.isAnonymous, "Child is anonymous");
|
||||
ok (!before._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok (!before._form.isShadowAnonymous, "Child is not shadow anonymous");
|
||||
ok (before._form.isNativeAnonymous, "Child is native anonymous");
|
||||
ok(before.isAnonymous, "Child is anonymous");
|
||||
ok(!before._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok(!before._form.isShadowAnonymous, "Child is not shadow anonymous");
|
||||
ok(before._form.isNativeAnonymous, "Child is native anonymous");
|
||||
|
||||
// <h3>Shadow <em>DOM</em></h3>
|
||||
let shadowChild1 = children.nodes[1];
|
||||
ok (shadowChild1.isAnonymous, "Child is anonymous");
|
||||
ok (!shadowChild1._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok (shadowChild1._form.isShadowAnonymous, "Child is shadow anonymous");
|
||||
ok (!shadowChild1._form.isNativeAnonymous, "Child is not native anonymous");
|
||||
ok(shadowChild1.isAnonymous, "Child is anonymous");
|
||||
ok(!shadowChild1._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok(shadowChild1._form.isShadowAnonymous, "Child is shadow anonymous");
|
||||
ok(!shadowChild1._form.isNativeAnonymous, "Child is not native anonymous");
|
||||
|
||||
let shadowSubChildren = yield gWalker.children(children.nodes[1]);
|
||||
is (shadowChild1.numChildren, 2, "Subchildren of the shadow root are counted");
|
||||
is (shadowSubChildren.nodes.length, 2, "Subchildren are returned from walker");
|
||||
is(shadowChild1.numChildren, 2, "Subchildren of the shadow root are counted");
|
||||
is(shadowSubChildren.nodes.length, 2, "Subchildren are returned from walker");
|
||||
|
||||
// <em>DOM</em>
|
||||
let shadowSubChild = children.nodes[1];
|
||||
ok (shadowSubChild.isAnonymous, "Child is anonymous");
|
||||
ok (!shadowSubChild._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok (shadowSubChild._form.isShadowAnonymous, "Child is shadow anonymous");
|
||||
ok (!shadowSubChild._form.isNativeAnonymous, "Child is not native anonymous");
|
||||
ok(shadowSubChild.isAnonymous, "Child is anonymous");
|
||||
ok(!shadowSubChild._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok(shadowSubChild._form.isShadowAnonymous, "Child is shadow anonymous");
|
||||
ok(!shadowSubChild._form.isNativeAnonymous, "Child is not native anonymous");
|
||||
|
||||
// <select multiple></select>
|
||||
let shadowChild2 = children.nodes[2];
|
||||
ok (shadowChild2.isAnonymous, "Child is anonymous");
|
||||
ok (!shadowChild2._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok (shadowChild2._form.isShadowAnonymous, "Child is shadow anonymous");
|
||||
ok (!shadowChild2._form.isNativeAnonymous, "Child is not native anonymous");
|
||||
ok(shadowChild2.isAnonymous, "Child is anonymous");
|
||||
ok(!shadowChild2._form.isXBLAnonymous, "Child is not XBL anonymous");
|
||||
ok(shadowChild2._form.isShadowAnonymous, "Child is shadow anonymous");
|
||||
ok(!shadowChild2._form.isNativeAnonymous, "Child is not native anonymous");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
|
|
@ -11,31 +11,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspectee = null;
|
||||
var gClient = null;
|
||||
var gWalker = null;
|
||||
var checkActorIDs = [];
|
||||
|
||||
function assertOwnership() {
|
||||
assertOwnershipTrees(gWalker);
|
||||
}
|
||||
let gInspectee = null;
|
||||
let gWalker = null;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -56,34 +49,36 @@ addTest(function testChangeAttrs() {
|
|||
// We're only going to test that the change hit the document.
|
||||
// There are other tests that make sure changes are propagated
|
||||
// to the client.
|
||||
is(attrNode.getAttribute("data-newattr"), "newvalue", "Node should have the first new attribute");
|
||||
is(attrNode.getAttribute("data-newattr2"), "newvalue", "Node should have the second new attribute.");
|
||||
is(attrNode.getAttribute("data-newattr"), "newvalue",
|
||||
"Node should have the first new attribute");
|
||||
is(attrNode.getAttribute("data-newattr2"), "newvalue",
|
||||
"Node should have the second new attribute.");
|
||||
}).then(() => {
|
||||
// Change an attribute.
|
||||
let list = attrFront.startModifyingAttributes();
|
||||
list.setAttribute("data-newattr", "changedvalue");
|
||||
return list.apply();
|
||||
}).then(() => {
|
||||
is(attrNode.getAttribute("data-newattr"), "changedvalue", "Node should have the changed first value.");
|
||||
is(attrNode.getAttribute("data-newattr2"), "newvalue", "Second value should remain unchanged.");
|
||||
is(attrNode.getAttribute("data-newattr"), "changedvalue",
|
||||
"Node should have the changed first value.");
|
||||
is(attrNode.getAttribute("data-newattr2"), "newvalue",
|
||||
"Second value should remain unchanged.");
|
||||
}).then(() => {
|
||||
let list = attrFront.startModifyingAttributes();
|
||||
list.removeAttribute("data-newattr2");
|
||||
return list.apply();
|
||||
}).then(() => {
|
||||
is(attrNode.getAttribute("data-newattr"), "changedvalue", "Node should have the changed first value.");
|
||||
is(attrNode.getAttribute("data-newattr"), "changedvalue",
|
||||
"Node should have the changed first value.");
|
||||
ok(!attrNode.hasAttribute("data-newattr2"), "Second value should be removed.");
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gInspectee;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
gInspectee = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,31 +11,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const Ci = Components.interfaces;
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspectee = null;
|
||||
var gClient = null;
|
||||
var gWalker = null;
|
||||
|
||||
function assertOwnership() {
|
||||
assertOwnershipTrees(gWalker);
|
||||
}
|
||||
let gInspectee = null;
|
||||
let gWalker = null;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -60,13 +55,10 @@ addTest(function testChangeValue() {
|
|||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gInspectee;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
gInspectee = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,20 +11,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1121528
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gWalker, gDoc;
|
||||
let gWalker = null;
|
||||
let gDoc = null;
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
|
||||
let def = promise.defer();
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
def.resolve({client, tab, doc});
|
||||
});
|
||||
let {client, tab, doc} = yield def.promise;
|
||||
|
@ -37,7 +38,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.parents(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -51,7 +52,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.children(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -65,7 +66,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.siblings(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -79,7 +80,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.nextSibling(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -93,7 +94,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.previousSibling(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -107,7 +108,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.addPseudoClassLock(nodeFront) before the load completes " +
|
||||
"shouldn't fail");
|
||||
|
@ -122,7 +123,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.removePseudoClassLock(nodeFront) before the load completes " +
|
||||
"shouldn't fail");
|
||||
|
@ -137,7 +138,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.clearPseudoClassLocks(nodeFront) before the load completes " +
|
||||
"shouldn't fail");
|
||||
|
@ -152,7 +153,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.innerHTML(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -166,7 +167,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.setInnerHTML(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -180,7 +181,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.outerHTML(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -194,7 +195,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.setOuterHTML(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -208,7 +209,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.insertAdjacentHTML(nodeFront) before the load completes shouldn't " +
|
||||
"fail");
|
||||
|
@ -224,7 +225,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.removeNode(nodeFront) before the load completes should throw");
|
||||
|
||||
|
@ -243,7 +244,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.removeNodes([nodeFront]) before the load completes should throw");
|
||||
|
||||
|
@ -264,7 +265,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.insertBefore(nodeFront, parent, null) before the load completes " +
|
||||
"shouldn't fail");
|
||||
|
@ -280,7 +281,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.insertBefore(nodeFront, parent, sibling) before the load completes " +
|
||||
"shouldn't fail");
|
||||
|
@ -297,7 +298,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.editTagName(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -311,7 +312,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.hideNode(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -325,7 +326,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.unhideNode(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -339,7 +340,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.releaseNode(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -353,7 +354,7 @@ addAsyncTest(function*() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
info("Getting a nodeFront, reloading the page, and calling " +
|
||||
"walker.querySelector(nodeFront) before the load completes shouldn't fail");
|
||||
|
||||
|
@ -368,7 +369,8 @@ addAsyncTest(function*() {
|
|||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
gWalker = gDoc = null;
|
||||
gWalker = null;
|
||||
gDoc = null;
|
||||
runNextTest();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -11,30 +11,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1208864
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspectee = null;
|
||||
var gClient = null;
|
||||
var gWalker = null;
|
||||
|
||||
function assertOwnership() {
|
||||
assertOwnershipTrees(gWalker);
|
||||
}
|
||||
let gWalker = null;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -55,9 +47,7 @@ addTest(Task.async(function* testDuplicateNode() {
|
|||
}));
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gInspectee;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
runNextTest();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -11,25 +11,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gWalker = null;
|
||||
var gClient = null;
|
||||
let gWalker = null;
|
||||
let gInspectee = null;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -56,8 +55,8 @@ addTest(function testRearrange() {
|
|||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
gInspectee = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
|
|
@ -11,29 +11,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
const inspector = require("devtools/server/actors/inspector");
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gWalker = null;
|
||||
var gClient = null;
|
||||
|
||||
function assertOwnership() {
|
||||
return assertOwnershipTrees(gWalker);
|
||||
}
|
||||
let gWalker = null;
|
||||
let gInspectee = null;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
let inspectorFront = InspectorFront(client, tab);
|
||||
promiseDone(inspectorFront.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -47,9 +44,11 @@ addAsyncTest(function* testRearrange() {
|
|||
|
||||
// Move nodeA to the end of the list.
|
||||
yield gWalker.insertBefore(nodeA, longlist, null);
|
||||
ok(!gInspectee.querySelector("#a").nextSibling, "a should now be at the end of the list.");
|
||||
ok(!gInspectee.querySelector("#a").nextSibling,
|
||||
"a should now be at the end of the list.");
|
||||
children = yield gWalker.children(longlist);
|
||||
is(nodeA, children.nodes[children.nodes.length - 1], "a should now be the last returned child.");
|
||||
is(nodeA, children.nodes[children.nodes.length - 1],
|
||||
"a should now be the last returned child.");
|
||||
|
||||
// Now move it to the middle of the list.
|
||||
let nextNode = children.nodes[13];
|
||||
|
@ -99,8 +98,8 @@ addAsyncTest(function* testInsertInvalidInput() {
|
|||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
gInspectee = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
|
|
@ -11,28 +11,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspectee = null;
|
||||
var gWalker = null;
|
||||
var gClient = null;
|
||||
var attrNode;
|
||||
var attrFront;
|
||||
let gInspectee = null;
|
||||
let gWalker = null;
|
||||
let attrNode;
|
||||
let attrFront;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -50,14 +48,14 @@ addTest(testRemoveAttribute);
|
|||
addTest(testQueuedMutations);
|
||||
|
||||
function setupAttrTest() {
|
||||
attrNode = gInspectee.querySelector("#a")
|
||||
attrNode = gInspectee.querySelector("#a");
|
||||
promiseDone(gWalker.querySelector(gWalker.rootNode, "#a").then(node => {
|
||||
attrFront = node;
|
||||
}).then(runNextTest));
|
||||
}
|
||||
|
||||
function setupFrameAttrTest() {
|
||||
let frame = gInspectee.querySelector('#childFrame');
|
||||
let frame = gInspectee.querySelector("#childFrame");
|
||||
attrNode = frame.contentDocument.querySelector("#a");
|
||||
|
||||
promiseDone(gWalker.querySelector(gWalker.rootNode, "#childFrame").then(childFrame => {
|
||||
|
@ -77,8 +75,10 @@ function testAddAttribute() {
|
|||
attrNode.setAttribute("data-newattr2", "newvalue");
|
||||
gWalker.once("mutations", () => {
|
||||
is(attrFront.attributes.length, 3, "Should have id and two new attributes.");
|
||||
is(attrFront.getAttribute("data-newattr"), "newvalue", "Node front should have the first new attribute");
|
||||
is(attrFront.getAttribute("data-newattr2"), "newvalue", "Node front should have the second new attribute.");
|
||||
is(attrFront.getAttribute("data-newattr"), "newvalue",
|
||||
"Node front should have the first new attribute");
|
||||
is(attrFront.getAttribute("data-newattr2"), "newvalue",
|
||||
"Node front should have the second new attribute.");
|
||||
runNextTest();
|
||||
});
|
||||
}
|
||||
|
@ -88,10 +88,13 @@ function testChangeAttribute() {
|
|||
attrNode.setAttribute("data-newattr", "changedvalue2");
|
||||
attrNode.setAttribute("data-newattr", "changedvalue3");
|
||||
gWalker.once("mutations", mutations => {
|
||||
is(mutations.length, 1, "Only one mutation is sent for multiple queued attribute changes");
|
||||
is(mutations.length, 1,
|
||||
"Only one mutation is sent for multiple queued attribute changes");
|
||||
is(attrFront.attributes.length, 3, "Should have id and two new attributes.");
|
||||
is(attrFront.getAttribute("data-newattr"), "changedvalue3", "Node front should have the changed first value");
|
||||
is(attrFront.getAttribute("data-newattr2"), "newvalue", "Second value should remain unchanged.");
|
||||
is(attrFront.getAttribute("data-newattr"), "changedvalue3",
|
||||
"Node front should have the changed first value");
|
||||
is(attrFront.getAttribute("data-newattr2"), "newvalue",
|
||||
"Second value should remain unchanged.");
|
||||
runNextTest();
|
||||
});
|
||||
}
|
||||
|
@ -100,10 +103,11 @@ function testRemoveAttribute() {
|
|||
attrNode.removeAttribute("data-newattr2");
|
||||
gWalker.once("mutations", () => {
|
||||
is(attrFront.attributes.length, 2, "Should have id and one remaining attribute.");
|
||||
is(attrFront.getAttribute("data-newattr"), "changedvalue3", "Node front should still have the first value");
|
||||
is(attrFront.getAttribute("data-newattr"), "changedvalue3",
|
||||
"Node front should still have the first value");
|
||||
ok(!attrFront.hasAttribute("data-newattr2"), "Second value should be removed.");
|
||||
runNextTest();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function testQueuedMutations() {
|
||||
|
@ -115,7 +119,7 @@ function testQueuedMutations() {
|
|||
attrNode.setAttribute("data-newattr", "2");
|
||||
attrNode.removeAttribute("data-newattr");
|
||||
|
||||
for (var i = 0; i <= 1000; i++) {
|
||||
for (let i = 0; i <= 1000; i++) {
|
||||
attrNode.setAttribute("data-newattr2", i);
|
||||
}
|
||||
|
||||
|
@ -132,26 +136,27 @@ function testQueuedMutations() {
|
|||
attrNode.removeAttribute("data-newattr4");
|
||||
|
||||
gWalker.once("mutations", mutations => {
|
||||
is(mutations.length, 4, "Only one mutation each is sent for multiple queued attribute changes");
|
||||
is(attrFront.attributes.length, 3, "Should have id, data-newattr2, and data-newattr3.");
|
||||
is(mutations.length, 4,
|
||||
"Only one mutation each is sent for multiple queued attribute changes");
|
||||
is(attrFront.attributes.length, 3,
|
||||
"Should have id, data-newattr2, and data-newattr3.");
|
||||
|
||||
is(attrFront.getAttribute("data-newattr2"), "1000", "Node front should still have the correct value");
|
||||
is(attrFront.getAttribute("data-newattr3"), "3", "Node front should still have the correct value");
|
||||
is(attrFront.getAttribute("data-newattr2"), "1000",
|
||||
"Node front should still have the correct value");
|
||||
is(attrFront.getAttribute("data-newattr3"), "3",
|
||||
"Node front should still have the correct value");
|
||||
ok(!attrFront.hasAttribute("data-newattr"), "Attribute value should be removed.");
|
||||
ok(!attrFront.hasAttribute("data-newattr4"), "Attribute value should be removed.");
|
||||
|
||||
runNextTest();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gInspectee;
|
||||
delete gWalker;
|
||||
delete gClient;
|
||||
gInspectee = null;
|
||||
gWalker = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,26 +11,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspectee = null;
|
||||
var gWalker = null;
|
||||
var gClient = null;
|
||||
var gCleanupConnection = null;
|
||||
let gInspectee = null;
|
||||
let gWalker = null;
|
||||
let gCleanupConnection = null;
|
||||
|
||||
function setup(callback) {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
gCleanupConnection = attachURL(url, function(err, client, tab, doc) {
|
||||
gCleanupConnection = attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(callback));
|
||||
});
|
||||
|
@ -38,7 +36,6 @@ function setup(callback) {
|
|||
|
||||
function teardown() {
|
||||
gWalker = null;
|
||||
gClient = null;
|
||||
gInspectee = null;
|
||||
if (gCleanupConnection) {
|
||||
gCleanupConnection();
|
||||
|
@ -47,7 +44,7 @@ function teardown() {
|
|||
}
|
||||
|
||||
function assertOwnership() {
|
||||
let num = assertOwnershipTrees(gWalker);
|
||||
return assertOwnershipTrees(gWalker);
|
||||
}
|
||||
|
||||
function setParent(nodeSelector, newParentSelector) {
|
||||
|
@ -83,7 +80,7 @@ function doMoves(moves) {
|
|||
var gDummySerial = 0;
|
||||
|
||||
function mutationTest(testSpec) {
|
||||
return function() {
|
||||
return function () {
|
||||
setup(() => {
|
||||
promiseDone(loadSelectors(testSpec.load || ["html"]).then(() => {
|
||||
gWalker.autoCleanup = !!testSpec.autoCleanup;
|
||||
|
@ -99,6 +96,7 @@ function mutationTest(testSpec) {
|
|||
|
||||
gWalker.once("mutations", (mutations) => {
|
||||
// Filter out our dummy mutation.
|
||||
// eslint-disable-next-line max-nested-callbacks
|
||||
mutations = mutations.filter(change => {
|
||||
if (change.type == "attributes" &&
|
||||
change.attributeName == "data-dummy") {
|
||||
|
@ -114,14 +112,14 @@ function mutationTest(testSpec) {
|
|||
runNextTest();
|
||||
});
|
||||
}));
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// Verify that our dummy mutation works.
|
||||
addTest(mutationTest({
|
||||
autoCleanup: false,
|
||||
postCheck: function(mutations) {
|
||||
postCheck: function (mutations) {
|
||||
is(mutations.length, 0, "Dummy mutation is filtered out.");
|
||||
}
|
||||
}));
|
||||
|
@ -134,17 +132,18 @@ addTest(mutationTest({
|
|||
moves: [
|
||||
["#a", "#longlist"]
|
||||
],
|
||||
postCheck: function(mutations) {
|
||||
postCheck: function (mutations) {
|
||||
let remove = mutations[0];
|
||||
is(remove.type, "childList", "First mutation should be a childList.")
|
||||
ok(remove.removed.length > 0, "First mutation should be a removal.")
|
||||
is(remove.type, "childList", "First mutation should be a childList.");
|
||||
ok(remove.removed.length > 0, "First mutation should be a removal.");
|
||||
let add = mutations[1];
|
||||
is(add.type, "childList", "Second mutation should be a childList removal.")
|
||||
ok(add.added.length > 0, "Second mutation should be an addition.")
|
||||
is(add.type, "childList", "Second mutation should be a childList removal.");
|
||||
ok(add.added.length > 0, "Second mutation should be an addition.");
|
||||
let a = add.added[0];
|
||||
is(a.id, "a", "Added node should be #a");
|
||||
is(a.parentNode(), remove.target, "Should still be a child of longlist.");
|
||||
is(remove.target, add.target, "First and second mutations should be against the same node.");
|
||||
is(remove.target, add.target,
|
||||
"First and second mutations should be against the same node.");
|
||||
}
|
||||
}));
|
||||
|
||||
|
@ -155,13 +154,13 @@ addTest(mutationTest({
|
|||
moves: [
|
||||
["#a", "#longlist-sibling"]
|
||||
],
|
||||
postCheck: function(mutations) {
|
||||
postCheck: function (mutations) {
|
||||
let remove = mutations[0];
|
||||
is(remove.type, "childList", "First mutation should be a childList.")
|
||||
ok(remove.removed.length > 0, "First mutation should be a removal.")
|
||||
is(remove.type, "childList", "First mutation should be a childList.");
|
||||
ok(remove.removed.length > 0, "First mutation should be a removal.");
|
||||
let add = mutations[1];
|
||||
is(add.type, "childList", "Second mutation should be a childList removal.")
|
||||
ok(add.added.length > 0, "Second mutation should be an addition.")
|
||||
is(add.type, "childList", "Second mutation should be a childList removal.");
|
||||
ok(add.added.length > 0, "Second mutation should be an addition.");
|
||||
let a = add.added[0];
|
||||
is(a.id, "a", "Added node should be #a");
|
||||
is(a.parentNode(), add.target, "Should still be a child of longlist.");
|
||||
|
@ -177,7 +176,7 @@ addTest(mutationTest({
|
|||
moves: [
|
||||
["#longlist-sibling", "#longlist"]
|
||||
],
|
||||
postCheck: function(mutations) {
|
||||
postCheck: function (mutations) {
|
||||
is(mutations.length, 2, "Should generate two mutations");
|
||||
is(mutations[0].type, "childList", "Should be childList mutations.");
|
||||
is(mutations[0].added.length, 0, "Should have no adds.");
|
||||
|
@ -196,7 +195,7 @@ addTest(mutationTest({
|
|||
moves: [
|
||||
["#longlist-sibling-firstchild", "#longlist"]
|
||||
],
|
||||
postCheck: function(mutations) {
|
||||
postCheck: function (mutations) {
|
||||
is(mutations.length, 1, "Should generate two mutations");
|
||||
is(mutations[0].type, "childList", "Should be childList mutations.");
|
||||
is(mutations[0].added.length, 0, "Should have no adds.");
|
||||
|
@ -211,7 +210,7 @@ addTest(mutationTest({
|
|||
moves: [
|
||||
["#longlist-sibling", "#longlist"]
|
||||
],
|
||||
postCheck: function(mutations) {
|
||||
postCheck: function (mutations) {
|
||||
is(mutations.length, 0, "Should generate no mutations.");
|
||||
}
|
||||
}));
|
||||
|
@ -223,14 +222,15 @@ addTest(mutationTest({
|
|||
moves: [
|
||||
["#longlist", null]
|
||||
],
|
||||
postCheck: function(mutations) {
|
||||
postCheck: function (mutations) {
|
||||
is(mutations.length, 1, "Should generate one mutation.");
|
||||
let change = mutations[0];
|
||||
is(change.type, "childList", "Should be a childList.");
|
||||
is(change.removed.length, 1, "Should have removed a child.");
|
||||
let ownership = clientOwnershipTree(gWalker);
|
||||
is(ownership.orphaned.length, 1, "Should have one orphaned subtree.");
|
||||
is(ownershipTreeSize(ownership.orphaned[0]), 1 + 26 + 26, "Should have orphaned longlist, and 26 children, and 26 singleTextChilds");
|
||||
is(ownershipTreeSize(ownership.orphaned[0]), 1 + 26 + 26,
|
||||
"Should have orphaned longlist, and 26 children, and 26 singleTextChilds");
|
||||
}
|
||||
}));
|
||||
|
||||
|
@ -241,7 +241,7 @@ addTest(mutationTest({
|
|||
moves: [
|
||||
["#longlist", null]
|
||||
],
|
||||
postCheck: function(mutations) {
|
||||
postCheck: function (mutations) {
|
||||
is(mutations.length, 1, "Should generate one mutation.");
|
||||
let change = mutations[0];
|
||||
is(change.type, "childList", "Should be a childList.");
|
||||
|
@ -258,25 +258,27 @@ addTest(mutationTest({
|
|||
moves: [
|
||||
["#longlist", "#longlist-sibling"]
|
||||
],
|
||||
postCheck: function(mutations) {
|
||||
postCheck: function (mutations) {
|
||||
is(mutations.length, 1, "Should generate one mutation.");
|
||||
let change = mutations[0];
|
||||
is(change.type, "childList", "Should be a childList.");
|
||||
is(change.removed.length, 1, "Should have removed a child.");
|
||||
let ownership = clientOwnershipTree(gWalker);
|
||||
is(ownership.orphaned.length, 1, "Should have one orphaned subtree.");
|
||||
is(ownershipTreeSize(ownership.orphaned[0]), 1 + 26 + 26, "Should have orphaned longlist, 26 children, and 26 singleTextChilds.");
|
||||
is(ownershipTreeSize(ownership.orphaned[0]), 1 + 26 + 26,
|
||||
"Should have orphaned longlist, 26 children, and 26 singleTextChilds.");
|
||||
}
|
||||
}));
|
||||
|
||||
// Orphan a node by moving it into the tree but out of our visible subtree, and clean it up.
|
||||
// Orphan a node by moving it into the tree but out of our visible subtree,
|
||||
// and clean it up.
|
||||
addTest(mutationTest({
|
||||
autoCleanup: true,
|
||||
load: ["#longlist div"],
|
||||
moves: [
|
||||
["#longlist", "#longlist-sibling"]
|
||||
],
|
||||
postCheck: function(mutations) {
|
||||
postCheck: function (mutations) {
|
||||
is(mutations.length, 1, "Should generate one mutation.");
|
||||
let change = mutations[0];
|
||||
is(change.type, "childList", "Should be a childList.");
|
||||
|
@ -286,15 +288,11 @@ addTest(mutationTest({
|
|||
}
|
||||
}));
|
||||
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gInspectee;
|
||||
delete gWalker;
|
||||
delete gClient;
|
||||
gInspectee = null;
|
||||
gWalker = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -10,9 +10,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1157469
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
|
||||
window.onload = function () {
|
||||
const Cu = Components.utils;
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
|
@ -30,11 +30,11 @@ window.onload = function() {
|
|||
let eventFront2;
|
||||
|
||||
addAsyncTest(function* setup() {
|
||||
info ("Setting up inspector and walker actors.");
|
||||
info("Setting up inspector and walker actors.");
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
|
||||
yield new Promise(resolve => {
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
inspectee = doc;
|
||||
inspector = InspectorFront(client, tab);
|
||||
resolve();
|
||||
|
@ -48,8 +48,8 @@ window.onload = function() {
|
|||
});
|
||||
|
||||
addAsyncTest(function* setupEventTest() {
|
||||
eventNode1 = inspectee.querySelector("#a")
|
||||
eventNode2 = inspectee.querySelector("#b")
|
||||
eventNode1 = inspectee.querySelector("#a");
|
||||
eventNode2 = inspectee.querySelector("#b");
|
||||
|
||||
eventFront1 = yield walker.querySelector(walker.rootNode, "#a");
|
||||
eventFront2 = yield walker.querySelector(walker.rootNode, "#b");
|
||||
|
@ -67,7 +67,8 @@ window.onload = function() {
|
|||
is(mutations.length, 1, "one mutation expected");
|
||||
is(mutations[0].target, eventFront1, "mutation targets eventFront1");
|
||||
is(mutations[0].type, "events", "mutation type is events");
|
||||
is(mutations[0].hasEventListeners, true, "mutation target should have event listeners");
|
||||
is(mutations[0].hasEventListeners, true,
|
||||
"mutation target should have event listeners");
|
||||
is(eventFront1.hasEventListeners, true, "eventFront1 should have event listeners");
|
||||
|
||||
info("remove event listener on a single node");
|
||||
|
@ -77,10 +78,12 @@ window.onload = function() {
|
|||
is(mutations.length, 1, "one mutation expected");
|
||||
is(mutations[0].target, eventFront1, "mutation targets eventFront1");
|
||||
is(mutations[0].type, "events", "mutation type is events");
|
||||
is(mutations[0].hasEventListeners, false, "mutation target should have no event listeners");
|
||||
is(eventFront1.hasEventListeners, false, "eventFront1 should have no event listeners");
|
||||
is(mutations[0].hasEventListeners, false,
|
||||
"mutation target should have no event listeners");
|
||||
is(eventFront1.hasEventListeners, false,
|
||||
"eventFront1 should have no event listeners");
|
||||
|
||||
info("perform several event listener changes on a single node")
|
||||
info("perform several event listener changes on a single node");
|
||||
eventNode1.addEventListener("click", eventListener1);
|
||||
eventNode1.addEventListener("click", eventListener2);
|
||||
eventNode1.removeEventListener("click", eventListener1);
|
||||
|
@ -90,7 +93,8 @@ window.onload = function() {
|
|||
is(mutations.length, 1, "one mutation expected");
|
||||
is(mutations[0].target, eventFront1, "mutation targets eventFront1");
|
||||
is(mutations[0].type, "events", "mutation type is events");
|
||||
is(mutations[0].hasEventListeners, false, "no event listener expected on mutation target");
|
||||
is(mutations[0].hasEventListeners, false,
|
||||
"no event listener expected on mutation target");
|
||||
is(eventFront1.hasEventListeners, false, "no event listener expected on node");
|
||||
|
||||
runNextTest();
|
||||
|
@ -108,12 +112,14 @@ window.onload = function() {
|
|||
// first mutation
|
||||
is(mutations[0].target, eventFront1, "first mutation targets eventFront1");
|
||||
is(mutations[0].type, "events", "mutation type is events");
|
||||
is(mutations[0].hasEventListeners, true, "mutation target should have event listeners");
|
||||
is(mutations[0].hasEventListeners, true,
|
||||
"mutation target should have event listeners");
|
||||
is(eventFront1.hasEventListeners, true, "eventFront1 should have event listeners");
|
||||
// second mutation
|
||||
is(mutations[1].target, eventFront2, "second mutation targets eventFront2");
|
||||
is(mutations[1].type, "events", "mutation type is events");
|
||||
is(mutations[1].hasEventListeners, true, "mutation target should have event listeners");
|
||||
is(mutations[1].hasEventListeners, true,
|
||||
"mutation target should have event listeners");
|
||||
is(eventFront2.hasEventListeners, true, "eventFront1 should have event listeners");
|
||||
|
||||
info("remove event listeners on both nodes");
|
||||
|
@ -125,13 +131,17 @@ window.onload = function() {
|
|||
// first mutation
|
||||
is(mutations[0].target, eventFront1, "first mutation targets eventFront1");
|
||||
is(mutations[0].type, "events", "mutation type is events");
|
||||
is(mutations[0].hasEventListeners, false, "mutation target should have no event listeners");
|
||||
is(eventFront1.hasEventListeners, false, "eventFront2 should have no event listeners");
|
||||
is(mutations[0].hasEventListeners, false,
|
||||
"mutation target should have no event listeners");
|
||||
is(eventFront1.hasEventListeners, false,
|
||||
"eventFront2 should have no event listeners");
|
||||
// second mutation
|
||||
is(mutations[1].target, eventFront2, "second mutation targets eventFront2");
|
||||
is(mutations[1].type, "events", "mutation type is events");
|
||||
is(mutations[1].hasEventListeners, false, "mutation target should have no event listeners");
|
||||
is(eventFront2.hasEventListeners, false, "eventFront2 should have no event listeners");
|
||||
is(mutations[1].hasEventListeners, false,
|
||||
"mutation target should have no event listeners");
|
||||
is(eventFront2.hasEventListeners, false,
|
||||
"eventFront2 should have no event listeners");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
@ -142,7 +152,7 @@ window.onload = function() {
|
|||
info("try to remove an event listener not previously added");
|
||||
eventNode1.removeEventListener("click", eventListener1);
|
||||
|
||||
info("set any attribute on the node to trigger a mutation")
|
||||
info("set any attribute on the node to trigger a mutation");
|
||||
eventNode1.setAttribute("data-attr", "somevalue");
|
||||
|
||||
let mutations = yield waitForMutations();
|
||||
|
@ -153,9 +163,11 @@ window.onload = function() {
|
|||
});
|
||||
|
||||
function checkNodesHaveNoEventListener() {
|
||||
is(eventFront1.hasEventListeners, false, "eventFront1 hasEventListeners should be false");
|
||||
is(eventFront2.hasEventListeners, false, "eventFront2 hasEventListeners should be false");
|
||||
};
|
||||
is(eventFront1.hasEventListeners, false,
|
||||
"eventFront1 hasEventListeners should be false");
|
||||
is(eventFront2.hasEventListeners, false,
|
||||
"eventFront2 hasEventListeners should be false");
|
||||
}
|
||||
|
||||
function waitForMutations() {
|
||||
return new Promise(resolve => {
|
||||
|
@ -166,8 +178,7 @@ window.onload = function() {
|
|||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,23 +11,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspectee = null;
|
||||
var gWalker = null;
|
||||
var gClient = null;
|
||||
var gChildFrame = null;
|
||||
var gChildDocument = null;
|
||||
var gCleanupConnection = null;
|
||||
let gInspectee = null;
|
||||
let gWalker = null;
|
||||
let gClient = null;
|
||||
let gCleanupConnection = null;
|
||||
|
||||
function setup(callback) {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
gCleanupConnection = attachURL(url, function(err, client, tab, doc) {
|
||||
gCleanupConnection = attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
|
@ -42,7 +40,6 @@ function teardown() {
|
|||
gWalker = null;
|
||||
gClient = null;
|
||||
gInspectee = null;
|
||||
gChildFrame = null;
|
||||
if (gCleanupConnection) {
|
||||
gCleanupConnection();
|
||||
gCleanupConnection = null;
|
||||
|
@ -55,8 +52,8 @@ function assertOwnership() {
|
|||
|
||||
function loadChildSelector(selector) {
|
||||
return gWalker.querySelector(gWalker.rootNode, "#childFrame").then(frame => {
|
||||
ok(frame.numChildren > 0, "Child frame should consider its loaded document as a child.");
|
||||
gChildFrame = frame;
|
||||
ok(frame.numChildren > 0,
|
||||
"Child frame should consider its loaded document as a child.");
|
||||
return gWalker.children(frame);
|
||||
}).then(children => {
|
||||
return gWalker.querySelectorAll(children.nodes[0], selector);
|
||||
|
@ -76,7 +73,6 @@ function getUnloadedDoc(mutations) {
|
|||
|
||||
addTest(function loadNewChild() {
|
||||
setup(() => {
|
||||
let beforeUnloadSize = 0;
|
||||
// Load a bunch of fronts for actors inside the child frame.
|
||||
promiseDone(loadChildSelector("#longlist div").then(() => {
|
||||
let childFrame = gInspectee.querySelector("#childFrame");
|
||||
|
@ -102,7 +98,6 @@ addTest(function loadNewChild() {
|
|||
|
||||
addTest(function loadNewChildTwice() {
|
||||
setup(() => {
|
||||
let beforeUnloadSize = 0;
|
||||
// Load a bunch of fronts for actors inside the child frame.
|
||||
promiseDone(loadChildSelector("#longlist div").then(() => {
|
||||
let childFrame = gInspectee.querySelector("#childFrame");
|
||||
|
@ -130,10 +125,8 @@ addTest(function loadNewChildTwice() {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
addTest(function loadNewChildTwiceAndCareAboutIt() {
|
||||
setup(() => {
|
||||
let beforeUnloadSize = 0;
|
||||
// Load a bunch of fronts for actors inside the child frame.
|
||||
promiseDone(loadChildSelector("#longlist div").then(() => {
|
||||
let childFrame = gInspectee.querySelector("#childFrame");
|
||||
|
@ -168,7 +161,6 @@ addTest(function loadNewChildTwiceAndCareAboutIt() {
|
|||
|
||||
addTest(function testBack() {
|
||||
setup(() => {
|
||||
let beforeUnloadSize = 0;
|
||||
// Load a bunch of fronts for actors inside the child frame.
|
||||
promiseDone(loadChildSelector("#longlist div").then(() => {
|
||||
let childFrame = gInspectee.querySelector("#childFrame");
|
||||
|
@ -178,7 +170,8 @@ addTest(function testBack() {
|
|||
// Read the new child
|
||||
return loadChildSelector("#longlist div");
|
||||
}).then(() => {
|
||||
// Now use history.back to change the source, and expect the same results as loadNewChild.
|
||||
// Now use history.back to change the source,
|
||||
// and expect the same results as loadNewChild.
|
||||
let childFrame = gInspectee.querySelector("#childFrame");
|
||||
childFrame.contentWindow.history.back();
|
||||
return waitForMutation(gWalker, isChildList);
|
||||
|
|
|
@ -11,39 +11,38 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
const inspector = require("devtools/server/actors/inspector");
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
const testSummaryLength = 10;
|
||||
inspector.setValueSummaryLength(testSummaryLength);
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SimpleTest.registerCleanupFunction(function () {
|
||||
inspector.setValueSummaryLength(inspector.DEFAULT_VALUE_SUMMARY_LENGTH);
|
||||
});
|
||||
|
||||
var gInspectee = null;
|
||||
var gWalker = null;
|
||||
var gClient = null;
|
||||
var valueNode;
|
||||
let gInspectee = null;
|
||||
let gWalker = null;
|
||||
let valueNode;
|
||||
var valueFront;
|
||||
var longStringFront;
|
||||
var longString = "stringstringstringstringstringstringstringstringstringstringstring";
|
||||
var truncatedLongString = longString.substring(0, testSummaryLength);
|
||||
var shortString = "str";
|
||||
var shortString2 = "str2";
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
let inspectorFront = InspectorFront(client, tab);
|
||||
promiseDone(inspectorFront.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -71,7 +70,7 @@ function setupValueTest() {
|
|||
}
|
||||
|
||||
function setupFrameValueTest() {
|
||||
let frame = gInspectee.querySelector('#childFrame');
|
||||
let frame = gInspectee.querySelector("#childFrame");
|
||||
valueNode = frame.contentDocument.querySelector("#longstring").firstChild;
|
||||
|
||||
promiseDone(gWalker.querySelector(gWalker.rootNode, "#childFrame").then(childFrame => {
|
||||
|
@ -94,7 +93,7 @@ function checkNodeFrontValue(front, expectedValue) {
|
|||
return longstring.string();
|
||||
}).then(str => {
|
||||
is(str, expectedValue, "Node value is as expected");
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function testKeepLongValue() {
|
||||
|
@ -147,9 +146,8 @@ function testSetLongValue() {
|
|||
}
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gInspectee;
|
||||
delete gWalker;
|
||||
delete gClient;
|
||||
gInspectee = null;
|
||||
gWalker = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
|
|
@ -1,101 +1,99 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test that the inspector actor has the pickColorFromPage and cancelPickColorFromPage
|
||||
methods and that when a color is picked the color-picked event is emitted and that when
|
||||
the eyedropper is dimissed, the color-pick-canceled event is emitted.
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1262439
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1262439</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
window.onload = function() {
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://devtools/shared/Loader.jsm");
|
||||
const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
|
||||
const {InspectorFront} = devtools.require("devtools/shared/fronts/inspector");
|
||||
const {console} = Cu.import("resource://gre/modules/Console.jsm", {});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let win = null;
|
||||
let inspector = null;
|
||||
|
||||
addAsyncTest(function*() {
|
||||
info("Setting up inspector actor");
|
||||
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
|
||||
yield new Promise(resolve => {
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
win = doc.defaultView;
|
||||
inspector = InspectorFront(client, tab);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
info("Start picking a color from the page");
|
||||
yield inspector.pickColorFromPage();
|
||||
|
||||
info("Click in the page and make sure a color-picked event is received");
|
||||
let onColorPicked = waitForEvent("color-picked");
|
||||
win.document.body.click();
|
||||
let color = yield onColorPicked;
|
||||
|
||||
is(color, "#000000", "The color-picked event was received with the right color");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
info("Start picking a color from the page");
|
||||
yield inspector.pickColorFromPage();
|
||||
|
||||
info("Use the escape key to dismiss the eyedropper");
|
||||
let onPickCanceled = waitForEvent("color-pick-canceled");
|
||||
|
||||
let keyboardEvent = win.document.createEvent("KeyboardEvent");
|
||||
keyboardEvent.initKeyEvent("keydown", true, true, win, false, false,
|
||||
false, false, 27, 0);
|
||||
win.document.dispatchEvent(keyboardEvent);
|
||||
|
||||
yield onPickCanceled;
|
||||
ok(true, "The color-pick-canceled event was received");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
info("Start picking a color from the page");
|
||||
yield inspector.pickColorFromPage();
|
||||
|
||||
info("And cancel the color picking");
|
||||
yield inspector.cancelPickColorFromPage();
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
function waitForEvent(name) {
|
||||
return new Promise(resolve => inspector.once(name, resolve));
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a id="inspectorContent" target="_blank" href="inspector-eyedropper.html">Test Document</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test that the inspector actor has the pickColorFromPage and cancelPickColorFromPage
|
||||
methods and that when a color is picked the color-picked event is emitted and that when
|
||||
the eyedropper is dimissed, the color-pick-canceled event is emitted.
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1262439
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1262439</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
const {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let win = null;
|
||||
let inspector = null;
|
||||
|
||||
addAsyncTest(function* () {
|
||||
info("Setting up inspector actor");
|
||||
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
|
||||
yield new Promise(resolve => {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
win = doc.defaultView;
|
||||
inspector = InspectorFront(client, tab);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function* () {
|
||||
info("Start picking a color from the page");
|
||||
yield inspector.pickColorFromPage();
|
||||
|
||||
info("Click in the page and make sure a color-picked event is received");
|
||||
let onColorPicked = waitForEvent("color-picked");
|
||||
win.document.body.click();
|
||||
let color = yield onColorPicked;
|
||||
|
||||
is(color, "#000000", "The color-picked event was received with the right color");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function* () {
|
||||
info("Start picking a color from the page");
|
||||
yield inspector.pickColorFromPage();
|
||||
|
||||
info("Use the escape key to dismiss the eyedropper");
|
||||
let onPickCanceled = waitForEvent("color-pick-canceled");
|
||||
|
||||
let keyboardEvent = win.document.createEvent("KeyboardEvent");
|
||||
keyboardEvent.initKeyEvent("keydown", true, true, win, false, false,
|
||||
false, false, 27, 0);
|
||||
win.document.dispatchEvent(keyboardEvent);
|
||||
|
||||
yield onPickCanceled;
|
||||
ok(true, "The color-pick-canceled event was received");
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function* () {
|
||||
info("Start picking a color from the page");
|
||||
yield inspector.pickColorFromPage();
|
||||
|
||||
info("And cancel the color picking");
|
||||
yield inspector.cancelPickColorFromPage();
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
function waitForEvent(name) {
|
||||
return new Promise(resolve => inspector.once(name, resolve));
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a id="inspectorContent" target="_blank" href="inspector-eyedropper.html">Test Document</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -11,30 +11,29 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
const DOMUtils = Components.classes["@mozilla.org/inspector/dom-utils;1"].
|
||||
getService(Components.interfaces.inIDOMUtils);
|
||||
"use strict";
|
||||
|
||||
const KNOWN_PSEUDOCLASSES = [':hover', ':active', ':focus']
|
||||
const DOMUtils = Components.classes["@mozilla.org/inspector/dom-utils;1"]
|
||||
.getService(Components.interfaces.inIDOMUtils);
|
||||
|
||||
window.onload = function() {
|
||||
const KNOWN_PSEUDOCLASSES = [":hover", ":active", ":focus"];
|
||||
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspectee = null;
|
||||
var gWalker = null;
|
||||
var gClient = null;
|
||||
var gCleanupConnection = null;
|
||||
let gInspectee = null;
|
||||
let gWalker = null;
|
||||
let gCleanupConnection = null;
|
||||
|
||||
function setup(callback) {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
gCleanupConnection = attachURL(url, function(err, client, tab, doc) {
|
||||
gCleanupConnection = attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(callback));
|
||||
});
|
||||
|
@ -42,7 +41,6 @@ function setup(callback) {
|
|||
|
||||
function teardown() {
|
||||
gWalker = null;
|
||||
gClient = null;
|
||||
gInspectee = null;
|
||||
if (gCleanupConnection) {
|
||||
gCleanupConnection();
|
||||
|
@ -53,10 +51,13 @@ function teardown() {
|
|||
function checkChange(change, expectation) {
|
||||
is(change.type, "pseudoClassLock", "Expect a pseudoclass lock change.");
|
||||
let target = change.target;
|
||||
if (expectation.id)
|
||||
if (expectation.id) {
|
||||
is(target.id, expectation.id, "Expect a change on node id " + expectation.id);
|
||||
if (expectation.nodeName)
|
||||
is(target.nodeName, expectation.nodeName, "Expect a change on node name " + expectation.nodeName);
|
||||
}
|
||||
if (expectation.nodeName) {
|
||||
is(target.nodeName, expectation.nodeName,
|
||||
"Expect a change on node name " + expectation.nodeName);
|
||||
}
|
||||
|
||||
is(target.pseudoClassLocks.length, expectation.pseudos.length,
|
||||
"Expect " + expectation.pseudos.length + " pseudoclass locks.");
|
||||
|
@ -74,7 +75,8 @@ function checkChange(change, expectation) {
|
|||
for (let pseudo of KNOWN_PSEUDOCLASSES) {
|
||||
if (!expectation.pseudos.some(expected => pseudo === expected)) {
|
||||
ok(!target.hasPseudoClassLock(pseudo), "Don't expect lock: " + pseudo);
|
||||
ok(!DOMUtils.hasPseudoClassLock(target.rawNode(), pseudo), "Don't expect lock in dom: " + pseudo);
|
||||
ok(!DOMUtils.hasPseudoClassLock(target.rawNode(), pseudo),
|
||||
"Don't expect lock in dom: " + pseudo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +84,7 @@ function checkChange(change, expectation) {
|
|||
function checkMutations(mutations, expectations) {
|
||||
is(mutations.length, expectations.length, "Should get the right number of mutations.");
|
||||
for (let i = 0; i < mutations.length; i++) {
|
||||
checkChange(mutations[i] , expectations[i]);
|
||||
checkChange(mutations[i], expectations[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +96,7 @@ addTest(function testPseudoClassLock() {
|
|||
return promiseDone(gWalker.querySelector(gWalker.rootNode, "#b").then(front => {
|
||||
nodeFront = front;
|
||||
// Lock the pseudoclass alone, no parents.
|
||||
gWalker.addPseudoClassLock(nodeFront, ':active');
|
||||
gWalker.addPseudoClassLock(nodeFront, ":active");
|
||||
// Expect a single pseudoClassLock mutation.
|
||||
return promiseOnce(gWalker, "mutations");
|
||||
}).then(mutations => {
|
||||
|
@ -107,50 +109,50 @@ addTest(function testPseudoClassLock() {
|
|||
});
|
||||
}).then(() => {
|
||||
// Now add :hover, this time with parents.
|
||||
gWalker.addPseudoClassLock(nodeFront, ':hover', {parents: true});
|
||||
gWalker.addPseudoClassLock(nodeFront, ":hover", {parents: true});
|
||||
return promiseOnce(gWalker, "mutations");
|
||||
}).then(mutations => {
|
||||
let expectedMutations = [{
|
||||
id: 'b',
|
||||
nodeName: 'DIV',
|
||||
pseudos: [':hover', ':active'],
|
||||
id: "b",
|
||||
nodeName: "DIV",
|
||||
pseudos: [":hover", ":active"],
|
||||
},
|
||||
{
|
||||
id: 'longlist',
|
||||
nodeName: 'DIV',
|
||||
pseudos: [':hover']
|
||||
id: "longlist",
|
||||
nodeName: "DIV",
|
||||
pseudos: [":hover"]
|
||||
},
|
||||
{
|
||||
nodeName: 'BODY',
|
||||
pseudos: [':hover']
|
||||
nodeName: "BODY",
|
||||
pseudos: [":hover"]
|
||||
},
|
||||
{
|
||||
nodeName: 'HTML',
|
||||
pseudos: [':hover']
|
||||
nodeName: "HTML",
|
||||
pseudos: [":hover"]
|
||||
}];
|
||||
checkMutations(mutations, expectedMutations);
|
||||
}).then(() => {
|
||||
// Now remove the :hover on all parents
|
||||
gWalker.removePseudoClassLock(nodeFront, ':hover', {parents: true});
|
||||
gWalker.removePseudoClassLock(nodeFront, ":hover", {parents: true});
|
||||
return promiseOnce(gWalker, "mutations");
|
||||
}).then(mutations => {
|
||||
let expectedMutations = [{
|
||||
id: 'b',
|
||||
nodeName: 'DIV',
|
||||
id: "b",
|
||||
nodeName: "DIV",
|
||||
// Should still have :active on the original node.
|
||||
pseudos: [':active']
|
||||
pseudos: [":active"]
|
||||
},
|
||||
{
|
||||
id: 'longlist',
|
||||
nodeName: 'DIV',
|
||||
id: "longlist",
|
||||
nodeName: "DIV",
|
||||
pseudos: []
|
||||
},
|
||||
{
|
||||
nodeName: 'BODY',
|
||||
nodeName: "BODY",
|
||||
pseudos: []
|
||||
},
|
||||
{
|
||||
nodeName: 'HTML',
|
||||
nodeName: "HTML",
|
||||
pseudos: []
|
||||
}];
|
||||
checkMutations(mutations, expectedMutations);
|
||||
|
@ -170,7 +172,8 @@ addTest(function testPseudoClassLock() {
|
|||
// Now shut down the walker and make sure that clears up the remaining lock.
|
||||
return gWalker.release();
|
||||
}).then(() => {
|
||||
ok(!DOMUtils.hasPseudoClassLock(contentNode, ':active'), "Pseudoclass should have been removed during destruction.");
|
||||
ok(!DOMUtils.hasPseudoClassLock(contentNode, ":active"),
|
||||
"Pseudoclass should have been removed during destruction.");
|
||||
teardown();
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
|
|
@ -11,15 +11,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gWalker = null;
|
||||
var gClient = null;
|
||||
let gWalker = null;
|
||||
let gClient = null;
|
||||
|
||||
function assertOwnership() {
|
||||
return assertOwnershipTrees(gWalker);
|
||||
|
@ -27,7 +27,7 @@ function assertOwnership() {
|
|||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
|
@ -45,7 +45,8 @@ addTest(function testReleaseSubtree() {
|
|||
promiseDone(gWalker.querySelectorAll(gWalker.rootNode, "#longlist div").then(list => {
|
||||
// Make sure we have the 26 children of longlist in our ownership tree.
|
||||
is(list.length, 26, "Expect 26 div children.");
|
||||
// Make sure we've read in all those children and incorporated them in our ownership tree.
|
||||
// Make sure we've read in all those children and incorporated them
|
||||
// in our ownership tree.
|
||||
return list.items();
|
||||
}).then((items)=> {
|
||||
originalOwnershipSize = assertOwnership();
|
||||
|
@ -69,7 +70,8 @@ addTest(function testReleaseSubtree() {
|
|||
longlist = node.actorID;
|
||||
return gWalker.releaseNode(node);
|
||||
}).then(() => {
|
||||
// Our ownership size should now be 53 fewer (we forgot about #longlist + 26 children + 26 singleTextChild nodes)
|
||||
// Our ownership size should now be 53 fewer
|
||||
// (we forgot about #longlist + 26 children + 26 singleTextChild nodes)
|
||||
let newOwnershipSize = assertOwnership();
|
||||
is(newOwnershipSize, originalOwnershipSize - 53,
|
||||
"Ownership tree should be lower");
|
||||
|
@ -81,12 +83,10 @@ addTest(function testReleaseSubtree() {
|
|||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
gClient = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,26 +11,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspectee = null;
|
||||
var gClient = null;
|
||||
var gWalker = null;
|
||||
let gInspectee = null;
|
||||
let gWalker = null;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
return inspector.getWalker();
|
||||
}).then(walker => {
|
||||
|
@ -41,7 +39,6 @@ addTest(function setup() {
|
|||
});
|
||||
|
||||
addTest(function testReload() {
|
||||
let nodeFront;
|
||||
let oldRootID = gWalker.rootNode.actorID;
|
||||
// Load a node to populate the tree a bit.
|
||||
promiseDone(gWalker.querySelector(gWalker.rootNode, "#a").then(front => {
|
||||
|
@ -58,13 +55,10 @@ addTest(function testReload() {
|
|||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gInspectee;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
gInspectee = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,15 +11,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gWalker = null;
|
||||
var gClient = null;
|
||||
let gWalker = null;
|
||||
let gClient = null;
|
||||
let gInspectee = null;
|
||||
|
||||
function assertOwnership() {
|
||||
return assertOwnershipTrees(gWalker);
|
||||
|
@ -33,7 +34,7 @@ function ignoreNode(node) {
|
|||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
|
@ -80,8 +81,10 @@ addTest(function testRemoveSubtree() {
|
|||
is(originalOwnershipSize, 56, "Correct number of items in ownership tree");
|
||||
return gWalker.removeNode(longlist);
|
||||
}).then(siblings => {
|
||||
is(siblings.previousSibling.rawNode(), previousSibling, "Should have returned the previous sibling.");
|
||||
is(siblings.nextSibling.rawNode(), nextSibling, "Should have returned the next sibling.");
|
||||
is(siblings.previousSibling.rawNode(), previousSibling,
|
||||
"Should have returned the previous sibling.");
|
||||
is(siblings.nextSibling.rawNode(), nextSibling,
|
||||
"Should have returned the next sibling.");
|
||||
return waitForMutation(gWalker, isChildList);
|
||||
}).then(() => {
|
||||
// Our ownership size should now be 51 fewer (we forgot about #longlist + 26
|
||||
|
@ -96,12 +99,11 @@ addTest(function testRemoveSubtree() {
|
|||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
gClient = null;
|
||||
gInspectee = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,12 +11,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1222409
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
window.onload = function() {
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
const Cu = Components.utils;
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const promise = require("promise");
|
||||
const {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
const {console} = Cu.import("resource://gre/modules/Console.jsm", {});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -24,12 +25,13 @@ window.onload = function() {
|
|||
let inspector = null;
|
||||
|
||||
addAsyncTest(function* setup() {
|
||||
info ("Setting up inspector and walker actors.");
|
||||
info("Setting up inspector and walker actors.");
|
||||
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
yield new promise(resolve => {
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
win = doc.defaultView;
|
||||
inspector = InspectorFront(client, tab);
|
||||
resolve();
|
||||
|
@ -39,7 +41,7 @@ window.onload = function() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
addAsyncTest(function*() {
|
||||
addAsyncTest(function* () {
|
||||
let walker = yield inspector.getWalker();
|
||||
|
||||
// We can't receive events from the walker if we haven't first executed a
|
||||
|
@ -47,6 +49,7 @@ window.onload = function() {
|
|||
yield walker.querySelector(walker.rootNode, "img");
|
||||
|
||||
let {outerWidth, outerHeight} = win;
|
||||
// eslint-disable-next-line new-cap
|
||||
let onResize = new promise(resolve => {
|
||||
walker.once("resize", () => {
|
||||
resolve();
|
||||
|
|
|
@ -11,19 +11,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=921102
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspector;
|
||||
var gDoc;
|
||||
let gInspector;
|
||||
let gDoc;
|
||||
|
||||
addTest(function() {
|
||||
addTest(function () {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gDoc = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
gInspector = InspectorFront(client, tab);
|
||||
|
@ -31,7 +31,7 @@ addTest(function() {
|
|||
});
|
||||
});
|
||||
|
||||
addTest(function() {
|
||||
addTest(function () {
|
||||
info("Resolve a relative URL without providing a context node");
|
||||
gInspector.resolveRelativeURL("test.png?id=4#wow").then(url => {
|
||||
is(url, "chrome://mochitests/content/chrome/devtools/server/tests/" +
|
||||
|
@ -40,16 +40,16 @@ addTest(function() {
|
|||
});
|
||||
});
|
||||
|
||||
addTest(function() {
|
||||
addTest(function () {
|
||||
info("Resolve an absolute URL without providing a context node");
|
||||
gInspector.resolveRelativeURL("chrome://mochitests/content/chrome/" +
|
||||
"devtools/server/").then(url => {
|
||||
is(url, "chrome://mochitests/content/chrome/devtools/server/");
|
||||
runNextTest();
|
||||
});
|
||||
"devtools/server/").then(url => {
|
||||
is(url, "chrome://mochitests/content/chrome/devtools/server/");
|
||||
runNextTest();
|
||||
});
|
||||
});
|
||||
|
||||
addTest(function() {
|
||||
addTest(function () {
|
||||
info("Resolve a relative URL providing a context node");
|
||||
let node = gDoc.querySelector(".big-horizontal");
|
||||
gInspector.resolveRelativeURL("test.png?id=4#wow", node).then(url => {
|
||||
|
@ -59,18 +59,19 @@ addTest(function() {
|
|||
});
|
||||
});
|
||||
|
||||
addTest(function() {
|
||||
addTest(function () {
|
||||
info("Resolve an absolute URL providing a context node");
|
||||
let node = gDoc.querySelector(".big-horizontal");
|
||||
gInspector.resolveRelativeURL("chrome://mochitests/content/chrome/" +
|
||||
"devtools/server/", node).then(url => {
|
||||
is(url, "chrome://mochitests/content/chrome/devtools/server/");
|
||||
runNextTest();
|
||||
});
|
||||
"devtools/server/", node).then(url => {
|
||||
is(url, "chrome://mochitests/content/chrome/devtools/server/");
|
||||
runNextTest();
|
||||
});
|
||||
});
|
||||
|
||||
addTest(function() {
|
||||
gInspector = gDoc = null;
|
||||
addTest(function () {
|
||||
gInspector = null;
|
||||
gDoc = null;
|
||||
runNextTest();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -11,16 +11,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gWalker = null;
|
||||
var gClient = null;
|
||||
var gInspectee = null;
|
||||
let gWalker = null;
|
||||
let gInspectee = null;
|
||||
|
||||
function assertOwnership() {
|
||||
return assertOwnershipTrees(gWalker);
|
||||
|
@ -28,13 +27,12 @@ function assertOwnership() {
|
|||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -50,7 +48,6 @@ addTest(function setup() {
|
|||
addTest(function testRetain() {
|
||||
let originalOwnershipSize = 0;
|
||||
let bodyFront = null;
|
||||
let frameFront = null;
|
||||
let childListFront = null;
|
||||
// Get the toplevel body element and retain it.
|
||||
promiseDone(gWalker.querySelector(gWalker.rootNode, "body").then(front => {
|
||||
|
@ -60,7 +57,6 @@ addTest(function testRetain() {
|
|||
// Get an element in the child frame and retain it.
|
||||
return gWalker.querySelector(gWalker.rootNode, "#childFrame");
|
||||
}).then(frame => {
|
||||
frameFront = frame;
|
||||
return gWalker.children(frame, { maxNodes: 1 }).then(children => {
|
||||
return children.nodes[0];
|
||||
});
|
||||
|
@ -75,7 +71,6 @@ addTest(function testRetain() {
|
|||
// OK, try releasing the parent of the first retained.
|
||||
return gWalker.releaseNode(bodyFront.parentNode());
|
||||
}).then(() => {
|
||||
let size = assertOwnership();
|
||||
let clientTree = clientOwnershipTree(gWalker);
|
||||
|
||||
// That request should have freed the parent of the first retained
|
||||
|
@ -84,26 +79,25 @@ addTest(function testRetain() {
|
|||
originalOwnershipSize,
|
||||
"Should have only lost one item overall.");
|
||||
is(gWalker._retainedOrphans.size, 1, "Should have retained one orphan");
|
||||
ok(gWalker._retainedOrphans.has(bodyFront), "Should have retained the expected node.");
|
||||
ok(gWalker._retainedOrphans.has(bodyFront),
|
||||
"Should have retained the expected node.");
|
||||
}).then(() => {
|
||||
// Unretain the body, which should promote the childListFront to a retained orphan.
|
||||
return gWalker.unretainNode(bodyFront);
|
||||
}).then(() => {
|
||||
assertOwnership();
|
||||
let clientTree = clientOwnershipTree(gWalker);
|
||||
|
||||
is(gWalker._retainedOrphans.size, 1, "Should still only have one retained orphan.");
|
||||
ok(!gWalker._retainedOrphans.has(bodyFront), "Should have dropped the body node.")
|
||||
ok(gWalker._retainedOrphans.has(childListFront), "Should have retained the child node.")
|
||||
ok(!gWalker._retainedOrphans.has(bodyFront), "Should have dropped the body node.");
|
||||
ok(gWalker._retainedOrphans.has(childListFront),
|
||||
"Should have retained the child node.");
|
||||
}).then(() => {
|
||||
// Change the source of the iframe, which should kill the retained orphan.
|
||||
gInspectee.querySelector("#childFrame").src = "data:text/html,<html>new child</html>";
|
||||
return waitForMutation(gWalker, isUnretained);
|
||||
}).then(mutations => {
|
||||
assertOwnership();
|
||||
let clientTree = clientOwnershipTree(gWalker);
|
||||
is(gWalker._retainedOrphans.size, 0, "Should have no more retained orphans.");
|
||||
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
||||
|
@ -123,14 +117,12 @@ addTest(function testWinRace() {
|
|||
]);
|
||||
}).then(() => {
|
||||
assertOwnership();
|
||||
let clientTree = clientOwnershipTree(gWalker);
|
||||
is(gWalker._retainedOrphans.size, 1, "Should have a retained orphan.");
|
||||
ok(gWalker._retainedOrphans.has(front), "Should have retained our expected node.");
|
||||
return gWalker.unretainNode(front);
|
||||
}).then(() => {
|
||||
// Make sure we're clear for the next test.
|
||||
assertOwnership();
|
||||
let clientTree = clientOwnershipTree(gWalker);
|
||||
is(gWalker._retainedOrphans.size, 0, "Should have no more retained orphans.");
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -149,19 +141,18 @@ addTest(function testLoseRace() {
|
|||
// Verify that we have an outstanding request (no good way to tell that it's a
|
||||
// getMutations request, but there's nothing else it would be).
|
||||
is(gWalker._requests.length, 1, "Should have an outstanding request.");
|
||||
return gWalker.retainNode(front)
|
||||
}).then(() => { ok(false, "Request should not have succeeded!"); },
|
||||
return gWalker.retainNode(front);
|
||||
}).then(() => ok(false, "Request should not have succeeded!"),
|
||||
(err) => {
|
||||
ok(err, "noSuchActor", "Should have lost the race.");
|
||||
let clientTree = clientOwnershipTree(gWalker);
|
||||
is(gWalker._retainedOrphans.size, 0, "Should have no more retained orphans.");
|
||||
// Don't re-throw the error.
|
||||
}).then(runNextTest));
|
||||
ok(err, "noSuchActor", "Should have lost the race.");
|
||||
is(gWalker._retainedOrphans.size, 0, "Should have no more retained orphans.");
|
||||
// Don't re-throw the error.
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
gInspectee = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
|
|
@ -11,30 +11,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=901250
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspectee = null;
|
||||
var gClient = null;
|
||||
var gWalker = null;
|
||||
|
||||
function assertOwnership() {
|
||||
assertOwnershipTrees(gWalker);
|
||||
}
|
||||
let gInspectee = null;
|
||||
let gWalker = null;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
ok(walker, "getWalker() should return an actor.");
|
||||
gClient = client;
|
||||
gWalker = walker;
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -67,9 +61,8 @@ addTest(Task.async(function* testScrollIntoView() {
|
|||
}));
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gInspectee;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
gInspectee = null;
|
||||
runNextTest();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -10,17 +10,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=835896
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
window.onload = function() {
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
const Cu = Components.utils;
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const promise = require("promise");
|
||||
const {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
const {console} = Cu.import("resource://gre/modules/Console.jsm", {});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let walkerFront = null;
|
||||
let inspectee = null;
|
||||
let inspector = null;
|
||||
|
||||
// WalkerFront specific tests. These aren't to excercise search
|
||||
|
@ -29,13 +29,13 @@ window.onload = function() {
|
|||
// See also test_inspector-search.html
|
||||
|
||||
addAsyncTest(function* setup() {
|
||||
info ("Setting up inspector and walker actors.");
|
||||
info("Setting up inspector and walker actors.");
|
||||
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
yield new promise(resolve => {
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
inspectee = doc;
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
inspector = InspectorFront(client, tab);
|
||||
resolve();
|
||||
});
|
||||
|
@ -48,7 +48,7 @@ window.onload = function() {
|
|||
});
|
||||
|
||||
addAsyncTest(function* testWalkerFrontDefaults() {
|
||||
info ("Testing search API using WalkerFront.");
|
||||
info("Testing search API using WalkerFront.");
|
||||
let nodes = yield walkerFront.querySelectorAll(walkerFront.rootNode, "h2");
|
||||
let fronts = yield nodes.items();
|
||||
|
||||
|
@ -77,7 +77,7 @@ window.onload = function() {
|
|||
});
|
||||
|
||||
addAsyncTest(function* testMultipleSearches() {
|
||||
info ("Testing search API using WalkerFront (reverse=false)");
|
||||
info("Testing search API using WalkerFront (reverse=false)");
|
||||
let nodes = yield walkerFront.querySelectorAll(walkerFront.rootNode, "h2");
|
||||
let fronts = yield nodes.items();
|
||||
|
||||
|
@ -119,7 +119,7 @@ window.onload = function() {
|
|||
});
|
||||
|
||||
addAsyncTest(function* testMultipleSearchesReverse() {
|
||||
info ("Testing search API using WalkerFront (reverse=true)");
|
||||
info("Testing search API using WalkerFront (reverse=true)");
|
||||
let nodes = yield walkerFront.querySelectorAll(walkerFront.rootNode, "h2");
|
||||
let fronts = yield nodes.items();
|
||||
|
||||
|
@ -168,9 +168,8 @@ window.onload = function() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
addAsyncTest(function* testBackwardsCompat() {
|
||||
info ("Simulating a server that doesn't have the new search functionality.");
|
||||
info("Simulating a server that doesn't have the new search functionality.");
|
||||
walkerFront.traits.textSearch = false;
|
||||
let front = yield walkerFront.querySelector(walkerFront.rootNode, "h1");
|
||||
|
||||
|
|
|
@ -10,14 +10,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=835896
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
window.onload = function() {
|
||||
"use strict";
|
||||
|
||||
window.onload = function () {
|
||||
const Cu = Components.utils;
|
||||
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const promise = require("promise");
|
||||
const {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
const {WalkerSearch, WalkerIndex} =
|
||||
require("devtools/server/actors/utils/walker-search");
|
||||
const {console} = Cu.import("resource://gre/modules/Console.jsm", {});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -31,12 +32,13 @@ window.onload = function() {
|
|||
// See also test_inspector-search-front.html.
|
||||
|
||||
addAsyncTest(function* setup() {
|
||||
info ("Setting up inspector and walker actors.");
|
||||
info("Setting up inspector and walker actors.");
|
||||
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
yield new promise(resolve => {
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
inspectee = doc;
|
||||
inspector = InspectorFront(client, tab);
|
||||
resolve();
|
||||
|
@ -56,7 +58,7 @@ window.onload = function() {
|
|||
});
|
||||
|
||||
addAsyncTest(function* testIndexExists() {
|
||||
info ("Testing basic index APIs exist.");
|
||||
info("Testing basic index APIs exist.");
|
||||
|
||||
let index = new WalkerIndex(walkerActor);
|
||||
ok(index.data.size > 0, "public index is filled after getting");
|
||||
|
@ -70,7 +72,7 @@ window.onload = function() {
|
|||
});
|
||||
|
||||
addAsyncTest(function* testSearchExists() {
|
||||
info ("Testing basic search APIs exist.");
|
||||
info("Testing basic search APIs exist.");
|
||||
|
||||
ok(walkerSearch, "walker search exists on the WalkerActor");
|
||||
ok(walkerSearch.search, "walker search has `search` method");
|
||||
|
@ -88,8 +90,8 @@ window.onload = function() {
|
|||
});
|
||||
|
||||
addAsyncTest(function* testEmptySearch() {
|
||||
info ("Testing search with an empty query.");
|
||||
results = walkerSearch.search("");
|
||||
info("Testing search with an empty query.");
|
||||
let results = walkerSearch.search("");
|
||||
is(results.length, 0, "No results when searching for ''");
|
||||
|
||||
results = walkerSearch.search(null);
|
||||
|
@ -165,7 +167,7 @@ window.onload = function() {
|
|||
{node: inspectee.querySelector("h1 + p > strong").childNodes[0], type: "text"},
|
||||
]
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
for (let {desc, search, expected} of testData) {
|
||||
info("Running test: " + desc);
|
||||
|
@ -178,7 +180,7 @@ window.onload = function() {
|
|||
});
|
||||
|
||||
addAsyncTest(function* testPseudoElements() {
|
||||
info ("Testing ::before and ::after element matching");
|
||||
info("Testing ::before and ::after element matching");
|
||||
|
||||
let beforeElt = new _documentWalker(inspectee.querySelector("#pseudo"),
|
||||
inspectee.defaultView).firstChild();
|
||||
|
@ -218,7 +220,7 @@ window.onload = function() {
|
|||
});
|
||||
|
||||
addAsyncTest(function* testSearchMutationChangeResults() {
|
||||
info ("Testing search before and after a mutation.");
|
||||
info("Testing search before and after a mutation.");
|
||||
let expected = [
|
||||
{node: inspectee.querySelectorAll("h3")[0], type: "tag"},
|
||||
{node: inspectee.querySelectorAll("h3")[1], type: "tag"},
|
||||
|
@ -238,6 +240,7 @@ window.onload = function() {
|
|||
expected[2]
|
||||
], "Results are updated after removal");
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
yield new promise(resolve => {
|
||||
info("Waiting for a mutation to happen");
|
||||
let observer = new inspectee.defaultView.MutationObserver(() => {
|
||||
|
@ -254,6 +257,7 @@ window.onload = function() {
|
|||
expected[2]
|
||||
], "Results are updated after addition");
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
yield new promise(resolve => {
|
||||
info("Waiting for a mutation to happen");
|
||||
let observer = new inspectee.defaultView.MutationObserver(() => {
|
||||
|
@ -274,6 +278,7 @@ window.onload = function() {
|
|||
runNextTest();
|
||||
|
||||
function mutateDocumentAndWaitForMutation(mutationFn) {
|
||||
// eslint-disable-next-line new-cap
|
||||
return new promise(resolve => {
|
||||
info("Listening to markup mutation on the inspectee");
|
||||
let observer = new inspectee.defaultView.MutationObserver(resolve);
|
||||
|
|
|
@ -11,24 +11,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/server/actors/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspectee = null;
|
||||
var gClient = null;
|
||||
var gWalker = null;
|
||||
var checkActorIDs = [];
|
||||
let gInspectee = null;
|
||||
let gClient = null;
|
||||
let gWalker = null;
|
||||
let checkActorIDs = [];
|
||||
|
||||
function assertOwnership() {
|
||||
assertOwnershipTrees(gWalker);
|
||||
}
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
gInspectee = doc;
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
|
@ -44,7 +44,8 @@ addTest(function testWalkerRoot() {
|
|||
// Make sure that refetching the root document of the walker returns the same
|
||||
// actor as the getWalker returned.
|
||||
promiseDone(gWalker.document().then(root => {
|
||||
ok(root === gWalker.rootNode, "Re-fetching the document node should match the root document node.");
|
||||
ok(root === gWalker.rootNode,
|
||||
"Re-fetching the document node should match the root document node.");
|
||||
checkActorIDs.push(root.actorID);
|
||||
assertOwnership();
|
||||
}).then(runNextTest));
|
||||
|
@ -121,11 +122,12 @@ addTest(function testQuerySelectors() {
|
|||
is(nodes[0], firstNode, "First node should be reused.");
|
||||
ok(nodes[0]._parent, "Parent node should be set.");
|
||||
ok(nodes[0]._next || nodes[0]._prev, "Siblings should be set.");
|
||||
ok(nodes[25]._next || nodes[25]._prev, "Siblings of " + nodes[25] + " should be set.");
|
||||
ok(nodes[25]._next || nodes[25]._prev,
|
||||
"Siblings of " + nodes[25] + " should be set.");
|
||||
assertOwnership();
|
||||
return nodeList.items(-1);
|
||||
}).then(nodes => {
|
||||
is(nodes.length, 1, "Expect 1 node")
|
||||
is(nodes.length, 1, "Expect 1 node");
|
||||
is(nodes[0].id, "z", "Expect it to be the last node.");
|
||||
checkActorIDs.push(nodes[0].actorID);
|
||||
// Save the node list ID so we can ensure it was destroyed.
|
||||
|
@ -142,17 +144,19 @@ addTest(function testQuerySelectors() {
|
|||
// Helper to check the response of requests that return hasFirst/hasLast/nodes
|
||||
// node lists (like `children` and `siblings`)
|
||||
function nodeArrayChecker(first, last, ids) {
|
||||
return function(response) {
|
||||
is(response.hasFirst, first, "Should " + (first ? "" : "not ") + " have the first node.");
|
||||
return function (response) {
|
||||
is(response.hasFirst, first,
|
||||
"Should " + (first ? "" : "not ") + " have the first node.");
|
||||
is(response.hasLast, last, "Should " + (last ? "" : "not ") + " have the last node.");
|
||||
is(response.nodes.length, ids.length, "Should have " + ids.length + " children listed.");
|
||||
let responseIds = '';
|
||||
for (node of response.nodes) {
|
||||
is(response.nodes.length, ids.length,
|
||||
"Should have " + ids.length + " children listed.");
|
||||
let responseIds = "";
|
||||
for (let node of response.nodes) {
|
||||
responseIds += node.id;
|
||||
}
|
||||
is(responseIds, ids, "Correct nodes were returned.");
|
||||
assertOwnership();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
addTest(function testNoChildren() {
|
||||
|
@ -163,8 +167,8 @@ addTest(function testNoChildren() {
|
|||
});
|
||||
|
||||
addTest(function testLongListTraversal() {
|
||||
var longList;
|
||||
var allChildren;
|
||||
let longList;
|
||||
let allChildren;
|
||||
promiseDone(gWalker.querySelector(gWalker.rootNode, "#longlist").then(node => {
|
||||
longList = node;
|
||||
// First call with no options, expect all children.
|
||||
|
@ -177,36 +181,37 @@ addTest(function testLongListTraversal() {
|
|||
}).then(() => {
|
||||
// maxNodes should limit us to the first 5 nodes.
|
||||
assertOwnership();
|
||||
return gWalker.children(longList, { maxNodes: 5 }).then(nodeArrayChecker(true, false, 'abcde'));
|
||||
return gWalker.children(longList, { maxNodes: 5 })
|
||||
.then(nodeArrayChecker(true, false, "abcde"));
|
||||
}).then(() => {
|
||||
assertOwnership();
|
||||
// maxNodes with the second item centered should still give us the first 5 nodes.
|
||||
return gWalker.children(longList, { maxNodes: 5, center: allChildren[1] }).then(
|
||||
nodeArrayChecker(true, false, 'abcde')
|
||||
nodeArrayChecker(true, false, "abcde")
|
||||
);
|
||||
}).then(() => {
|
||||
// maxNodes with a center in the middle of the list should put that item in the middle
|
||||
let center = allChildren[13];
|
||||
is(center.id, 'n', "Make sure I know how to count letters.");
|
||||
is(center.id, "n", "Make sure I know how to count letters.");
|
||||
return gWalker.children(longList, { maxNodes: 5, center: center }).then(
|
||||
nodeArrayChecker(false, false, 'lmnop')
|
||||
nodeArrayChecker(false, false, "lmnop")
|
||||
);
|
||||
}).then(() => {
|
||||
// maxNodes with the second-to-last item centered should give us the last 5 nodes.
|
||||
return gWalker.children(longList, { maxNodes: 5, center: allChildren[24] }).then(
|
||||
nodeArrayChecker(false, true, 'vwxyz')
|
||||
nodeArrayChecker(false, true, "vwxyz")
|
||||
);
|
||||
}).then(() => {
|
||||
// maxNodes with a start in the middle should start at that node and fetch 5
|
||||
let start = allChildren[13];
|
||||
is(start.id, 'n', "Make sure I know how to count letters.")
|
||||
is(start.id, "n", "Make sure I know how to count letters.");
|
||||
return gWalker.children(longList, { maxNodes: 5, start: start }).then(
|
||||
nodeArrayChecker(false, false, 'nopqr')
|
||||
nodeArrayChecker(false, false, "nopqr")
|
||||
);
|
||||
}).then(() => {
|
||||
// maxNodes near the end should only return what's left
|
||||
return gWalker.children(longList, { maxNodes: 5, start: allChildren[24] }).then(
|
||||
nodeArrayChecker(false, true, 'yz')
|
||||
nodeArrayChecker(false, true, "yz")
|
||||
);
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
@ -221,7 +226,8 @@ addTest(function testObjectNodeChildren() {
|
|||
|
||||
addTest(function testSiblings() {
|
||||
promiseDone(gWalker.querySelector(gWalker.rootNode, "#a").then(a => {
|
||||
return gWalker.siblings(a, { maxNodes: 5, center: a }).then(nodeArrayChecker(true, false, "abcde"));
|
||||
return gWalker.siblings(a, { maxNodes: 5, center: a })
|
||||
.then(nodeArrayChecker(true, false, "abcde"));
|
||||
}).then(() => {
|
||||
return gWalker.siblings(gWalker.rootNode).then(response => {
|
||||
ok(response.hasFirst && response.hasLast, "Has first and last.");
|
||||
|
@ -255,7 +261,6 @@ addTest(function testPreviousSibling() {
|
|||
}).then(runNextTest));
|
||||
});
|
||||
|
||||
|
||||
addTest(function testFrameTraversal() {
|
||||
promiseDone(gWalker.querySelector(gWalker.rootNode, "#childFrame").then(childFrame => {
|
||||
return gWalker.children(childFrame);
|
||||
|
@ -268,7 +273,8 @@ addTest(function testFrameTraversal() {
|
|||
return gWalker.parents(childDocumentZ);
|
||||
}).then(parents => {
|
||||
// Expected set of parent tag names for this item:
|
||||
let expectedParents = ['DIV', 'BODY', 'HTML', '#document', 'IFRAME', 'BODY', 'HTML', '#document'];
|
||||
let expectedParents = ["DIV", "BODY", "HTML", "#document", "IFRAME", "BODY", "HTML",
|
||||
"#document"];
|
||||
for (let parent of parents) {
|
||||
let expected = expectedParents.shift();
|
||||
is(parent.nodeName, expected, "Got expected parent");
|
||||
|
@ -278,8 +284,10 @@ addTest(function testFrameTraversal() {
|
|||
|
||||
addTest(function testLongValue() {
|
||||
const testSummaryLength = 10;
|
||||
const inspector = require("devtools/server/actors/inspector");
|
||||
|
||||
inspector.setValueSummaryLength(testSummaryLength);
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SimpleTest.registerCleanupFunction(function () {
|
||||
inspector.setValueSummaryLength(inspector.DEFAULT_VALUE_SUMMARY_LENGTH);
|
||||
});
|
||||
|
||||
|
@ -298,7 +306,8 @@ addTest(function testLongValue() {
|
|||
}).then(value => {
|
||||
return value.string();
|
||||
}).then(valueStr => {
|
||||
is(valueStr, longstringText, "Full node value should match the string from the document.");
|
||||
is(valueStr, longstringText,
|
||||
"Full node value should match the string from the document.");
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
||||
|
@ -318,7 +327,8 @@ addTest(function testShortValue() {
|
|||
}).then(value => {
|
||||
return value.string();
|
||||
}).then(valueStr => {
|
||||
is(valueStr, shortstringText, "Full node value should match the string from the document.");
|
||||
is(valueStr, shortstringText,
|
||||
"Full node value should match the string from the document.");
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
||||
|
@ -327,18 +337,16 @@ addTest(function testReleaseWalker() {
|
|||
|
||||
promiseDone(gWalker.release().then(() => {
|
||||
let promises = Array.from(checkActorIDs, (id) => checkMissing(gClient, id));
|
||||
return promise.all(promises)
|
||||
return promise.all(promises);
|
||||
}).then(runNextTest));
|
||||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
delete gInspectee;
|
||||
delete gClient;
|
||||
gWalker = null;
|
||||
gInspectee = null;
|
||||
gClient = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -17,10 +17,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1192536
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
const flags = require("devtools/shared/flags");
|
||||
const wasTesting = flags.testing;
|
||||
SimpleTest.registerCleanupFunction(() => flags.testing = wasTesting);
|
||||
SimpleTest.registerCleanupFunction(function () {
|
||||
flags.testing = wasTesting;
|
||||
});
|
||||
|
||||
const PATH = "http://mochi.test:8888/chrome/devtools/server/tests/mochitest/";
|
||||
const BASE_IMAGE = PATH + "inspector-delay-image-response.sjs";
|
||||
|
@ -28,23 +31,24 @@ const DELAYED_IMAGE = BASE_IMAGE + "?delay=300";
|
|||
const TIMEOUT_IMAGE = BASE_IMAGE + "?delay=50000";
|
||||
const NONEXISTENT_IMAGE = PATH + "this-does-not-exist.png";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gImg = null;
|
||||
var gNodeFront = null;
|
||||
var gWalker = null;
|
||||
let gImg = null;
|
||||
let gNodeFront = null;
|
||||
let gWalker = null;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
|
||||
promiseDone(inspector.getWalker().then(walker => {
|
||||
gWalker = walker;
|
||||
// eslint-disable-next-line max-nested-callbacks
|
||||
return walker.querySelector(gWalker.rootNode, "img.custom").then(img => {
|
||||
gNodeFront = img;
|
||||
gImg = doc.querySelector("img.custom");
|
||||
|
@ -93,9 +97,9 @@ addTest(function testDelayedImage() {
|
|||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gImg;
|
||||
delete gNodeFront
|
||||
delete gWalker;
|
||||
gImg = null;
|
||||
gNodeFront = null;
|
||||
gWalker = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
|
|
@ -11,18 +11,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=932937
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
const inspector = require("devtools/shared/fronts/inspector");
|
||||
"use strict";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gWalker = null;
|
||||
let gWalker = null;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
let inspector = InspectorFront(client, tab);
|
||||
|
||||
|
@ -45,6 +45,7 @@ addTest(function testLargeImage() {
|
|||
is(imageData.size.naturalHeight, 3000, "Natural width of the image correct");
|
||||
ok(imageData.size.resized, "Image was resized");
|
||||
|
||||
// eslint-disable-next-line max-nested-callbacks
|
||||
imageData.data.string().then(str => {
|
||||
ok(str, "We have an image data string!");
|
||||
testResizing(imageData, str);
|
||||
|
@ -66,6 +67,7 @@ addTest(function testLargeCanvas() {
|
|||
is(imageData.size.naturalHeight, 2000, "Natural width of the image correct");
|
||||
ok(imageData.size.resized, "Image was resized");
|
||||
|
||||
// eslint-disable-next-line max-nested-callbacks
|
||||
imageData.data.string().then(str => {
|
||||
ok(str, "We have an image data string!");
|
||||
testResizing(imageData, str);
|
||||
|
@ -87,6 +89,7 @@ addTest(function testSmallImage() {
|
|||
is(imageData.size.naturalHeight, 240, "Natural width of the image correct");
|
||||
ok(!imageData.size.resized, "Image was NOT resized");
|
||||
|
||||
// eslint-disable-next-line max-nested-callbacks
|
||||
imageData.data.string().then(str => {
|
||||
ok(str, "We have an image data string!");
|
||||
testResizing(imageData, str);
|
||||
|
@ -108,6 +111,7 @@ addTest(function testDataImage() {
|
|||
is(imageData.size.naturalHeight, 28, "Natural width of the image correct");
|
||||
ok(imageData.size.resized, "Image was resized");
|
||||
|
||||
// eslint-disable-next-line max-nested-callbacks
|
||||
imageData.data.string().then(str => {
|
||||
ok(str, "We have an image data string!");
|
||||
testResizing(imageData, str);
|
||||
|
@ -123,7 +127,7 @@ addTest(function testNonImgOrCanvasElements() {
|
|||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gWalker;
|
||||
gWalker = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
|
|
@ -16,10 +16,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1192536
|
|||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript" src="inspector-helpers.js"></script>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
const flags = require("devtools/shared/flags");
|
||||
const wasTesting = flags.testing;
|
||||
SimpleTest.registerCleanupFunction(() => flags.testing = wasTesting);
|
||||
SimpleTest.registerCleanupFunction(function () {
|
||||
flags.testing = wasTesting;
|
||||
});
|
||||
|
||||
const PATH = "http://mochi.test:8888/chrome/devtools/server/tests/mochitest/";
|
||||
const BASE_IMAGE = PATH + "inspector-delay-image-response.sjs";
|
||||
|
@ -27,16 +30,16 @@ const DELAYED_IMAGE = BASE_IMAGE + "?delay=300";
|
|||
const TIMEOUT_IMAGE = BASE_IMAGE + "?delay=50000";
|
||||
const NONEXISTENT_IMAGE = PATH + "this-does-not-exist.png";
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
var gInspector = null;
|
||||
let gInspector = null;
|
||||
|
||||
addTest(function setup() {
|
||||
let url = document.getElementById("inspectorContent").href;
|
||||
attachURL(url, function(err, client, tab, doc) {
|
||||
attachURL(url, function (err, client, tab, doc) {
|
||||
let {InspectorFront} = require("devtools/shared/fronts/inspector");
|
||||
gInspector = InspectorFront(client, tab);
|
||||
runNextTest();
|
||||
|
@ -73,7 +76,7 @@ addTest(function testNormalImage() {
|
|||
});
|
||||
|
||||
addTest(function cleanup() {
|
||||
delete gInspector;
|
||||
gInspector = null;
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче