Merge central to b2g-inbound

This commit is contained in:
Wes Kocher 2013-09-25 21:07:03 -07:00
commit 9043d09269
360 changed files with 4086 additions and 2370 deletions

View File

@ -5,7 +5,13 @@
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL} ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc ac_add_options --enable-jemalloc
ac_add_options --with-google-api-keyfile=/e/builds/gapi.data if [ -f /c/builds/gapi.data ]; then
_gapi_keyfile=/c/builds/gapi.data
else
_gapi_keyfile=/e/builds/gapi.data
fi
ac_add_options --with-google-api-keyfile=${_gapi_keyfile}
# Needed to enable breakpad in application.ini # Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1 export MOZILLA_OFFICIAL=1

View File

@ -5,7 +5,12 @@
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL} ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc ac_add_options --enable-jemalloc
ac_add_options --with-google-api-keyfile=/e/builds/gapi.data if [ -f /c/builds/gapi.data ]; then
_gapi_keyfile=/c/builds/gapi.data
else
_gapi_keyfile=/e/builds/gapi.data
fi
ac_add_options --with-google-api-keyfile=${_gapi_keyfile}
# Needed to enable breakpad in application.ini # Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1 export MOZILLA_OFFICIAL=1

View File

@ -126,6 +126,33 @@ DevTools.prototype = {
return tools.sort(this.ordinalSort); return tools.sort(this.ordinalSort);
}, },
/**
* Get a tool definition if it exists and is enabled.
*
* @param {string} toolId
* The id of the tool to show
*
* @return {ToolDefinition|null} tool
* The ToolDefinition for the id or null.
*/
getToolDefinition: function DT_getToolDefinition(toolId) {
let tool = this._tools.get(toolId);
if (!tool) {
return null;
} else if (tool.id == "options") {
return tool;
}
let enabled;
try {
enabled = Services.prefs.getBoolPref(tool.visibilityswitch);
} catch (e) {
enabled = true;
}
return enabled ? tool : null;
},
/** /**
* Allow ToolBoxes to get at the list of tools that they should populate * Allow ToolBoxes to get at the list of tools that they should populate
* themselves with. * themselves with.
@ -136,19 +163,12 @@ DevTools.prototype = {
getToolDefinitionMap: function DT_getToolDefinitionMap() { getToolDefinitionMap: function DT_getToolDefinitionMap() {
let tools = new Map(); let tools = new Map();
for (let [key, value] of this._tools) { for (let [id, definition] of this._tools) {
let enabled; if (this.getToolDefinition(id)) {
tools.set(id, definition);
try { }
enabled = Services.prefs.getBoolPref(value.visibilityswitch);
} catch(e) {
enabled = true;
} }
if (enabled || value.id == "options") {
tools.set(key, value);
}
}
return tools; return tools;
}, },
@ -162,9 +182,12 @@ DevTools.prototype = {
*/ */
getToolDefinitionArray: function DT_getToolDefinitionArray() { getToolDefinitionArray: function DT_getToolDefinitionArray() {
let definitions = []; let definitions = [];
for (let [id, definition] of this.getToolDefinitionMap()) {
for (let [id, definition] of this._tools) {
if (this.getToolDefinition(id)) {
definitions.push(definition); definitions.push(definition);
} }
}
return definitions.sort(this.ordinalSort); return definitions.sort(this.ordinalSort);
}, },
@ -415,8 +438,7 @@ let gDevToolsBrowser = {
selectToolCommand: function(gBrowser, toolId) { selectToolCommand: function(gBrowser, toolId) {
let target = devtools.TargetFactory.forTab(gBrowser.selectedTab); let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = gDevTools.getToolbox(target); let toolbox = gDevTools.getToolbox(target);
let tools = gDevTools.getToolDefinitionMap(); let toolDefinition = gDevTools.getToolDefinition(toolId);
let toolDefinition = tools.get(toolId);
if (toolbox && toolbox.currentToolId == toolId) { if (toolbox && toolbox.currentToolId == toolId) {
toolbox.fireCustomKey(toolId); toolbox.fireCustomKey(toolId);
@ -603,13 +625,6 @@ let gDevToolsBrowser = {
continue; continue;
} }
// Skip if the tool is disabled.
try {
if (!Services.prefs.getBoolPref(toolDefinition.visibilityswitch)) {
continue;
}
} catch(e) {}
let elements = gDevToolsBrowser._createToolMenuElements(toolDefinition, doc); let elements = gDevToolsBrowser._createToolMenuElements(toolDefinition, doc);
if (!elements) { if (!elements) {

View File

@ -4,50 +4,44 @@
"use strict"; "use strict";
const {Cc, Ci, Cu} = require("chrome");
const MAX_ORDINAL = 99; const MAX_ORDINAL = 99;
const ZOOM_PREF = "devtools.toolbox.zoomValue"; const ZOOM_PREF = "devtools.toolbox.zoomValue";
const MIN_ZOOM = 0.5; const MIN_ZOOM = 0.5;
const MAX_ZOOM = 2; const MAX_ZOOM = 2;
let {Cc, Ci, Cu} = require("chrome");
let promise = require("sdk/core/promise"); let promise = require("sdk/core/promise");
let EventEmitter = require("devtools/shared/event-emitter"); let EventEmitter = require("devtools/shared/event-emitter");
let Telemetry = require("devtools/shared/telemetry"); let Telemetry = require("devtools/shared/telemetry");
let HUDService = require("devtools/webconsole/hudservice"); let HUDService = require("devtools/webconsole/hudservice");
Cu.import('resource://gre/modules/XPCOMUtils.jsm'); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/devtools/gDevTools.jsm"); Cu.import("resource:///modules/devtools/gDevTools.jsm");
Cu.import("resource:///modules/devtools/scratchpad-manager.jsm"); Cu.import("resource:///modules/devtools/scratchpad-manager.jsm");
loader.lazyGetter(this, "Hosts", () => require("devtools/framework/toolbox-hosts").Hosts); loader.lazyGetter(this, "Hosts", () => require("devtools/framework/toolbox-hosts").Hosts);
XPCOMUtils.defineLazyModuleGetter(this, "CommandUtils", loader.lazyImporter(this, "CommandUtils", "resource:///modules/devtools/DeveloperToolbar.jsm");
"resource:///modules/devtools/DeveloperToolbar.jsm");
XPCOMUtils.defineLazyGetter(this, "toolboxStrings", function() { loader.lazyGetter(this, "toolboxStrings", () => {
let bundle = Services.strings.createBundle("chrome://browser/locale/devtools/toolbox.properties"); let bundle = Services.strings.createBundle("chrome://browser/locale/devtools/toolbox.properties");
let l10n = function(aName, ...aArgs) { return (name, ...args) => {
try { try {
if (aArgs.length == 0) { if (!args.length) {
return bundle.GetStringFromName(aName); return bundle.GetStringFromName(name);
} else {
return bundle.formatStringFromName(aName, aArgs, aArgs.length);
} }
return bundle.formatStringFromName(name, args, args.length);
} catch (ex) { } catch (ex) {
Services.console.logStringMessage("Error reading '" + aName + "'"); Services.console.logStringMessage("Error reading '" + name + "'");
} }
}; };
return l10n;
}); });
XPCOMUtils.defineLazyGetter(this, "Requisition", function() { loader.lazyGetter(this, "Requisition", () => {
let scope = {}; let {require} = Cu.import("resource://gre/modules/devtools/Require.jsm", {});
Cu.import("resource://gre/modules/devtools/Require.jsm", scope);
Cu.import("resource://gre/modules/devtools/gcli.jsm", {}); Cu.import("resource://gre/modules/devtools/gcli.jsm", {});
return require("gcli/cli").Requisition;
let req = scope.require;
return req('gcli/cli').Requisition;
}); });
/** /**
@ -69,6 +63,7 @@ function Toolbox(target, selectedTool, hostType) {
this._toolRegistered = this._toolRegistered.bind(this); this._toolRegistered = this._toolRegistered.bind(this);
this._toolUnregistered = this._toolUnregistered.bind(this); this._toolUnregistered = this._toolUnregistered.bind(this);
this._refreshHostTitle = this._refreshHostTitle.bind(this);
this.destroy = this.destroy.bind(this); this.destroy = this.destroy.bind(this);
this._target.on("close", this.destroy); this._target.on("close", this.destroy);
@ -79,8 +74,7 @@ function Toolbox(target, selectedTool, hostType) {
if (!selectedTool) { if (!selectedTool) {
selectedTool = Services.prefs.getCharPref(this._prefs.LAST_TOOL); selectedTool = Services.prefs.getCharPref(this._prefs.LAST_TOOL);
} }
let definitions = gDevTools.getToolDefinitionMap(); if (!gDevTools.getToolDefinition(selectedTool)) {
if (!definitions.get(selectedTool) && selectedTool != "options") {
selectedTool = "webconsole"; selectedTool = "webconsole";
} }
this._defaultToolId = selectedTool; this._defaultToolId = selectedTool;
@ -89,7 +83,6 @@ function Toolbox(target, selectedTool, hostType) {
EventEmitter.decorate(this); EventEmitter.decorate(this);
this._refreshHostTitle = this._refreshHostTitle.bind(this);
this._target.on("navigate", this._refreshHostTitle); this._target.on("navigate", this._refreshHostTitle);
this.on("host-changed", this._refreshHostTitle); this.on("host-changed", this._refreshHostTitle);
this.on("select", this._refreshHostTitle); this.on("select", this._refreshHostTitle);
@ -107,7 +100,7 @@ Toolbox.HostType = {
BOTTOM: "bottom", BOTTOM: "bottom",
SIDE: "side", SIDE: "side",
WINDOW: "window" WINDOW: "window"
} };
Toolbox.prototype = { Toolbox.prototype = {
_URL: "chrome://browser/content/devtools/framework/toolbox.xul", _URL: "chrome://browser/content/devtools/framework/toolbox.xul",
@ -118,7 +111,7 @@ Toolbox.prototype = {
SIDE_ENABLED: "devtools.toolbox.sideEnabled" SIDE_ENABLED: "devtools.toolbox.sideEnabled"
}, },
HostType: Toolbox.HostType, currentToolId: null,
/** /**
* Returns a *copy* of the _toolPanels collection. * Returns a *copy* of the _toolPanels collection.
@ -126,20 +119,15 @@ Toolbox.prototype = {
* @return {Map} panels * @return {Map} panels
* All the running panels in the toolbox * All the running panels in the toolbox
*/ */
getToolPanels: function TB_getToolPanels() { getToolPanels: function() {
let panels = new Map(); return new Map(this._toolPanels);
for (let [key, value] of this._toolPanels) {
panels.set(key, value);
}
return panels;
}, },
/** /**
* Access the panel for a given tool * Access the panel for a given tool
*/ */
getPanel: function TBOX_getPanel(id) { getPanel: function(id) {
return this.getToolPanels().get(id); return this._toolPanels.get(id);
}, },
/** /**
@ -147,8 +135,8 @@ Toolbox.prototype = {
* likely that we're going to want to get the panel that we've just made * likely that we're going to want to get the panel that we've just made
* visible * visible
*/ */
getCurrentPanel: function TBOX_getCurrentPanel() { getCurrentPanel: function() {
return this.getToolPanels().get(this.currentToolId); return this._toolPanels.get(this.currentToolId);
}, },
/** /**
@ -168,17 +156,6 @@ Toolbox.prototype = {
return this._host.type; return this._host.type;
}, },
/**
* Get/alter the currently displayed tool.
*/
get currentToolId() {
return this._currentToolId;
},
set currentToolId(value) {
this._currentToolId = value;
},
/** /**
* Get the iframe containing the toolbox UI. * Get the iframe containing the toolbox UI.
*/ */
@ -203,10 +180,12 @@ Toolbox.prototype = {
/** /**
* Open the toolbox * Open the toolbox
*/ */
open: function TBOX_open() { open: function() {
let deferred = promise.defer();
return this._host.create().then(iframe => {
let deferred = promise.defer(); let deferred = promise.defer();
this._host.create().then(iframe => {
let domReady = () => { let domReady = () => {
iframe.removeEventListener("DOMContentLoaded", domReady, true); iframe.removeEventListener("DOMContentLoaded", domReady, true);
@ -226,27 +205,27 @@ Toolbox.prototype = {
this._telemetry.toolOpened("toolbox"); this._telemetry.toolOpened("toolbox");
this.selectTool(this._defaultToolId).then(function(panel) { this.selectTool(this._defaultToolId).then(panel => {
this.emit("ready"); this.emit("ready");
deferred.resolve(); deferred.resolve();
}.bind(this)); });
}; };
iframe.addEventListener("DOMContentLoaded", domReady, true); iframe.addEventListener("DOMContentLoaded", domReady, true);
iframe.setAttribute("src", this._URL); iframe.setAttribute("src", this._URL);
});
return deferred.promise; return deferred.promise;
});
}, },
_buildOptions: function TBOX__buildOptions() { _buildOptions: function() {
let key = this.doc.getElementById("toolbox-options-key"); let key = this.doc.getElementById("toolbox-options-key");
key.addEventListener("command", function(toolId) { key.addEventListener("command", () => {
this.selectTool(toolId); this.selectTool("options");
}.bind(this, "options"), true); }, true);
}, },
_addToolSwitchingKeys: function TBOX__addToolSwitchingKeys() { _addToolSwitchingKeys: function() {
let nextKey = this.doc.getElementById("toolbox-next-tool-key"); let nextKey = this.doc.getElementById("toolbox-next-tool-key");
nextKey.addEventListener("command", this.selectNextTool.bind(this), true); nextKey.addEventListener("command", this.selectNextTool.bind(this), true);
let prevKey = this.doc.getElementById("toolbox-previous-tool-key"); let prevKey = this.doc.getElementById("toolbox-previous-tool-key");
@ -256,7 +235,7 @@ Toolbox.prototype = {
/** /**
* Wire up the listeners for the zoom keys. * Wire up the listeners for the zoom keys.
*/ */
_addZoomKeys: function TBOX__addZoomKeys() { _addZoomKeys: function() {
let inKey = this.doc.getElementById("toolbox-zoom-in-key"); let inKey = this.doc.getElementById("toolbox-zoom-in-key");
inKey.addEventListener("command", this.zoomIn.bind(this), true); inKey.addEventListener("command", this.zoomIn.bind(this), true);
@ -273,28 +252,28 @@ Toolbox.prototype = {
/** /**
* Set zoom on toolbox to whatever the last setting was. * Set zoom on toolbox to whatever the last setting was.
*/ */
_loadInitialZoom: function TBOX__loadInitialZoom() { _loadInitialZoom: function() {
this.setZoom(this.zoomValue); this.setZoom(this.zoomValue);
}, },
/** /**
* Increase zoom level of toolbox window - make things bigger. * Increase zoom level of toolbox window - make things bigger.
*/ */
zoomIn: function TBOX__zoomIn() { zoomIn: function() {
this.setZoom(this.zoomValue + 0.1); this.setZoom(this.zoomValue + 0.1);
}, },
/** /**
* Decrease zoom level of toolbox window - make things smaller. * Decrease zoom level of toolbox window - make things smaller.
*/ */
zoomOut: function TBOX__zoomOut() { zoomOut: function() {
this.setZoom(this.zoomValue - 0.1); this.setZoom(this.zoomValue - 0.1);
}, },
/** /**
* Reset zoom level of the toolbox window. * Reset zoom level of the toolbox window.
*/ */
zoomReset: function TBOX__zoomReset() { zoomReset: function() {
this.setZoom(1); this.setZoom(1);
}, },
@ -304,7 +283,7 @@ Toolbox.prototype = {
* @param {number} zoomValue * @param {number} zoomValue
* Zoom level e.g. 1.2 * Zoom level e.g. 1.2
*/ */
setZoom: function TBOX__setZoom(zoomValue) { setZoom: function(zoomValue) {
// cap zoom value // cap zoom value
zoomValue = Math.max(zoomValue, MIN_ZOOM); zoomValue = Math.max(zoomValue, MIN_ZOOM);
zoomValue = Math.min(zoomValue, MAX_ZOOM); zoomValue = Math.min(zoomValue, MAX_ZOOM);
@ -320,19 +299,23 @@ Toolbox.prototype = {
/** /**
* Adds the keys and commands to the Toolbox Window in window mode. * Adds the keys and commands to the Toolbox Window in window mode.
*/ */
_addKeysToWindow: function TBOX__addKeysToWindow() { _addKeysToWindow: function() {
if (this.hostType != Toolbox.HostType.WINDOW) { if (this.hostType != Toolbox.HostType.WINDOW) {
return; return;
} }
let doc = this.doc.defaultView.parent.document; let doc = this.doc.defaultView.parent.document;
for (let [id, toolDefinition] of gDevTools.getToolDefinitionMap()) { for (let [id, toolDefinition] of gDevTools.getToolDefinitionMap()) {
if (toolDefinition.key) {
// Prevent multiple entries for the same tool. // Prevent multiple entries for the same tool.
if (doc.getElementById("key_" + id)) { if (!toolDefinition.key || doc.getElementById("key_" + id)) {
continue; continue;
} }
let toolId = id;
let key = doc.createElement("key"); let key = doc.createElement("key");
key.id = "key_" + id;
key.id = "key_" + toolId;
if (toolDefinition.key.startsWith("VK_")) { if (toolDefinition.key.startsWith("VK_")) {
key.setAttribute("keycode", toolDefinition.key); key.setAttribute("keycode", toolDefinition.key);
@ -342,38 +325,21 @@ Toolbox.prototype = {
key.setAttribute("modifiers", toolDefinition.modifiers); key.setAttribute("modifiers", toolDefinition.modifiers);
key.setAttribute("oncommand", "void(0);"); // needed. See bug 371900 key.setAttribute("oncommand", "void(0);"); // needed. See bug 371900
key.addEventListener("command", function(toolId) { key.addEventListener("command", () => {
this.selectTool(toolId).then(() => { this.selectTool(toolId).then(() => this.fireCustomKey(toolId));
this.fireCustomKey(toolId);
});
}.bind(this, id), true);
doc.getElementById("toolbox-keyset").appendChild(key);
}
}
// Add key for opening Scratchpad from the detached window
if(doc.getElementById("key_scratchpad") == null) {
let key = doc.createElement("key");
key.id = "key_scratchpad";
key.setAttribute("keycode", toolboxStrings("scratchpad.keycode"));
key.setAttribute("modifiers", "shift");
key.setAttribute("oncommand", "void(0)"); // needed. See bug 371900
key.addEventListener("command", function() {
ScratchpadManager.openScratchpad();
}, true); }, true);
doc.getElementById("toolbox-keyset").appendChild(key); doc.getElementById("toolbox-keyset").appendChild(key);
} }
// Add key for toggling the browser console from the detached window // Add key for toggling the browser console from the detached window
if(doc.getElementById("key_browserconsole") == null) { if (!doc.getElementById("key_browserconsole")) {
let key = doc.createElement("key"); let key = doc.createElement("key");
key.id = "key_browserconsole"; key.id = "key_browserconsole";
key.setAttribute("key", toolboxStrings("browserConsoleCmd.commandkey")); key.setAttribute("key", toolboxStrings("browserConsoleCmd.commandkey"));
key.setAttribute("modifiers", "accel,shift"); key.setAttribute("modifiers", "accel,shift");
key.setAttribute("oncommand", "void(0)"); // needed. See bug 371900 key.setAttribute("oncommand", "void(0)"); // needed. See bug 371900
key.addEventListener("command", function() { key.addEventListener("command", () => {
HUDService.toggleBrowserConsole(); HUDService.toggleBrowserConsole();
}, true); }, true);
doc.getElementById("toolbox-keyset").appendChild(key); doc.getElementById("toolbox-keyset").appendChild(key);
@ -386,12 +352,11 @@ Toolbox.prototype = {
* @param {string} toolId * @param {string} toolId
* Which tool to run the command on (skip if not current) * Which tool to run the command on (skip if not current)
*/ */
fireCustomKey: function TBOX_fireCustomKey(toolId) { fireCustomKey: function(toolId) {
let tools = gDevTools.getToolDefinitionMap(); let toolDefinition = gDevTools.getToolDefinition(toolId);
let activeToolDefinition = tools.get(toolId);
if (activeToolDefinition.onkey && this.currentToolId === toolId) { if (toolDefinition.onkey && this.currentToolId === toolId) {
activeToolDefinition.onkey(this.getCurrentPanel()); toolDefinition.onkey(this.getCurrentPanel());
} }
}, },
@ -399,7 +364,7 @@ Toolbox.prototype = {
* Build the buttons for changing hosts. Called every time * Build the buttons for changing hosts. Called every time
* the host changes. * the host changes.
*/ */
_buildDockButtons: function TBOX_createDockButtons() { _buildDockButtons: function() {
let dockBox = this.doc.getElementById("toolbox-dock-buttons"); let dockBox = this.doc.getElementById("toolbox-dock-buttons");
while (dockBox.firstChild) { while (dockBox.firstChild) {
@ -411,7 +376,7 @@ Toolbox.prototype = {
} }
let closeButton = this.doc.getElementById("toolbox-close"); let closeButton = this.doc.getElementById("toolbox-close");
if (this.hostType === this.HostType.WINDOW) { if (this.hostType == Toolbox.HostType.WINDOW) {
closeButton.setAttribute("hidden", "true"); closeButton.setAttribute("hidden", "true");
} else { } else {
closeButton.removeAttribute("hidden"); closeButton.removeAttribute("hidden");
@ -419,9 +384,10 @@ Toolbox.prototype = {
let sideEnabled = Services.prefs.getBoolPref(this._prefs.SIDE_ENABLED); let sideEnabled = Services.prefs.getBoolPref(this._prefs.SIDE_ENABLED);
for each (let position in this.HostType) { for (let type in Toolbox.HostType) {
let position = Toolbox.HostType[type];
if (position == this.hostType || if (position == this.hostType ||
(!sideEnabled && position == this.HostType.SIDE)) { (!sideEnabled && position == Toolbox.HostType.SIDE)) {
continue; continue;
} }
@ -430,9 +396,9 @@ Toolbox.prototype = {
button.className = "toolbox-dock-button"; button.className = "toolbox-dock-button";
button.setAttribute("tooltiptext", toolboxStrings("toolboxDockButtons." + button.setAttribute("tooltiptext", toolboxStrings("toolboxDockButtons." +
position + ".tooltip")); position + ".tooltip"));
button.addEventListener("command", function(position) { button.addEventListener("command", () => {
this.switchHost(position); this.switchHost(position);
}.bind(this, position)); });
dockBox.appendChild(button); dockBox.appendChild(button);
} }
@ -441,7 +407,7 @@ Toolbox.prototype = {
/** /**
* Add tabs to the toolbox UI for registered tools * Add tabs to the toolbox UI for registered tools
*/ */
_buildTabs: function TBOX_buildTabs() { _buildTabs: function() {
for (let definition of gDevTools.getToolDefinitionArray()) { for (let definition of gDevTools.getToolDefinitionArray()) {
this._buildTabForTool(definition); this._buildTabForTool(definition);
} }
@ -450,18 +416,16 @@ Toolbox.prototype = {
/** /**
* Add buttons to the UI as specified in the devtools.window.toolbarSpec pref * Add buttons to the UI as specified in the devtools.window.toolbarSpec pref
*/ */
_buildButtons: function TBOX_buildButtons() { _buildButtons: function() {
if (!this.target.isLocalTab) { if (!this.target.isLocalTab) {
return; return;
} }
let toolbarSpec = CommandUtils.getCommandbarSpec("devtools.toolbox.toolbarSpec"); let spec = CommandUtils.getCommandbarSpec("devtools.toolbox.toolbarSpec");
let env = CommandUtils.createEnvironment(this.target.tab.ownerDocument, let env = CommandUtils.createEnvironment(this.target.tab.ownerDocument,
this.target.window.document); this.target.window.document);
let requisition = new Requisition(env); let req = new Requisition(env);
let buttons = CommandUtils.createButtons(spec, this._target, this.doc, req);
let buttons = CommandUtils.createButtons(toolbarSpec, this._target, this.doc, requisition);
let container = this.doc.getElementById("toolbox-buttons"); let container = this.doc.getElementById("toolbox-buttons");
buttons.forEach(container.appendChild.bind(container)); buttons.forEach(container.appendChild.bind(container));
}, },
@ -472,7 +436,7 @@ Toolbox.prototype = {
* @param {string} toolDefinition * @param {string} toolDefinition
* Tool definition of the tool to build a tab for. * Tool definition of the tool to build a tab for.
*/ */
_buildTabForTool: function TBOX_buildTabForTool(toolDefinition) { _buildTabForTool: function(toolDefinition) {
if (!toolDefinition.isTargetSupported(this._target)) { if (!toolDefinition.isTargetSupported(this._target)) {
return; return;
} }
@ -482,6 +446,10 @@ Toolbox.prototype = {
let id = toolDefinition.id; let id = toolDefinition.id;
if (toolDefinition.ordinal == undefined || toolDefinition.ordinal < 0) {
toolDefinition.ordinal = MAX_ORDINAL;
}
let radio = this.doc.createElement("radio"); let radio = this.doc.createElement("radio");
// The radio element is not being used in the conventional way, thus // The radio element is not being used in the conventional way, thus
// the devtools-tab class replaces the radio XBL binding with its base // the devtools-tab class replaces the radio XBL binding with its base
@ -489,15 +457,12 @@ Toolbox.prototype = {
radio.className = "toolbox-tab devtools-tab"; radio.className = "toolbox-tab devtools-tab";
radio.id = "toolbox-tab-" + id; radio.id = "toolbox-tab-" + id;
radio.setAttribute("toolid", id); radio.setAttribute("toolid", id);
if (toolDefinition.ordinal == undefined || toolDefinition.ordinal < 0) {
toolDefinition.ordinal = MAX_ORDINAL;
}
radio.setAttribute("ordinal", toolDefinition.ordinal); radio.setAttribute("ordinal", toolDefinition.ordinal);
radio.setAttribute("tooltiptext", toolDefinition.tooltip); radio.setAttribute("tooltiptext", toolDefinition.tooltip);
radio.addEventListener("command", function(id) { radio.addEventListener("command", () => {
this.selectTool(id); this.selectTool(id);
}.bind(this, id)); });
// spacer lets us center the image and label, while allowing cropping // spacer lets us center the image and label, while allowing cropping
let spacer = this.doc.createElement("spacer"); let spacer = this.doc.createElement("spacer");
@ -537,9 +502,8 @@ Toolbox.prototype = {
+tabs.lastChild.getAttribute("ordinal") <= toolDefinition.ordinal) { +tabs.lastChild.getAttribute("ordinal") <= toolDefinition.ordinal) {
tabs.appendChild(radio); tabs.appendChild(radio);
deck.appendChild(vbox); deck.appendChild(vbox);
} } else {
// else, iterate over all the tabs to get the correct location. // else, iterate over all the tabs to get the correct location.
else {
Array.some(tabs.childNodes, (node, i) => { Array.some(tabs.childNodes, (node, i) => {
if (+node.getAttribute("ordinal") > toolDefinition.ordinal) { if (+node.getAttribute("ordinal") > toolDefinition.ordinal) {
tabs.insertBefore(radio, node); tabs.insertBefore(radio, node);
@ -558,7 +522,7 @@ Toolbox.prototype = {
* @param {string} id * @param {string} id
* The id of the tool to load. * The id of the tool to load.
*/ */
loadTool: function TBOX_loadTool(id) { loadTool: function(id) {
let deferred = promise.defer(); let deferred = promise.defer();
let iframe = this.doc.getElementById("toolbox-panel-iframe-" + id); let iframe = this.doc.getElementById("toolbox-panel-iframe-" + id);
@ -567,18 +531,19 @@ Toolbox.prototype = {
if (panel) { if (panel) {
deferred.resolve(panel); deferred.resolve(panel);
} else { } else {
this.once(id + "-ready", (panel) => { this.once(id + "-ready", panel => {
deferred.resolve(panel); deferred.resolve(panel);
}); });
} }
return deferred.promise; return deferred.promise;
} }
let definition = gDevTools.getToolDefinitionMap().get(id); let definition = gDevTools.getToolDefinition(id);
if (!definition) { if (!definition) {
deferred.reject(new Error("no such tool id "+id)); deferred.reject(new Error("no such tool id "+id));
return deferred.promise; return deferred.promise;
} }
iframe = this.doc.createElement("iframe"); iframe = this.doc.createElement("iframe");
iframe.className = "toolbox-panel-iframe"; iframe.className = "toolbox-panel-iframe";
iframe.id = "toolbox-panel-iframe-" + id; iframe.id = "toolbox-panel-iframe-" + id;
@ -612,17 +577,17 @@ Toolbox.prototype = {
* @param {string} id * @param {string} id
* The id of the tool to switch to * The id of the tool to switch to
*/ */
selectTool: function TBOX_selectTool(id) { selectTool: function(id) {
let selected = this.doc.querySelector(".devtools-tab[selected]"); let selected = this.doc.querySelector(".devtools-tab[selected]");
if (selected) { if (selected) {
selected.removeAttribute("selected"); selected.removeAttribute("selected");
} }
let tab = this.doc.getElementById("toolbox-tab-" + id); let tab = this.doc.getElementById("toolbox-tab-" + id);
tab.setAttribute("selected", "true"); tab.setAttribute("selected", "true");
let prevToolId = this._currentToolId;
if (this._currentToolId == id) { if (this.currentToolId == id) {
// re-focus tool to get key events again // re-focus tool to get key events again
this.focusTool(id); this.focusTool(id);
@ -633,11 +598,12 @@ Toolbox.prototype = {
if (!this.isReady) { if (!this.isReady) {
throw new Error("Can't select tool, wait for toolbox 'ready' event"); throw new Error("Can't select tool, wait for toolbox 'ready' event");
} }
let tab = this.doc.getElementById("toolbox-tab-" + id);
tab = this.doc.getElementById("toolbox-tab-" + id);
if (tab) { if (tab) {
if (prevToolId) { if (this.currentToolId) {
this._telemetry.toolClosed(prevToolId); this._telemetry.toolClosed(this.currentToolId);
} }
this._telemetry.toolOpened(id); this._telemetry.toolOpened(id);
} else { } else {
@ -662,12 +628,12 @@ Toolbox.prototype = {
let deck = this.doc.getElementById("toolbox-deck"); let deck = this.doc.getElementById("toolbox-deck");
deck.selectedIndex = index; deck.selectedIndex = index;
this._currentToolId = id; this.currentToolId = id;
if (id != "options") { if (id != "options") {
Services.prefs.setCharPref(this._prefs.LAST_TOOL, id); Services.prefs.setCharPref(this._prefs.LAST_TOOL, id);
} }
return this.loadTool(id).then((panel) => { return this.loadTool(id).then(panel => {
// focus the tool's frame to start receiving key events // focus the tool's frame to start receiving key events
this.focusTool(id); this.focusTool(id);
@ -690,7 +656,7 @@ Toolbox.prototype = {
/** /**
* Loads the tool next to the currently selected tool. * Loads the tool next to the currently selected tool.
*/ */
selectNextTool: function TBOX_selectNextTool() { selectNextTool: function() {
let selected = this.doc.querySelector(".devtools-tab[selected]"); let selected = this.doc.querySelector(".devtools-tab[selected]");
let next = selected.nextSibling || selected.parentNode.firstChild; let next = selected.nextSibling || selected.parentNode.firstChild;
let tool = next.getAttribute("toolid"); let tool = next.getAttribute("toolid");
@ -700,7 +666,7 @@ Toolbox.prototype = {
/** /**
* Loads the tool just left to the currently selected tool. * Loads the tool just left to the currently selected tool.
*/ */
selectPreviousTool: function TBOX_selectPreviousTool() { selectPreviousTool: function() {
let selected = this.doc.querySelector(".devtools-tab[selected]"); let selected = this.doc.querySelector(".devtools-tab[selected]");
let previous = selected.previousSibling || selected.parentNode.lastChild; let previous = selected.previousSibling || selected.parentNode.lastChild;
let tool = previous.getAttribute("toolid"); let tool = previous.getAttribute("toolid");
@ -713,7 +679,7 @@ Toolbox.prototype = {
* @param {string} id * @param {string} id
* The id of the tool to highlight * The id of the tool to highlight
*/ */
highlightTool: function TBOX_highlightTool(id) { highlightTool: function(id) {
let tab = this.doc.getElementById("toolbox-tab-" + id); let tab = this.doc.getElementById("toolbox-tab-" + id);
tab && tab.classList.add("highlighted"); tab && tab.classList.add("highlighted");
}, },
@ -724,7 +690,7 @@ Toolbox.prototype = {
* @param {string} id * @param {string} id
* The id of the tool to unhighlight * The id of the tool to unhighlight
*/ */
unhighlightTool: function TBOX_unhighlightTool(id) { unhighlightTool: function(id) {
let tab = this.doc.getElementById("toolbox-tab-" + id); let tab = this.doc.getElementById("toolbox-tab-" + id);
tab && tab.classList.remove("highlighted"); tab && tab.classList.remove("highlighted");
}, },
@ -732,17 +698,16 @@ Toolbox.prototype = {
/** /**
* Raise the toolbox host. * Raise the toolbox host.
*/ */
raise: function TBOX_raise() { raise: function() {
this._host.raise(); this._host.raise();
}, },
/** /**
* Refresh the host's title. * Refresh the host's title.
*/ */
_refreshHostTitle: function TBOX_refreshHostTitle() { _refreshHostTitle: function() {
let toolName; let toolName;
let toolId = this.currentToolId; let toolDef = gDevTools.getToolDefinition(this.currentToolId);
let toolDef = gDevTools.getToolDefinitionMap().get(toolId);
if (toolDef) { if (toolDef) {
toolName = toolDef.label; toolName = toolDef.label;
} else { } else {
@ -767,15 +732,14 @@ Toolbox.prototype = {
* @return {Host} host * @return {Host} host
* The created host object * The created host object
*/ */
_createHost: function TBOX_createHost(hostType) { _createHost: function(hostType) {
if (!Hosts[hostType]) { if (!Hosts[hostType]) {
throw new Error('Unknown hostType: '+ hostType); throw new Error("Unknown hostType: " + hostType);
} }
let newHost = new Hosts[hostType](this.target.tab);
// clean up the toolbox if its window is closed // clean up the toolbox if its window is closed
let newHost = new Hosts[hostType](this.target.tab);
newHost.on("window-closed", this.destroy); newHost.on("window-closed", this.destroy);
return newHost; return newHost;
}, },
@ -786,17 +750,13 @@ Toolbox.prototype = {
* @param {string} hostType * @param {string} hostType
* The host type of the new host object * The host type of the new host object
*/ */
switchHost: function TBOX_switchHost(hostType) { switchHost: function(hostType) {
if (hostType == this._host.type) { if (hostType == this._host.type || !this._target.isLocalTab) {
return;
}
if (!this._target.isLocalTab) {
return; return;
} }
let newHost = this._createHost(hostType); let newHost = this._createHost(hostType);
return newHost.create().then(function(iframe) { return newHost.create().then(iframe => {
// change toolbox document's parent to the new host // change toolbox document's parent to the new host
iframe.QueryInterface(Ci.nsIFrameLoaderOwner); iframe.QueryInterface(Ci.nsIFrameLoaderOwner);
iframe.swapFrameLoaders(this.frame); iframe.swapFrameLoaders(this.frame);
@ -812,7 +772,7 @@ Toolbox.prototype = {
this._addKeysToWindow(); this._addKeysToWindow();
this.emit("host-changed"); this.emit("host-changed");
}.bind(this)); });
}, },
/** /**
@ -822,10 +782,8 @@ Toolbox.prototype = {
* @param {string} toolId * @param {string} toolId
* Id of the tool that was registered * Id of the tool that was registered
*/ */
_toolRegistered: function TBOX_toolRegistered(event, toolId) { _toolRegistered: function(event, toolId) {
let defs = gDevTools.getToolDefinitionMap(); let tool = gDevTools.getToolDefinition(toolId);
let tool = defs.get(toolId);
this._buildTabForTool(tool); this._buildTabForTool(tool);
}, },
@ -837,7 +795,7 @@ Toolbox.prototype = {
* Definition or id of the tool that was unregistered. Passing the * Definition or id of the tool that was unregistered. Passing the
* tool id should be avoided as it is a temporary measure. * tool id should be avoided as it is a temporary measure.
*/ */
_toolUnregistered: function TBOX_toolUnregistered(event, toolId) { _toolUnregistered: function(event, toolId) {
if (typeof toolId != "string") { if (typeof toolId != "string") {
toolId = toolId.id; toolId = toolId.id;
} }
@ -852,7 +810,7 @@ Toolbox.prototype = {
let panel = this.doc.getElementById("toolbox-panel-" + toolId); let panel = this.doc.getElementById("toolbox-panel-" + toolId);
if (radio) { if (radio) {
if (this._currentToolId == toolId) { if (this.currentToolId == toolId) {
let nextToolName = null; let nextToolName = null;
if (radio.nextSibling) { if (radio.nextSibling) {
nextToolName = radio.nextSibling.getAttribute("toolid"); nextToolName = radio.nextSibling.getAttribute("toolid");
@ -880,30 +838,24 @@ Toolbox.prototype = {
} }
}, },
/** /**
* Get the toolbox's notification box * Get the toolbox's notification box
* *
* @return The notification box element. * @return The notification box element.
*/ */
getNotificationBox: function TBOX_getNotificationBox() { getNotificationBox: function() {
return this.doc.getElementById("toolbox-notificationbox"); return this.doc.getElementById("toolbox-notificationbox");
}, },
/** /**
* Remove all UI elements, detach from target and clear up * Remove all UI elements, detach from target and clear up
*/ */
destroy: function TBOX_destroy() { destroy: function() {
// If several things call destroy then we give them all the same // If several things call destroy then we give them all the same
// destruction promise so we're sure to destroy only once // destruction promise so we're sure to destroy only once
if (this._destroyer) { if (this._destroyer) {
return this._destroyer; return this._destroyer;
} }
// Assign the "_destroyer" property before calling the other
// destroyer methods to guarantee that the Toolbox's destroy
// method is only executed once.
let deferred = promise.defer();
this._destroyer = deferred.promise;
this._target.off("navigate", this._refreshHostTitle); this._target.off("navigate", this._refreshHostTitle);
this.off("select", this._refreshHostTitle); this.off("select", this._refreshHostTitle);
@ -917,7 +869,7 @@ Toolbox.prototype = {
if (typeof this._origAllowJavascript != "undefined") { if (typeof this._origAllowJavascript != "undefined") {
let docShell = this._host.hostTab.linkedBrowser.docShell; let docShell = this._host.hostTab.linkedBrowser.docShell;
docShell.allowJavascript = this._origAllowJavascript; docShell.allowJavascript = this._origAllowJavascript;
delete this._origAllowJavascript; this._origAllowJavascript = undefined;
} }
let outstanding = []; let outstanding = [];
@ -940,7 +892,7 @@ Toolbox.prototype = {
this._telemetry.destroy(); this._telemetry.destroy();
promise.all(outstanding).then(() => { return this._destroyer = promise.all(outstanding).then(() => {
// Targets need to be notified that the toolbox is being torn down. // Targets need to be notified that the toolbox is being torn down.
// This is done after other destruction tasks since it may tear down // This is done after other destruction tasks since it may tear down
// fronts and the debugger transport which earlier destroy methods may // fronts and the debugger transport which earlier destroy methods may
@ -951,14 +903,11 @@ Toolbox.prototype = {
target.off("close", this.destroy); target.off("close", this.destroy);
return target.destroy(); return target.destroy();
} }
}).then(function() { }).then(() => {
this.emit("destroyed"); this.emit("destroyed");
// Free _host after the call to destroyed in order to let a chance // Free _host after the call to destroyed in order to let a chance
// to destroyed listeners to still query toolbox attributes // to destroyed listeners to still query toolbox attributes
this._host = null; this._host = null;
deferred.resolve(); });
}.bind(this));
return this._destroyer;
} }
}; };

View File

@ -8,10 +8,6 @@
* singleton to provide data-level functionality to the views * singleton to provide data-level functionality to the views
*/ */
let TopSites = { let TopSites = {
_initialized: false,
Site: Site,
prepareCache: function(aForce){ prepareCache: function(aForce){
// front to the NewTabUtils' links cache // front to the NewTabUtils' links cache
// -ensure NewTabUtils.links links are pre-cached // -ensure NewTabUtils.links links are pre-cached
@ -151,6 +147,7 @@ let TopSites = {
this._sitesDirty.clear(); this._sitesDirty.clear();
this.update(); this.update();
}, },
_linkFromNode: function _linkFromNode(aNode) { _linkFromNode: function _linkFromNode(aNode) {
return { return {
url: aNode.getAttribute("value"), url: aNode.getAttribute("value"),

View File

@ -16,6 +16,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
XPCOMUtils.defineLazyModuleGetter(this, "FormHistory", XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
"resource://gre/modules/FormHistory.jsm"); "resource://gre/modules/FormHistory.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PageThumbs",
"resource://gre/modules/PageThumbs.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm"); "resource://gre/modules/PluralForm.jsm");

View File

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; "use strict";
Cu.import("resource://gre/modules/PageThumbs.jsm");
Cu.import("resource://gre/modules/devtools/dbg-server.jsm") Cu.import("resource://gre/modules/devtools/dbg-server.jsm")
/** /**
@ -108,6 +107,7 @@ var BrowserUI = {
PanelUI.init(); PanelUI.init();
FlyoutPanelsUI.init(); FlyoutPanelsUI.init();
PageThumbs.init(); PageThumbs.init();
NewTabUtils.init();
SettingsCharm.init(); SettingsCharm.init();
NavButtonSlider.init(); NavButtonSlider.init();

View File

@ -424,6 +424,7 @@
<label id="about-policy-label" <label id="about-policy-label"
onclick="FlyoutPanelsUI.AboutFlyoutPanel.onPolicyClick(event);" onclick="FlyoutPanelsUI.AboutFlyoutPanel.onPolicyClick(event);"
class="text-link" value="&aboutHeader.policy.label;"/> class="text-link" value="&aboutHeader.policy.label;"/>
<spacer class="flyoutpanel-hack"/>
</flyoutpanel> </flyoutpanel>
#ifdef MOZ_SERVICES_SYNC #ifdef MOZ_SERVICES_SYNC
@ -682,9 +683,12 @@
<description>&doNotTrack.desc;</description> <description>&doNotTrack.desc;</description>
<setting id="prefs-dnt-value" pref="privacy.donottrackheader.value" type="radio" > <setting id="prefs-dnt-value" pref="privacy.donottrackheader.value" type="radio" >
<radiogroup id="prefs-dnt-options"> <radiogroup id="prefs-dnt-options">
<radio id="prefs-dnt-notrack" label="&doNotTrack.options.trackingNotOkay;" value="1"/> <radio id="prefs-dnt-notrack" class="flyoutpanel-hack"
<radio id="prefs-dnt-nopref" label="&doNotTrack.options.noPreference;" value="-1"/> label="&doNotTrack.options.trackingNotOkay;" value="1"/>
<radio id="prefs-dnt-oktrack" label="&doNotTrack.options.trackingOkay;" value="0"/> <radio id="prefs-dnt-nopref" class="flyoutpanel-hack"
label="&doNotTrack.options.noPreference;" value="-1"/>
<radio id="prefs-dnt-oktrack" class="flyoutpanel-hack"
label="&doNotTrack.options.trackingOkay;" value="0"/>
</radiogroup> </radiogroup>
</setting> </setting>
</settings> </settings>

View File

@ -21,7 +21,6 @@ function TopSitesView(aGrid, aMaxSites) {
getService(Ci.nsINavHistoryService); getService(Ci.nsINavHistoryService);
history.addObserver(this, false); history.addObserver(this, false);
PageThumbs.addExpirationFilter(this);
Services.obs.addObserver(this, "Metro:RefreshTopsiteThumbnail", false); Services.obs.addObserver(this, "Metro:RefreshTopsiteThumbnail", false);
NewTabUtils.allPages.register(this); NewTabUtils.allPages.register(this);
@ -40,7 +39,6 @@ TopSitesView.prototype = Util.extend(Object.create(View.prototype), {
destruct: function destruct() { destruct: function destruct() {
Services.obs.removeObserver(this, "Metro:RefreshTopsiteThumbnail"); Services.obs.removeObserver(this, "Metro:RefreshTopsiteThumbnail");
PageThumbs.removeExpirationFilter(this);
NewTabUtils.allPages.unregister(this); NewTabUtils.allPages.unregister(this);
if (StartUI.chromeWin) { if (StartUI.chromeWin) {
StartUI.chromeWin.removeEventListener('MozAppbarDismissing', this, false); StartUI.chromeWin.removeEventListener('MozAppbarDismissing', this, false);
@ -216,10 +214,6 @@ TopSitesView.prototype = Util.extend(Object.create(View.prototype), {
} }
}, },
filterForThumbnailExpiration: function filterForThumbnailExpiration(aCallback) {
aCallback([item.getAttribute("value") for (item of this._set.children)]);
},
isFirstRun: function isFirstRun() { isFirstRun: function isFirstRun() {
return prefs.getBoolPref("browser.firstrun.show.localepicker"); return prefs.getBoolPref("browser.firstrun.show.localepicker");
}, },

View File

@ -86,7 +86,3 @@ flyoutpanel[visible] {
.flyout-close-button:active { .flyout-close-button:active {
-moz-image-region: rect(0 96px 32px 64px); -moz-image-region: rect(0 96px 32px 64px);
} }
.flyout-narrow {
width: 346px;
}

View File

@ -840,7 +840,14 @@ appbar toolbar[labelled] toolbarbutton > .toolbarbutton-text {
list-style-image: url(chrome://browser/skin/images/appbar-icons.png); list-style-image: url(chrome://browser/skin/images/appbar-icons.png);
} }
.flyout-narrow description, /* Flyout panels (sidebars) ------------------------------------------------- */
.flyout-narrow label {
max-width: 266px; /* Accounts for a 40px padding on each side of the flyout */ .flyout-narrow {
width: 346px;
}
/* Some elements don't resize to fit their container properly for some reason.
* Setting max-width on the element or a child fixes it. */
.flyout-narrow .flyoutpanel-hack {
max-width: calc(346px - 2 * 40px);
} }

View File

@ -111,7 +111,6 @@ richgriditem:not([tiletype="thumbnail"]) .tile-start-container {
richgriditem:not([iconURI]) .tile-icon-box, richgriditem:not([iconURI]) .tile-icon-box,
richgriditem[iconURI=""] .tile-icon-box, richgriditem[iconURI=""] .tile-icon-box,
richgriditem[iconsize="large"] .tile-icon-box { richgriditem[iconsize="large"] .tile-icon-box {
background-color: transparent!important;
border-color: transparent!important; border-color: transparent!important;
padding: 4px; padding: 4px;
} }
@ -129,6 +128,7 @@ richgriditem[iconsize="large"] .tile-icon-box > image,
left: 52px; /* label goes to the right of the favicon */ left: 52px; /* label goes to the right of the favicon */
right: 0; right: 0;
padding: 1em 6px 6px 12px; padding: 1em 6px 6px 12px;
background: white;
color: #333; color: #333;
margin: 0; margin: 0;
-moz-margin-start: 0; -moz-margin-start: 0;

10
build/docs/Vagrantfile vendored Normal file
View File

@ -0,0 +1,10 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# We intentionally use the old config format because Mozilla's Jenkins
# server doesn't run a modern Vagrant.
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.share_folder("gecko", "/gecko", "../..")
end

View File

@ -757,7 +757,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
for (uint32_t i = 0; i < mListeners.Length(); ++i) { for (uint32_t i = 0; i < mListeners.Length(); ++i) {
// Remove mListeners[i] if it's an expired weak listener. // Remove mListeners[i] if it's an expired weak listener.
nsCOMPtr<nsIMessageListener> weakListener; nsCOMPtr<nsISupports> weakListener;
if (mListeners[i].mWeakListener) { if (mListeners[i].mWeakListener) {
weakListener = do_QueryReferent(mListeners[i].mWeakListener); weakListener = do_QueryReferent(mListeners[i].mWeakListener);
if (!weakListener) { if (!weakListener) {

View File

@ -2538,6 +2538,23 @@ nsDOMWindowUtils::GetOuterWindowWithId(uint64_t aWindowID,
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsDOMWindowUtils::GetContainerElement(nsIDOMElement** aResult)
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
nsCOMPtr<nsIDOMElement> element =
do_QueryInterface(window->GetFrameElementInternal());
element.forget(aResult);
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsDOMWindowUtils::WrapDOMFile(nsIFile *aFile, nsDOMWindowUtils::WrapDOMFile(nsIFile *aFile,
nsIDOMFile **aDOMFile) nsIDOMFile **aDOMFile)

View File

@ -1378,19 +1378,12 @@ InitIds(JSContext* cx, const Prefable<Spec>* prefableSpecs, jsid* ids)
bool bool
QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp); QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp);
template <class T, bool isISupports=IsBaseOf<nsISupports, T>::value> template <class T>
struct struct
WantsQueryInterface WantsQueryInterface
{ {
static bool Enabled(JSContext* aCx, JSObject* aGlobal) static_assert(IsBaseOf<nsISupports, T>::value,
{ "QueryInterface can't work without an nsISupports.");
return false;
}
};
template <class T>
struct
WantsQueryInterface<T, true>
{
static bool Enabled(JSContext* aCx, JSObject* aGlobal) static bool Enabled(JSContext* aCx, JSObject* aGlobal)
{ {
return NS_IsMainThread() && IsChromeOrXBL(aCx, aGlobal); return NS_IsMainThread() && IsChromeOrXBL(aCx, aGlobal);

View File

@ -30,8 +30,6 @@
# true for workers, false otherwise). # true for workers, false otherwise).
# * customFinalize - The native class will use a custom finalize hook # * customFinalize - The native class will use a custom finalize hook
# (defaults to true for workers, false otherwise). # (defaults to true for workers, false otherwise).
# * wantsQI - Indicates whether the interface should have a QueryInterface
# method available to chrome.
# * notflattened - The native type does not have nsIClassInfo, so when # * notflattened - The native type does not have nsIClassInfo, so when
# wrapping it the right IID needs to be passed in. # wrapping it the right IID needs to be passed in.
# * register - True if this binding should be registered. Defaults to true. # * register - True if this binding should be registered. Defaults to true.
@ -318,7 +316,6 @@ DOMInterfaces = {
}, },
'DOMException': { 'DOMException': {
'wantsQI': False,
'binaryNames': { 'binaryNames': {
'message': 'messageMoz', 'message': 'messageMoz',
}, },
@ -395,7 +392,6 @@ DOMInterfaces = {
'Exception': { 'Exception': {
'headerFile': 'mozilla/dom/DOMException.h', 'headerFile': 'mozilla/dom/DOMException.h',
'wantsQI': False,
'binaryNames': { 'binaryNames': {
'message': 'messageMoz', 'message': 'messageMoz',
}, },
@ -660,7 +656,6 @@ DOMInterfaces = {
'ImageData': [ 'ImageData': [
{ {
'wrapperCache': False, 'wrapperCache': False,
'wantsQI': False,
}], }],
'InputStream': [ 'InputStream': [

View File

@ -1462,6 +1462,41 @@ class MethodDefiner(PropertyDefiner):
self.chrome = [] self.chrome = []
self.regular = [] self.regular = []
for m in methods: for m in methods:
if m.identifier.name == 'queryInterface':
if self.descriptor.workers:
continue
if m.isStatic():
raise TypeError("Legacy queryInterface member shouldn't be static")
signatures = m.signatures()
def argTypeIsIID(arg):
return arg.type.inner.isExternal() and arg.type.inner.identifier.name == 'IID'
if len(signatures) > 1 or len(signatures[0][1]) > 1 or not argTypeIsIID(signatures[0][1][0]):
raise TypeError("There should be only one queryInterface method with 1 argument of type IID")
# Make sure to not stick QueryInterface on abstract interfaces that
# have hasXPConnectImpls (like EventTarget). So only put it on
# interfaces that are concrete and all of whose ancestors are abstract.
def allAncestorsAbstract(iface):
if not iface.parent:
return True
desc = self.descriptor.getDescriptor(iface.parent.identifier.name)
if desc.concrete:
return False
return allAncestorsAbstract(iface.parent)
if (not self.descriptor.interface.hasInterfacePrototypeObject() or
not self.descriptor.concrete or
not allAncestorsAbstract(self.descriptor.interface)):
raise TypeError("QueryInterface is only supported on "
"interfaces that are concrete and all "
"of whose ancestors are abstract: " +
self.descriptor.name)
condition = "WantsQueryInterface<%s>::Enabled" % descriptor.nativeType
self.regular.append({"name": 'QueryInterface',
"methodInfo": False,
"length": 1,
"flags": "0",
"condition": MemberCondition(None, condition) })
continue
method = { "name": m.identifier.name, method = { "name": m.identifier.name,
"methodInfo": not m.isStatic(), "methodInfo": not m.isStatic(),
"length": methodLength(m), "length": methodLength(m),
@ -1481,14 +1516,6 @@ class MethodDefiner(PropertyDefiner):
"flags": "JSPROP_ENUMERATE", "flags": "JSPROP_ENUMERATE",
"condition": MemberCondition(None, None) }) "condition": MemberCondition(None, None) })
if not static and descriptor.wantsQI():
condition = "WantsQueryInterface<%s>::Enabled" % descriptor.nativeType
self.regular.append({"name": 'QueryInterface',
"methodInfo": False,
"length": 1,
"flags": "0",
"condition": MemberCondition(None, condition) })
if not static: if not static:
stringifier = descriptor.operations['Stringifier'] stringifier = descriptor.operations['Stringifier']
if stringifier: if stringifier:
@ -7860,6 +7887,8 @@ class CGDescriptor(CGThing):
cgThings.append(CGClassConstructor(descriptor, n, cgThings.append(CGClassConstructor(descriptor, n,
NamedConstructorName(n))) NamedConstructorName(n)))
for m in descriptor.interface.members: for m in descriptor.interface.members:
if m.isMethod() and m.identifier.name == 'queryInterface':
continue
if (m.isMethod() and m == descriptor.operations['Jsonifier']): if (m.isMethod() and m == descriptor.operations['Jsonifier']):
hasJsonifier = True hasJsonifier = True
hasMethod = True hasMethod = True

View File

@ -356,8 +356,6 @@ class Descriptor(DescriptorProvider):
(self.interface.identifier.name, self.nativeOwnership)) (self.interface.identifier.name, self.nativeOwnership))
self.customTrace = desc.get('customTrace', self.workers) self.customTrace = desc.get('customTrace', self.workers)
self.customFinalize = desc.get('customFinalize', self.workers) self.customFinalize = desc.get('customFinalize', self.workers)
if desc.get('wantsQI', None) != None:
self._wantsQI = desc.get('wantsQI', None)
self.wrapperCache = (not self.interface.isCallback() and self.wrapperCache = (not self.interface.isCallback() and
(self.nativeOwnership == 'worker' or (self.nativeOwnership == 'worker' or
(self.nativeOwnership != 'owned' and (self.nativeOwnership != 'owned' and
@ -477,26 +475,6 @@ class Descriptor(DescriptorProvider):
any((m.isAttr() or m.isMethod()) and m.isStatic() for m any((m.isAttr() or m.isMethod()) and m.isStatic() for m
in self.interface.members)) in self.interface.members))
def wantsQI(self):
# If it was specified explicitly use that.
if hasattr(self, '_wantsQI'):
return self._wantsQI
# Make sure to not stick QueryInterface on abstract interfaces that
# have hasXPConnectImpls (like EventTarget). So only put it on
# interfaces that are concrete and all of whose ancestors are abstract.
def allAncestorsAbstract(iface):
if not iface.parent:
return True
desc = self.getDescriptor(iface.parent.identifier.name)
if desc.concrete:
return False
return allAncestorsAbstract(iface.parent)
return (not self.workers and
self.interface.hasInterfacePrototypeObject() and
self.concrete and
allAncestorsAbstract(self.interface))
# Some utility methods # Some utility methods
def getTypesFromDescriptor(descriptor): def getTypesFromDescriptor(descriptor):
""" """

View File

@ -0,0 +1,6 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
MOCHITEST_FILES := \
test_historical.html.json \
test_interfaces.html.json \
$(NULL)

View File

@ -0,0 +1,5 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
MOCHITEST_FILES := \
test_HTMLCollection-empty-name.html.json \
$(NULL)

View File

@ -0,0 +1,9 @@
{
"Empty string as a name for Document.getElementsByTagName": true,
"Empty string as a name for Element.getElementsByTagName": true,
"Empty string as a name for Document.getElementsByTagNameNS": true,
"Empty string as a name for Element.getElementsByTagNameNS": true,
"Empty string as a name for Document.getElementsByClassName": true,
"Empty string as a name for Element.getElementsByClassName": true,
"Empty string as a name for Element.children": true
}

View File

@ -1,5 +1,5 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT # THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
MOCHITEST_FILES := \ MOCHITEST_FILES := \
test_document-dir.html.json \ test_exceptions.html.json \
$(NULL) $(NULL)

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [
]

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [
]

View File

@ -0,0 +1,14 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
MOCHITEST_FILES := \
test_Document-createElement-namespace.html.json \
test_Document-createElementNS.html.json \
test_Document-createEvent.html.json \
test_Document-getElementsByTagName.html.json \
test_Node-isEqualNode.xhtml.json \
test_Node-properties.html.json \
test_attributes.html.json \
test_case.html.json \
test_getElementsByClassName-10.xml.json \
test_getElementsByClassName-11.xml.json \
$(NULL)

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [
]

View File

@ -0,0 +1,12 @@
{
"Created element's namespace in empty.xml": true,
"Created element's namespace in xhtml.xml": true,
"Created element's namespace in svg.xml": true,
"Created element's namespace in mathml.xml": true,
"Created element's namespace in minimal_html.xml": true,
"Created element's namespace in xhtml_ns_removed.xml": true,
"Created element's namespace in xhtml_ns_changed.xml": true,
"Created element's namespace in bare_xhtml.xml": true,
"Created element's namespace in bare_svg.xml": true,
"Created element's namespace in bare_mathml.xml": true
}

View File

@ -0,0 +1,26 @@
{
"createEvent('CustomEvent') should be initialized correctly.": true,
"createEvent('customevent') should be initialized correctly.": true,
"createEvent('CUSTOMEVENT') should be initialized correctly.": true,
"createEvent('Event') should be initialized correctly.": true,
"createEvent('event') should be initialized correctly.": true,
"createEvent('EVENT') should be initialized correctly.": true,
"createEvent('Events') should be initialized correctly.": true,
"createEvent('events') should be initialized correctly.": true,
"createEvent('EVENTS') should be initialized correctly.": true,
"createEvent('HTMLEvents') should be initialized correctly.": true,
"createEvent('htmlevents') should be initialized correctly.": true,
"createEvent('HTMLEVENTS') should be initialized correctly.": true,
"createEvent('MouseEvent') should be initialized correctly.": true,
"createEvent('mouseevent') should be initialized correctly.": true,
"createEvent('MOUSEEVENT') should be initialized correctly.": true,
"createEvent('MouseEvents') should be initialized correctly.": true,
"createEvent('mouseevents') should be initialized correctly.": true,
"createEvent('MOUSEEVENTS') should be initialized correctly.": true,
"createEvent('UIEvent') should be initialized correctly.": true,
"createEvent('uievent') should be initialized correctly.": true,
"createEvent('UIEVENT') should be initialized correctly.": true,
"createEvent('UIEvents') should be initialized correctly.": true,
"createEvent('uievents') should be initialized correctly.": true,
"createEvent('UIEVENTS') should be initialized correctly.": true
}

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [
]

View File

@ -1,34 +1,6 @@
{ {
"DOMException exception: existence and properties of exception interface object": true,
"DOMException exception: existence and properties of exception interface prototype object": true, "DOMException exception: existence and properties of exception interface prototype object": true,
"DOMException exception: existence and properties of exception interface prototype object's \"name\" property": true, "DOMException exception: existence and properties of exception interface prototype object's \"name\" property": true,
"DOMException exception: existence and properties of exception interface prototype object's \"constructor\" property": true,
"DOMException exception: constant INDEX_SIZE_ERR on exception interface prototype object": true,
"DOMException exception: constant DOMSTRING_SIZE_ERR on exception interface prototype object": true,
"DOMException exception: constant HIERARCHY_REQUEST_ERR on exception interface prototype object": true,
"DOMException exception: constant WRONG_DOCUMENT_ERR on exception interface prototype object": true,
"DOMException exception: constant INVALID_CHARACTER_ERR on exception interface prototype object": true,
"DOMException exception: constant NO_DATA_ALLOWED_ERR on exception interface prototype object": true,
"DOMException exception: constant NO_MODIFICATION_ALLOWED_ERR on exception interface prototype object": true,
"DOMException exception: constant NOT_FOUND_ERR on exception interface prototype object": true,
"DOMException exception: constant NOT_SUPPORTED_ERR on exception interface prototype object": true,
"DOMException exception: constant INUSE_ATTRIBUTE_ERR on exception interface prototype object": true,
"DOMException exception: constant INVALID_STATE_ERR on exception interface prototype object": true,
"DOMException exception: constant SYNTAX_ERR on exception interface prototype object": true,
"DOMException exception: constant INVALID_MODIFICATION_ERR on exception interface prototype object": true,
"DOMException exception: constant NAMESPACE_ERR on exception interface prototype object": true,
"DOMException exception: constant INVALID_ACCESS_ERR on exception interface prototype object": true,
"DOMException exception: constant VALIDATION_ERR on exception interface prototype object": true,
"DOMException exception: constant TYPE_MISMATCH_ERR on exception interface prototype object": true,
"DOMException exception: constant SECURITY_ERR on exception interface prototype object": true,
"DOMException exception: constant NETWORK_ERR on exception interface prototype object": true,
"DOMException exception: constant ABORT_ERR on exception interface prototype object": true,
"DOMException exception: constant URL_MISMATCH_ERR on exception interface prototype object": true,
"DOMException exception: constant QUOTA_EXCEEDED_ERR on exception interface prototype object": true,
"DOMException exception: constant TIMEOUT_ERR on exception interface prototype object": true,
"DOMException exception: constant INVALID_NODE_TYPE_ERR on exception interface prototype object": true,
"DOMException exception: constant DATA_CLONE_ERR on exception interface prototype object": true,
"DOMException exception: field code on exception interface prototype object": true,
"Event interface: document.createEvent(\"Event\") must have own property \"isTrusted\"": true, "Event interface: document.createEvent(\"Event\") must have own property \"isTrusted\"": true,
"Event interface: document.createEvent(\"Event\") must inherit property \"timeStamp\" with the proper type (15)": true, "Event interface: document.createEvent(\"Event\") must inherit property \"timeStamp\" with the proper type (15)": true,
"Event interface: new Event(\"foo\") must have own property \"isTrusted\"": true, "Event interface: new Event(\"foo\") must have own property \"isTrusted\"": true,
@ -36,48 +8,39 @@
"CustomEvent interface: existence and properties of interface object": true, "CustomEvent interface: existence and properties of interface object": true,
"Event interface: new CustomEvent(\"foo\") must have own property \"isTrusted\"": true, "Event interface: new CustomEvent(\"foo\") must have own property \"isTrusted\"": true,
"Event interface: new CustomEvent(\"foo\") must inherit property \"timeStamp\" with the proper type (15)": true, "Event interface: new CustomEvent(\"foo\") must inherit property \"timeStamp\" with the proper type (15)": true,
"EventListener interface: existence and properties of interface prototype object": true,
"EventListener interface: existence and properties of interface prototype object's \"constructor\" property": true,
"EventListener interface: operation handleEvent(Event)": true,
"MutationObserver interface: operation observe(Node,MutationObserverInit)": true, "MutationObserver interface: operation observe(Node,MutationObserverInit)": true,
"Document interface: attribute children": true, "Node interface: existence and properties of interface object": true,
"Document interface: attribute firstElementChild": true, "Document interface: existence and properties of interface object": true,
"Document interface: attribute lastElementChild": true,
"Document interface: attribute childElementCount": true,
"Document interface: operation prepend(union)": true, "Document interface: operation prepend(union)": true,
"Document interface: operation append(union)": true, "Document interface: operation append(union)": true,
"Document interface: xmlDoc must inherit property \"children\" with the proper type (24)": true, "XMLDocument interface: existence and properties of interface object": true,
"Document interface: xmlDoc must inherit property \"firstElementChild\" with the proper type (25)": true,
"Document interface: xmlDoc must inherit property \"lastElementChild\" with the proper type (26)": true,
"Document interface: xmlDoc must inherit property \"childElementCount\" with the proper type (27)": true,
"Document interface: xmlDoc must inherit property \"prepend\" with the proper type (28)": true, "Document interface: xmlDoc must inherit property \"prepend\" with the proper type (28)": true,
"Document interface: calling prepend(union) on xmlDoc with too few arguments must throw TypeError": true, "Document interface: calling prepend(union) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: xmlDoc must inherit property \"append\" with the proper type (29)": true, "Document interface: xmlDoc must inherit property \"append\" with the proper type (29)": true,
"Document interface: calling append(union) on xmlDoc with too few arguments must throw TypeError": true, "Document interface: calling append(union) on xmlDoc with too few arguments must throw TypeError": true,
"DocumentFragment interface: attribute children": true, "DOMImplementation interface: operation createDocument(DOMString,DOMString,DocumentType)": true,
"DocumentFragment interface: attribute firstElementChild": true, "DOMImplementation interface: calling createDocument(DOMString,DOMString,DocumentType) on document.implementation with too few arguments must throw TypeError": true,
"DocumentFragment interface: attribute lastElementChild": true, "DocumentFragment interface: existence and properties of interface object": true,
"DocumentFragment interface: attribute childElementCount": true,
"DocumentFragment interface: operation prepend(union)": true, "DocumentFragment interface: operation prepend(union)": true,
"DocumentFragment interface: operation append(union)": true, "DocumentFragment interface: operation append(union)": true,
"DocumentFragment interface: document.createDocumentFragment() must inherit property \"children\" with the proper type (0)": true,
"DocumentFragment interface: document.createDocumentFragment() must inherit property \"firstElementChild\" with the proper type (1)": true,
"DocumentFragment interface: document.createDocumentFragment() must inherit property \"lastElementChild\" with the proper type (2)": true,
"DocumentFragment interface: document.createDocumentFragment() must inherit property \"childElementCount\" with the proper type (3)": true,
"DocumentFragment interface: document.createDocumentFragment() must inherit property \"prepend\" with the proper type (4)": true, "DocumentFragment interface: document.createDocumentFragment() must inherit property \"prepend\" with the proper type (4)": true,
"DocumentFragment interface: calling prepend(union) on document.createDocumentFragment() with too few arguments must throw TypeError": true, "DocumentFragment interface: calling prepend(union) on document.createDocumentFragment() with too few arguments must throw TypeError": true,
"DocumentFragment interface: document.createDocumentFragment() must inherit property \"append\" with the proper type (5)": true, "DocumentFragment interface: document.createDocumentFragment() must inherit property \"append\" with the proper type (5)": true,
"DocumentFragment interface: calling append(union) on document.createDocumentFragment() with too few arguments must throw TypeError": true, "DocumentFragment interface: calling append(union) on document.createDocumentFragment() with too few arguments must throw TypeError": true,
"DocumentType interface: attribute previousElementSibling": true, "DocumentType interface: existence and properties of interface object": true,
"DocumentType interface: attribute nextElementSibling": true,
"DocumentType interface: operation before(union)": true, "DocumentType interface: operation before(union)": true,
"DocumentType interface: operation after(union)": true, "DocumentType interface: operation after(union)": true,
"DocumentType interface: operation replace(union)": true, "DocumentType interface: operation replace(union)": true,
"DocumentType interface: document.doctype must inherit property \"previousElementSibling\" with the proper type (3)": true,
"DocumentType interface: document.doctype must inherit property \"nextElementSibling\" with the proper type (4)": true,
"DocumentType interface: document.doctype must inherit property \"before\" with the proper type (5)": true, "DocumentType interface: document.doctype must inherit property \"before\" with the proper type (5)": true,
"DocumentType interface: calling before(union) on document.doctype with too few arguments must throw TypeError": true, "DocumentType interface: calling before(union) on document.doctype with too few arguments must throw TypeError": true,
"DocumentType interface: document.doctype must inherit property \"after\" with the proper type (6)": true, "DocumentType interface: document.doctype must inherit property \"after\" with the proper type (6)": true,
"DocumentType interface: calling after(union) on document.doctype with too few arguments must throw TypeError": true, "DocumentType interface: calling after(union) on document.doctype with too few arguments must throw TypeError": true,
"DocumentType interface: document.doctype must inherit property \"replace\" with the proper type (7)": true, "DocumentType interface: document.doctype must inherit property \"replace\" with the proper type (7)": true,
"DocumentType interface: calling replace(union) on document.doctype with too few arguments must throw TypeError": true, "DocumentType interface: calling replace(union) on document.doctype with too few arguments must throw TypeError": true,
"Element interface: existence and properties of interface object": true,
"Element interface: attribute namespaceURI": true, "Element interface: attribute namespaceURI": true,
"Element interface: attribute prefix": true, "Element interface: attribute prefix": true,
"Element interface: attribute localName": true, "Element interface: attribute localName": true,
@ -98,48 +61,38 @@
"Element interface: calling after(union) on element with too few arguments must throw TypeError": true, "Element interface: calling after(union) on element with too few arguments must throw TypeError": true,
"Element interface: element must inherit property \"replace\" with the proper type (29)": true, "Element interface: element must inherit property \"replace\" with the proper type (29)": true,
"Element interface: calling replace(union) on element with too few arguments must throw TypeError": true, "Element interface: calling replace(union) on element with too few arguments must throw TypeError": true,
"Attr interface: existence and properties of interface object": true,
"Attr interface: existence and properties of interface prototype object": true, "Attr interface: existence and properties of interface prototype object": true,
"CharacterData interface: attribute previousElementSibling": true, "CharacterData interface: existence and properties of interface object": true,
"CharacterData interface: attribute nextElementSibling": true,
"CharacterData interface: operation before(union)": true, "CharacterData interface: operation before(union)": true,
"CharacterData interface: operation after(union)": true, "CharacterData interface: operation after(union)": true,
"CharacterData interface: operation replace(union)": true, "CharacterData interface: operation replace(union)": true,
"CharacterData interface: document.createTextNode(\"abc\") must inherit property \"previousElementSibling\" with the proper type (7)": true, "Text interface: existence and properties of interface object": true,
"CharacterData interface: document.createTextNode(\"abc\") must inherit property \"nextElementSibling\" with the proper type (8)": true,
"CharacterData interface: document.createTextNode(\"abc\") must inherit property \"before\" with the proper type (9)": true, "CharacterData interface: document.createTextNode(\"abc\") must inherit property \"before\" with the proper type (9)": true,
"CharacterData interface: calling before(union) on document.createTextNode(\"abc\") with too few arguments must throw TypeError": true, "CharacterData interface: calling before(union) on document.createTextNode(\"abc\") with too few arguments must throw TypeError": true,
"CharacterData interface: document.createTextNode(\"abc\") must inherit property \"after\" with the proper type (10)": true, "CharacterData interface: document.createTextNode(\"abc\") must inherit property \"after\" with the proper type (10)": true,
"CharacterData interface: calling after(union) on document.createTextNode(\"abc\") with too few arguments must throw TypeError": true, "CharacterData interface: calling after(union) on document.createTextNode(\"abc\") with too few arguments must throw TypeError": true,
"CharacterData interface: document.createTextNode(\"abc\") must inherit property \"replace\" with the proper type (11)": true, "CharacterData interface: document.createTextNode(\"abc\") must inherit property \"replace\" with the proper type (11)": true,
"CharacterData interface: calling replace(union) on document.createTextNode(\"abc\") with too few arguments must throw TypeError": true, "CharacterData interface: calling replace(union) on document.createTextNode(\"abc\") with too few arguments must throw TypeError": true,
"CharacterData interface: xmlDoc.createProcessingInstruction(\"abc\", \"def\") must inherit property \"previousElementSibling\" with the proper type (7)": true, "ProcessingInstruction interface: existence and properties of interface object": true,
"CharacterData interface: xmlDoc.createProcessingInstruction(\"abc\", \"def\") must inherit property \"nextElementSibling\" with the proper type (8)": true,
"CharacterData interface: xmlDoc.createProcessingInstruction(\"abc\", \"def\") must inherit property \"before\" with the proper type (9)": true, "CharacterData interface: xmlDoc.createProcessingInstruction(\"abc\", \"def\") must inherit property \"before\" with the proper type (9)": true,
"CharacterData interface: calling before(union) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true, "CharacterData interface: calling before(union) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"CharacterData interface: xmlDoc.createProcessingInstruction(\"abc\", \"def\") must inherit property \"after\" with the proper type (10)": true, "CharacterData interface: xmlDoc.createProcessingInstruction(\"abc\", \"def\") must inherit property \"after\" with the proper type (10)": true,
"CharacterData interface: calling after(union) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true, "CharacterData interface: calling after(union) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"CharacterData interface: xmlDoc.createProcessingInstruction(\"abc\", \"def\") must inherit property \"replace\" with the proper type (11)": true, "CharacterData interface: xmlDoc.createProcessingInstruction(\"abc\", \"def\") must inherit property \"replace\" with the proper type (11)": true,
"CharacterData interface: calling replace(union) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true, "CharacterData interface: calling replace(union) on xmlDoc.createProcessingInstruction(\"abc\", \"def\") with too few arguments must throw TypeError": true,
"CharacterData interface: document.createComment(\"abc\") must inherit property \"previousElementSibling\" with the proper type (7)": true, "Comment interface: existence and properties of interface object": true,
"CharacterData interface: document.createComment(\"abc\") must inherit property \"nextElementSibling\" with the proper type (8)": true,
"CharacterData interface: document.createComment(\"abc\") must inherit property \"before\" with the proper type (9)": true, "CharacterData interface: document.createComment(\"abc\") must inherit property \"before\" with the proper type (9)": true,
"CharacterData interface: calling before(union) on document.createComment(\"abc\") with too few arguments must throw TypeError": true, "CharacterData interface: calling before(union) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"CharacterData interface: document.createComment(\"abc\") must inherit property \"after\" with the proper type (10)": true, "CharacterData interface: document.createComment(\"abc\") must inherit property \"after\" with the proper type (10)": true,
"CharacterData interface: calling after(union) on document.createComment(\"abc\") with too few arguments must throw TypeError": true, "CharacterData interface: calling after(union) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"CharacterData interface: document.createComment(\"abc\") must inherit property \"replace\" with the proper type (11)": true, "CharacterData interface: document.createComment(\"abc\") must inherit property \"replace\" with the proper type (11)": true,
"CharacterData interface: calling replace(union) on document.createComment(\"abc\") with too few arguments must throw TypeError": true, "CharacterData interface: calling replace(union) on document.createComment(\"abc\") with too few arguments must throw TypeError": true,
"Node interface: existence and properties of interface object": true,
"Document interface: existence and properties of interface object": true,
"XMLDocument interface: existence and properties of interface object": true,
"DocumentFragment interface: existence and properties of interface object": true,
"DocumentType interface: existence and properties of interface object": true,
"Element interface: existence and properties of interface object": true,
"Attr interface: existence and properties of interface object": true,
"CharacterData interface: existence and properties of interface object": true,
"Text interface: existence and properties of interface object": true,
"ProcessingInstruction interface: existence and properties of interface object": true,
"Comment interface: existence and properties of interface object": true,
"DOMSettableTokenList interface: existence and properties of interface object": true,
"NodeFilter interface: existence and properties of interface object": true, "NodeFilter interface: existence and properties of interface object": true,
"NodeList interface: existence and properties of interface prototype object": true "NodeList interface: existence and properties of interface prototype object": true,
"DOMTokenList interface: operation add(DOMString)": true,
"DOMTokenList interface: operation remove(DOMString)": true,
"DOMTokenList interface: calling add(DOMString) on document.body.classList with too few arguments must throw TypeError": true,
"DOMTokenList interface: calling remove(DOMString) on document.body.classList with too few arguments must throw TypeError": true,
"DOMSettableTokenList interface: existence and properties of interface object": true
} }

View File

@ -1,3 +0,0 @@
{
"Setting the idl attribute to the empty sting": true
}

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [
]

View File

@ -1,18 +0,0 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
MOCHITEST_FILES := \
test_Node-properties.html.json \
test_Range-cloneContents.html.json \
test_Range-cloneRange.html.json \
test_Range-collapse.html.json \
test_Range-commonAncestorContainer.html.json \
test_Range-compareBoundaryPoints.html.json \
test_Range-comparePoint.html.json \
test_Range-deleteContents.html.json \
test_Range-extractContents.html.json \
test_Range-intersectsNode.html.json \
test_Range-isPointInRange.html.json \
test_Range-set.html.json \
test_exceptions.html.json \
test_interfaces.html.json \
$(NULL)

View File

@ -1,5 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [
]

View File

@ -1,12 +0,0 @@
{
"paras[0].firstChild.splitText(1), with unselected range on paras[0] from 0 to 1": true,
"paras[0].firstChild.splitText(1), with selected range on paras[0] from 0 to 1": true,
"paras[0].firstChild.splitText(1), with unselected range collapsed at (paras[0], 1)": true,
"paras[0].firstChild.splitText(1), with selected range collapsed at (paras[0], 1)": true,
"paras[0].firstChild.splitText(1), with unselected range from (paras[0].firstChild, 1) to (paras[0], 1)": true,
"paras[0].firstChild.splitText(1), with selected range from (paras[0].firstChild, 1) to (paras[0], 1)": true,
"paras[0].firstChild.splitText(2), with unselected range from (paras[0].firstChild, 1) to (paras[0], 1)": true,
"paras[0].firstChild.splitText(2), with selected range from (paras[0].firstChild, 1) to (paras[0], 1)": true,
"paras[0].firstChild.splitText(3), with unselected range from (paras[0].firstChild, 1) to (paras[0], 1)": true,
"paras[0].firstChild.splitText(3), with selected range from (paras[0].firstChild, 1) to (paras[0], 1)": true
}

View File

@ -1,10 +0,0 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
MOCHITEST_FILES := \
test_Document-createElementNS.html.json \
test_Document-getElementsByTagName.html.json \
test_Node-isEqualNode.xhtml.json \
test_attributes.html.json \
test_case.html.json \
test_historical.html.json \
$(NULL)

View File

@ -1,5 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [
]

View File

@ -1,5 +0,0 @@
{
"createDocument test 91: null,null,DocumentType node,\"WRONG_DOCUMENT_ERR\"": true,
"createDocument test 92: null,null,DocumentType node,\"WRONG_DOCUMENT_ERR\"": true,
"createDocument test 94: null,null,DocumentType node,\"WRONG_DOCUMENT_ERR\"": true
}

View File

@ -1,3 +0,0 @@
{
"If the context node is not a node that can contain children, a NotFoundError exception should be thrown": true
}

View File

@ -1,4 +0,0 @@
{
"Constants for acceptNode on NodeFilter prototype object.": true,
"Constants for whatToShow on NodeFilter prototype object.": true
}

View File

@ -1,5 +0,0 @@
{
"Range.intersectsNode": true,
"Range.intersectsNode 1": true,
"Range.intersectsNode 2": true
}

View File

@ -1,6 +0,0 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
MOCHITEST_FILES := \
test_getElementsByClassName-10.xml.json \
test_getElementsByClassName-11.xml.json \
$(NULL)

View File

@ -1,5 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [
]

View File

@ -1,6 +1,15 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT # THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
DIRS += [ DIRS += [
'html/dom',
'html/dom/collections',
'html/dom/errors',
'html/dom/events',
'html/dom/nodes',
'html/dom/nodes/Document-createElement-namespace-tests',
'html/dom/ranges',
'html/dom/traversal',
'html/dom/traversal/unfinished',
'html/domxpath', 'html/domxpath',
'html/html/browsers/browsing-the-web/read-media', 'html/html/browsers/browsing-the-web/read-media',
'html/html/browsers/the-window-object', 'html/html/browsers/the-window-object',
@ -22,7 +31,7 @@ DIRS += [
'html/html/webappapis/scripting/processing-model-2', 'html/html/webappapis/scripting/processing-model-2',
'html/html/webappapis/timers', 'html/html/webappapis/timers',
'html/js/builtins', 'html/js/builtins',
'html/old-tests/submission/Opera/microdata', 'html/microdata/microdata-dom-api',
'html/typedarrays', 'html/typedarrays',
'html/webgl', 'html/webgl',
] ]

View File

@ -1,4 +1,5 @@
git|git://github.com/w3c/web-platform-tests.git|html git|git://github.com/w3c/web-platform-tests.git|html
dom
domxpath domxpath
html/browsers/browsing-the-web/read-media html/browsers/browsing-the-web/read-media
html/browsers/the-window-object html/browsers/the-window-object
@ -18,6 +19,6 @@ html/webappapis/scripting/events
html/webappapis/scripting/processing-model-2 html/webappapis/scripting/processing-model-2
html/webappapis/timers html/webappapis/timers
js/builtins js/builtins
old-tests/submission/Opera/microdata microdata/microdata-dom-api
typedarrays typedarrays
webgl webgl

View File

@ -0,0 +1,9 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
MOCHITEST_FILES := \
test_historical.html \
test_interface-objects.html \
test_interfaces.html \
common.js \
constants.js \
$(NULL)

View File

@ -0,0 +1,5 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
MOCHITEST_FILES := \
test_HTMLCollection-empty-name.html \
$(NULL)

View File

@ -0,0 +1,65 @@
<!doctype html>
<meta charset=utf-8>
<title>HTMLCollection and empty names</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<div id=test>
<div class=a id></div>
<div class=a name></div>
<a class=a name></a>
</div>
<script>
test(function() {
var c = document.getElementsByTagName("*");
assert_false("" in c, "Empty string should not be in the collection.");
assert_equals(c[""], undefined, "Named getter should return undefined for empty string.");
assert_equals(c.namedItem(""), null, "namedItem should return null for empty string.");
}, "Empty string as a name for Document.getElementsByTagName");
test(function() {
var div = document.getElementById("test");
var c = div.getElementsByTagName("*");
assert_false("" in c, "Empty string should not be in the collection.");
assert_equals(c[""], undefined, "Named getter should return undefined for empty string.");
assert_equals(c.namedItem(""), null, "namedItem should return null for empty string.");
}, "Empty string as a name for Element.getElementsByTagName");
test(function() {
var c = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "a");
assert_false("" in c, "Empty string should not be in the collection.");
assert_equals(c[""], undefined, "Named getter should return undefined for empty string.");
assert_equals(c.namedItem(""), null, "namedItem should return null for empty string.");
}, "Empty string as a name for Document.getElementsByTagNameNS");
test(function() {
var div = document.getElementById("test");
var c = div.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "a");
assert_false("" in c, "Empty string should not be in the collection.");
assert_equals(c[""], undefined, "Named getter should return undefined for empty string.");
assert_equals(c.namedItem(""), null, "namedItem should return null for empty string.");
}, "Empty string as a name for Element.getElementsByTagNameNS");
test(function() {
var c = document.getElementsByClassName("a");
assert_false("" in c, "Empty string should not be in the collection.");
assert_equals(c[""], undefined, "Named getter should return undefined for empty string.");
assert_equals(c.namedItem(""), null, "namedItem should return null for empty string.");
}, "Empty string as a name for Document.getElementsByClassName");
test(function() {
var div = document.getElementById("test");
var c = div.getElementsByClassName("a");
assert_false("" in c, "Empty string should not be in the collection.");
assert_equals(c[""], undefined, "Named getter should return undefined for empty string.");
assert_equals(c.namedItem(""), null, "namedItem should return null for empty string.");
}, "Empty string as a name for Element.getElementsByClassName");
test(function() {
var div = document.getElementById("test");
var c = div.children;
assert_false("" in c, "Empty string should not be in the collection.");
assert_equals(c[""], undefined, "Named getter should return undefined for empty string.");
assert_equals(c.namedItem(""), null, "namedItem should return null for empty string.");
}, "Empty string as a name for Element.children");
</script>

View File

@ -14,7 +14,7 @@ var testDiv, paras, detachedDiv, detachedPara1, detachedPara2,
detachedComment, foreignComment, detachedForeignComment, xmlComment, detachedComment, foreignComment, detachedForeignComment, xmlComment,
detachedXmlComment, docfrag, foreignDocfrag, xmlDocfrag, doctype, detachedXmlComment, docfrag, foreignDocfrag, xmlDocfrag, doctype,
foreignDoctype, xmlDoctype; foreignDoctype, xmlDoctype;
var testRanges, testPoints, testNodes; var testRangesShort, testRanges, testPoints, testNodesShort, testNodes;
function setupRangeTests() { function setupRangeTests() {
selection = getSelection(); selection = getSelection();
@ -121,7 +121,7 @@ function setupRangeTests() {
doctype = document.doctype; doctype = document.doctype;
foreignDoctype = foreignDoc.doctype; foreignDoctype = foreignDoc.doctype;
testRanges = [ testRangesShort = [
// Various ranges within the text node children of different // Various ranges within the text node children of different
// paragraphs. All should be valid. // paragraphs. All should be valid.
"[paras[0].firstChild, 0, paras[0].firstChild, 0]", "[paras[0].firstChild, 0, paras[0].firstChild, 0]",
@ -129,14 +129,10 @@ function setupRangeTests() {
"[paras[0].firstChild, 2, paras[0].firstChild, 8]", "[paras[0].firstChild, 2, paras[0].firstChild, 8]",
"[paras[0].firstChild, 2, paras[0].firstChild, 9]", "[paras[0].firstChild, 2, paras[0].firstChild, 9]",
"[paras[1].firstChild, 0, paras[1].firstChild, 0]", "[paras[1].firstChild, 0, paras[1].firstChild, 0]",
"[paras[1].firstChild, 0, paras[1].firstChild, 1]",
"[paras[1].firstChild, 2, paras[1].firstChild, 8]",
"[paras[1].firstChild, 2, paras[1].firstChild, 9]", "[paras[1].firstChild, 2, paras[1].firstChild, 9]",
"[detachedPara1.firstChild, 0, detachedPara1.firstChild, 0]", "[detachedPara1.firstChild, 0, detachedPara1.firstChild, 0]",
"[detachedPara1.firstChild, 0, detachedPara1.firstChild, 1]",
"[detachedPara1.firstChild, 2, detachedPara1.firstChild, 8]", "[detachedPara1.firstChild, 2, detachedPara1.firstChild, 8]",
"[foreignPara1.firstChild, 0, foreignPara1.firstChild, 0]", "[foreignPara1.firstChild, 0, foreignPara1.firstChild, 0]",
"[foreignPara1.firstChild, 0, foreignPara1.firstChild, 1]",
"[foreignPara1.firstChild, 2, foreignPara1.firstChild, 8]", "[foreignPara1.firstChild, 2, foreignPara1.firstChild, 8]",
// Now try testing some elements, not just text nodes. // Now try testing some elements, not just text nodes.
"[document.documentElement, 0, document.documentElement, 1]", "[document.documentElement, 0, document.documentElement, 1]",
@ -145,11 +141,7 @@ function setupRangeTests() {
"[document.head, 1, document.head, 1]", "[document.head, 1, document.head, 1]",
"[document.body, 4, document.body, 5]", "[document.body, 4, document.body, 5]",
"[foreignDoc.documentElement, 0, foreignDoc.documentElement, 1]", "[foreignDoc.documentElement, 0, foreignDoc.documentElement, 1]",
"[foreignDoc.head, 1, foreignDoc.head, 1]",
"[foreignDoc.body, 0, foreignDoc.body, 0]",
"[paras[0], 0, paras[0], 0]",
"[paras[0], 0, paras[0], 1]", "[paras[0], 0, paras[0], 1]",
"[detachedPara1, 0, detachedPara1, 0]",
"[detachedPara1, 0, detachedPara1, 1]", "[detachedPara1, 0, detachedPara1, 1]",
// Now try some ranges that span elements. // Now try some ranges that span elements.
"[paras[0].firstChild, 0, paras[1].firstChild, 0]", "[paras[0].firstChild, 0, paras[1].firstChild, 0]",
@ -158,38 +150,47 @@ function setupRangeTests() {
// How about something that spans a node and its descendant? // How about something that spans a node and its descendant?
"[paras[0], 0, paras[0].firstChild, 7]", "[paras[0], 0, paras[0].firstChild, 7]",
"[testDiv, 2, paras[4], 1]", "[testDiv, 2, paras[4], 1]",
"[testDiv, 1, paras[2].firstChild, 5]",
"[document.documentElement, 1, document.body, 0]",
"[foreignDoc.documentElement, 1, foreignDoc.body, 0]",
// Then a few more interesting things just for good measure. // Then a few more interesting things just for good measure.
"[document, 0, document, 1]", "[document, 0, document, 1]",
"[document, 0, document, 2]", "[document, 0, document, 2]",
"[document, 1, document, 2]",
"[comment, 2, comment, 3]", "[comment, 2, comment, 3]",
"[testDiv, 0, comment, 5]", "[testDiv, 0, comment, 5]",
"[foreignDoc, 1, foreignComment, 2]",
"[foreignDoc.body, 0, foreignTextNode, 36]",
"[xmlDoc, 1, xmlComment, 0]",
"[detachedTextNode, 0, detachedTextNode, 8]",
"[detachedForeignTextNode, 0, detachedForeignTextNode, 8]",
"[detachedXmlTextNode, 0, detachedXmlTextNode, 8]",
"[detachedComment, 3, detachedComment, 4]",
"[detachedForeignComment, 0, detachedForeignComment, 1]",
"[detachedXmlComment, 2, detachedXmlComment, 6]",
"[docfrag, 0, docfrag, 0]",
];
testRanges = testRangesShort.concat([
"[paras[1].firstChild, 0, paras[1].firstChild, 1]",
"[paras[1].firstChild, 2, paras[1].firstChild, 8]",
"[detachedPara1.firstChild, 0, detachedPara1.firstChild, 1]",
"[foreignPara1.firstChild, 0, foreignPara1.firstChild, 1]",
"[foreignDoc.head, 1, foreignDoc.head, 1]",
"[foreignDoc.body, 0, foreignDoc.body, 0]",
"[paras[0], 0, paras[0], 0]",
"[detachedPara1, 0, detachedPara1, 0]",
"[testDiv, 1, paras[2].firstChild, 5]",
"[document.documentElement, 1, document.body, 0]",
"[foreignDoc.documentElement, 1, foreignDoc.body, 0]",
"[document, 1, document, 2]",
"[paras[2].firstChild, 4, comment, 2]", "[paras[2].firstChild, 4, comment, 2]",
"[paras[3], 1, comment, 8]", "[paras[3], 1, comment, 8]",
"[foreignDoc, 0, foreignDoc, 0]", "[foreignDoc, 0, foreignDoc, 0]",
"[foreignDoc, 1, foreignComment, 2]",
"[foreignDoc.body, 0, foreignTextNode, 36]",
"[xmlDoc, 0, xmlDoc, 0]", "[xmlDoc, 0, xmlDoc, 0]",
// Opera 11 crashes if you extractContents() a range that ends at offset
// zero in a comment. Comment out this line to run the tests successfully.
"[xmlDoc, 1, xmlComment, 0]",
"[detachedTextNode, 0, detachedTextNode, 8]",
"[detachedForeignTextNode, 7, detachedForeignTextNode, 7]", "[detachedForeignTextNode, 7, detachedForeignTextNode, 7]",
"[detachedForeignTextNode, 0, detachedForeignTextNode, 8]",
"[detachedXmlTextNode, 7, detachedXmlTextNode, 7]", "[detachedXmlTextNode, 7, detachedXmlTextNode, 7]",
"[detachedXmlTextNode, 0, detachedXmlTextNode, 8]",
"[detachedComment, 3, detachedComment, 4]",
"[detachedComment, 5, detachedComment, 5]", "[detachedComment, 5, detachedComment, 5]",
"[detachedForeignComment, 0, detachedForeignComment, 1]",
"[detachedForeignComment, 4, detachedForeignComment, 4]", "[detachedForeignComment, 4, detachedForeignComment, 4]",
"[detachedXmlComment, 2, detachedXmlComment, 6]",
"[docfrag, 0, docfrag, 0]",
"[foreignDocfrag, 0, foreignDocfrag, 0]", "[foreignDocfrag, 0, foreignDocfrag, 0]",
"[xmlDocfrag, 0, xmlDocfrag, 0]", "[xmlDocfrag, 0, xmlDocfrag, 0]",
]; ]);
testPoints = [ testPoints = [
// Various positions within the page, some invalid. Remember that // Various positions within the page, some invalid. Remember that
@ -286,45 +287,48 @@ function setupRangeTests() {
"[xmlDoctype, 0]", "[xmlDoctype, 0]",
]; ];
testNodes = [ testNodesShort = [
"paras[0]", "paras[0]",
"paras[0].firstChild", "paras[0].firstChild",
"paras[1]",
"paras[1].firstChild", "paras[1].firstChild",
"foreignPara1", "foreignPara1",
"foreignPara1.firstChild", "foreignPara1.firstChild",
"detachedPara1", "detachedPara1",
"detachedPara1.firstChild", "detachedPara1.firstChild",
"detachedPara2",
"detachedPara2.firstChild",
"testDiv",
"document", "document",
"detachedDiv", "detachedDiv",
"foreignDoc", "foreignDoc",
"foreignPara2", "foreignPara2",
"xmlDoc", "xmlDoc",
"xmlElement", "xmlElement",
"detachedXmlElement",
"detachedTextNode", "detachedTextNode",
"foreignTextNode", "foreignTextNode",
"detachedForeignTextNode",
"xmlTextNode",
"detachedXmlTextNode",
"processingInstruction", "processingInstruction",
"detachedProcessingInstruction", "detachedProcessingInstruction",
"comment", "comment",
"detachedComment", "detachedComment",
"foreignComment",
"detachedForeignComment",
"xmlComment",
"detachedXmlComment",
"docfrag", "docfrag",
"foreignDocfrag",
"xmlDocfrag",
"doctype", "doctype",
"foreignDoctype", "foreignDoctype",
"xmlDoctype",
]; ];
testNodes = testNodesShort.concat([
"paras[1]",
"detachedPara2",
"detachedPara2.firstChild",
"testDiv",
"detachedXmlElement",
"detachedForeignTextNode",
"xmlTextNode",
"detachedXmlTextNode",
"xmlComment",
"foreignComment",
"detachedForeignComment",
"detachedXmlComment",
"foreignDocfrag",
"xmlDocfrag",
"xmlDoctype",
]);
} }
if ("setup" in window) { if ("setup" in window) {
setup(setupRangeTests); setup(setupRangeTests);

View File

@ -0,0 +1,6 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
MOCHITEST_FILES := \
test_DOMException-constants.html \
test_exceptions.html \
$(NULL)

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
DIRS += [
]

View File

@ -0,0 +1,14 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
MOCHITEST_FILES := \
test_Event-constants.html \
test_Event-constructors.html \
test_Event-defaultPrevented.html \
test_Event-initEvent.html \
test_Event-propagation.html \
test_EventTarget-addEventListener.html \
test_EventTarget-dispatchEvent.html \
test_EventTarget-removeEventListener.html \
test_Event-type.html \
test_ProgressEvent.html \
$(NULL)

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
DIRS += [
]

View File

@ -2,7 +2,7 @@
<title>Event constants</title> <title>Event constants</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="constants.js"></script> <script src="../constants.js"></script>
<div id="log"></div> <div id="log"></div>
<script> <script>
var objects = [ var objects = [

View File

@ -0,0 +1,35 @@
<!doctype html>
<title>Event propagation tests</title>
<link rel=author title="Aryeh Gregor" href=ayg@aryeh.name>
<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
"use strict";
function testPropagationFlag(ev, expected, desc) {
test(function() {
var called = false;
var callback = function() { called = true };
document.head.addEventListener("foo", callback);
document.head.dispatchEvent(ev);
assert_equals(called, expected, "Propagation flag");
document.head.removeEventListener("foo", callback);
}, desc);
}
var ev = document.createEvent("Event");
ev.initEvent("foo", true, false);
testPropagationFlag(ev, true, "Newly-created Event");
ev.stopPropagation();
testPropagationFlag(ev, false, "After stopPropagation()");
ev.initEvent("foo", true, false);
testPropagationFlag(ev, true, "Reinitialized after stopPropagation()");
var ev = document.createEvent("Event");
ev.initEvent("foo", true, false);
ev.stopImmediatePropagation();
testPropagationFlag(ev, false, "After stopImmediatePropagation()");
ev.initEvent("foo", true, false);
testPropagationFlag(ev, true, "Reinitialized after stopImmediatePropagation()");
</script>

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>EventTarget.addEventListener</title>
<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
<link rel="help" href="http://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
// Step 1.
test(function() {
assert_equals(document.addEventListener("x", null, false), undefined);
assert_equals(document.addEventListener("x", null, true), undefined);
assert_equals(document.addEventListener("x", null), undefined);
}, "Adding a null event listener should succeed");
</script>

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>EventTarget.removeEventListener</title>
<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
<link rel="help" href="http://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
// Step 1.
test(function() {
assert_equals(document.removeEventListener("x", null, false), undefined);
assert_equals(document.removeEventListener("x", null, true), undefined);
assert_equals(document.removeEventListener("x", null), undefined);
}, "removing a null event listener should succeed");
</script>

View File

@ -0,0 +1,25 @@
<!doctype html>
<title>ProgressEvent constructor</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
test(function() {
var ev = new ProgressEvent("test")
assert_equals(ev.type, "test")
assert_equals(ev.target, null)
assert_equals(ev.currentTarget, null)
assert_equals(ev.eventPhase, Event.NONE)
assert_equals(ev.bubbles, false)
assert_equals(ev.cancelable, false)
assert_equals(ev.defaultPrevented, false)
assert_equals(ev.isTrusted, false)
assert_true(ev.timeStamp > 0)
assert_true("initEvent" in ev)
}, "Default event values.")
test(function() {
assert_throws("NotSupportedError", function() {
document.createEvent("ProgressEvent")
})
}, "document.createEvent() should not work with ProgressEvent.")
</script>

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
DIRS += [
]

View File

@ -0,0 +1,45 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
MOCHITEST_FILES := \
bare_mathml.html \
bare_mathml.svg \
bare_mathml.xhtml \
bare_mathml.xml \
bare_svg.html \
bare_svg.svg \
bare_svg.xhtml \
bare_svg.xml \
bare_xhtml.html \
bare_xhtml.svg \
bare_xhtml.xhtml \
bare_xhtml.xml \
empty.html \
empty.svg \
empty.xhtml \
empty.xml \
generate.py \
mathml.html \
mathml.svg \
mathml.xhtml \
mathml.xml \
minimal_html.html \
minimal_html.svg \
minimal_html.xhtml \
minimal_html.xml \
svg.html \
svg.svg \
svg.xhtml \
svg.xml \
xhtml.html \
xhtml_ns_changed.html \
xhtml_ns_changed.svg \
xhtml_ns_changed.xhtml \
xhtml_ns_changed.xml \
xhtml_ns_removed.html \
xhtml_ns_removed.svg \
xhtml_ns_removed.xhtml \
xhtml_ns_removed.xml \
xhtml.svg \
xhtml.xhtml \
xhtml.xml \
$(NULL)

View File

@ -0,0 +1 @@
<svg></svg>

After

Width:  |  Height:  |  Size: 11 B

Some files were not shown because too many files have changed in this diff Show More