id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
sequence
docstring
stringlengths
4
11.8k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
86
226
400
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_disableAddon
function addonsManager_disableAddon(aSpec) { var spec = aSpec || { }; spec.button = "disable"; var button = this.getAddonButton(spec); this._controller.click(button); }
javascript
function addonsManager_disableAddon(aSpec) { var spec = aSpec || { }; spec.button = "disable"; var button = this.getAddonButton(spec); this._controller.click(button); }
[ "function", "addonsManager_disableAddon", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "spec", ".", "button", "=", "\"disable\"", ";", "var", "button", "=", "this", ".", "getAddonButton", "(", "spec", ")", ";", "this", ".", "_controller", ".", "click", "(", "button", ")", ";", "}" ]
Disables the specified add-on @param {object} aSpec Information on which add-on to operate on Elements: addon - Add-on element
[ "Disables", "the", "specified", "add", "-", "on" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L361-L367
401
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_installAddon
function addonsManager_installAddon(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var timeout = spec.timeout; var button = "install"; var waitFor = (spec.waitFor == undefined) ? true : spec.waitFor; var button = this.getAddonButton({addon: addon, button: button}); this._controller.click(button); if (waitFor) this.waitForDownloaded({addon: addon, timeout: timeout}); }
javascript
function addonsManager_installAddon(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var timeout = spec.timeout; var button = "install"; var waitFor = (spec.waitFor == undefined) ? true : spec.waitFor; var button = this.getAddonButton({addon: addon, button: button}); this._controller.click(button); if (waitFor) this.waitForDownloaded({addon: addon, timeout: timeout}); }
[ "function", "addonsManager_installAddon", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "addon", "=", "spec", ".", "addon", ";", "var", "timeout", "=", "spec", ".", "timeout", ";", "var", "button", "=", "\"install\"", ";", "var", "waitFor", "=", "(", "spec", ".", "waitFor", "==", "undefined", ")", "?", "true", ":", "spec", ".", "waitFor", ";", "var", "button", "=", "this", ".", "getAddonButton", "(", "{", "addon", ":", "addon", ",", "button", ":", "button", "}", ")", ";", "this", ".", "_controller", ".", "click", "(", "button", ")", ";", "if", "(", "waitFor", ")", "this", ".", "waitForDownloaded", "(", "{", "addon", ":", "addon", ",", "timeout", ":", "timeout", "}", ")", ";", "}" ]
Installs the specified add-on @param {object} aSpec Information on which add-on to operate on Elements: addon - Add-on element waitFor - Wait until the category has been selected [optional - default: true] timeout - Duration to wait for the download [optional - default: 15s]
[ "Installs", "the", "specified", "add", "-", "on" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L380-L392
402
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_removeAddon
function addonsManager_removeAddon(aSpec) { var spec = aSpec || { }; spec.button = "remove"; var button = this.getAddonButton(spec); this._controller.click(button); }
javascript
function addonsManager_removeAddon(aSpec) { var spec = aSpec || { }; spec.button = "remove"; var button = this.getAddonButton(spec); this._controller.click(button); }
[ "function", "addonsManager_removeAddon", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "spec", ".", "button", "=", "\"remove\"", ";", "var", "button", "=", "this", ".", "getAddonButton", "(", "spec", ")", ";", "this", ".", "_controller", ".", "click", "(", "button", ")", ";", "}" ]
Removes the specified add-on @param {object} aSpec Information on which add-on to operate on Elements: addon - Add-on element
[ "Removes", "the", "specified", "add", "-", "on" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L401-L407
403
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_undo
function addonsManager_undo(aSpec) { var spec = aSpec || { }; spec.link = "undo"; var link = this.getAddonLink(spec); this._controller.click(link); }
javascript
function addonsManager_undo(aSpec) { var spec = aSpec || { }; spec.link = "undo"; var link = this.getAddonLink(spec); this._controller.click(link); }
[ "function", "addonsManager_undo", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "spec", ".", "link", "=", "\"undo\"", ";", "var", "link", "=", "this", ".", "getAddonLink", "(", "spec", ")", ";", "this", ".", "_controller", ".", "click", "(", "link", ")", ";", "}" ]
Undo the last action performed for the given add-on @param {object} aSpec Information on which add-on to operate on Elements: addon - Add-on element
[ "Undo", "the", "last", "action", "performed", "for", "the", "given", "add", "-", "on" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L416-L422
404
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_addons
function addonsManager_addons(aSpec) { var spec = aSpec || {}; return this.getElements({ type: "addons", subtype: spec.attribute, value: spec.value, parent: this.selectedView }); }
javascript
function addonsManager_addons(aSpec) { var spec = aSpec || {}; return this.getElements({ type: "addons", subtype: spec.attribute, value: spec.value, parent: this.selectedView }); }
[ "function", "addonsManager_addons", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "return", "this", ".", "getElements", "(", "{", "type", ":", "\"addons\"", ",", "subtype", ":", "spec", ".", "attribute", ",", "value", ":", "spec", ".", "value", ",", "parent", ":", "this", ".", "selectedView", "}", ")", ";", "}" ]
Returns the addons from the currently selected view which match the filter criteria @param {object} aSpec Information about the filter to apply Elements: attribute - DOM attribute of the wanted addon [optional - default: ""] value - Value of the DOM attribute [optional - default: ""] @returns List of addons @type {array of ElemBase}
[ "Returns", "the", "addons", "from", "the", "currently", "selected", "view", "which", "match", "the", "filter", "criteria" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L438-L447
405
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getAddonButton
function addonsManager_getAddonButton(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var button = spec.button; if (!button) throw new Error(arguments.callee.name + ": Button not specified."); return this.getAddonChildElement({addon: addon, type: button + "Button"}); }
javascript
function addonsManager_getAddonButton(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var button = spec.button; if (!button) throw new Error(arguments.callee.name + ": Button not specified."); return this.getAddonChildElement({addon: addon, type: button + "Button"}); }
[ "function", "addonsManager_getAddonButton", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "addon", "=", "spec", ".", "addon", ";", "var", "button", "=", "spec", ".", "button", ";", "if", "(", "!", "button", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Button not specified.\"", ")", ";", "return", "this", ".", "getAddonChildElement", "(", "{", "addon", ":", "addon", ",", "type", ":", "button", "+", "\"Button\"", "}", ")", ";", "}" ]
Returns the element of the specified add-ons button @param {object} aSpec Information on which add-on to operate on Elements: addon - Add-on element button - Button (disable, enable, preferences, remove) @returns Add-on button @type {ElemBase}
[ "Returns", "the", "element", "of", "the", "specified", "add", "-", "ons", "button" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L460-L469
406
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getAddonLink
function addonsManager_getAddonLink(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var link = spec.link; if (!link) throw new Error(arguments.callee.name + ": Link not specified."); return this.getAddonChildElement({addon: addon, type: link + "Link"}); }
javascript
function addonsManager_getAddonLink(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var link = spec.link; if (!link) throw new Error(arguments.callee.name + ": Link not specified."); return this.getAddonChildElement({addon: addon, type: link + "Link"}); }
[ "function", "addonsManager_getAddonLink", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "addon", "=", "spec", ".", "addon", ";", "var", "link", "=", "spec", ".", "link", ";", "if", "(", "!", "link", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Link not specified.\"", ")", ";", "return", "this", ".", "getAddonChildElement", "(", "{", "addon", ":", "addon", ",", "type", ":", "link", "+", "\"Link\"", "}", ")", ";", "}" ]
Returns the element of the specified add-ons link @param {object} aSpec Information on which add-on to operate on Elements: addon - Add-on element link - Link List view (more, restart, undo) Detail view (findUpdates, restart, undo) @return Add-on link @type {ElemBase}
[ "Returns", "the", "element", "of", "the", "specified", "add", "-", "ons", "link" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L484-L493
407
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getAddonRadiogroup
function addonsManager_getAddonRadiogroup(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var radiogroup = spec.radiogroup; if (!radiogroup) throw new Error(arguments.callee.name + ": Radiogroup not specified."); return this.getAddonChildElement({addon: addon, type: radiogroup + "Radiogroup"}); }
javascript
function addonsManager_getAddonRadiogroup(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var radiogroup = spec.radiogroup; if (!radiogroup) throw new Error(arguments.callee.name + ": Radiogroup not specified."); return this.getAddonChildElement({addon: addon, type: radiogroup + "Radiogroup"}); }
[ "function", "addonsManager_getAddonRadiogroup", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "addon", "=", "spec", ".", "addon", ";", "var", "radiogroup", "=", "spec", ".", "radiogroup", ";", "if", "(", "!", "radiogroup", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Radiogroup not specified.\"", ")", ";", "return", "this", ".", "getAddonChildElement", "(", "{", "addon", ":", "addon", ",", "type", ":", "radiogroup", "+", "\"Radiogroup\"", "}", ")", ";", "}" ]
Returns the element of the specified add-ons radio group @param {object} aSpec Information on which add-on to operate on Elements: addon - Add-on element radiogroup - Radiogroup Detail View (autoUpdate) @returns Add-on radiogroup @type {ElemBase}
[ "Returns", "the", "element", "of", "the", "specified", "add", "-", "ons", "radio", "group" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L507-L516
408
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getAddonChildElement
function addonsManager_getAddonChildElement(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var attribute = spec.attribute; var value = spec.value; var type = spec.type; if (!addon) throw new Error(arguments.callee.name + ": Add-on not specified."); // If no type has been set retrieve a general element which needs an // attribute and value if (!type) { type = "element"; if (!attribute) throw new Error(arguments.callee.name + ": DOM attribute not specified."); if (!value) throw new Error(arguments.callee.name + ": Value not specified."); } // For the details view the elements don't have anonymous nodes if (this.selectedView.getNode().id == "detail-view") { return this.getElement({ type: "detailView_" + type, subtype: attribute, value: value }); } else { return this.getElement({ type: "listView_" + type, subtype: attribute, value: value, parent: addon }); } }
javascript
function addonsManager_getAddonChildElement(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var attribute = spec.attribute; var value = spec.value; var type = spec.type; if (!addon) throw new Error(arguments.callee.name + ": Add-on not specified."); // If no type has been set retrieve a general element which needs an // attribute and value if (!type) { type = "element"; if (!attribute) throw new Error(arguments.callee.name + ": DOM attribute not specified."); if (!value) throw new Error(arguments.callee.name + ": Value not specified."); } // For the details view the elements don't have anonymous nodes if (this.selectedView.getNode().id == "detail-view") { return this.getElement({ type: "detailView_" + type, subtype: attribute, value: value }); } else { return this.getElement({ type: "listView_" + type, subtype: attribute, value: value, parent: addon }); } }
[ "function", "addonsManager_getAddonChildElement", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "addon", "=", "spec", ".", "addon", ";", "var", "attribute", "=", "spec", ".", "attribute", ";", "var", "value", "=", "spec", ".", "value", ";", "var", "type", "=", "spec", ".", "type", ";", "if", "(", "!", "addon", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Add-on not specified.\"", ")", ";", "// If no type has been set retrieve a general element which needs an", "// attribute and value", "if", "(", "!", "type", ")", "{", "type", "=", "\"element\"", ";", "if", "(", "!", "attribute", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": DOM attribute not specified.\"", ")", ";", "if", "(", "!", "value", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Value not specified.\"", ")", ";", "}", "// For the details view the elements don't have anonymous nodes", "if", "(", "this", ".", "selectedView", ".", "getNode", "(", ")", ".", "id", "==", "\"detail-view\"", ")", "{", "return", "this", ".", "getElement", "(", "{", "type", ":", "\"detailView_\"", "+", "type", ",", "subtype", ":", "attribute", ",", "value", ":", "value", "}", ")", ";", "}", "else", "{", "return", "this", ".", "getElement", "(", "{", "type", ":", "\"listView_\"", "+", "type", ",", "subtype", ":", "attribute", ",", "value", ":", "value", ",", "parent", ":", "addon", "}", ")", ";", "}", "}" ]
Retrieve the given child element of the specified add-on @param {object} aSpec Information for getting the add-ons child node Elements: addon - Add-on element type - Type of the element [optional - default: use attribute/value] attribute - DOM attribute of the node value - Value of the DOM attribute @returns Element @type {ElemBase}
[ "Retrieve", "the", "given", "child", "element", "of", "the", "specified", "add", "-", "on" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L532-L568
409
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_waitForDownloaded
function addonsManager_waitForDownloaded(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var timeout = (spec.timeout == undefined) ? TIMEOUT_DOWNLOAD : spec.timeout; if (!addon) throw new Error(arguments.callee.name + ": Add-on not specified."); var self = this; var node = addon.getNode(); // TODO: restore after 1.5.1 has landed // mozmill.utils.waitFor(function () { // return node.getAttribute("pending") == "install" && // node.getAttribute("status") != "installing"; // }, timeout, 100, "'" + node.getAttribute("name") + "' has been downloaded"); mozmill.utils.waitForEval("subject.getAttribute('pending') == 'install' &&" + "subject.getAttribute('status') != 'installing'", timeout, 100, node); }
javascript
function addonsManager_waitForDownloaded(aSpec) { var spec = aSpec || { }; var addon = spec.addon; var timeout = (spec.timeout == undefined) ? TIMEOUT_DOWNLOAD : spec.timeout; if (!addon) throw new Error(arguments.callee.name + ": Add-on not specified."); var self = this; var node = addon.getNode(); // TODO: restore after 1.5.1 has landed // mozmill.utils.waitFor(function () { // return node.getAttribute("pending") == "install" && // node.getAttribute("status") != "installing"; // }, timeout, 100, "'" + node.getAttribute("name") + "' has been downloaded"); mozmill.utils.waitForEval("subject.getAttribute('pending') == 'install' &&" + "subject.getAttribute('status') != 'installing'", timeout, 100, node); }
[ "function", "addonsManager_waitForDownloaded", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "addon", "=", "spec", ".", "addon", ";", "var", "timeout", "=", "(", "spec", ".", "timeout", "==", "undefined", ")", "?", "TIMEOUT_DOWNLOAD", ":", "spec", ".", "timeout", ";", "if", "(", "!", "addon", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Add-on not specified.\"", ")", ";", "var", "self", "=", "this", ";", "var", "node", "=", "addon", ".", "getNode", "(", ")", ";", "// TODO: restore after 1.5.1 has landed", "// mozmill.utils.waitFor(function () {", "// return node.getAttribute(\"pending\") == \"install\" &&", "// node.getAttribute(\"status\") != \"installing\";", "// }, timeout, 100, \"'\" + node.getAttribute(\"name\") + \"' has been downloaded\");", "mozmill", ".", "utils", ".", "waitForEval", "(", "\"subject.getAttribute('pending') == 'install' &&\"", "+", "\"subject.getAttribute('status') != 'installing'\"", ",", "timeout", ",", "100", ",", "node", ")", ";", "}" ]
Wait until the specified add-on has been downloaded @param {object} aSpec Object with parameters for customization Elements: addon - Add-on element to wait for being downloaded timeout - Duration to wait for the target state [optional - default: 15s]
[ "Wait", "until", "the", "specified", "add", "-", "on", "has", "been", "downloaded" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L579-L599
410
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_categories
function addonsManager_categories(aSpec) { var spec = aSpec || { }; var categories = this.getElements({ type: "categories", subtype: spec.attribute, value: spec.value }); if (categories.length == 0) throw new Error(arguments.callee.name + ": Categories could not be found."); return categories; }
javascript
function addonsManager_categories(aSpec) { var spec = aSpec || { }; var categories = this.getElements({ type: "categories", subtype: spec.attribute, value: spec.value }); if (categories.length == 0) throw new Error(arguments.callee.name + ": Categories could not be found."); return categories; }
[ "function", "addonsManager_categories", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "categories", "=", "this", ".", "getElements", "(", "{", "type", ":", "\"categories\"", ",", "subtype", ":", "spec", ".", "attribute", ",", "value", ":", "spec", ".", "value", "}", ")", ";", "if", "(", "categories", ".", "length", "==", "0", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Categories could not be found.\"", ")", ";", "return", "categories", ";", "}" ]
Returns the categories which match the filter criteria @param {object} aSpec Information about the filter to apply Elements: attribute - DOM attribute of the wanted category [optional - default: ""] value - Value of the DOM attribute [optional - default: ""] @returns List of categories @type {array of ElemBase}
[ "Returns", "the", "categories", "which", "match", "the", "filter", "criteria" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L629-L642
411
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getCategoryById
function addonsManager_getCategoryById(aSpec) { var spec = aSpec || { }; var id = spec.id; if (!id) throw new Error(arguments.callee.name + ": Category ID not specified."); return this.getCategories({ attribute: "id", value: "category-" + id })[0]; }
javascript
function addonsManager_getCategoryById(aSpec) { var spec = aSpec || { }; var id = spec.id; if (!id) throw new Error(arguments.callee.name + ": Category ID not specified."); return this.getCategories({ attribute: "id", value: "category-" + id })[0]; }
[ "function", "addonsManager_getCategoryById", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "id", "=", "spec", ".", "id", ";", "if", "(", "!", "id", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Category ID not specified.\"", ")", ";", "return", "this", ".", "getCategories", "(", "{", "attribute", ":", "\"id\"", ",", "value", ":", "\"category-\"", "+", "id", "}", ")", "[", "0", "]", ";", "}" ]
Get the category element for the specified id @param {object} aSpec Information for getting a category Elements: id - Category id (search, discover, languages, searchengines, extensions, themes, plugins, availableUpdates, recentUpdates) @returns Category @type {ElemBase}
[ "Get", "the", "category", "element", "for", "the", "specified", "id" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L656-L667
412
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getCategoryId
function addonsManager_getCategoryId(aSpec) { var spec = aSpec || { }; var category = spec.category; if (!category) throw new Error(arguments.callee.name + ": Category not specified."); return category.getNode().id; }
javascript
function addonsManager_getCategoryId(aSpec) { var spec = aSpec || { }; var category = spec.category; if (!category) throw new Error(arguments.callee.name + ": Category not specified."); return category.getNode().id; }
[ "function", "addonsManager_getCategoryId", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "category", "=", "spec", ".", "category", ";", "if", "(", "!", "category", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Category not specified.\"", ")", ";", "return", "category", ".", "getNode", "(", ")", ".", "id", ";", "}" ]
Get the ID of the given category element @param {object} aSpec Information for getting a category Elements: category - Category to get the id from @returns Category Id @type {string}
[ "Get", "the", "ID", "of", "the", "given", "category", "element" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L679-L687
413
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_setCategory
function addonsManager_setCategory(aSpec) { var spec = aSpec || { }; var category = spec.category; var waitFor = (spec.waitFor == undefined) ? true : spec.waitFor; if (!category) throw new Error(arguments.callee.name + ": Category not specified."); this._controller.click(category); if (waitFor) this.waitForCategory({category: category}); }
javascript
function addonsManager_setCategory(aSpec) { var spec = aSpec || { }; var category = spec.category; var waitFor = (spec.waitFor == undefined) ? true : spec.waitFor; if (!category) throw new Error(arguments.callee.name + ": Category not specified."); this._controller.click(category); if (waitFor) this.waitForCategory({category: category}); }
[ "function", "addonsManager_setCategory", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "category", "=", "spec", ".", "category", ";", "var", "waitFor", "=", "(", "spec", ".", "waitFor", "==", "undefined", ")", "?", "true", ":", "spec", ".", "waitFor", ";", "if", "(", "!", "category", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Category not specified.\"", ")", ";", "this", ".", "_controller", ".", "click", "(", "category", ")", ";", "if", "(", "waitFor", ")", "this", ".", "waitForCategory", "(", "{", "category", ":", "category", "}", ")", ";", "}" ]
Select the given category @param {object} aSpec Information for selecting a category Elements: category - Category element waitFor - Wait until the category has been selected [optional - default: true]
[ "Select", "the", "given", "category" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L698-L710
414
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_setCategoryById
function addonsManager_setCategoryById(aSpec) { var spec = aSpec || { }; var id = spec.id; var waitFor = (spec.waitFor == undefined) ? true : spec.waitFor; if (!id) throw new Error(arguments.callee.name + ": Category ID not specified."); // Retrieve the category and set it as active var category = this.getCategoryById({id: id}); if (category) this.setCategory({category: category, waitFor: waitFor}); else throw new Error(arguments.callee.name + ": Category '" + id + " not found."); }
javascript
function addonsManager_setCategoryById(aSpec) { var spec = aSpec || { }; var id = spec.id; var waitFor = (spec.waitFor == undefined) ? true : spec.waitFor; if (!id) throw new Error(arguments.callee.name + ": Category ID not specified."); // Retrieve the category and set it as active var category = this.getCategoryById({id: id}); if (category) this.setCategory({category: category, waitFor: waitFor}); else throw new Error(arguments.callee.name + ": Category '" + id + " not found."); }
[ "function", "addonsManager_setCategoryById", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "id", "=", "spec", ".", "id", ";", "var", "waitFor", "=", "(", "spec", ".", "waitFor", "==", "undefined", ")", "?", "true", ":", "spec", ".", "waitFor", ";", "if", "(", "!", "id", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Category ID not specified.\"", ")", ";", "// Retrieve the category and set it as active", "var", "category", "=", "this", ".", "getCategoryById", "(", "{", "id", ":", "id", "}", ")", ";", "if", "(", "category", ")", "this", ".", "setCategory", "(", "{", "category", ":", "category", ",", "waitFor", ":", "waitFor", "}", ")", ";", "else", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Category '\"", "+", "id", "+", "\" not found.\"", ")", ";", "}" ]
Select the category with the given id @param {object} aSpec Information for selecting a category Elements: id - Category id (search, discover, languages, searchengines, extensions, themes, plugins, availableUpdates, recentUpdates) waitFor - Wait until the category has been selected [optional - default: true]
[ "Select", "the", "category", "with", "the", "given", "id" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L723-L737
415
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_waitForCategory
function addonsManager_waitForCategory(aSpec) { var spec = aSpec || { }; var category = spec.category; var timeout = (spec.timeout == undefined) ? TIMEOUT : spec.timeout; if (!category) throw new Error(arguments.callee.name + ": Category not specified."); // TODO: restore after 1.5.1 has landed // var self = this; // mozmill.utils.waitFor(function () { // return self.selectedCategory.getNode() == category.getNode(); // }, timeout, 100, "Category '" + category.getNode().id + "' has been set"); mozmill.utils.waitForEval("subject.self.selectedCategory.getNode() == subject.aCategory.getNode()", timeout, 100, {self: this, aCategory: category}); }
javascript
function addonsManager_waitForCategory(aSpec) { var spec = aSpec || { }; var category = spec.category; var timeout = (spec.timeout == undefined) ? TIMEOUT : spec.timeout; if (!category) throw new Error(arguments.callee.name + ": Category not specified."); // TODO: restore after 1.5.1 has landed // var self = this; // mozmill.utils.waitFor(function () { // return self.selectedCategory.getNode() == category.getNode(); // }, timeout, 100, "Category '" + category.getNode().id + "' has been set"); mozmill.utils.waitForEval("subject.self.selectedCategory.getNode() == subject.aCategory.getNode()", timeout, 100, {self: this, aCategory: category}); }
[ "function", "addonsManager_waitForCategory", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "category", "=", "spec", ".", "category", ";", "var", "timeout", "=", "(", "spec", ".", "timeout", "==", "undefined", ")", "?", "TIMEOUT", ":", "spec", ".", "timeout", ";", "if", "(", "!", "category", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Category not specified.\"", ")", ";", "// TODO: restore after 1.5.1 has landed", "// var self = this;", "// mozmill.utils.waitFor(function () {", "// return self.selectedCategory.getNode() == category.getNode();", "// }, timeout, 100, \"Category '\" + category.getNode().id + \"' has been set\");", "mozmill", ".", "utils", ".", "waitForEval", "(", "\"subject.self.selectedCategory.getNode() == subject.aCategory.getNode()\"", ",", "timeout", ",", "100", ",", "{", "self", ":", "this", ",", "aCategory", ":", "category", "}", ")", ";", "}" ]
Wait until the specified category has been selected @param {object} aSpec Object with parameters for customization Elements: category - Category element to wait for timeout - Duration to wait for the target state [optional - default: 5s]
[ "Wait", "until", "the", "specified", "category", "has", "been", "selected" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L748-L765
416
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_search
function addonsManager_search(aSpec) { var spec = aSpec || { }; var value = spec.value; var timeout = (spec.timeout == undefined) ? TIMEOUT_SEARCH : spec.timeout; var waitFor = (spec.waitFor == undefined) ? true : spec.waitFor; if (!value) throw new Error(arguments.callee.name + ": Search term not specified."); var textbox = this.getElement({type: "search_textbox"}); this.clearSearchField(); this._controller.type(textbox, value); this._controller.keypress(textbox, "VK_RETURN", {}); if (waitFor) this.waitForSearchFinished(); }
javascript
function addonsManager_search(aSpec) { var spec = aSpec || { }; var value = spec.value; var timeout = (spec.timeout == undefined) ? TIMEOUT_SEARCH : spec.timeout; var waitFor = (spec.waitFor == undefined) ? true : spec.waitFor; if (!value) throw new Error(arguments.callee.name + ": Search term not specified."); var textbox = this.getElement({type: "search_textbox"}); this.clearSearchField(); this._controller.type(textbox, value); this._controller.keypress(textbox, "VK_RETURN", {}); if (waitFor) this.waitForSearchFinished(); }
[ "function", "addonsManager_search", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "value", "=", "spec", ".", "value", ";", "var", "timeout", "=", "(", "spec", ".", "timeout", "==", "undefined", ")", "?", "TIMEOUT_SEARCH", ":", "spec", ".", "timeout", ";", "var", "waitFor", "=", "(", "spec", ".", "waitFor", "==", "undefined", ")", "?", "true", ":", "spec", ".", "waitFor", ";", "if", "(", "!", "value", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Search term not specified.\"", ")", ";", "var", "textbox", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"search_textbox\"", "}", ")", ";", "this", ".", "clearSearchField", "(", ")", ";", "this", ".", "_controller", ".", "type", "(", "textbox", ",", "value", ")", ";", "this", ".", "_controller", ".", "keypress", "(", "textbox", ",", "\"VK_RETURN\"", ",", "{", "}", ")", ";", "if", "(", "waitFor", ")", "this", ".", "waitForSearchFinished", "(", ")", ";", "}" ]
Search for a specified add-on @param {object} aSpec Information to execute the search Elements: value - Search term timeout - Duration to wait for search results [optional - default: 30s] waitFor - Wait until the search has been finished [optional - default: true]
[ "Search", "for", "a", "specified", "add", "-", "on" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L793-L810
417
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getSearchFilter
function addonsManager_getSearchFilter(aSpec) { var spec = aSpec || { }; return this.getElements({ type: "search_filterRadioButtons", subtype: spec.attribute, value: spec.value }); }
javascript
function addonsManager_getSearchFilter(aSpec) { var spec = aSpec || { }; return this.getElements({ type: "search_filterRadioButtons", subtype: spec.attribute, value: spec.value }); }
[ "function", "addonsManager_getSearchFilter", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "return", "this", ".", "getElements", "(", "{", "type", ":", "\"search_filterRadioButtons\"", ",", "subtype", ":", "spec", ".", "attribute", ",", "value", ":", "spec", ".", "value", "}", ")", ";", "}" ]
Returns the available search filters which match the filter criteria @param {object} aSpec Information about the filter to apply Elements: attribute - DOM attribute of the wanted filter [optional - default: ""] value - Value of the DOM attribute [optional - default: ""] @returns List of search filters @type {array of ElemBase}
[ "Returns", "the", "available", "search", "filters", "which", "match", "the", "filter", "criteria" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L867-L875
418
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getSearchFilterByValue
function addonsManager_getSearchFilterByValue(aValue) { if (!aValue) throw new Error(arguments.callee.name + ": Search filter value not specified."); return this.getElement({ type: "search_filterRadioGroup", subtype: "value", value: aValue }); }
javascript
function addonsManager_getSearchFilterByValue(aValue) { if (!aValue) throw new Error(arguments.callee.name + ": Search filter value not specified."); return this.getElement({ type: "search_filterRadioGroup", subtype: "value", value: aValue }); }
[ "function", "addonsManager_getSearchFilterByValue", "(", "aValue", ")", "{", "if", "(", "!", "aValue", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Search filter value not specified.\"", ")", ";", "return", "this", ".", "getElement", "(", "{", "type", ":", "\"search_filterRadioGroup\"", ",", "subtype", ":", "\"value\"", ",", "value", ":", "aValue", "}", ")", ";", "}" ]
Get the search filter element for the specified value @param {string} aValue Search filter value (local, remote) @returns Search filter element @type {ElemBase}
[ "Get", "the", "search", "filter", "element", "for", "the", "specified", "value" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L886-L895
419
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getSearchFilterValue
function addonsManager_getSearchFilterValue(aSpec) { var spec = aSpec || { }; var filter = spec.filter; if (!filter) throw new Error(arguments.callee.name + ": Search filter not specified."); return filter.getNode().value; }
javascript
function addonsManager_getSearchFilterValue(aSpec) { var spec = aSpec || { }; var filter = spec.filter; if (!filter) throw new Error(arguments.callee.name + ": Search filter not specified."); return filter.getNode().value; }
[ "function", "addonsManager_getSearchFilterValue", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "filter", "=", "spec", ".", "filter", ";", "if", "(", "!", "filter", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Search filter not specified.\"", ")", ";", "return", "filter", ".", "getNode", "(", ")", ".", "value", ";", "}" ]
Get the value of the given search filter element @param {object} aSpec Information for getting the views matched by the criteria Elements: filter - Filter element @returns Value of the search filter @type {string}
[ "Get", "the", "value", "of", "the", "given", "search", "filter", "element" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L907-L915
420
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_waitForSearchFilter
function addonsManager_waitForSearchFilter(aSpec) { var spec = aSpec || { }; var filter = spec.filter; var timeout = (spec.timeout == undefined) ? TIMEOUT : spec.timeout; if (!filter) throw new Error(arguments.callee.name + ": Search filter not specified."); // TODO: restore after 1.5.1 has landed // var self = this; // // mozmill.utils.waitFor(function () { // return self.selectedSearchFilter.getNode() == filter.getNode(); // }, timeout, 100, "Search filter '" + filter.getNode().value + "' has been set"); mozmill.utils.waitForEval("subject.self.selectedSearchFilter.getNode() == subject.aFilter.getNode()", timeout, 100, {self: this, aFilter: filter}); }
javascript
function addonsManager_waitForSearchFilter(aSpec) { var spec = aSpec || { }; var filter = spec.filter; var timeout = (spec.timeout == undefined) ? TIMEOUT : spec.timeout; if (!filter) throw new Error(arguments.callee.name + ": Search filter not specified."); // TODO: restore after 1.5.1 has landed // var self = this; // // mozmill.utils.waitFor(function () { // return self.selectedSearchFilter.getNode() == filter.getNode(); // }, timeout, 100, "Search filter '" + filter.getNode().value + "' has been set"); mozmill.utils.waitForEval("subject.self.selectedSearchFilter.getNode() == subject.aFilter.getNode()", timeout, 100, {self: this, aFilter: filter}); }
[ "function", "addonsManager_waitForSearchFilter", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "filter", "=", "spec", ".", "filter", ";", "var", "timeout", "=", "(", "spec", ".", "timeout", "==", "undefined", ")", "?", "TIMEOUT", ":", "spec", ".", "timeout", ";", "if", "(", "!", "filter", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Search filter not specified.\"", ")", ";", "// TODO: restore after 1.5.1 has landed", "// var self = this;", "// ", "// mozmill.utils.waitFor(function () {", "// return self.selectedSearchFilter.getNode() == filter.getNode();", "// }, timeout, 100, \"Search filter '\" + filter.getNode().value + \"' has been set\");", "mozmill", ".", "utils", ".", "waitForEval", "(", "\"subject.self.selectedSearchFilter.getNode() == subject.aFilter.getNode()\"", ",", "timeout", ",", "100", ",", "{", "self", ":", "this", ",", "aFilter", ":", "filter", "}", ")", ";", "}" ]
Waits until the specified search filter has been selected @param {object} aSpec Object with parameters for customization Elements: filter - Filter element to wait for timeout - Duration to wait for the target state [optional - default: 5s]
[ "Waits", "until", "the", "specified", "search", "filter", "has", "been", "selected" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L926-L944
421
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getSearchResults
function addonsManager_getSearchResults() { var filterValue = this.getSearchFilterValue({ filter: this.selectedSearchFilter }); switch (filterValue) { case "local": return this.getAddons({attribute: "status", value: "installed"}); case "remote": return this.getAddons({attribute: "remote", value: "true"}); default: throw new Error(arguments.callee.name + ": Unknown search filter '" + filterValue + "' selected"); } }
javascript
function addonsManager_getSearchResults() { var filterValue = this.getSearchFilterValue({ filter: this.selectedSearchFilter }); switch (filterValue) { case "local": return this.getAddons({attribute: "status", value: "installed"}); case "remote": return this.getAddons({attribute: "remote", value: "true"}); default: throw new Error(arguments.callee.name + ": Unknown search filter '" + filterValue + "' selected"); } }
[ "function", "addonsManager_getSearchResults", "(", ")", "{", "var", "filterValue", "=", "this", ".", "getSearchFilterValue", "(", "{", "filter", ":", "this", ".", "selectedSearchFilter", "}", ")", ";", "switch", "(", "filterValue", ")", "{", "case", "\"local\"", ":", "return", "this", ".", "getAddons", "(", "{", "attribute", ":", "\"status\"", ",", "value", ":", "\"installed\"", "}", ")", ";", "case", "\"remote\"", ":", "return", "this", ".", "getAddons", "(", "{", "attribute", ":", "\"remote\"", ",", "value", ":", "\"true\"", "}", ")", ";", "default", ":", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Unknown search filter '\"", "+", "filterValue", "+", "\"' selected\"", ")", ";", "}", "}" ]
Returns the list of add-ons found by the selected filter @returns List of add-ons @type {ElemBase}
[ "Returns", "the", "list", "of", "add", "-", "ons", "found", "by", "the", "selected", "filter" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L952-L966
422
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_waitForSearchFinished
function addonsManager_waitForSearchFinished(aSpec) { var spec = aSpec || { }; var timeout = (spec.timeout == undefined) ? TIMEOUT_SEARCH : spec.timeout; // TODO: restore after 1.5.1 has landed // var self = this; // // mozmill.utils.waitFor(function () { // return self.isSearching == false; // }, timeout, 100, "Search has been finished"); mozmill.utils.waitForEval("subject.isSearching == false", timeout, 100, this); }
javascript
function addonsManager_waitForSearchFinished(aSpec) { var spec = aSpec || { }; var timeout = (spec.timeout == undefined) ? TIMEOUT_SEARCH : spec.timeout; // TODO: restore after 1.5.1 has landed // var self = this; // // mozmill.utils.waitFor(function () { // return self.isSearching == false; // }, timeout, 100, "Search has been finished"); mozmill.utils.waitForEval("subject.isSearching == false", timeout, 100, this); }
[ "function", "addonsManager_waitForSearchFinished", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "timeout", "=", "(", "spec", ".", "timeout", "==", "undefined", ")", "?", "TIMEOUT_SEARCH", ":", "spec", ".", "timeout", ";", "// TODO: restore after 1.5.1 has landed", "// var self = this;", "// ", "// mozmill.utils.waitFor(function () {", "// return self.isSearching == false;", "// }, timeout, 100, \"Search has been finished\");", "mozmill", ".", "utils", ".", "waitForEval", "(", "\"subject.isSearching == false\"", ",", "timeout", ",", "100", ",", "this", ")", ";", "}" ]
Waits until the active search has been finished @param {object} aSpec Object with parameters for customization Elements: timeout - Duration to wait for the target state
[ "Waits", "until", "the", "active", "search", "has", "been", "finished" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L975-L988
423
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addToWhiteList
function addToWhiteList(aDomain) { pm.add(utils.createURI(aDomain), "install", Ci.nsIPermissionManager.ALLOW_ACTION); }
javascript
function addToWhiteList(aDomain) { pm.add(utils.createURI(aDomain), "install", Ci.nsIPermissionManager.ALLOW_ACTION); }
[ "function", "addToWhiteList", "(", "aDomain", ")", "{", "pm", ".", "add", "(", "utils", ".", "createURI", "(", "aDomain", ")", ",", "\"install\"", ",", "Ci", ".", "nsIPermissionManager", ".", "ALLOW_ACTION", ")", ";", "}" ]
Whitelist permission for the specified domain @param {string} aDomain The domain to add the permission for
[ "Whitelist", "permission", "for", "the", "specified", "domain" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L1234-L1238
424
SeleniumHQ/selenium
third_party/closure/goog/i18n/dateintervalformat.js
function( pattern, opt_dateIntervalSymbols, opt_dateTimeSymbols) { asserts.assert(goog.isDef(pattern), 'Pattern must be defined.'); asserts.assert( goog.isDef(opt_dateIntervalSymbols) || goog.isDef(dateIntervalSymbols.getDateIntervalSymbols()), 'goog.i18n.DateIntervalSymbols or explicit symbols must be defined'); asserts.assert( goog.isDef(opt_dateTimeSymbols) || goog.isDef(DateTimeSymbols), 'goog.i18n.DateTimeSymbols or explicit symbols must be defined'); /** * DateIntervalSymbols object that contains locale data required by the * formatter. * @private @const {!dateIntervalSymbols.DateIntervalSymbols} */ this.dateIntervalSymbols_ = opt_dateIntervalSymbols || dateIntervalSymbols.getDateIntervalSymbols(); /** * DateTimeSymbols object that contain locale data required by the formatter. * @private @const {!DateTimeSymbolsType} */ this.dateTimeSymbols_ = opt_dateTimeSymbols || DateTimeSymbols; /** * Date interval pattern to use. * @private @const {!dateIntervalSymbols.DateIntervalPatternMap} */ this.intervalPattern_ = this.getIntervalPattern_(pattern); /** * Keys of the available date interval patterns. Used to lookup the key that * contains a specific pattern letter (e.g. for ['Myd', 'hms'], the key that * contains 'y' is 'Myd'). * @private @const {!Array<string>} */ this.intervalPatternKeys_ = object.getKeys(this.intervalPattern_); // Remove the default pattern's key ('_') from intervalPatternKeys_. Is not // necesary when looking up for a key: when no key is found it will always // default to the default pattern. array.remove(this.intervalPatternKeys_, DEFAULT_PATTERN_KEY_); /** * Default fallback pattern to use. * @private @const {string} */ this.fallbackPattern_ = this.dateIntervalSymbols_.FALLBACK || DEFAULT_FALLBACK_PATTERN_; // Determine which date should be used with each part of the interval // pattern. var indexOfFirstDate = this.fallbackPattern_.indexOf(FIRST_DATE_PLACEHOLDER_); var indexOfSecondDate = this.fallbackPattern_.indexOf(SECOND_DATE_PLACEHOLDER_); if (indexOfFirstDate < 0 || indexOfSecondDate < 0) { throw new Error('Malformed fallback interval pattern'); } /** * True if the first date provided should be formatted with the first pattern * of the interval pattern. * @private @const {boolean} */ this.useFirstDateOnFirstPattern_ = indexOfFirstDate <= indexOfSecondDate; /** * Map that stores a Formatter_ object per calendar field. Formatters will be * instanced on demand and stored on this map until required again. * @private @const {!Object<string, !Formatter_>} */ this.formatterMap_ = {}; }
javascript
function( pattern, opt_dateIntervalSymbols, opt_dateTimeSymbols) { asserts.assert(goog.isDef(pattern), 'Pattern must be defined.'); asserts.assert( goog.isDef(opt_dateIntervalSymbols) || goog.isDef(dateIntervalSymbols.getDateIntervalSymbols()), 'goog.i18n.DateIntervalSymbols or explicit symbols must be defined'); asserts.assert( goog.isDef(opt_dateTimeSymbols) || goog.isDef(DateTimeSymbols), 'goog.i18n.DateTimeSymbols or explicit symbols must be defined'); /** * DateIntervalSymbols object that contains locale data required by the * formatter. * @private @const {!dateIntervalSymbols.DateIntervalSymbols} */ this.dateIntervalSymbols_ = opt_dateIntervalSymbols || dateIntervalSymbols.getDateIntervalSymbols(); /** * DateTimeSymbols object that contain locale data required by the formatter. * @private @const {!DateTimeSymbolsType} */ this.dateTimeSymbols_ = opt_dateTimeSymbols || DateTimeSymbols; /** * Date interval pattern to use. * @private @const {!dateIntervalSymbols.DateIntervalPatternMap} */ this.intervalPattern_ = this.getIntervalPattern_(pattern); /** * Keys of the available date interval patterns. Used to lookup the key that * contains a specific pattern letter (e.g. for ['Myd', 'hms'], the key that * contains 'y' is 'Myd'). * @private @const {!Array<string>} */ this.intervalPatternKeys_ = object.getKeys(this.intervalPattern_); // Remove the default pattern's key ('_') from intervalPatternKeys_. Is not // necesary when looking up for a key: when no key is found it will always // default to the default pattern. array.remove(this.intervalPatternKeys_, DEFAULT_PATTERN_KEY_); /** * Default fallback pattern to use. * @private @const {string} */ this.fallbackPattern_ = this.dateIntervalSymbols_.FALLBACK || DEFAULT_FALLBACK_PATTERN_; // Determine which date should be used with each part of the interval // pattern. var indexOfFirstDate = this.fallbackPattern_.indexOf(FIRST_DATE_PLACEHOLDER_); var indexOfSecondDate = this.fallbackPattern_.indexOf(SECOND_DATE_PLACEHOLDER_); if (indexOfFirstDate < 0 || indexOfSecondDate < 0) { throw new Error('Malformed fallback interval pattern'); } /** * True if the first date provided should be formatted with the first pattern * of the interval pattern. * @private @const {boolean} */ this.useFirstDateOnFirstPattern_ = indexOfFirstDate <= indexOfSecondDate; /** * Map that stores a Formatter_ object per calendar field. Formatters will be * instanced on demand and stored on this map until required again. * @private @const {!Object<string, !Formatter_>} */ this.formatterMap_ = {}; }
[ "function", "(", "pattern", ",", "opt_dateIntervalSymbols", ",", "opt_dateTimeSymbols", ")", "{", "asserts", ".", "assert", "(", "goog", ".", "isDef", "(", "pattern", ")", ",", "'Pattern must be defined.'", ")", ";", "asserts", ".", "assert", "(", "goog", ".", "isDef", "(", "opt_dateIntervalSymbols", ")", "||", "goog", ".", "isDef", "(", "dateIntervalSymbols", ".", "getDateIntervalSymbols", "(", ")", ")", ",", "'goog.i18n.DateIntervalSymbols or explicit symbols must be defined'", ")", ";", "asserts", ".", "assert", "(", "goog", ".", "isDef", "(", "opt_dateTimeSymbols", ")", "||", "goog", ".", "isDef", "(", "DateTimeSymbols", ")", ",", "'goog.i18n.DateTimeSymbols or explicit symbols must be defined'", ")", ";", "/**\n * DateIntervalSymbols object that contains locale data required by the\n * formatter.\n * @private @const {!dateIntervalSymbols.DateIntervalSymbols}\n */", "this", ".", "dateIntervalSymbols_", "=", "opt_dateIntervalSymbols", "||", "dateIntervalSymbols", ".", "getDateIntervalSymbols", "(", ")", ";", "/**\n * DateTimeSymbols object that contain locale data required by the formatter.\n * @private @const {!DateTimeSymbolsType}\n */", "this", ".", "dateTimeSymbols_", "=", "opt_dateTimeSymbols", "||", "DateTimeSymbols", ";", "/**\n * Date interval pattern to use.\n * @private @const {!dateIntervalSymbols.DateIntervalPatternMap}\n */", "this", ".", "intervalPattern_", "=", "this", ".", "getIntervalPattern_", "(", "pattern", ")", ";", "/**\n * Keys of the available date interval patterns. Used to lookup the key that\n * contains a specific pattern letter (e.g. for ['Myd', 'hms'], the key that\n * contains 'y' is 'Myd').\n * @private @const {!Array<string>}\n */", "this", ".", "intervalPatternKeys_", "=", "object", ".", "getKeys", "(", "this", ".", "intervalPattern_", ")", ";", "// Remove the default pattern's key ('_') from intervalPatternKeys_. Is not", "// necesary when looking up for a key: when no key is found it will always", "// default to the default pattern.", "array", ".", "remove", "(", "this", ".", "intervalPatternKeys_", ",", "DEFAULT_PATTERN_KEY_", ")", ";", "/**\n * Default fallback pattern to use.\n * @private @const {string}\n */", "this", ".", "fallbackPattern_", "=", "this", ".", "dateIntervalSymbols_", ".", "FALLBACK", "||", "DEFAULT_FALLBACK_PATTERN_", ";", "// Determine which date should be used with each part of the interval", "// pattern.", "var", "indexOfFirstDate", "=", "this", ".", "fallbackPattern_", ".", "indexOf", "(", "FIRST_DATE_PLACEHOLDER_", ")", ";", "var", "indexOfSecondDate", "=", "this", ".", "fallbackPattern_", ".", "indexOf", "(", "SECOND_DATE_PLACEHOLDER_", ")", ";", "if", "(", "indexOfFirstDate", "<", "0", "||", "indexOfSecondDate", "<", "0", ")", "{", "throw", "new", "Error", "(", "'Malformed fallback interval pattern'", ")", ";", "}", "/**\n * True if the first date provided should be formatted with the first pattern\n * of the interval pattern.\n * @private @const {boolean}\n */", "this", ".", "useFirstDateOnFirstPattern_", "=", "indexOfFirstDate", "<=", "indexOfSecondDate", ";", "/**\n * Map that stores a Formatter_ object per calendar field. Formatters will be\n * instanced on demand and stored on this map until required again.\n * @private @const {!Object<string, !Formatter_>}\n */", "this", ".", "formatterMap_", "=", "{", "}", ";", "}" ]
Constructs a DateIntervalFormat object based on the current locale. @param {number|!dateIntervalSymbols.DateIntervalPatternMap} pattern Pattern specification or pattern object. @param {!dateIntervalSymbols.DateIntervalSymbols=} opt_dateIntervalSymbols Optional DateIntervalSymbols to use for this instance rather than the global symbols. @param {!DateTimeSymbolsType=} opt_dateTimeSymbols Optional DateTimeSymbols to use for this instance rather than the global symbols. @constructor @struct @final
[ "Constructs", "a", "DateIntervalFormat", "object", "based", "on", "the", "current", "locale", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/i18n/dateintervalformat.js#L80-L153
425
SeleniumHQ/selenium
third_party/closure/goog/i18n/dateintervalformat.js
function( firstPattern, secondPattern, dateTimeSymbols, useFirstDateOnFirstPattern) { /** * Formatter_ to format the first part of the date interval. * @private {!DateTimeFormat} */ this.firstPartFormatter_ = new DateTimeFormat(firstPattern, dateTimeSymbols); /** * Formatter_ to format the second part of the date interval. * @private {!DateTimeFormat} */ this.secondPartFormatter_ = new DateTimeFormat(secondPattern, dateTimeSymbols); /** * Specifies if the first or the second date should be formatted by the * formatter of the first or second part of the date interval. * @private {boolean} */ this.useFirstDateOnFirstPattern_ = useFirstDateOnFirstPattern; }
javascript
function( firstPattern, secondPattern, dateTimeSymbols, useFirstDateOnFirstPattern) { /** * Formatter_ to format the first part of the date interval. * @private {!DateTimeFormat} */ this.firstPartFormatter_ = new DateTimeFormat(firstPattern, dateTimeSymbols); /** * Formatter_ to format the second part of the date interval. * @private {!DateTimeFormat} */ this.secondPartFormatter_ = new DateTimeFormat(secondPattern, dateTimeSymbols); /** * Specifies if the first or the second date should be formatted by the * formatter of the first or second part of the date interval. * @private {boolean} */ this.useFirstDateOnFirstPattern_ = useFirstDateOnFirstPattern; }
[ "function", "(", "firstPattern", ",", "secondPattern", ",", "dateTimeSymbols", ",", "useFirstDateOnFirstPattern", ")", "{", "/**\n * Formatter_ to format the first part of the date interval.\n * @private {!DateTimeFormat}\n */", "this", ".", "firstPartFormatter_", "=", "new", "DateTimeFormat", "(", "firstPattern", ",", "dateTimeSymbols", ")", ";", "/**\n * Formatter_ to format the second part of the date interval.\n * @private {!DateTimeFormat}\n */", "this", ".", "secondPartFormatter_", "=", "new", "DateTimeFormat", "(", "secondPattern", ",", "dateTimeSymbols", ")", ";", "/**\n * Specifies if the first or the second date should be formatted by the\n * formatter of the first or second part of the date interval.\n * @private {boolean}\n */", "this", ".", "useFirstDateOnFirstPattern_", "=", "useFirstDateOnFirstPattern", ";", "}" ]
Constructs an IntervalFormatter_ object which implements the Formatter_ interface. Internal object to construct and store a goog.i18n.DateTimeFormat for each part of the date interval pattern. @param {string} firstPattern First part of the date interval pattern. @param {string} secondPattern Second part of the date interval pattern. @param {!DateTimeSymbolsType} dateTimeSymbols Symbols to use with the datetime formatters. @param {boolean} useFirstDateOnFirstPattern Indicates if the first or the second date should be formatted with the first or second part of the date interval pattern. @constructor @implements {Formatter_} @private
[ "Constructs", "an", "IntervalFormatter_", "object", "which", "implements", "the", "Formatter_", "interface", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/i18n/dateintervalformat.js#L556-L577
426
SeleniumHQ/selenium
third_party/closure/goog/i18n/dateintervalformat.js
function( dateTimePattern, fallbackPattern, dateTimeSymbols) { /** * Date time pattern used to format the dates. * @private {string} */ this.dateTimePattern_ = dateTimePattern; /** * Date time formatter used to format the dates. * @private {!DateTimeFormat} */ this.dateTimeFormatter_ = new DateTimeFormat(dateTimePattern, dateTimeSymbols); /** * Fallback interval pattern. * @private {string} */ this.fallbackPattern_ = fallbackPattern; }
javascript
function( dateTimePattern, fallbackPattern, dateTimeSymbols) { /** * Date time pattern used to format the dates. * @private {string} */ this.dateTimePattern_ = dateTimePattern; /** * Date time formatter used to format the dates. * @private {!DateTimeFormat} */ this.dateTimeFormatter_ = new DateTimeFormat(dateTimePattern, dateTimeSymbols); /** * Fallback interval pattern. * @private {string} */ this.fallbackPattern_ = fallbackPattern; }
[ "function", "(", "dateTimePattern", ",", "fallbackPattern", ",", "dateTimeSymbols", ")", "{", "/**\n * Date time pattern used to format the dates.\n * @private {string}\n */", "this", ".", "dateTimePattern_", "=", "dateTimePattern", ";", "/**\n * Date time formatter used to format the dates.\n * @private {!DateTimeFormat}\n */", "this", ".", "dateTimeFormatter_", "=", "new", "DateTimeFormat", "(", "dateTimePattern", ",", "dateTimeSymbols", ")", ";", "/**\n * Fallback interval pattern.\n * @private {string}\n */", "this", ".", "fallbackPattern_", "=", "fallbackPattern", ";", "}" ]
Constructs a DateTimeFormatter_ object which implements the Formatter_ interface. Internal object to construct and store a goog.i18n.DateTimeFormat for the a datetime pattern and formats dates using the fallback interval pattern (e.g. '{0} – {1}'). @param {string} dateTimePattern Datetime pattern used to format the dates. @param {string} fallbackPattern Fallback interval pattern to be used with the datetime pattern. @param {!DateTimeSymbolsType} dateTimeSymbols Symbols to use with the datetime format. @constructor @implements {Formatter_} @private
[ "Constructs", "a", "DateTimeFormatter_", "object", "which", "implements", "the", "Formatter_", "interface", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/i18n/dateintervalformat.js#L608-L628
427
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/capabilities.js
toMap
function toMap(hash) { let m = new Map; for (let key in hash) { if (hash.hasOwnProperty(key)) { m.set(key, hash[key]); } } return m; }
javascript
function toMap(hash) { let m = new Map; for (let key in hash) { if (hash.hasOwnProperty(key)) { m.set(key, hash[key]); } } return m; }
[ "function", "toMap", "(", "hash", ")", "{", "let", "m", "=", "new", "Map", ";", "for", "(", "let", "key", "in", "hash", ")", "{", "if", "(", "hash", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "m", ".", "set", "(", "key", ",", "hash", "[", "key", "]", ")", ";", "}", "}", "return", "m", ";", "}" ]
Converts a generic hash object to a map. @param {!Object<string, ?>} hash The hash object. @return {!Map<string, ?>} The converted map.
[ "Converts", "a", "generic", "hash", "object", "to", "a", "map", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/capabilities.js#L223-L231
428
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
preferencesDialog_close
function preferencesDialog_close(saveChanges) { saveChanges = (saveChanges == undefined) ? false : saveChanges; var button = this.getElement({type: "button", subtype: (saveChanges ? "accept" : "cancel")}); this._controller.click(button); }
javascript
function preferencesDialog_close(saveChanges) { saveChanges = (saveChanges == undefined) ? false : saveChanges; var button = this.getElement({type: "button", subtype: (saveChanges ? "accept" : "cancel")}); this._controller.click(button); }
[ "function", "preferencesDialog_close", "(", "saveChanges", ")", "{", "saveChanges", "=", "(", "saveChanges", "==", "undefined", ")", "?", "false", ":", "saveChanges", ";", "var", "button", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"button\"", ",", "subtype", ":", "(", "saveChanges", "?", "\"accept\"", ":", "\"cancel\"", ")", "}", ")", ";", "this", ".", "_controller", ".", "click", "(", "button", ")", ";", "}" ]
Close the engine manager @param {MozMillController} controller MozMillController of the window to operate on @param {boolean} saveChanges (Optional) If true the OK button is clicked otherwise Cancel
[ "Close", "the", "engine", "manager" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L202-L207
429
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
engineManager_editKeyword
function engineManager_editKeyword(name, handler) { // Select the search engine this.selectedEngine = name; // Setup the modal dialog handler md = new modalDialog.modalDialog(this._controller.window); md.start(handler); var button = this.getElement({type: "engine_button", subtype: "edit"}); this._controller.click(button); md.waitForDialog(); }
javascript
function engineManager_editKeyword(name, handler) { // Select the search engine this.selectedEngine = name; // Setup the modal dialog handler md = new modalDialog.modalDialog(this._controller.window); md.start(handler); var button = this.getElement({type: "engine_button", subtype: "edit"}); this._controller.click(button); md.waitForDialog(); }
[ "function", "engineManager_editKeyword", "(", "name", ",", "handler", ")", "{", "// Select the search engine", "this", ".", "selectedEngine", "=", "name", ";", "// Setup the modal dialog handler", "md", "=", "new", "modalDialog", ".", "modalDialog", "(", "this", ".", "_controller", ".", "window", ")", ";", "md", ".", "start", "(", "handler", ")", ";", "var", "button", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"engine_button\"", ",", "subtype", ":", "\"edit\"", "}", ")", ";", "this", ".", "_controller", ".", "click", "(", "button", ")", ";", "md", ".", "waitForDialog", "(", ")", ";", "}" ]
Edit the keyword associated to a search engine @param {string} name Name of the engine to remove @param {function} handler Callback function for Engine Manager
[ "Edit", "the", "keyword", "associated", "to", "a", "search", "engine" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L217-L229
430
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
engineManager_moveUpEngine
function engineManager_moveUpEngine(name) { this.selectedEngine = name; var index = this.selectedIndex; var button = this.getElement({type: "engine_button", subtype: "up"}); this._controller.click(button); this._controller.waitForEval("subject.manager.selectedIndex == subject.oldIndex - 1", TIMEOUT, 100, {manager: this, oldIndex: index}); }
javascript
function engineManager_moveUpEngine(name) { this.selectedEngine = name; var index = this.selectedIndex; var button = this.getElement({type: "engine_button", subtype: "up"}); this._controller.click(button); this._controller.waitForEval("subject.manager.selectedIndex == subject.oldIndex - 1", TIMEOUT, 100, {manager: this, oldIndex: index}); }
[ "function", "engineManager_moveUpEngine", "(", "name", ")", "{", "this", ".", "selectedEngine", "=", "name", ";", "var", "index", "=", "this", ".", "selectedIndex", ";", "var", "button", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"engine_button\"", ",", "subtype", ":", "\"up\"", "}", ")", ";", "this", ".", "_controller", ".", "click", "(", "button", ")", ";", "this", ".", "_controller", ".", "waitForEval", "(", "\"subject.manager.selectedIndex == subject.oldIndex - 1\"", ",", "TIMEOUT", ",", "100", ",", "{", "manager", ":", "this", ",", "oldIndex", ":", "index", "}", ")", ";", "}" ]
Move up the engine with the given name @param {string} name Name of the engine to remove
[ "Move", "up", "the", "engine", "with", "the", "given", "name" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L328-L337
431
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
engineManager_removeEngine
function engineManager_removeEngine(name) { this.selectedEngine = name; var button = this.getElement({type: "engine_button", subtype: "remove"}); this._controller.click(button); this._controller.waitForEval("subject.manager.selectedEngine != subject.removedEngine", TIMEOUT, 100, {manager: this, removedEngine: name}); }
javascript
function engineManager_removeEngine(name) { this.selectedEngine = name; var button = this.getElement({type: "engine_button", subtype: "remove"}); this._controller.click(button); this._controller.waitForEval("subject.manager.selectedEngine != subject.removedEngine", TIMEOUT, 100, {manager: this, removedEngine: name}); }
[ "function", "engineManager_removeEngine", "(", "name", ")", "{", "this", ".", "selectedEngine", "=", "name", ";", "var", "button", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"engine_button\"", ",", "subtype", ":", "\"remove\"", "}", ")", ";", "this", ".", "_controller", ".", "click", "(", "button", ")", ";", "this", ".", "_controller", ".", "waitForEval", "(", "\"subject.manager.selectedEngine != subject.removedEngine\"", ",", "TIMEOUT", ",", "100", ",", "{", "manager", ":", "this", ",", "removedEngine", ":", "name", "}", ")", ";", "}" ]
Remove the engine with the given name @param {string} name Name of the engine to remove
[ "Remove", "the", "engine", "with", "the", "given", "name" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L345-L353
432
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
searchBar_checkSearchResultPage
function searchBar_checkSearchResultPage(searchTerm) { // Retrieve the URL which is used for the currently selected search engine var targetUrl = this._bss.currentEngine.getSubmission(searchTerm, null).uri; var currentUrl = this._controller.tabs.activeTabWindow.document.location.href; // Check if pure domain names are identical var domainName = targetUrl.host.replace(/.+\.(\w+)\.\w+$/gi, "$1"); var index = currentUrl.indexOf(domainName); this._controller.assertJS("subject.URLContainsDomain == true", {URLContainsDomain: currentUrl.indexOf(domainName) != -1}); // Check if search term is listed in URL this._controller.assertJS("subject.URLContainsText == true", {URLContainsText: currentUrl.toLowerCase().indexOf(searchTerm.toLowerCase()) != -1}); }
javascript
function searchBar_checkSearchResultPage(searchTerm) { // Retrieve the URL which is used for the currently selected search engine var targetUrl = this._bss.currentEngine.getSubmission(searchTerm, null).uri; var currentUrl = this._controller.tabs.activeTabWindow.document.location.href; // Check if pure domain names are identical var domainName = targetUrl.host.replace(/.+\.(\w+)\.\w+$/gi, "$1"); var index = currentUrl.indexOf(domainName); this._controller.assertJS("subject.URLContainsDomain == true", {URLContainsDomain: currentUrl.indexOf(domainName) != -1}); // Check if search term is listed in URL this._controller.assertJS("subject.URLContainsText == true", {URLContainsText: currentUrl.toLowerCase().indexOf(searchTerm.toLowerCase()) != -1}); }
[ "function", "searchBar_checkSearchResultPage", "(", "searchTerm", ")", "{", "// Retrieve the URL which is used for the currently selected search engine", "var", "targetUrl", "=", "this", ".", "_bss", ".", "currentEngine", ".", "getSubmission", "(", "searchTerm", ",", "null", ")", ".", "uri", ";", "var", "currentUrl", "=", "this", ".", "_controller", ".", "tabs", ".", "activeTabWindow", ".", "document", ".", "location", ".", "href", ";", "// Check if pure domain names are identical", "var", "domainName", "=", "targetUrl", ".", "host", ".", "replace", "(", "/", ".+\\.(\\w+)\\.\\w+$", "/", "gi", ",", "\"$1\"", ")", ";", "var", "index", "=", "currentUrl", ".", "indexOf", "(", "domainName", ")", ";", "this", ".", "_controller", ".", "assertJS", "(", "\"subject.URLContainsDomain == true\"", ",", "{", "URLContainsDomain", ":", "currentUrl", ".", "indexOf", "(", "domainName", ")", "!=", "-", "1", "}", ")", ";", "// Check if search term is listed in URL", "this", ".", "_controller", ".", "assertJS", "(", "\"subject.URLContainsText == true\"", ",", "{", "URLContainsText", ":", "currentUrl", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "searchTerm", ".", "toLowerCase", "(", ")", ")", "!=", "-", "1", "}", ")", ";", "}" ]
Checks if the correct target URL has been opened for the search @param {string} searchTerm Text which should be checked for
[ "Checks", "if", "the", "correct", "target", "URL", "has", "been", "opened", "for", "the", "search" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L513-L528
433
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
searchBar_clear
function searchBar_clear() { var activeElement = this._controller.window.document.activeElement; var searchInput = this.getElement({type: "searchBar_input"}); var cmdKey = utils.getEntity(this.getDtds(), "selectAllCmd.key"); this._controller.keypress(searchInput, cmdKey, {accelKey: true}); this._controller.keypress(searchInput, 'VK_DELETE', {}); if (activeElement) activeElement.focus(); }
javascript
function searchBar_clear() { var activeElement = this._controller.window.document.activeElement; var searchInput = this.getElement({type: "searchBar_input"}); var cmdKey = utils.getEntity(this.getDtds(), "selectAllCmd.key"); this._controller.keypress(searchInput, cmdKey, {accelKey: true}); this._controller.keypress(searchInput, 'VK_DELETE', {}); if (activeElement) activeElement.focus(); }
[ "function", "searchBar_clear", "(", ")", "{", "var", "activeElement", "=", "this", ".", "_controller", ".", "window", ".", "document", ".", "activeElement", ";", "var", "searchInput", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"searchBar_input\"", "}", ")", ";", "var", "cmdKey", "=", "utils", ".", "getEntity", "(", "this", ".", "getDtds", "(", ")", ",", "\"selectAllCmd.key\"", ")", ";", "this", ".", "_controller", ".", "keypress", "(", "searchInput", ",", "cmdKey", ",", "{", "accelKey", ":", "true", "}", ")", ";", "this", ".", "_controller", ".", "keypress", "(", "searchInput", ",", "'VK_DELETE'", ",", "{", "}", ")", ";", "if", "(", "activeElement", ")", "activeElement", ".", "focus", "(", ")", ";", "}" ]
Clear the search field
[ "Clear", "the", "search", "field" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L533-L544
434
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
searchBar_focus
function searchBar_focus(event) { var input = this.getElement({type: "searchBar_input"}); switch (event.type) { case "click": this._controller.click(input); break; case "shortcut": if (mozmill.isLinux) { var cmdKey = utils.getEntity(this.getDtds(), "searchFocusUnix.commandkey"); } else { var cmdKey = utils.getEntity(this.getDtds(), "searchFocus.commandkey"); } this._controller.keypress(null, cmdKey, {accelKey: true}); break; default: throw new Error(arguments.callee.name + ": Unknown element type - " + event.type); } // Check if the search bar has the focus var activeElement = this._controller.window.document.activeElement; this._controller.assertJS("subject.isFocused == true", {isFocused: input.getNode() == activeElement}); }
javascript
function searchBar_focus(event) { var input = this.getElement({type: "searchBar_input"}); switch (event.type) { case "click": this._controller.click(input); break; case "shortcut": if (mozmill.isLinux) { var cmdKey = utils.getEntity(this.getDtds(), "searchFocusUnix.commandkey"); } else { var cmdKey = utils.getEntity(this.getDtds(), "searchFocus.commandkey"); } this._controller.keypress(null, cmdKey, {accelKey: true}); break; default: throw new Error(arguments.callee.name + ": Unknown element type - " + event.type); } // Check if the search bar has the focus var activeElement = this._controller.window.document.activeElement; this._controller.assertJS("subject.isFocused == true", {isFocused: input.getNode() == activeElement}); }
[ "function", "searchBar_focus", "(", "event", ")", "{", "var", "input", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"searchBar_input\"", "}", ")", ";", "switch", "(", "event", ".", "type", ")", "{", "case", "\"click\"", ":", "this", ".", "_controller", ".", "click", "(", "input", ")", ";", "break", ";", "case", "\"shortcut\"", ":", "if", "(", "mozmill", ".", "isLinux", ")", "{", "var", "cmdKey", "=", "utils", ".", "getEntity", "(", "this", ".", "getDtds", "(", ")", ",", "\"searchFocusUnix.commandkey\"", ")", ";", "}", "else", "{", "var", "cmdKey", "=", "utils", ".", "getEntity", "(", "this", ".", "getDtds", "(", ")", ",", "\"searchFocus.commandkey\"", ")", ";", "}", "this", ".", "_controller", ".", "keypress", "(", "null", ",", "cmdKey", ",", "{", "accelKey", ":", "true", "}", ")", ";", "break", ";", "default", ":", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Unknown element type - \"", "+", "event", ".", "type", ")", ";", "}", "// Check if the search bar has the focus", "var", "activeElement", "=", "this", ".", "_controller", ".", "window", ".", "document", ".", "activeElement", ";", "this", ".", "_controller", ".", "assertJS", "(", "\"subject.isFocused == true\"", ",", "{", "isFocused", ":", "input", ".", "getNode", "(", ")", "==", "activeElement", "}", ")", ";", "}" ]
Focus the search bar text field @param {object} event Specifies the event which has to be used to focus the search bar
[ "Focus", "the", "search", "bar", "text", "field" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L552-L576
435
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
function(searchTerm) { var suggestions = [ ]; var popup = this.getElement({type: "searchBar_autoCompletePopup"}); var treeElem = this.getElement({type: "searchBar_suggestions"}); // Enter search term and wait for the popup this.type(searchTerm); this._controller.waitForEval("subject.popup.state == 'open'", TIMEOUT, 100, {popup: popup.getNode()}); this._controller.waitForElement(treeElem, TIMEOUT); // Get all suggestions var tree = treeElem.getNode(); this._controller.waitForEval("subject.tree.view != null", TIMEOUT, 100, {tree: tree}); for (var i = 0; i < tree.view.rowCount; i ++) { suggestions.push(tree.view.getCellText(i, tree.columns.getColumnAt(0))); } // Close auto-complete popup this._controller.keypress(popup, "VK_ESCAPE", {}); this._controller.waitForEval("subject.popup.state == 'closed'", TIMEOUT, 100, {popup: popup.getNode()}); return suggestions; }
javascript
function(searchTerm) { var suggestions = [ ]; var popup = this.getElement({type: "searchBar_autoCompletePopup"}); var treeElem = this.getElement({type: "searchBar_suggestions"}); // Enter search term and wait for the popup this.type(searchTerm); this._controller.waitForEval("subject.popup.state == 'open'", TIMEOUT, 100, {popup: popup.getNode()}); this._controller.waitForElement(treeElem, TIMEOUT); // Get all suggestions var tree = treeElem.getNode(); this._controller.waitForEval("subject.tree.view != null", TIMEOUT, 100, {tree: tree}); for (var i = 0; i < tree.view.rowCount; i ++) { suggestions.push(tree.view.getCellText(i, tree.columns.getColumnAt(0))); } // Close auto-complete popup this._controller.keypress(popup, "VK_ESCAPE", {}); this._controller.waitForEval("subject.popup.state == 'closed'", TIMEOUT, 100, {popup: popup.getNode()}); return suggestions; }
[ "function", "(", "searchTerm", ")", "{", "var", "suggestions", "=", "[", "]", ";", "var", "popup", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"searchBar_autoCompletePopup\"", "}", ")", ";", "var", "treeElem", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"searchBar_suggestions\"", "}", ")", ";", "// Enter search term and wait for the popup", "this", ".", "type", "(", "searchTerm", ")", ";", "this", ".", "_controller", ".", "waitForEval", "(", "\"subject.popup.state == 'open'\"", ",", "TIMEOUT", ",", "100", ",", "{", "popup", ":", "popup", ".", "getNode", "(", ")", "}", ")", ";", "this", ".", "_controller", ".", "waitForElement", "(", "treeElem", ",", "TIMEOUT", ")", ";", "// Get all suggestions", "var", "tree", "=", "treeElem", ".", "getNode", "(", ")", ";", "this", ".", "_controller", ".", "waitForEval", "(", "\"subject.tree.view != null\"", ",", "TIMEOUT", ",", "100", ",", "{", "tree", ":", "tree", "}", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "tree", ".", "view", ".", "rowCount", ";", "i", "++", ")", "{", "suggestions", ".", "push", "(", "tree", ".", "view", ".", "getCellText", "(", "i", ",", "tree", ".", "columns", ".", "getColumnAt", "(", "0", ")", ")", ")", ";", "}", "// Close auto-complete popup", "this", ".", "_controller", ".", "keypress", "(", "popup", ",", "\"VK_ESCAPE\"", ",", "{", "}", ")", ";", "this", ".", "_controller", ".", "waitForEval", "(", "\"subject.popup.state == 'closed'\"", ",", "TIMEOUT", ",", "100", ",", "{", "popup", ":", "popup", ".", "getNode", "(", ")", "}", ")", ";", "return", "suggestions", ";", "}" ]
Returns the search suggestions for the search term
[ "Returns", "the", "search", "suggestions", "for", "the", "search", "term" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L674-L700
436
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
searchBar_openEngineManager
function searchBar_openEngineManager(handler) { this.enginesDropDownOpen = true; var engineManager = this.getElement({type: "engine_manager"}); // Setup the modal dialog handler md = new modalDialog.modalDialog(this._controller.window); md.start(handler); // XXX: Bug 555347 - Process any outstanding events before clicking the entry this._controller.sleep(0); this._controller.click(engineManager); md.waitForDialog(); this._controller.assert(function () { return this.enginesDropDownOpen == false; }, "The search engine drop down menu has been closed", this); }
javascript
function searchBar_openEngineManager(handler) { this.enginesDropDownOpen = true; var engineManager = this.getElement({type: "engine_manager"}); // Setup the modal dialog handler md = new modalDialog.modalDialog(this._controller.window); md.start(handler); // XXX: Bug 555347 - Process any outstanding events before clicking the entry this._controller.sleep(0); this._controller.click(engineManager); md.waitForDialog(); this._controller.assert(function () { return this.enginesDropDownOpen == false; }, "The search engine drop down menu has been closed", this); }
[ "function", "searchBar_openEngineManager", "(", "handler", ")", "{", "this", ".", "enginesDropDownOpen", "=", "true", ";", "var", "engineManager", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"engine_manager\"", "}", ")", ";", "// Setup the modal dialog handler", "md", "=", "new", "modalDialog", ".", "modalDialog", "(", "this", ".", "_controller", ".", "window", ")", ";", "md", ".", "start", "(", "handler", ")", ";", "// XXX: Bug 555347 - Process any outstanding events before clicking the entry", "this", ".", "_controller", ".", "sleep", "(", "0", ")", ";", "this", ".", "_controller", ".", "click", "(", "engineManager", ")", ";", "md", ".", "waitForDialog", "(", ")", ";", "this", ".", "_controller", ".", "assert", "(", "function", "(", ")", "{", "return", "this", ".", "enginesDropDownOpen", "==", "false", ";", "}", ",", "\"The search engine drop down menu has been closed\"", ",", "this", ")", ";", "}" ]
Open the Engine Manager @param {function} handler Callback function for Engine Manager
[ "Open", "the", "Engine", "Manager" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L720-L737
437
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
searchBar_search
function searchBar_search(data) { var searchBar = this.getElement({type: "searchBar"}); this.type(data.text); switch (data.action) { case "returnKey": this._controller.keypress(searchBar, 'VK_RETURN', {}); break; case "goButton": default: this._controller.click(this.getElement({type: "searchBar_goButton"})); break; } this._controller.waitForPageLoad(); this.checkSearchResultPage(data.text); }
javascript
function searchBar_search(data) { var searchBar = this.getElement({type: "searchBar"}); this.type(data.text); switch (data.action) { case "returnKey": this._controller.keypress(searchBar, 'VK_RETURN', {}); break; case "goButton": default: this._controller.click(this.getElement({type: "searchBar_goButton"})); break; } this._controller.waitForPageLoad(); this.checkSearchResultPage(data.text); }
[ "function", "searchBar_search", "(", "data", ")", "{", "var", "searchBar", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"searchBar\"", "}", ")", ";", "this", ".", "type", "(", "data", ".", "text", ")", ";", "switch", "(", "data", ".", "action", ")", "{", "case", "\"returnKey\"", ":", "this", ".", "_controller", ".", "keypress", "(", "searchBar", ",", "'VK_RETURN'", ",", "{", "}", ")", ";", "break", ";", "case", "\"goButton\"", ":", "default", ":", "this", ".", "_controller", ".", "click", "(", "this", ".", "getElement", "(", "{", "type", ":", "\"searchBar_goButton\"", "}", ")", ")", ";", "break", ";", "}", "this", ".", "_controller", ".", "waitForPageLoad", "(", ")", ";", "this", ".", "checkSearchResultPage", "(", "data", ".", "text", ")", ";", "}" ]
Start a search with the given search term and check if the resulting URL contains the search term. @param {object} data Object which contains the search term and the action type
[ "Start", "a", "search", "with", "the", "given", "search", "term", "and", "check", "if", "the", "resulting", "URL", "contains", "the", "search", "term", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L783-L800
438
SeleniumHQ/selenium
javascript/selenium-core/xpath/dom.js
XNode
function XNode(type, name, opt_value, opt_owner) { this.attributes = []; this.childNodes = []; XNode.init.call(this, type, name, opt_value, opt_owner); }
javascript
function XNode(type, name, opt_value, opt_owner) { this.attributes = []; this.childNodes = []; XNode.init.call(this, type, name, opt_value, opt_owner); }
[ "function", "XNode", "(", "type", ",", "name", ",", "opt_value", ",", "opt_owner", ")", "{", "this", ".", "attributes", "=", "[", "]", ";", "this", ".", "childNodes", "=", "[", "]", ";", "XNode", ".", "init", ".", "call", "(", "this", ",", "type", ",", "name", ",", "opt_value", ",", "opt_owner", ")", ";", "}" ]
Our W3C DOM Node implementation. Note we call it XNode because we can't define the identifier Node. We do this mostly for Opera, where we can't reuse the HTML DOM for parsing our own XML, and for Safari, where it is too expensive to have the template processor operate on native DOM nodes.
[ "Our", "W3C", "DOM", "Node", "implementation", ".", "Note", "we", "call", "it", "XNode", "because", "we", "can", "t", "define", "the", "identifier", "Node", ".", "We", "do", "this", "mostly", "for", "Opera", "where", "we", "can", "t", "reuse", "the", "HTML", "DOM", "for", "parsing", "our", "own", "XML", "and", "for", "Safari", "where", "it", "is", "too", "expensive", "to", "have", "the", "template", "processor", "operate", "on", "native", "DOM", "nodes", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/dom.js#L265-L270
439
SeleniumHQ/selenium
third_party/closure/goog/base.js
addNewerLanguageTranspilationCheck
function addNewerLanguageTranspilationCheck(modeName, isSupported) { if (transpilationRequiredForAllLaterModes) { requiresTranspilation[modeName] = true; } else if (isSupported()) { requiresTranspilation[modeName] = false; } else { requiresTranspilation[modeName] = true; transpilationRequiredForAllLaterModes = true; } }
javascript
function addNewerLanguageTranspilationCheck(modeName, isSupported) { if (transpilationRequiredForAllLaterModes) { requiresTranspilation[modeName] = true; } else if (isSupported()) { requiresTranspilation[modeName] = false; } else { requiresTranspilation[modeName] = true; transpilationRequiredForAllLaterModes = true; } }
[ "function", "addNewerLanguageTranspilationCheck", "(", "modeName", ",", "isSupported", ")", "{", "if", "(", "transpilationRequiredForAllLaterModes", ")", "{", "requiresTranspilation", "[", "modeName", "]", "=", "true", ";", "}", "else", "if", "(", "isSupported", "(", ")", ")", "{", "requiresTranspilation", "[", "modeName", "]", "=", "false", ";", "}", "else", "{", "requiresTranspilation", "[", "modeName", "]", "=", "true", ";", "transpilationRequiredForAllLaterModes", "=", "true", ";", "}", "}" ]
Adds an entry to requiresTranspliation for the given language mode. IMPORTANT: Calls must be made in order from oldest to newest language mode. @param {string} modeName @param {function(): boolean} isSupported Returns true if the JS engine supports the given mode.
[ "Adds", "an", "entry", "to", "requiresTranspliation", "for", "the", "given", "language", "mode", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/base.js#L2853-L2862
440
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/widgets.js
clickTreeCell
function clickTreeCell(controller, tree, rowIndex, columnIndex, eventDetails) { tree = tree.getNode(); var selection = tree.view.selection; selection.select(rowIndex); tree.treeBoxObject.ensureRowIsVisible(rowIndex); // get cell coordinates var x = {}, y = {}, width = {}, height = {}; var column = tree.columns[columnIndex]; tree.treeBoxObject.getCoordsForCellItem(rowIndex, column, "text", x, y, width, height); controller.sleep(0); EventUtils.synthesizeMouse(tree.body, x.value + 4, y.value + 4, eventDetails, tree.ownerDocument.defaultView); controller.sleep(0); }
javascript
function clickTreeCell(controller, tree, rowIndex, columnIndex, eventDetails) { tree = tree.getNode(); var selection = tree.view.selection; selection.select(rowIndex); tree.treeBoxObject.ensureRowIsVisible(rowIndex); // get cell coordinates var x = {}, y = {}, width = {}, height = {}; var column = tree.columns[columnIndex]; tree.treeBoxObject.getCoordsForCellItem(rowIndex, column, "text", x, y, width, height); controller.sleep(0); EventUtils.synthesizeMouse(tree.body, x.value + 4, y.value + 4, eventDetails, tree.ownerDocument.defaultView); controller.sleep(0); }
[ "function", "clickTreeCell", "(", "controller", ",", "tree", ",", "rowIndex", ",", "columnIndex", ",", "eventDetails", ")", "{", "tree", "=", "tree", ".", "getNode", "(", ")", ";", "var", "selection", "=", "tree", ".", "view", ".", "selection", ";", "selection", ".", "select", "(", "rowIndex", ")", ";", "tree", ".", "treeBoxObject", ".", "ensureRowIsVisible", "(", "rowIndex", ")", ";", "// get cell coordinates", "var", "x", "=", "{", "}", ",", "y", "=", "{", "}", ",", "width", "=", "{", "}", ",", "height", "=", "{", "}", ";", "var", "column", "=", "tree", ".", "columns", "[", "columnIndex", "]", ";", "tree", ".", "treeBoxObject", ".", "getCoordsForCellItem", "(", "rowIndex", ",", "column", ",", "\"text\"", ",", "x", ",", "y", ",", "width", ",", "height", ")", ";", "controller", ".", "sleep", "(", "0", ")", ";", "EventUtils", ".", "synthesizeMouse", "(", "tree", ".", "body", ",", "x", ".", "value", "+", "4", ",", "y", ".", "value", "+", "4", ",", "eventDetails", ",", "tree", ".", "ownerDocument", ".", "defaultView", ")", ";", "controller", ".", "sleep", "(", "0", ")", ";", "}" ]
Click the specified tree cell @param {MozMillController} controller MozMillController of the browser window to operate on @param {tree} tree Tree to operate on @param {number } rowIndex Index of the row @param {number} columnIndex Index of the column @param {object} eventDetails Details about the mouse event
[ "Click", "the", "specified", "tree", "cell" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/widgets.js#L61-L79
441
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/software-update.js
softwareUpdate
function softwareUpdate() { this._controller = null; this._wizard = null; this._aus = Cc["@mozilla.org/updates/update-service;1"]. getService(Ci.nsIApplicationUpdateService); this._ums = Cc["@mozilla.org/updates/update-manager;1"]. getService(Ci.nsIUpdateManager); this._vc = Cc["@mozilla.org/xpcom/version-comparator;1"]. getService(Ci.nsIVersionComparator); }
javascript
function softwareUpdate() { this._controller = null; this._wizard = null; this._aus = Cc["@mozilla.org/updates/update-service;1"]. getService(Ci.nsIApplicationUpdateService); this._ums = Cc["@mozilla.org/updates/update-manager;1"]. getService(Ci.nsIUpdateManager); this._vc = Cc["@mozilla.org/xpcom/version-comparator;1"]. getService(Ci.nsIVersionComparator); }
[ "function", "softwareUpdate", "(", ")", "{", "this", ".", "_controller", "=", "null", ";", "this", ".", "_wizard", "=", "null", ";", "this", ".", "_aus", "=", "Cc", "[", "\"@mozilla.org/updates/update-service;1\"", "]", ".", "getService", "(", "Ci", ".", "nsIApplicationUpdateService", ")", ";", "this", ".", "_ums", "=", "Cc", "[", "\"@mozilla.org/updates/update-manager;1\"", "]", ".", "getService", "(", "Ci", ".", "nsIUpdateManager", ")", ";", "this", ".", "_vc", "=", "Cc", "[", "\"@mozilla.org/xpcom/version-comparator;1\"", "]", ".", "getService", "(", "Ci", ".", "nsIVersionComparator", ")", ";", "}" ]
Constructor for software update class
[ "Constructor", "for", "software", "update", "class" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/software-update.js#L101-L111
442
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/software-update.js
softwareUpdate_assertUpdateApplied
function softwareUpdate_assertUpdateApplied(updateData) { // Get the information from the last update var info = updateData.updates[updateData.updateIndex]; // The upgraded version should be identical with the version given by // the update and we shouldn't have run a downgrade var check = this._vc.compare(info.build_post.version, info.build_pre.version); this._controller.assert(function() { return check >= 0; }, "The version number of the upgraded build is higher or equal."); // The build id should be identical with the one from the update this._controller.assert(function() { return info.build_post.buildid == info.patch.buildid; }, "The build id is equal to the build id of the update."); // An upgrade should not change the builds locale this._controller.assert(function() { return info.build_post.locale == info.build_pre.locale; }, "The locale of the updated build is identical to the original locale."); }
javascript
function softwareUpdate_assertUpdateApplied(updateData) { // Get the information from the last update var info = updateData.updates[updateData.updateIndex]; // The upgraded version should be identical with the version given by // the update and we shouldn't have run a downgrade var check = this._vc.compare(info.build_post.version, info.build_pre.version); this._controller.assert(function() { return check >= 0; }, "The version number of the upgraded build is higher or equal."); // The build id should be identical with the one from the update this._controller.assert(function() { return info.build_post.buildid == info.patch.buildid; }, "The build id is equal to the build id of the update."); // An upgrade should not change the builds locale this._controller.assert(function() { return info.build_post.locale == info.build_pre.locale; }, "The locale of the updated build is identical to the original locale."); }
[ "function", "softwareUpdate_assertUpdateApplied", "(", "updateData", ")", "{", "// Get the information from the last update", "var", "info", "=", "updateData", ".", "updates", "[", "updateData", ".", "updateIndex", "]", ";", "// The upgraded version should be identical with the version given by", "// the update and we shouldn't have run a downgrade", "var", "check", "=", "this", ".", "_vc", ".", "compare", "(", "info", ".", "build_post", ".", "version", ",", "info", ".", "build_pre", ".", "version", ")", ";", "this", ".", "_controller", ".", "assert", "(", "function", "(", ")", "{", "return", "check", ">=", "0", ";", "}", ",", "\"The version number of the upgraded build is higher or equal.\"", ")", ";", "// The build id should be identical with the one from the update", "this", ".", "_controller", ".", "assert", "(", "function", "(", ")", "{", "return", "info", ".", "build_post", ".", "buildid", "==", "info", ".", "patch", ".", "buildid", ";", "}", ",", "\"The build id is equal to the build id of the update.\"", ")", ";", "// An upgrade should not change the builds locale", "this", ".", "_controller", ".", "assert", "(", "function", "(", ")", "{", "return", "info", ".", "build_post", ".", "locale", "==", "info", ".", "build_pre", ".", "locale", ";", "}", ",", "\"The locale of the updated build is identical to the original locale.\"", ")", ";", "}" ]
Checks if an update has been applied correctly @param {object} updateData All the data collected during the update process
[ "Checks", "if", "an", "update", "has", "been", "applied", "correctly" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/software-update.js#L242-L262
443
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/software-update.js
softwareUpdate_closeDialog
function softwareUpdate_closeDialog() { if (this._controller) { this._controller.keypress(null, "VK_ESCAPE", {}); this._controller.sleep(500); this._controller = null; this._wizard = null; } }
javascript
function softwareUpdate_closeDialog() { if (this._controller) { this._controller.keypress(null, "VK_ESCAPE", {}); this._controller.sleep(500); this._controller = null; this._wizard = null; } }
[ "function", "softwareUpdate_closeDialog", "(", ")", "{", "if", "(", "this", ".", "_controller", ")", "{", "this", ".", "_controller", ".", "keypress", "(", "null", ",", "\"VK_ESCAPE\"", ",", "{", "}", ")", ";", "this", ".", "_controller", ".", "sleep", "(", "500", ")", ";", "this", ".", "_controller", "=", "null", ";", "this", ".", "_wizard", "=", "null", ";", "}", "}" ]
Close the software update dialog
[ "Close", "the", "software", "update", "dialog" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/software-update.js#L267-L274
444
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/software-update.js
softwareUpdate_download
function softwareUpdate_download(channel, waitForFinish, timeout) { waitForFinish = waitForFinish ? waitForFinish : true; // Check that the correct channel has been set this._controller.assert(function() { return channel == this.channel; }, "The current update channel is identical to the specified one.", this); // Click the next button var next = this.getElement({type: "button", subtype: "next"}); this._controller.click(next); // Wait for the download page - if it fails the update was already cached try { this.waitForWizardPage(WIZARD_PAGES.downloading); if (waitForFinish) this.waitforDownloadFinished(timeout); } catch (ex) { this.waitForWizardPage(WIZARD_PAGES.finished); } }
javascript
function softwareUpdate_download(channel, waitForFinish, timeout) { waitForFinish = waitForFinish ? waitForFinish : true; // Check that the correct channel has been set this._controller.assert(function() { return channel == this.channel; }, "The current update channel is identical to the specified one.", this); // Click the next button var next = this.getElement({type: "button", subtype: "next"}); this._controller.click(next); // Wait for the download page - if it fails the update was already cached try { this.waitForWizardPage(WIZARD_PAGES.downloading); if (waitForFinish) this.waitforDownloadFinished(timeout); } catch (ex) { this.waitForWizardPage(WIZARD_PAGES.finished); } }
[ "function", "softwareUpdate_download", "(", "channel", ",", "waitForFinish", ",", "timeout", ")", "{", "waitForFinish", "=", "waitForFinish", "?", "waitForFinish", ":", "true", ";", "// Check that the correct channel has been set", "this", ".", "_controller", ".", "assert", "(", "function", "(", ")", "{", "return", "channel", "==", "this", ".", "channel", ";", "}", ",", "\"The current update channel is identical to the specified one.\"", ",", "this", ")", ";", "// Click the next button", "var", "next", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"button\"", ",", "subtype", ":", "\"next\"", "}", ")", ";", "this", ".", "_controller", ".", "click", "(", "next", ")", ";", "// Wait for the download page - if it fails the update was already cached", "try", "{", "this", ".", "waitForWizardPage", "(", "WIZARD_PAGES", ".", "downloading", ")", ";", "if", "(", "waitForFinish", ")", "this", ".", "waitforDownloadFinished", "(", "timeout", ")", ";", "}", "catch", "(", "ex", ")", "{", "this", ".", "waitForWizardPage", "(", "WIZARD_PAGES", ".", "finished", ")", ";", "}", "}" ]
Download the update of the given channel and type @param {string} channel Update channel to use @param {boolean} waitForFinish Sets if the function should wait until the download has been finished @param {number} timeout Timeout the download has to stop
[ "Download", "the", "update", "of", "the", "given", "channel", "and", "type" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/software-update.js#L285-L306
445
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/software-update.js
softwareUpdate_openDialog
function softwareUpdate_openDialog(browserController) { // XXX: After Firefox 4 has been released and we do not have to test any // beta release anymore uncomment out the following code // With version >= 4.0b7pre the update dialog is reachable from within the // about window now. var appVersion = utils.appInfo.version; if (this._vc.compare(appVersion, "4.0b7pre") >= 0) { // XXX: We can't open the about window, otherwise a parallel download of // the update will let us fallback to a complete one all the time // Open the about window and check the update button //var aboutItem = new elementslib.Elem(browserController.menus.helpMenu.aboutName); //browserController.click(aboutItem); // //utils.handleWindow("type", "Browser:About", function(controller) { // // XXX: Bug 599290 - Check for updates has been completely relocated // // into the about window. We can't check the in-about ui yet. // var updateButton = new elementslib.ID(controller.window.document, // "checkForUpdatesButton"); // //controller.click(updateButton); // controller.waitForElement(updateButton, gTimeout); //}); // For now just call the old ui until we have support for the about window. var updatePrompt = Cc["@mozilla.org/updates/update-prompt;1"]. createInstance(Ci.nsIUpdatePrompt); updatePrompt.checkForUpdates(); } else { // For builds <4.0b7pre updateItem = new elementslib.Elem(browserController.menus.helpMenu.checkForUpdates); browserController.click(updateItem); } this.waitForDialogOpen(browserController); }
javascript
function softwareUpdate_openDialog(browserController) { // XXX: After Firefox 4 has been released and we do not have to test any // beta release anymore uncomment out the following code // With version >= 4.0b7pre the update dialog is reachable from within the // about window now. var appVersion = utils.appInfo.version; if (this._vc.compare(appVersion, "4.0b7pre") >= 0) { // XXX: We can't open the about window, otherwise a parallel download of // the update will let us fallback to a complete one all the time // Open the about window and check the update button //var aboutItem = new elementslib.Elem(browserController.menus.helpMenu.aboutName); //browserController.click(aboutItem); // //utils.handleWindow("type", "Browser:About", function(controller) { // // XXX: Bug 599290 - Check for updates has been completely relocated // // into the about window. We can't check the in-about ui yet. // var updateButton = new elementslib.ID(controller.window.document, // "checkForUpdatesButton"); // //controller.click(updateButton); // controller.waitForElement(updateButton, gTimeout); //}); // For now just call the old ui until we have support for the about window. var updatePrompt = Cc["@mozilla.org/updates/update-prompt;1"]. createInstance(Ci.nsIUpdatePrompt); updatePrompt.checkForUpdates(); } else { // For builds <4.0b7pre updateItem = new elementslib.Elem(browserController.menus.helpMenu.checkForUpdates); browserController.click(updateItem); } this.waitForDialogOpen(browserController); }
[ "function", "softwareUpdate_openDialog", "(", "browserController", ")", "{", "// XXX: After Firefox 4 has been released and we do not have to test any", "// beta release anymore uncomment out the following code", "// With version >= 4.0b7pre the update dialog is reachable from within the", "// about window now.", "var", "appVersion", "=", "utils", ".", "appInfo", ".", "version", ";", "if", "(", "this", ".", "_vc", ".", "compare", "(", "appVersion", ",", "\"4.0b7pre\"", ")", ">=", "0", ")", "{", "// XXX: We can't open the about window, otherwise a parallel download of", "// the update will let us fallback to a complete one all the time", "// Open the about window and check the update button", "//var aboutItem = new elementslib.Elem(browserController.menus.helpMenu.aboutName);", "//browserController.click(aboutItem);", "//", "//utils.handleWindow(\"type\", \"Browser:About\", function(controller) {", "// // XXX: Bug 599290 - Check for updates has been completely relocated", "// // into the about window. We can't check the in-about ui yet.", "// var updateButton = new elementslib.ID(controller.window.document,", "// \"checkForUpdatesButton\");", "// //controller.click(updateButton);", "// controller.waitForElement(updateButton, gTimeout);", "//});", "// For now just call the old ui until we have support for the about window.", "var", "updatePrompt", "=", "Cc", "[", "\"@mozilla.org/updates/update-prompt;1\"", "]", ".", "createInstance", "(", "Ci", ".", "nsIUpdatePrompt", ")", ";", "updatePrompt", ".", "checkForUpdates", "(", ")", ";", "}", "else", "{", "// For builds <4.0b7pre", "updateItem", "=", "new", "elementslib", ".", "Elem", "(", "browserController", ".", "menus", ".", "helpMenu", ".", "checkForUpdates", ")", ";", "browserController", ".", "click", "(", "updateItem", ")", ";", "}", "this", ".", "waitForDialogOpen", "(", "browserController", ")", ";", "}" ]
Open software update dialog @param {MozMillController} browserController Mozmill controller of the browser window
[ "Open", "software", "update", "dialog" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/software-update.js#L404-L440
446
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/software-update.js
softwareUpdate_waitForCheckFinished
function softwareUpdate_waitForCheckFinished(timeout) { timeout = timeout ? timeout : gTimeoutUpdateCheck; this._controller.waitFor(function() { return this.currentPage != WIZARD_PAGES.checking; }, "Check for updates has been completed.", timeout, null, this); }
javascript
function softwareUpdate_waitForCheckFinished(timeout) { timeout = timeout ? timeout : gTimeoutUpdateCheck; this._controller.waitFor(function() { return this.currentPage != WIZARD_PAGES.checking; }, "Check for updates has been completed.", timeout, null, this); }
[ "function", "softwareUpdate_waitForCheckFinished", "(", "timeout", ")", "{", "timeout", "=", "timeout", "?", "timeout", ":", "gTimeoutUpdateCheck", ";", "this", ".", "_controller", ".", "waitFor", "(", "function", "(", ")", "{", "return", "this", ".", "currentPage", "!=", "WIZARD_PAGES", ".", "checking", ";", "}", ",", "\"Check for updates has been completed.\"", ",", "timeout", ",", "null", ",", "this", ")", ";", "}" ]
Wait that check for updates has been finished @param {number} timeout
[ "Wait", "that", "check", "for", "updates", "has", "been", "finished" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/software-update.js#L446-L452
447
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/software-update.js
softwareUpdate_waitForDialogOpen
function softwareUpdate_waitForDialogOpen(browserController) { this._controller = utils.handleWindow("type", "Update:Wizard", null, true); this._wizard = this.getElement({type: "wizard"}); this._controller.waitFor(function() { return this.currentPage != WIZARD_PAGES.dummy; }, "Dummy wizard page has been made invisible.", undefined, undefined, this); this._controller.window.focus(); }
javascript
function softwareUpdate_waitForDialogOpen(browserController) { this._controller = utils.handleWindow("type", "Update:Wizard", null, true); this._wizard = this.getElement({type: "wizard"}); this._controller.waitFor(function() { return this.currentPage != WIZARD_PAGES.dummy; }, "Dummy wizard page has been made invisible.", undefined, undefined, this); this._controller.window.focus(); }
[ "function", "softwareUpdate_waitForDialogOpen", "(", "browserController", ")", "{", "this", ".", "_controller", "=", "utils", ".", "handleWindow", "(", "\"type\"", ",", "\"Update:Wizard\"", ",", "null", ",", "true", ")", ";", "this", ".", "_wizard", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"wizard\"", "}", ")", ";", "this", ".", "_controller", ".", "waitFor", "(", "function", "(", ")", "{", "return", "this", ".", "currentPage", "!=", "WIZARD_PAGES", ".", "dummy", ";", "}", ",", "\"Dummy wizard page has been made invisible.\"", ",", "undefined", ",", "undefined", ",", "this", ")", ";", "this", ".", "_controller", ".", "window", ".", "focus", "(", ")", ";", "}" ]
Wait for the software update dialog @param {MozMillController} browserController Mozmill controller of the browser window
[ "Wait", "for", "the", "software", "update", "dialog" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/software-update.js#L460-L470
448
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/software-update.js
softwareUpdate_waitForDownloadFinished
function softwareUpdate_waitForDownloadFinished(timeout) { timeout = timeout ? timeout : gTimeoutUpdateDownload; var progress = this.getElement({type: "download_progress"}); this._controller.waitFor(function() { return progress.getNode().value == 100; }, "Update has been finished downloading.", timeout); this.waitForWizardPage(WIZARD_PAGES.finished); }
javascript
function softwareUpdate_waitForDownloadFinished(timeout) { timeout = timeout ? timeout : gTimeoutUpdateDownload; var progress = this.getElement({type: "download_progress"}); this._controller.waitFor(function() { return progress.getNode().value == 100; }, "Update has been finished downloading.", timeout); this.waitForWizardPage(WIZARD_PAGES.finished); }
[ "function", "softwareUpdate_waitForDownloadFinished", "(", "timeout", ")", "{", "timeout", "=", "timeout", "?", "timeout", ":", "gTimeoutUpdateDownload", ";", "var", "progress", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"download_progress\"", "}", ")", ";", "this", ".", "_controller", ".", "waitFor", "(", "function", "(", ")", "{", "return", "progress", ".", "getNode", "(", ")", ".", "value", "==", "100", ";", "}", ",", "\"Update has been finished downloading.\"", ",", "timeout", ")", ";", "this", ".", "waitForWizardPage", "(", "WIZARD_PAGES", ".", "finished", ")", ";", "}" ]
Wait until the download has been finished @param {number} timeout Timeout the download has to stop
[ "Wait", "until", "the", "download", "has", "been", "finished" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/software-update.js#L478-L487
449
SeleniumHQ/selenium
javascript/selenium-core/lib/snapsie.js
getCanonicalPath
function getCanonicalPath(path) { path = path.replace(/\//g, '\\'); path = path.replace(/\\\\/g, '\\'); return path; }
javascript
function getCanonicalPath(path) { path = path.replace(/\//g, '\\'); path = path.replace(/\\\\/g, '\\'); return path; }
[ "function", "getCanonicalPath", "(", "path", ")", "{", "path", "=", "path", ".", "replace", "(", "/", "\\/", "/", "g", ",", "'\\\\'", ")", ";", "path", "=", "path", ".", "replace", "(", "/", "\\\\\\\\", "/", "g", ",", "'\\\\'", ")", ";", "return", "path", ";", "}" ]
Returns the canonical Windows path for a given path. This means basically replacing any forwards slashes with backslashes. @param path the path whose canonical form to return
[ "Returns", "the", "canonical", "Windows", "path", "for", "a", "given", "path", ".", "This", "means", "basically", "replacing", "any", "forwards", "slashes", "with", "backslashes", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/lib/snapsie.js#L32-L36
450
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/error.js
checkResponse
function checkResponse(data) { if (data && typeof data.error === 'string') { let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError; throw new ctor(data.message); } return data; }
javascript
function checkResponse(data) { if (data && typeof data.error === 'string') { let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError; throw new ctor(data.message); } return data; }
[ "function", "checkResponse", "(", "data", ")", "{", "if", "(", "data", "&&", "typeof", "data", ".", "error", "===", "'string'", ")", "{", "let", "ctor", "=", "ERROR_CODE_TO_TYPE", ".", "get", "(", "data", ".", "error", ")", "||", "WebDriverError", ";", "throw", "new", "ctor", "(", "data", ".", "message", ")", ";", "}", "return", "data", ";", "}" ]
Checks a response object from a server that adheres to the W3C WebDriver protocol. @param {*} data The response data to check. @return {*} The response data if it was not an encoded error. @throws {WebDriverError} the decoded error, if present in the data object. @deprecated Use {@link #throwDecodedError(data)} instead. @see https://w3c.github.io/webdriver/webdriver-spec.html#protocol
[ "Checks", "a", "response", "object", "from", "a", "server", "that", "adheres", "to", "the", "W3C", "WebDriver", "protocol", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/error.js#L518-L524
451
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/error.js
throwDecodedError
function throwDecodedError(data) { if (isErrorResponse(data)) { let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError; let err = new ctor(data.message); // TODO(jleyba): remove whichever case is excluded from the final W3C spec. if (typeof data.stacktrace === 'string') { err.remoteStacktrace = data.stacktrace; } else if (typeof data.stackTrace === 'string') { err.remoteStacktrace = data.stackTrace; } throw err; } throw new WebDriverError('Unknown error: ' + JSON.stringify(data)); }
javascript
function throwDecodedError(data) { if (isErrorResponse(data)) { let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError; let err = new ctor(data.message); // TODO(jleyba): remove whichever case is excluded from the final W3C spec. if (typeof data.stacktrace === 'string') { err.remoteStacktrace = data.stacktrace; } else if (typeof data.stackTrace === 'string') { err.remoteStacktrace = data.stackTrace; } throw err; } throw new WebDriverError('Unknown error: ' + JSON.stringify(data)); }
[ "function", "throwDecodedError", "(", "data", ")", "{", "if", "(", "isErrorResponse", "(", "data", ")", ")", "{", "let", "ctor", "=", "ERROR_CODE_TO_TYPE", ".", "get", "(", "data", ".", "error", ")", "||", "WebDriverError", ";", "let", "err", "=", "new", "ctor", "(", "data", ".", "message", ")", ";", "// TODO(jleyba): remove whichever case is excluded from the final W3C spec.", "if", "(", "typeof", "data", ".", "stacktrace", "===", "'string'", ")", "{", "err", ".", "remoteStacktrace", "=", "data", ".", "stacktrace", ";", "}", "else", "if", "(", "typeof", "data", ".", "stackTrace", "===", "'string'", ")", "{", "err", ".", "remoteStacktrace", "=", "data", ".", "stackTrace", ";", "}", "throw", "err", ";", "}", "throw", "new", "WebDriverError", "(", "'Unknown error: '", "+", "JSON", ".", "stringify", "(", "data", ")", ")", ";", "}" ]
Throws an error coded from the W3C protocol. A generic error will be thrown if the provided `data` is not a valid encoded error. @param {{error: string, message: string}} data The error data to decode. @throws {WebDriverError} the decoded error. @see https://w3c.github.io/webdriver/webdriver-spec.html#protocol
[ "Throws", "an", "error", "coded", "from", "the", "W3C", "protocol", ".", "A", "generic", "error", "will", "be", "thrown", "if", "the", "provided", "data", "is", "not", "a", "valid", "encoded", "error", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/error.js#L547-L560
452
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/error.js
checkLegacyResponse
function checkLegacyResponse(responseObj) { // Handle the legacy Selenium error response format. if (responseObj && typeof responseObj === 'object' && typeof responseObj['status'] === 'number' && responseObj['status'] !== 0) { let status = responseObj['status']; let ctor = LEGACY_ERROR_CODE_TO_TYPE.get(status) || WebDriverError; let value = responseObj['value']; if (!value || typeof value !== 'object') { throw new ctor(value + ''); } else { let message = value['message'] + ''; if (ctor !== UnexpectedAlertOpenError) { throw new ctor(message); } let text = ''; if (value['alert'] && typeof value['alert']['text'] === 'string') { text = value['alert']['text']; } throw new UnexpectedAlertOpenError(message, text); } } return responseObj; }
javascript
function checkLegacyResponse(responseObj) { // Handle the legacy Selenium error response format. if (responseObj && typeof responseObj === 'object' && typeof responseObj['status'] === 'number' && responseObj['status'] !== 0) { let status = responseObj['status']; let ctor = LEGACY_ERROR_CODE_TO_TYPE.get(status) || WebDriverError; let value = responseObj['value']; if (!value || typeof value !== 'object') { throw new ctor(value + ''); } else { let message = value['message'] + ''; if (ctor !== UnexpectedAlertOpenError) { throw new ctor(message); } let text = ''; if (value['alert'] && typeof value['alert']['text'] === 'string') { text = value['alert']['text']; } throw new UnexpectedAlertOpenError(message, text); } } return responseObj; }
[ "function", "checkLegacyResponse", "(", "responseObj", ")", "{", "// Handle the legacy Selenium error response format.", "if", "(", "responseObj", "&&", "typeof", "responseObj", "===", "'object'", "&&", "typeof", "responseObj", "[", "'status'", "]", "===", "'number'", "&&", "responseObj", "[", "'status'", "]", "!==", "0", ")", "{", "let", "status", "=", "responseObj", "[", "'status'", "]", ";", "let", "ctor", "=", "LEGACY_ERROR_CODE_TO_TYPE", ".", "get", "(", "status", ")", "||", "WebDriverError", ";", "let", "value", "=", "responseObj", "[", "'value'", "]", ";", "if", "(", "!", "value", "||", "typeof", "value", "!==", "'object'", ")", "{", "throw", "new", "ctor", "(", "value", "+", "''", ")", ";", "}", "else", "{", "let", "message", "=", "value", "[", "'message'", "]", "+", "''", ";", "if", "(", "ctor", "!==", "UnexpectedAlertOpenError", ")", "{", "throw", "new", "ctor", "(", "message", ")", ";", "}", "let", "text", "=", "''", ";", "if", "(", "value", "[", "'alert'", "]", "&&", "typeof", "value", "[", "'alert'", "]", "[", "'text'", "]", "===", "'string'", ")", "{", "text", "=", "value", "[", "'alert'", "]", "[", "'text'", "]", ";", "}", "throw", "new", "UnexpectedAlertOpenError", "(", "message", ",", "text", ")", ";", "}", "}", "return", "responseObj", ";", "}" ]
Checks a legacy response from the Selenium 2.0 wire protocol for an error. @param {*} responseObj the response object to check. @return {*} responseObj the original response if it does not define an error. @throws {WebDriverError} if the response object defines an error.
[ "Checks", "a", "legacy", "response", "from", "the", "Selenium", "2", ".", "0", "wire", "protocol", "for", "an", "error", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/error.js#L569-L596
453
SeleniumHQ/selenium
javascript/selenium-core/scripts/selenium-remoterunner.js
function(commandRequest) { //decodeURIComponent doesn't strip plus signs var processed = commandRequest.replace(/\+/g, "%20"); // strip trailing spaces var processed = processed.replace(/\s+$/, ""); var vars = processed.split("&"); var cmdArgs = new Object(); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); cmdArgs[pair[0]] = pair[1]; } var cmd = cmdArgs['cmd']; var arg1 = cmdArgs['1']; if (null == arg1) arg1 = ""; arg1 = decodeURIComponent(arg1); var arg2 = cmdArgs['2']; if (null == arg2) arg2 = ""; arg2 = decodeURIComponent(arg2); if (cmd == null) { throw new Error("Bad command request: " + commandRequest); } return new SeleniumCommand(cmd, arg1, arg2); }
javascript
function(commandRequest) { //decodeURIComponent doesn't strip plus signs var processed = commandRequest.replace(/\+/g, "%20"); // strip trailing spaces var processed = processed.replace(/\s+$/, ""); var vars = processed.split("&"); var cmdArgs = new Object(); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); cmdArgs[pair[0]] = pair[1]; } var cmd = cmdArgs['cmd']; var arg1 = cmdArgs['1']; if (null == arg1) arg1 = ""; arg1 = decodeURIComponent(arg1); var arg2 = cmdArgs['2']; if (null == arg2) arg2 = ""; arg2 = decodeURIComponent(arg2); if (cmd == null) { throw new Error("Bad command request: " + commandRequest); } return new SeleniumCommand(cmd, arg1, arg2); }
[ "function", "(", "commandRequest", ")", "{", "//decodeURIComponent doesn't strip plus signs", "var", "processed", "=", "commandRequest", ".", "replace", "(", "/", "\\+", "/", "g", ",", "\"%20\"", ")", ";", "// strip trailing spaces", "var", "processed", "=", "processed", ".", "replace", "(", "/", "\\s+$", "/", ",", "\"\"", ")", ";", "var", "vars", "=", "processed", ".", "split", "(", "\"&\"", ")", ";", "var", "cmdArgs", "=", "new", "Object", "(", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "vars", ".", "length", ";", "i", "++", ")", "{", "var", "pair", "=", "vars", "[", "i", "]", ".", "split", "(", "\"=\"", ")", ";", "cmdArgs", "[", "pair", "[", "0", "]", "]", "=", "pair", "[", "1", "]", ";", "}", "var", "cmd", "=", "cmdArgs", "[", "'cmd'", "]", ";", "var", "arg1", "=", "cmdArgs", "[", "'1'", "]", ";", "if", "(", "null", "==", "arg1", ")", "arg1", "=", "\"\"", ";", "arg1", "=", "decodeURIComponent", "(", "arg1", ")", ";", "var", "arg2", "=", "cmdArgs", "[", "'2'", "]", ";", "if", "(", "null", "==", "arg2", ")", "arg2", "=", "\"\"", ";", "arg2", "=", "decodeURIComponent", "(", "arg2", ")", ";", "if", "(", "cmd", "==", "null", ")", "{", "throw", "new", "Error", "(", "\"Bad command request: \"", "+", "commandRequest", ")", ";", "}", "return", "new", "SeleniumCommand", "(", "cmd", ",", "arg1", ",", "arg2", ")", ";", "}" ]
Parses a URI query string into a SeleniumCommand object
[ "Parses", "a", "URI", "query", "string", "into", "a", "SeleniumCommand", "object" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/selenium-remoterunner.js#L361-L383
454
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/by.js
escapeCss
function escapeCss(css) { if (typeof css !== 'string') { throw new TypeError('input must be a string'); } let ret = ''; const n = css.length; for (let i = 0; i < n; i++) { const c = css.charCodeAt(i); if (c == 0x0) { throw new InvalidCharacterError(); } if ((c >= 0x0001 && c <= 0x001F) || c == 0x007F || (i == 0 && c >= 0x0030 && c <= 0x0039) || (i == 1 && c >= 0x0030 && c <= 0x0039 && css.charCodeAt(0) == 0x002D)) { ret += '\\' + c.toString(16) + ' '; continue; } if (i == 0 && c == 0x002D && n == 1) { ret += '\\' + css.charAt(i); continue; } if (c >= 0x0080 || c == 0x002D // - || c == 0x005F // _ || (c >= 0x0030 && c <= 0x0039) // [0-9] || (c >= 0x0041 && c <= 0x005A) // [A-Z] || (c >= 0x0061 && c <= 0x007A)) { // [a-z] ret += css.charAt(i); continue; } ret += '\\' + css.charAt(i); } return ret; }
javascript
function escapeCss(css) { if (typeof css !== 'string') { throw new TypeError('input must be a string'); } let ret = ''; const n = css.length; for (let i = 0; i < n; i++) { const c = css.charCodeAt(i); if (c == 0x0) { throw new InvalidCharacterError(); } if ((c >= 0x0001 && c <= 0x001F) || c == 0x007F || (i == 0 && c >= 0x0030 && c <= 0x0039) || (i == 1 && c >= 0x0030 && c <= 0x0039 && css.charCodeAt(0) == 0x002D)) { ret += '\\' + c.toString(16) + ' '; continue; } if (i == 0 && c == 0x002D && n == 1) { ret += '\\' + css.charAt(i); continue; } if (c >= 0x0080 || c == 0x002D // - || c == 0x005F // _ || (c >= 0x0030 && c <= 0x0039) // [0-9] || (c >= 0x0041 && c <= 0x005A) // [A-Z] || (c >= 0x0061 && c <= 0x007A)) { // [a-z] ret += css.charAt(i); continue; } ret += '\\' + css.charAt(i); } return ret; }
[ "function", "escapeCss", "(", "css", ")", "{", "if", "(", "typeof", "css", "!==", "'string'", ")", "{", "throw", "new", "TypeError", "(", "'input must be a string'", ")", ";", "}", "let", "ret", "=", "''", ";", "const", "n", "=", "css", ".", "length", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "const", "c", "=", "css", ".", "charCodeAt", "(", "i", ")", ";", "if", "(", "c", "==", "0x0", ")", "{", "throw", "new", "InvalidCharacterError", "(", ")", ";", "}", "if", "(", "(", "c", ">=", "0x0001", "&&", "c", "<=", "0x001F", ")", "||", "c", "==", "0x007F", "||", "(", "i", "==", "0", "&&", "c", ">=", "0x0030", "&&", "c", "<=", "0x0039", ")", "||", "(", "i", "==", "1", "&&", "c", ">=", "0x0030", "&&", "c", "<=", "0x0039", "&&", "css", ".", "charCodeAt", "(", "0", ")", "==", "0x002D", ")", ")", "{", "ret", "+=", "'\\\\'", "+", "c", ".", "toString", "(", "16", ")", "+", "' '", ";", "continue", ";", "}", "if", "(", "i", "==", "0", "&&", "c", "==", "0x002D", "&&", "n", "==", "1", ")", "{", "ret", "+=", "'\\\\'", "+", "css", ".", "charAt", "(", "i", ")", ";", "continue", ";", "}", "if", "(", "c", ">=", "0x0080", "||", "c", "==", "0x002D", "// -", "||", "c", "==", "0x005F", "// _", "||", "(", "c", ">=", "0x0030", "&&", "c", "<=", "0x0039", ")", "// [0-9]", "||", "(", "c", ">=", "0x0041", "&&", "c", "<=", "0x005A", ")", "// [A-Z]", "||", "(", "c", ">=", "0x0061", "&&", "c", "<=", "0x007A", ")", ")", "{", "// [a-z]", "ret", "+=", "css", ".", "charAt", "(", "i", ")", ";", "continue", ";", "}", "ret", "+=", "'\\\\'", "+", "css", ".", "charAt", "(", "i", ")", ";", "}", "return", "ret", ";", "}" ]
Escapes a CSS string. @param {string} css the string to escape. @return {string} the escaped string. @throws {TypeError} if the input value is not a string. @throws {InvalidCharacterError} if the string contains an invalid character. @see https://drafts.csswg.org/cssom/#serialize-an-identifier
[ "Escapes", "a", "CSS", "string", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/by.js#L70-L109
455
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/by.js
check
function check(locator) { if (locator instanceof By || typeof locator === 'function') { return locator; } if (locator && typeof locator === 'object' && typeof locator.using === 'string' && typeof locator.value === 'string') { return new By(locator.using, locator.value); } for (let key in locator) { if (locator.hasOwnProperty(key) && By.hasOwnProperty(key)) { return By[key](locator[key]); } } throw new TypeError('Invalid locator'); }
javascript
function check(locator) { if (locator instanceof By || typeof locator === 'function') { return locator; } if (locator && typeof locator === 'object' && typeof locator.using === 'string' && typeof locator.value === 'string') { return new By(locator.using, locator.value); } for (let key in locator) { if (locator.hasOwnProperty(key) && By.hasOwnProperty(key)) { return By[key](locator[key]); } } throw new TypeError('Invalid locator'); }
[ "function", "check", "(", "locator", ")", "{", "if", "(", "locator", "instanceof", "By", "||", "typeof", "locator", "===", "'function'", ")", "{", "return", "locator", ";", "}", "if", "(", "locator", "&&", "typeof", "locator", "===", "'object'", "&&", "typeof", "locator", ".", "using", "===", "'string'", "&&", "typeof", "locator", ".", "value", "===", "'string'", ")", "{", "return", "new", "By", "(", "locator", ".", "using", ",", "locator", ".", "value", ")", ";", "}", "for", "(", "let", "key", "in", "locator", ")", "{", "if", "(", "locator", ".", "hasOwnProperty", "(", "key", ")", "&&", "By", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "return", "By", "[", "key", "]", "(", "locator", "[", "key", "]", ")", ";", "}", "}", "throw", "new", "TypeError", "(", "'Invalid locator'", ")", ";", "}" ]
Checks if a value is a valid locator. @param {!(By|Function|ByHash)} locator The value to check. @return {!(By|Function)} The valid locator. @throws {TypeError} If the given value does not define a valid locator strategy.
[ "Checks", "if", "a", "value", "is", "a", "valid", "locator", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/by.js#L258-L276
456
SeleniumHQ/selenium
javascript/selenium-core/scripts/selenium-api.js
getFailureMessage
function getFailureMessage(exceptionMessage) { var msg = 'Snapsie failed: '; if (exceptionMessage) { if (exceptionMessage == "Automation server can't create object") { msg += 'Is it installed? Does it have permission to run ' + 'as an add-on? See http://snapsie.sourceforge.net/'; } else { msg += exceptionMessage; } } else { msg += 'Undocumented error'; } return msg; }
javascript
function getFailureMessage(exceptionMessage) { var msg = 'Snapsie failed: '; if (exceptionMessage) { if (exceptionMessage == "Automation server can't create object") { msg += 'Is it installed? Does it have permission to run ' + 'as an add-on? See http://snapsie.sourceforge.net/'; } else { msg += exceptionMessage; } } else { msg += 'Undocumented error'; } return msg; }
[ "function", "getFailureMessage", "(", "exceptionMessage", ")", "{", "var", "msg", "=", "'Snapsie failed: '", ";", "if", "(", "exceptionMessage", ")", "{", "if", "(", "exceptionMessage", "==", "\"Automation server can't create object\"", ")", "{", "msg", "+=", "'Is it installed? Does it have permission to run '", "+", "'as an add-on? See http://snapsie.sourceforge.net/'", ";", "}", "else", "{", "msg", "+=", "exceptionMessage", ";", "}", "}", "else", "{", "msg", "+=", "'Undocumented error'", ";", "}", "return", "msg", ";", "}" ]
targeting snapsIE >= 0.2
[ "targeting", "snapsIE", ">", "=", "0", ".", "2" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/selenium-api.js#L2982-L2998
457
SeleniumHQ/selenium
third_party/closure/goog/bootstrap/nodejs.js
nodeGlobalRequire
function nodeGlobalRequire(file) { vm.runInThisContext.call(global, fs.readFileSync(file), file); }
javascript
function nodeGlobalRequire(file) { vm.runInThisContext.call(global, fs.readFileSync(file), file); }
[ "function", "nodeGlobalRequire", "(", "file", ")", "{", "vm", ".", "runInThisContext", ".", "call", "(", "global", ",", "fs", ".", "readFileSync", "(", "file", ")", ",", "file", ")", ";", "}" ]
Declared here so it can be used to require base.js
[ "Declared", "here", "so", "it", "can", "be", "used", "to", "require", "base", ".", "js" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/bootstrap/nodejs.js#L86-L88
458
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/sessionstore.js
aboutSessionRestore_getRestoreState
function aboutSessionRestore_getRestoreState(element) { var tree = this.tabList.getNode(); return tree.view.getCellValue(element.listIndex, tree.columns.getColumnAt(0)); }
javascript
function aboutSessionRestore_getRestoreState(element) { var tree = this.tabList.getNode(); return tree.view.getCellValue(element.listIndex, tree.columns.getColumnAt(0)); }
[ "function", "aboutSessionRestore_getRestoreState", "(", "element", ")", "{", "var", "tree", "=", "this", ".", "tabList", ".", "getNode", "(", ")", ";", "return", "tree", ".", "view", ".", "getCellValue", "(", "element", ".", "listIndex", ",", "tree", ".", "columns", ".", "getColumnAt", "(", "0", ")", ")", ";", "}" ]
Returns the current restore state of the given element @param {object} element Element which restore state should be retrieved @returns True if the element should be restored @type {boolean}
[ "Returns", "the", "current", "restore", "state", "of", "the", "given", "element" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/sessionstore.js#L155-L159
459
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/sessionstore.js
aboutSessionRestore_getTabs
function aboutSessionRestore_getTabs(window) { var tabs = [ ]; var tree = this.tabList.getNode(); // Add entries when they are tabs (no container) var ii = window.listIndex + 1; while (ii < tree.view.rowCount && !tree.view.isContainer(ii)) { tabs.push({ index: tabs.length, listIndex : ii, restore: tree.view.getCellValue(ii, tree.columns.getColumnAt(0)), title: tree.view.getCellText(ii, tree.columns.getColumnAt(2)) }); ii++; } return tabs; }
javascript
function aboutSessionRestore_getTabs(window) { var tabs = [ ]; var tree = this.tabList.getNode(); // Add entries when they are tabs (no container) var ii = window.listIndex + 1; while (ii < tree.view.rowCount && !tree.view.isContainer(ii)) { tabs.push({ index: tabs.length, listIndex : ii, restore: tree.view.getCellValue(ii, tree.columns.getColumnAt(0)), title: tree.view.getCellText(ii, tree.columns.getColumnAt(2)) }); ii++; } return tabs; }
[ "function", "aboutSessionRestore_getTabs", "(", "window", ")", "{", "var", "tabs", "=", "[", "]", ";", "var", "tree", "=", "this", ".", "tabList", ".", "getNode", "(", ")", ";", "// Add entries when they are tabs (no container)", "var", "ii", "=", "window", ".", "listIndex", "+", "1", ";", "while", "(", "ii", "<", "tree", ".", "view", ".", "rowCount", "&&", "!", "tree", ".", "view", ".", "isContainer", "(", "ii", ")", ")", "{", "tabs", ".", "push", "(", "{", "index", ":", "tabs", ".", "length", ",", "listIndex", ":", "ii", ",", "restore", ":", "tree", ".", "view", ".", "getCellValue", "(", "ii", ",", "tree", ".", "columns", ".", "getColumnAt", "(", "0", ")", ")", ",", "title", ":", "tree", ".", "view", ".", "getCellText", "(", "ii", ",", "tree", ".", "columns", ".", "getColumnAt", "(", "2", ")", ")", "}", ")", ";", "ii", "++", ";", "}", "return", "tabs", ";", "}" ]
Get restorable tabs under the given window @param {object} window Window inside the tree @returns List of tabs @type {array of object}
[ "Get", "restorable", "tabs", "under", "the", "given", "window" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/sessionstore.js#L169-L186
460
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/sessionstore.js
aboutSessionRestore_getWindows
function aboutSessionRestore_getWindows() { var windows = [ ]; var tree = this.tabList.getNode(); for (var ii = 0; ii < tree.view.rowCount; ii++) { if (tree.view.isContainer(ii)) { windows.push({ index: windows.length, listIndex : ii, open: tree.view.isContainerOpen(ii), restore: tree.view.getCellValue(ii, tree.columns.getColumnAt(0)), title: tree.view.getCellText(ii, tree.columns.getColumnAt(2)) }); } } return windows; }
javascript
function aboutSessionRestore_getWindows() { var windows = [ ]; var tree = this.tabList.getNode(); for (var ii = 0; ii < tree.view.rowCount; ii++) { if (tree.view.isContainer(ii)) { windows.push({ index: windows.length, listIndex : ii, open: tree.view.isContainerOpen(ii), restore: tree.view.getCellValue(ii, tree.columns.getColumnAt(0)), title: tree.view.getCellText(ii, tree.columns.getColumnAt(2)) }); } } return windows; }
[ "function", "aboutSessionRestore_getWindows", "(", ")", "{", "var", "windows", "=", "[", "]", ";", "var", "tree", "=", "this", ".", "tabList", ".", "getNode", "(", ")", ";", "for", "(", "var", "ii", "=", "0", ";", "ii", "<", "tree", ".", "view", ".", "rowCount", ";", "ii", "++", ")", "{", "if", "(", "tree", ".", "view", ".", "isContainer", "(", "ii", ")", ")", "{", "windows", ".", "push", "(", "{", "index", ":", "windows", ".", "length", ",", "listIndex", ":", "ii", ",", "open", ":", "tree", ".", "view", ".", "isContainerOpen", "(", "ii", ")", ",", "restore", ":", "tree", ".", "view", ".", "getCellValue", "(", "ii", ",", "tree", ".", "columns", ".", "getColumnAt", "(", "0", ")", ")", ",", "title", ":", "tree", ".", "view", ".", "getCellText", "(", "ii", ",", "tree", ".", "columns", ".", "getColumnAt", "(", "2", ")", ")", "}", ")", ";", "}", "}", "return", "windows", ";", "}" ]
Get restorable windows @returns List of windows @type {array of object}
[ "Get", "restorable", "windows" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/sessionstore.js#L194-L211
461
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/sessionstore.js
aboutSessionRestore_toggleRestoreState
function aboutSessionRestore_toggleRestoreState(element) { var state = this.getRestoreState(element); widgets.clickTreeCell(this._controller, this.tabList, element.listIndex, 0, {}); this._controller.sleep(0); this._controller.assertJS("subject.newState != subject.oldState", {newState : this.getRestoreState(element), oldState : state}); }
javascript
function aboutSessionRestore_toggleRestoreState(element) { var state = this.getRestoreState(element); widgets.clickTreeCell(this._controller, this.tabList, element.listIndex, 0, {}); this._controller.sleep(0); this._controller.assertJS("subject.newState != subject.oldState", {newState : this.getRestoreState(element), oldState : state}); }
[ "function", "aboutSessionRestore_toggleRestoreState", "(", "element", ")", "{", "var", "state", "=", "this", ".", "getRestoreState", "(", "element", ")", ";", "widgets", ".", "clickTreeCell", "(", "this", ".", "_controller", ",", "this", ".", "tabList", ",", "element", ".", "listIndex", ",", "0", ",", "{", "}", ")", ";", "this", ".", "_controller", ".", "sleep", "(", "0", ")", ";", "this", ".", "_controller", ".", "assertJS", "(", "\"subject.newState != subject.oldState\"", ",", "{", "newState", ":", "this", ".", "getRestoreState", "(", "element", ")", ",", "oldState", ":", "state", "}", ")", ";", "}" ]
Toggles the restore state for the element @param {object} element Specifies the element which restore state should be toggled
[ "Toggles", "the", "restore", "state", "for", "the", "element" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/sessionstore.js#L219-L227
462
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/sessionstore.js
undoClosedTab
function undoClosedTab(controller, event) { var count = sessionStoreService.getClosedTabCount(controller.window); switch (event.type) { case "menu": throw new Error("Menu gets build dynamically and cannot be accessed."); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "tabCmd.commandkey"); controller.keypress(null, cmdKey, {accelKey: true, shiftKey: true}); break; } if (count > 0) controller.assertJS("subject.newTabCount < subject.oldTabCount", { newTabCount : sessionStoreService.getClosedTabCount(controller.window), oldTabCount : count }); }
javascript
function undoClosedTab(controller, event) { var count = sessionStoreService.getClosedTabCount(controller.window); switch (event.type) { case "menu": throw new Error("Menu gets build dynamically and cannot be accessed."); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "tabCmd.commandkey"); controller.keypress(null, cmdKey, {accelKey: true, shiftKey: true}); break; } if (count > 0) controller.assertJS("subject.newTabCount < subject.oldTabCount", { newTabCount : sessionStoreService.getClosedTabCount(controller.window), oldTabCount : count }); }
[ "function", "undoClosedTab", "(", "controller", ",", "event", ")", "{", "var", "count", "=", "sessionStoreService", ".", "getClosedTabCount", "(", "controller", ".", "window", ")", ";", "switch", "(", "event", ".", "type", ")", "{", "case", "\"menu\"", ":", "throw", "new", "Error", "(", "\"Menu gets build dynamically and cannot be accessed.\"", ")", ";", "break", ";", "case", "\"shortcut\"", ":", "var", "cmdKey", "=", "utils", ".", "getEntity", "(", "this", ".", "getDtds", "(", ")", ",", "\"tabCmd.commandkey\"", ")", ";", "controller", ".", "keypress", "(", "null", ",", "cmdKey", ",", "{", "accelKey", ":", "true", ",", "shiftKey", ":", "true", "}", ")", ";", "break", ";", "}", "if", "(", "count", ">", "0", ")", "controller", ".", "assertJS", "(", "\"subject.newTabCount < subject.oldTabCount\"", ",", "{", "newTabCount", ":", "sessionStoreService", ".", "getClosedTabCount", "(", "controller", ".", "window", ")", ",", "oldTabCount", ":", "count", "}", ")", ";", "}" ]
Restores the tab which has been recently closed @param {MozMillController} controller MozMillController of the window to operate on @param {object} event Specifies the event to use to execute the command
[ "Restores", "the", "tab", "which", "has", "been", "recently", "closed" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/sessionstore.js#L259-L279
463
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/sessionstore.js
undoClosedWindow
function undoClosedWindow(controller, event) { var count = sessionStoreService.getClosedWindowCount(controller.window); switch (event.type) { case "menu": throw new Error("Menu gets build dynamically and cannot be accessed."); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "newNavigatorCmd.key"); controller.keypress(null, cmdKey, {accelKey: true, shiftKey: true}); break; } if (count > 0) controller.assertJS("subject.newWindowCount < subject.oldWindowCount", { newWindowCount : sessionStoreService.getClosedWindowCount(controller.window), oldWindowCount : count }); }
javascript
function undoClosedWindow(controller, event) { var count = sessionStoreService.getClosedWindowCount(controller.window); switch (event.type) { case "menu": throw new Error("Menu gets build dynamically and cannot be accessed."); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "newNavigatorCmd.key"); controller.keypress(null, cmdKey, {accelKey: true, shiftKey: true}); break; } if (count > 0) controller.assertJS("subject.newWindowCount < subject.oldWindowCount", { newWindowCount : sessionStoreService.getClosedWindowCount(controller.window), oldWindowCount : count }); }
[ "function", "undoClosedWindow", "(", "controller", ",", "event", ")", "{", "var", "count", "=", "sessionStoreService", ".", "getClosedWindowCount", "(", "controller", ".", "window", ")", ";", "switch", "(", "event", ".", "type", ")", "{", "case", "\"menu\"", ":", "throw", "new", "Error", "(", "\"Menu gets build dynamically and cannot be accessed.\"", ")", ";", "break", ";", "case", "\"shortcut\"", ":", "var", "cmdKey", "=", "utils", ".", "getEntity", "(", "this", ".", "getDtds", "(", ")", ",", "\"newNavigatorCmd.key\"", ")", ";", "controller", ".", "keypress", "(", "null", ",", "cmdKey", ",", "{", "accelKey", ":", "true", ",", "shiftKey", ":", "true", "}", ")", ";", "break", ";", "}", "if", "(", "count", ">", "0", ")", "controller", ".", "assertJS", "(", "\"subject.newWindowCount < subject.oldWindowCount\"", ",", "{", "newWindowCount", ":", "sessionStoreService", ".", "getClosedWindowCount", "(", "controller", ".", "window", ")", ",", "oldWindowCount", ":", "count", "}", ")", ";", "}" ]
Restores the window which has been recently closed @param {MozMillController} controller MozMillController of the window to operate on @param {object} event Specifies the event to use to execute the command
[ "Restores", "the", "window", "which", "has", "been", "recently", "closed" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/sessionstore.js#L289-L309
464
SeleniumHQ/selenium
third_party/closure/goog/labs/format/csv.js
pushBack
function pushBack(t) { goog.labs.format.csv.assertToken_(t); goog.asserts.assert(goog.isNull(pushBackToken)); pushBackToken = t; }
javascript
function pushBack(t) { goog.labs.format.csv.assertToken_(t); goog.asserts.assert(goog.isNull(pushBackToken)); pushBackToken = t; }
[ "function", "pushBack", "(", "t", ")", "{", "goog", ".", "labs", ".", "format", ".", "csv", ".", "assertToken_", "(", "t", ")", ";", "goog", ".", "asserts", ".", "assert", "(", "goog", ".", "isNull", "(", "pushBackToken", ")", ")", ";", "pushBackToken", "=", "t", ";", "}" ]
Special case for terminal comma. Push a single token into the push-back variable. @param {goog.labs.format.csv.Token} t Single token.
[ "Special", "case", "for", "terminal", "comma", ".", "Push", "a", "single", "token", "into", "the", "push", "-", "back", "variable", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/labs/format/csv.js#L174-L178
465
SeleniumHQ/selenium
third_party/closure/goog/labs/format/csv.js
readQuotedField
function readQuotedField() { // We've already consumed the first quote by the time we get here. var start = index; var end = null; for (var token = nextToken(); token != EOF; token = nextToken()) { if (token == '"') { end = index - 1; token = nextToken(); // Two double quotes in a row. Keep scanning. if (token == '"') { end = null; continue; } // End of field. Break out. if (token == delimiter || token == EOF || token == NEWLINE) { if (token == NEWLINE) { pushBack(token); } break; } if (!opt_ignoreErrors) { // Ignoring errors here means keep going in current field after // closing quote. E.g. "ab"c,d splits into abc,d throw new goog.labs.format.csv.ParseError( text, index - 1, 'Unexpected character "' + token + '" after quote mark'); } else { // Fall back to reading the rest of this field as unquoted. // Note: the rest is guaranteed not start with ", as that case is // eliminated above. var prefix = '"' + text.substring(start, index); var suffix = readField(); if (suffix == EOR) { pushBack(NEWLINE); return prefix; } else { return prefix + suffix; } } } } if (goog.isNull(end)) { if (!opt_ignoreErrors) { throw new goog.labs.format.csv.ParseError( text, text.length - 1, 'Unexpected end of text after open quote'); } else { end = text.length; } } // Take substring, combine double quotes. return text.substring(start, end).replace(/""/g, '"'); }
javascript
function readQuotedField() { // We've already consumed the first quote by the time we get here. var start = index; var end = null; for (var token = nextToken(); token != EOF; token = nextToken()) { if (token == '"') { end = index - 1; token = nextToken(); // Two double quotes in a row. Keep scanning. if (token == '"') { end = null; continue; } // End of field. Break out. if (token == delimiter || token == EOF || token == NEWLINE) { if (token == NEWLINE) { pushBack(token); } break; } if (!opt_ignoreErrors) { // Ignoring errors here means keep going in current field after // closing quote. E.g. "ab"c,d splits into abc,d throw new goog.labs.format.csv.ParseError( text, index - 1, 'Unexpected character "' + token + '" after quote mark'); } else { // Fall back to reading the rest of this field as unquoted. // Note: the rest is guaranteed not start with ", as that case is // eliminated above. var prefix = '"' + text.substring(start, index); var suffix = readField(); if (suffix == EOR) { pushBack(NEWLINE); return prefix; } else { return prefix + suffix; } } } } if (goog.isNull(end)) { if (!opt_ignoreErrors) { throw new goog.labs.format.csv.ParseError( text, text.length - 1, 'Unexpected end of text after open quote'); } else { end = text.length; } } // Take substring, combine double quotes. return text.substring(start, end).replace(/""/g, '"'); }
[ "function", "readQuotedField", "(", ")", "{", "// We've already consumed the first quote by the time we get here.", "var", "start", "=", "index", ";", "var", "end", "=", "null", ";", "for", "(", "var", "token", "=", "nextToken", "(", ")", ";", "token", "!=", "EOF", ";", "token", "=", "nextToken", "(", ")", ")", "{", "if", "(", "token", "==", "'\"'", ")", "{", "end", "=", "index", "-", "1", ";", "token", "=", "nextToken", "(", ")", ";", "// Two double quotes in a row. Keep scanning.", "if", "(", "token", "==", "'\"'", ")", "{", "end", "=", "null", ";", "continue", ";", "}", "// End of field. Break out.", "if", "(", "token", "==", "delimiter", "||", "token", "==", "EOF", "||", "token", "==", "NEWLINE", ")", "{", "if", "(", "token", "==", "NEWLINE", ")", "{", "pushBack", "(", "token", ")", ";", "}", "break", ";", "}", "if", "(", "!", "opt_ignoreErrors", ")", "{", "// Ignoring errors here means keep going in current field after", "// closing quote. E.g. \"ab\"c,d splits into abc,d", "throw", "new", "goog", ".", "labs", ".", "format", ".", "csv", ".", "ParseError", "(", "text", ",", "index", "-", "1", ",", "'Unexpected character \"'", "+", "token", "+", "'\" after quote mark'", ")", ";", "}", "else", "{", "// Fall back to reading the rest of this field as unquoted.", "// Note: the rest is guaranteed not start with \", as that case is", "// eliminated above.", "var", "prefix", "=", "'\"'", "+", "text", ".", "substring", "(", "start", ",", "index", ")", ";", "var", "suffix", "=", "readField", "(", ")", ";", "if", "(", "suffix", "==", "EOR", ")", "{", "pushBack", "(", "NEWLINE", ")", ";", "return", "prefix", ";", "}", "else", "{", "return", "prefix", "+", "suffix", ";", "}", "}", "}", "}", "if", "(", "goog", ".", "isNull", "(", "end", ")", ")", "{", "if", "(", "!", "opt_ignoreErrors", ")", "{", "throw", "new", "goog", ".", "labs", ".", "format", ".", "csv", ".", "ParseError", "(", "text", ",", "text", ".", "length", "-", "1", ",", "'Unexpected end of text after open quote'", ")", ";", "}", "else", "{", "end", "=", "text", ".", "length", ";", "}", "}", "// Take substring, combine double quotes.", "return", "text", ".", "substring", "(", "start", ",", "end", ")", ".", "replace", "(", "/", "\"\"", "/", "g", ",", "'\"'", ")", ";", "}" ]
Read a quoted field from input. @return {string} The field, as a string.
[ "Read", "a", "quoted", "field", "from", "input", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/labs/format/csv.js#L225-L282
466
SeleniumHQ/selenium
third_party/closure/goog/labs/format/csv.js
readField
function readField() { var start = index; var didSeeComma = sawComma; sawComma = false; var token = nextToken(); if (token == EMPTY) { return EOR; } if (token == EOF || token == NEWLINE) { if (didSeeComma) { pushBack(EMPTY); return ''; } return EOR; } // This is the beginning of a quoted field. if (token == '"') { return readQuotedField(); } while (true) { // This is the end of line or file. if (token == EOF || token == NEWLINE) { pushBack(token); break; } // This is the end of record. if (token == delimiter) { sawComma = true; break; } if (token == '"' && !opt_ignoreErrors) { throw new goog.labs.format.csv.ParseError( text, index - 1, 'Unexpected quote mark'); } token = nextToken(); } var returnString = (token == EOF) ? text.substring(start) : // Return to end of file. text.substring(start, index - 1); return returnString.replace(/[\r\n]+/g, ''); // Squash any CRLFs. }
javascript
function readField() { var start = index; var didSeeComma = sawComma; sawComma = false; var token = nextToken(); if (token == EMPTY) { return EOR; } if (token == EOF || token == NEWLINE) { if (didSeeComma) { pushBack(EMPTY); return ''; } return EOR; } // This is the beginning of a quoted field. if (token == '"') { return readQuotedField(); } while (true) { // This is the end of line or file. if (token == EOF || token == NEWLINE) { pushBack(token); break; } // This is the end of record. if (token == delimiter) { sawComma = true; break; } if (token == '"' && !opt_ignoreErrors) { throw new goog.labs.format.csv.ParseError( text, index - 1, 'Unexpected quote mark'); } token = nextToken(); } var returnString = (token == EOF) ? text.substring(start) : // Return to end of file. text.substring(start, index - 1); return returnString.replace(/[\r\n]+/g, ''); // Squash any CRLFs. }
[ "function", "readField", "(", ")", "{", "var", "start", "=", "index", ";", "var", "didSeeComma", "=", "sawComma", ";", "sawComma", "=", "false", ";", "var", "token", "=", "nextToken", "(", ")", ";", "if", "(", "token", "==", "EMPTY", ")", "{", "return", "EOR", ";", "}", "if", "(", "token", "==", "EOF", "||", "token", "==", "NEWLINE", ")", "{", "if", "(", "didSeeComma", ")", "{", "pushBack", "(", "EMPTY", ")", ";", "return", "''", ";", "}", "return", "EOR", ";", "}", "// This is the beginning of a quoted field.", "if", "(", "token", "==", "'\"'", ")", "{", "return", "readQuotedField", "(", ")", ";", "}", "while", "(", "true", ")", "{", "// This is the end of line or file.", "if", "(", "token", "==", "EOF", "||", "token", "==", "NEWLINE", ")", "{", "pushBack", "(", "token", ")", ";", "break", ";", "}", "// This is the end of record.", "if", "(", "token", "==", "delimiter", ")", "{", "sawComma", "=", "true", ";", "break", ";", "}", "if", "(", "token", "==", "'\"'", "&&", "!", "opt_ignoreErrors", ")", "{", "throw", "new", "goog", ".", "labs", ".", "format", ".", "csv", ".", "ParseError", "(", "text", ",", "index", "-", "1", ",", "'Unexpected quote mark'", ")", ";", "}", "token", "=", "nextToken", "(", ")", ";", "}", "var", "returnString", "=", "(", "token", "==", "EOF", ")", "?", "text", ".", "substring", "(", "start", ")", ":", "// Return to end of file.", "text", ".", "substring", "(", "start", ",", "index", "-", "1", ")", ";", "return", "returnString", ".", "replace", "(", "/", "[\\r\\n]+", "/", "g", ",", "''", ")", ";", "// Squash any CRLFs.", "}" ]
Read a field from input. @return {string|!goog.labs.format.csv.Sentinels_} The field, as a string, or a sentinel (if applicable).
[ "Read", "a", "field", "from", "input", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/labs/format/csv.js#L289-L337
467
SeleniumHQ/selenium
third_party/closure/goog/labs/format/csv.js
readRecord
function readRecord() { if (index >= text.length) { return EOF; } var record = []; for (var field = readField(); field != EOR; field = readField()) { record.push(field); } return record; }
javascript
function readRecord() { if (index >= text.length) { return EOF; } var record = []; for (var field = readField(); field != EOR; field = readField()) { record.push(field); } return record; }
[ "function", "readRecord", "(", ")", "{", "if", "(", "index", ">=", "text", ".", "length", ")", "{", "return", "EOF", ";", "}", "var", "record", "=", "[", "]", ";", "for", "(", "var", "field", "=", "readField", "(", ")", ";", "field", "!=", "EOR", ";", "field", "=", "readField", "(", ")", ")", "{", "record", ".", "push", "(", "field", ")", ";", "}", "return", "record", ";", "}" ]
Read the next record. @return {!Array<string>|!goog.labs.format.csv.Sentinels_} A single record with multiple fields.
[ "Read", "the", "next", "record", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/labs/format/csv.js#L344-L353
468
SeleniumHQ/selenium
common/src/web/jquery-1.3.2.js
function( data ) { if ( data && /\S/.test(data) ) { // Inspired by code by Andrea Giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html var head = document.getElementsByTagName("head")[0] || document.documentElement, script = document.createElement("script"); script.type = "text/javascript"; if ( jQuery.support.scriptEval ) script.appendChild( document.createTextNode( data ) ); else script.text = data; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709). head.insertBefore( script, head.firstChild ); head.removeChild( script ); } }
javascript
function( data ) { if ( data && /\S/.test(data) ) { // Inspired by code by Andrea Giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html var head = document.getElementsByTagName("head")[0] || document.documentElement, script = document.createElement("script"); script.type = "text/javascript"; if ( jQuery.support.scriptEval ) script.appendChild( document.createTextNode( data ) ); else script.text = data; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709). head.insertBefore( script, head.firstChild ); head.removeChild( script ); } }
[ "function", "(", "data", ")", "{", "if", "(", "data", "&&", "/", "\\S", "/", ".", "test", "(", "data", ")", ")", "{", "// Inspired by code by Andrea Giammarchi", "// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html", "var", "head", "=", "document", ".", "getElementsByTagName", "(", "\"head\"", ")", "[", "0", "]", "||", "document", ".", "documentElement", ",", "script", "=", "document", ".", "createElement", "(", "\"script\"", ")", ";", "script", ".", "type", "=", "\"text/javascript\"", ";", "if", "(", "jQuery", ".", "support", ".", "scriptEval", ")", "script", ".", "appendChild", "(", "document", ".", "createTextNode", "(", "data", ")", ")", ";", "else", "script", ".", "text", "=", "data", ";", "// Use insertBefore instead of appendChild to circumvent an IE6 bug.", "// This arises when a base node is used (#2709).", "head", ".", "insertBefore", "(", "script", ",", "head", ".", "firstChild", ")", ";", "head", ".", "removeChild", "(", "script", ")", ";", "}", "}" ]
Evalulates a script in a global context
[ "Evalulates", "a", "script", "in", "a", "global", "context" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L646-L664
469
SeleniumHQ/selenium
common/src/web/jquery-1.3.2.js
num
function num(elem, prop) { return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; }
javascript
function num(elem, prop) { return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; }
[ "function", "num", "(", "elem", ",", "prop", ")", "{", "return", "elem", "[", "0", "]", "&&", "parseInt", "(", "jQuery", ".", "curCSS", "(", "elem", "[", "0", "]", ",", "prop", ",", "true", ")", ",", "10", ")", "||", "0", ";", "}" ]
Helper function used by the dimensions and offset modules
[ "Helper", "function", "used", "by", "the", "dimensions", "and", "offset", "modules" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L1266-L1268
470
SeleniumHQ/selenium
common/src/web/jquery-1.3.2.js
function( event, data, elem, bubbling ) { // Event object or event type var type = event.type || event; if( !bubbling ){ event = typeof event === "object" ? // jQuery.Event object event[expando] ? event : // Object literal jQuery.extend( jQuery.Event(type), event ) : // Just the event type (string) jQuery.Event(type); if ( type.indexOf("!") >= 0 ) { event.type = type = type.slice(0, -1); event.exclusive = true; } // Handle a global trigger if ( !elem ) { // Don't bubble custom events when global (to avoid too much overhead) event.stopPropagation(); // Only trigger if we've ever bound an event for it if ( this.global[type] ) jQuery.each( jQuery.cache, function(){ if ( this.events && this.events[type] ) jQuery.event.trigger( event, data, this.handle.elem ); }); } // Handle triggering a single element // don't do events on text and comment nodes if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 ) return undefined; // Clean up in case it is reused event.result = undefined; event.target = elem; // Clone the incoming data, if any data = jQuery.makeArray(data); data.unshift( event ); } event.currentTarget = elem; // Trigger the event, it is assumed that "handle" is a function var handle = jQuery.data(elem, "handle"); if ( handle ) handle.apply( elem, data ); // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) event.result = false; // Trigger the native events (except for clicks on links) if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) { this.triggered = true; try { elem[ type ](); // prevent IE from throwing an error for some hidden elements } catch (e) {} } this.triggered = false; if ( !event.isPropagationStopped() ) { var parent = elem.parentNode || elem.ownerDocument; if ( parent ) jQuery.event.trigger(event, data, parent, true); } }
javascript
function( event, data, elem, bubbling ) { // Event object or event type var type = event.type || event; if( !bubbling ){ event = typeof event === "object" ? // jQuery.Event object event[expando] ? event : // Object literal jQuery.extend( jQuery.Event(type), event ) : // Just the event type (string) jQuery.Event(type); if ( type.indexOf("!") >= 0 ) { event.type = type = type.slice(0, -1); event.exclusive = true; } // Handle a global trigger if ( !elem ) { // Don't bubble custom events when global (to avoid too much overhead) event.stopPropagation(); // Only trigger if we've ever bound an event for it if ( this.global[type] ) jQuery.each( jQuery.cache, function(){ if ( this.events && this.events[type] ) jQuery.event.trigger( event, data, this.handle.elem ); }); } // Handle triggering a single element // don't do events on text and comment nodes if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 ) return undefined; // Clean up in case it is reused event.result = undefined; event.target = elem; // Clone the incoming data, if any data = jQuery.makeArray(data); data.unshift( event ); } event.currentTarget = elem; // Trigger the event, it is assumed that "handle" is a function var handle = jQuery.data(elem, "handle"); if ( handle ) handle.apply( elem, data ); // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) event.result = false; // Trigger the native events (except for clicks on links) if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) { this.triggered = true; try { elem[ type ](); // prevent IE from throwing an error for some hidden elements } catch (e) {} } this.triggered = false; if ( !event.isPropagationStopped() ) { var parent = elem.parentNode || elem.ownerDocument; if ( parent ) jQuery.event.trigger(event, data, parent, true); } }
[ "function", "(", "event", ",", "data", ",", "elem", ",", "bubbling", ")", "{", "// Event object or event type", "var", "type", "=", "event", ".", "type", "||", "event", ";", "if", "(", "!", "bubbling", ")", "{", "event", "=", "typeof", "event", "===", "\"object\"", "?", "// jQuery.Event object", "event", "[", "expando", "]", "?", "event", ":", "// Object literal", "jQuery", ".", "extend", "(", "jQuery", ".", "Event", "(", "type", ")", ",", "event", ")", ":", "// Just the event type (string)", "jQuery", ".", "Event", "(", "type", ")", ";", "if", "(", "type", ".", "indexOf", "(", "\"!\"", ")", ">=", "0", ")", "{", "event", ".", "type", "=", "type", "=", "type", ".", "slice", "(", "0", ",", "-", "1", ")", ";", "event", ".", "exclusive", "=", "true", ";", "}", "// Handle a global trigger", "if", "(", "!", "elem", ")", "{", "// Don't bubble custom events when global (to avoid too much overhead)", "event", ".", "stopPropagation", "(", ")", ";", "// Only trigger if we've ever bound an event for it", "if", "(", "this", ".", "global", "[", "type", "]", ")", "jQuery", ".", "each", "(", "jQuery", ".", "cache", ",", "function", "(", ")", "{", "if", "(", "this", ".", "events", "&&", "this", ".", "events", "[", "type", "]", ")", "jQuery", ".", "event", ".", "trigger", "(", "event", ",", "data", ",", "this", ".", "handle", ".", "elem", ")", ";", "}", ")", ";", "}", "// Handle triggering a single element", "// don't do events on text and comment nodes", "if", "(", "!", "elem", "||", "elem", ".", "nodeType", "==", "3", "||", "elem", ".", "nodeType", "==", "8", ")", "return", "undefined", ";", "// Clean up in case it is reused", "event", ".", "result", "=", "undefined", ";", "event", ".", "target", "=", "elem", ";", "// Clone the incoming data, if any", "data", "=", "jQuery", ".", "makeArray", "(", "data", ")", ";", "data", ".", "unshift", "(", "event", ")", ";", "}", "event", ".", "currentTarget", "=", "elem", ";", "// Trigger the event, it is assumed that \"handle\" is a function", "var", "handle", "=", "jQuery", ".", "data", "(", "elem", ",", "\"handle\"", ")", ";", "if", "(", "handle", ")", "handle", ".", "apply", "(", "elem", ",", "data", ")", ";", "// Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)", "if", "(", "(", "!", "elem", "[", "type", "]", "||", "(", "jQuery", ".", "nodeName", "(", "elem", ",", "'a'", ")", "&&", "type", "==", "\"click\"", ")", ")", "&&", "elem", "[", "\"on\"", "+", "type", "]", "&&", "elem", "[", "\"on\"", "+", "type", "]", ".", "apply", "(", "elem", ",", "data", ")", "===", "false", ")", "event", ".", "result", "=", "false", ";", "// Trigger the native events (except for clicks on links)", "if", "(", "!", "bubbling", "&&", "elem", "[", "type", "]", "&&", "!", "event", ".", "isDefaultPrevented", "(", ")", "&&", "!", "(", "jQuery", ".", "nodeName", "(", "elem", ",", "'a'", ")", "&&", "type", "==", "\"click\"", ")", ")", "{", "this", ".", "triggered", "=", "true", ";", "try", "{", "elem", "[", "type", "]", "(", ")", ";", "// prevent IE from throwing an error for some hidden elements", "}", "catch", "(", "e", ")", "{", "}", "}", "this", ".", "triggered", "=", "false", ";", "if", "(", "!", "event", ".", "isPropagationStopped", "(", ")", ")", "{", "var", "parent", "=", "elem", ".", "parentNode", "||", "elem", ".", "ownerDocument", ";", "if", "(", "parent", ")", "jQuery", ".", "event", ".", "trigger", "(", "event", ",", "data", ",", "parent", ",", "true", ")", ";", "}", "}" ]
bubbling is internal
[ "bubbling", "is", "internal" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L2591-L2663
471
SeleniumHQ/selenium
common/src/web/jquery-1.3.2.js
function(isTimeout){ // The request was aborted, clear the interval and decrement jQuery.active if (xhr.readyState == 0) { if (ival) { // clear poll interval clearInterval(ival); ival = null; // Handle the global AJAX counter if ( s.global && ! --jQuery.active ) jQuery.event.trigger( "ajaxStop" ); } // The transfer is complete and the data is available, or the request timed out } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) { requestDone = true; // clear poll interval if (ival) { clearInterval(ival); ival = null; } status = isTimeout == "timeout" ? "timeout" : !jQuery.httpSuccess( xhr ) ? "error" : s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" : "success"; if ( status == "success" ) { // Watch for, and catch, XML document parse errors try { // process the data (runs the xml through httpData regardless of callback) data = jQuery.httpData( xhr, s.dataType, s ); } catch(e) { status = "parsererror"; } } // Make sure that the request was successful or notmodified if ( status == "success" ) { // Cache Last-Modified header, if ifModified mode. var modRes; try { modRes = xhr.getResponseHeader("Last-Modified"); } catch(e) {} // swallow exception thrown by FF if header is not available if ( s.ifModified && modRes ) jQuery.lastModified[s.url] = modRes; // JSONP handles its own success callback if ( !jsonp ) success(); } else jQuery.handleError(s, xhr, status); // Fire the complete handlers complete(); if ( isTimeout ) xhr.abort(); // Stop memory leaks if ( s.async ) xhr = null; } }
javascript
function(isTimeout){ // The request was aborted, clear the interval and decrement jQuery.active if (xhr.readyState == 0) { if (ival) { // clear poll interval clearInterval(ival); ival = null; // Handle the global AJAX counter if ( s.global && ! --jQuery.active ) jQuery.event.trigger( "ajaxStop" ); } // The transfer is complete and the data is available, or the request timed out } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) { requestDone = true; // clear poll interval if (ival) { clearInterval(ival); ival = null; } status = isTimeout == "timeout" ? "timeout" : !jQuery.httpSuccess( xhr ) ? "error" : s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" : "success"; if ( status == "success" ) { // Watch for, and catch, XML document parse errors try { // process the data (runs the xml through httpData regardless of callback) data = jQuery.httpData( xhr, s.dataType, s ); } catch(e) { status = "parsererror"; } } // Make sure that the request was successful or notmodified if ( status == "success" ) { // Cache Last-Modified header, if ifModified mode. var modRes; try { modRes = xhr.getResponseHeader("Last-Modified"); } catch(e) {} // swallow exception thrown by FF if header is not available if ( s.ifModified && modRes ) jQuery.lastModified[s.url] = modRes; // JSONP handles its own success callback if ( !jsonp ) success(); } else jQuery.handleError(s, xhr, status); // Fire the complete handlers complete(); if ( isTimeout ) xhr.abort(); // Stop memory leaks if ( s.async ) xhr = null; } }
[ "function", "(", "isTimeout", ")", "{", "// The request was aborted, clear the interval and decrement jQuery.active", "if", "(", "xhr", ".", "readyState", "==", "0", ")", "{", "if", "(", "ival", ")", "{", "// clear poll interval", "clearInterval", "(", "ival", ")", ";", "ival", "=", "null", ";", "// Handle the global AJAX counter", "if", "(", "s", ".", "global", "&&", "!", "--", "jQuery", ".", "active", ")", "jQuery", ".", "event", ".", "trigger", "(", "\"ajaxStop\"", ")", ";", "}", "// The transfer is complete and the data is available, or the request timed out", "}", "else", "if", "(", "!", "requestDone", "&&", "xhr", "&&", "(", "xhr", ".", "readyState", "==", "4", "||", "isTimeout", "==", "\"timeout\"", ")", ")", "{", "requestDone", "=", "true", ";", "// clear poll interval", "if", "(", "ival", ")", "{", "clearInterval", "(", "ival", ")", ";", "ival", "=", "null", ";", "}", "status", "=", "isTimeout", "==", "\"timeout\"", "?", "\"timeout\"", ":", "!", "jQuery", ".", "httpSuccess", "(", "xhr", ")", "?", "\"error\"", ":", "s", ".", "ifModified", "&&", "jQuery", ".", "httpNotModified", "(", "xhr", ",", "s", ".", "url", ")", "?", "\"notmodified\"", ":", "\"success\"", ";", "if", "(", "status", "==", "\"success\"", ")", "{", "// Watch for, and catch, XML document parse errors", "try", "{", "// process the data (runs the xml through httpData regardless of callback)", "data", "=", "jQuery", ".", "httpData", "(", "xhr", ",", "s", ".", "dataType", ",", "s", ")", ";", "}", "catch", "(", "e", ")", "{", "status", "=", "\"parsererror\"", ";", "}", "}", "// Make sure that the request was successful or notmodified", "if", "(", "status", "==", "\"success\"", ")", "{", "// Cache Last-Modified header, if ifModified mode.", "var", "modRes", ";", "try", "{", "modRes", "=", "xhr", ".", "getResponseHeader", "(", "\"Last-Modified\"", ")", ";", "}", "catch", "(", "e", ")", "{", "}", "// swallow exception thrown by FF if header is not available", "if", "(", "s", ".", "ifModified", "&&", "modRes", ")", "jQuery", ".", "lastModified", "[", "s", ".", "url", "]", "=", "modRes", ";", "// JSONP handles its own success callback", "if", "(", "!", "jsonp", ")", "success", "(", ")", ";", "}", "else", "jQuery", ".", "handleError", "(", "s", ",", "xhr", ",", "status", ")", ";", "// Fire the complete handlers", "complete", "(", ")", ";", "if", "(", "isTimeout", ")", "xhr", ".", "abort", "(", ")", ";", "// Stop memory leaks", "if", "(", "s", ".", "async", ")", "xhr", "=", "null", ";", "}", "}" ]
Wait for a response to come back
[ "Wait", "for", "a", "response", "to", "come", "back" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L3553-L3616
472
SeleniumHQ/selenium
common/src/web/jquery-1.3.2.js
function( xhr ) { try { // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 return !xhr.status && location.protocol == "file:" || ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223; } catch(e){} return false; }
javascript
function( xhr ) { try { // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 return !xhr.status && location.protocol == "file:" || ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223; } catch(e){} return false; }
[ "function", "(", "xhr", ")", "{", "try", "{", "// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450", "return", "!", "xhr", ".", "status", "&&", "location", ".", "protocol", "==", "\"file:\"", "||", "(", "xhr", ".", "status", ">=", "200", "&&", "xhr", ".", "status", "<", "300", ")", "||", "xhr", ".", "status", "==", "304", "||", "xhr", ".", "status", "==", "1223", ";", "}", "catch", "(", "e", ")", "{", "}", "return", "false", ";", "}" ]
Determines if an XMLHttpRequest was successful or not
[ "Determines", "if", "an", "XMLHttpRequest", "was", "successful", "or", "not" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L3683-L3690
473
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/places.js
isBookmarkInFolder
function isBookmarkInFolder(uri, folderId) { var ids = bookmarksService.getBookmarkIdsForURI(uri, {}); for (let i = 0; i < ids.length; i++) { if (bookmarksService.getFolderIdForItem(ids[i]) == folderId) return true; } return false; }
javascript
function isBookmarkInFolder(uri, folderId) { var ids = bookmarksService.getBookmarkIdsForURI(uri, {}); for (let i = 0; i < ids.length; i++) { if (bookmarksService.getFolderIdForItem(ids[i]) == folderId) return true; } return false; }
[ "function", "isBookmarkInFolder", "(", "uri", ",", "folderId", ")", "{", "var", "ids", "=", "bookmarksService", ".", "getBookmarkIdsForURI", "(", "uri", ",", "{", "}", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "ids", ".", "length", ";", "i", "++", ")", "{", "if", "(", "bookmarksService", ".", "getFolderIdForItem", "(", "ids", "[", "i", "]", ")", "==", "folderId", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Check if an URI is bookmarked within the specified folder @param (nsIURI) uri URI of the bookmark @param {String} folderId Folder in which the search has to take place @return Returns if the URI exists in the given folder @type Boolean
[ "Check", "if", "an", "URI", "is", "bookmarked", "within", "the", "specified", "folder" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/places.js#L111-L120
474
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/places.js
restoreDefaultBookmarks
function restoreDefaultBookmarks() { // Set up the observer -- we're only checking for success here, so we'll simply // time out and throw on failure. It makes the code much clearer than handling // finished state and success state separately. var importSuccessful = false; var importObserver = { observe: function (aSubject, aTopic, aData) { if (aTopic == TOPIC_BOOKMARKS_RESTORE_SUCCESS) { importSuccessful = true; } } } observerService.addObserver(importObserver, TOPIC_BOOKMARKS_RESTORE_SUCCESS, false); try { // Fire off the import var bookmarksURI = utils.createURI(BOOKMARKS_RESOURCE); var importer = Cc["@mozilla.org/browser/places/import-export-service;1"]. getService(Ci.nsIPlacesImportExportService); importer.importHTMLFromURI(bookmarksURI, true); // Wait for it to be finished--the observer above will flip this flag mozmill.utils.waitFor(function () { return importSuccessful; }, "Default bookmarks have finished importing", BOOKMARKS_TIMEOUT); } finally { // Whatever happens, remove the observer afterwards observerService.removeObserver(importObserver, TOPIC_BOOKMARKS_RESTORE_SUCCESS); } }
javascript
function restoreDefaultBookmarks() { // Set up the observer -- we're only checking for success here, so we'll simply // time out and throw on failure. It makes the code much clearer than handling // finished state and success state separately. var importSuccessful = false; var importObserver = { observe: function (aSubject, aTopic, aData) { if (aTopic == TOPIC_BOOKMARKS_RESTORE_SUCCESS) { importSuccessful = true; } } } observerService.addObserver(importObserver, TOPIC_BOOKMARKS_RESTORE_SUCCESS, false); try { // Fire off the import var bookmarksURI = utils.createURI(BOOKMARKS_RESOURCE); var importer = Cc["@mozilla.org/browser/places/import-export-service;1"]. getService(Ci.nsIPlacesImportExportService); importer.importHTMLFromURI(bookmarksURI, true); // Wait for it to be finished--the observer above will flip this flag mozmill.utils.waitFor(function () { return importSuccessful; }, "Default bookmarks have finished importing", BOOKMARKS_TIMEOUT); } finally { // Whatever happens, remove the observer afterwards observerService.removeObserver(importObserver, TOPIC_BOOKMARKS_RESTORE_SUCCESS); } }
[ "function", "restoreDefaultBookmarks", "(", ")", "{", "// Set up the observer -- we're only checking for success here, so we'll simply", "// time out and throw on failure. It makes the code much clearer than handling", "// finished state and success state separately.", "var", "importSuccessful", "=", "false", ";", "var", "importObserver", "=", "{", "observe", ":", "function", "(", "aSubject", ",", "aTopic", ",", "aData", ")", "{", "if", "(", "aTopic", "==", "TOPIC_BOOKMARKS_RESTORE_SUCCESS", ")", "{", "importSuccessful", "=", "true", ";", "}", "}", "}", "observerService", ".", "addObserver", "(", "importObserver", ",", "TOPIC_BOOKMARKS_RESTORE_SUCCESS", ",", "false", ")", ";", "try", "{", "// Fire off the import", "var", "bookmarksURI", "=", "utils", ".", "createURI", "(", "BOOKMARKS_RESOURCE", ")", ";", "var", "importer", "=", "Cc", "[", "\"@mozilla.org/browser/places/import-export-service;1\"", "]", ".", "getService", "(", "Ci", ".", "nsIPlacesImportExportService", ")", ";", "importer", ".", "importHTMLFromURI", "(", "bookmarksURI", ",", "true", ")", ";", "// Wait for it to be finished--the observer above will flip this flag", "mozmill", ".", "utils", ".", "waitFor", "(", "function", "(", ")", "{", "return", "importSuccessful", ";", "}", ",", "\"Default bookmarks have finished importing\"", ",", "BOOKMARKS_TIMEOUT", ")", ";", "}", "finally", "{", "// Whatever happens, remove the observer afterwards", "observerService", ".", "removeObserver", "(", "importObserver", ",", "TOPIC_BOOKMARKS_RESTORE_SUCCESS", ")", ";", "}", "}" ]
Restore the default bookmarks for the current profile
[ "Restore", "the", "default", "bookmarks", "for", "the", "current", "profile" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/places.js#L125-L155
475
SeleniumHQ/selenium
javascript/node/selenium-webdriver/io/zip.js
load
function load(path) { return io.read(path).then(data => { let zip = new Zip; return zip.z_.loadAsync(data).then(() => zip); }); }
javascript
function load(path) { return io.read(path).then(data => { let zip = new Zip; return zip.z_.loadAsync(data).then(() => zip); }); }
[ "function", "load", "(", "path", ")", "{", "return", "io", ".", "read", "(", "path", ")", ".", "then", "(", "data", "=>", "{", "let", "zip", "=", "new", "Zip", ";", "return", "zip", ".", "z_", ".", "loadAsync", "(", "data", ")", ".", "then", "(", "(", ")", "=>", "zip", ")", ";", "}", ")", ";", "}" ]
Asynchronously opens a zip archive. @param {string} path to the zip archive to load. @return {!Promise<!Zip>} a promise that will resolve with the opened archive.
[ "Asynchronously", "opens", "a", "zip", "archive", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/io/zip.js#L154-L159
476
SeleniumHQ/selenium
javascript/node/selenium-webdriver/io/zip.js
unzip
function unzip(src, dst) { return load(src).then(zip => { let promisedDirs = new Map; let promises = []; zip.z_.forEach((relPath, file) => { let p; if (file.dir) { p = createDir(relPath); } else { let dirname = path.dirname(relPath); if (dirname === '.') { p = writeFile(relPath, file); } else { p = createDir(dirname).then(() => writeFile(relPath, file)); } } promises.push(p); }); return Promise.all(promises).then(() => dst); function createDir(dir) { let p = promisedDirs.get(dir); if (!p) { p = io.mkdirp(path.join(dst, dir)); promisedDirs.set(dir, p); } return p; } function writeFile(relPath, file) { return file.async('nodebuffer') .then(buffer => io.write(path.join(dst, relPath), buffer)); } }); }
javascript
function unzip(src, dst) { return load(src).then(zip => { let promisedDirs = new Map; let promises = []; zip.z_.forEach((relPath, file) => { let p; if (file.dir) { p = createDir(relPath); } else { let dirname = path.dirname(relPath); if (dirname === '.') { p = writeFile(relPath, file); } else { p = createDir(dirname).then(() => writeFile(relPath, file)); } } promises.push(p); }); return Promise.all(promises).then(() => dst); function createDir(dir) { let p = promisedDirs.get(dir); if (!p) { p = io.mkdirp(path.join(dst, dir)); promisedDirs.set(dir, p); } return p; } function writeFile(relPath, file) { return file.async('nodebuffer') .then(buffer => io.write(path.join(dst, relPath), buffer)); } }); }
[ "function", "unzip", "(", "src", ",", "dst", ")", "{", "return", "load", "(", "src", ")", ".", "then", "(", "zip", "=>", "{", "let", "promisedDirs", "=", "new", "Map", ";", "let", "promises", "=", "[", "]", ";", "zip", ".", "z_", ".", "forEach", "(", "(", "relPath", ",", "file", ")", "=>", "{", "let", "p", ";", "if", "(", "file", ".", "dir", ")", "{", "p", "=", "createDir", "(", "relPath", ")", ";", "}", "else", "{", "let", "dirname", "=", "path", ".", "dirname", "(", "relPath", ")", ";", "if", "(", "dirname", "===", "'.'", ")", "{", "p", "=", "writeFile", "(", "relPath", ",", "file", ")", ";", "}", "else", "{", "p", "=", "createDir", "(", "dirname", ")", ".", "then", "(", "(", ")", "=>", "writeFile", "(", "relPath", ",", "file", ")", ")", ";", "}", "}", "promises", ".", "push", "(", "p", ")", ";", "}", ")", ";", "return", "Promise", ".", "all", "(", "promises", ")", ".", "then", "(", "(", ")", "=>", "dst", ")", ";", "function", "createDir", "(", "dir", ")", "{", "let", "p", "=", "promisedDirs", ".", "get", "(", "dir", ")", ";", "if", "(", "!", "p", ")", "{", "p", "=", "io", ".", "mkdirp", "(", "path", ".", "join", "(", "dst", ",", "dir", ")", ")", ";", "promisedDirs", ".", "set", "(", "dir", ",", "p", ")", ";", "}", "return", "p", ";", "}", "function", "writeFile", "(", "relPath", ",", "file", ")", "{", "return", "file", ".", "async", "(", "'nodebuffer'", ")", ".", "then", "(", "buffer", "=>", "io", ".", "write", "(", "path", ".", "join", "(", "dst", ",", "relPath", ")", ",", "buffer", ")", ")", ";", "}", "}", ")", ";", "}" ]
Asynchronously unzips an archive file. @param {string} src path to the source file to unzip. @param {string} dst path to the destination directory. @return {!Promise<string>} a promise that will resolve with `dst` once the archive has been unzipped.
[ "Asynchronously", "unzips", "an", "archive", "file", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/io/zip.js#L170-L206
477
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/http.js
headersToString
function headersToString(headers) { let ret = []; headers.forEach(function(value, name) { ret.push(`${name.toLowerCase()}: ${value}`); }); return ret.join('\n'); }
javascript
function headersToString(headers) { let ret = []; headers.forEach(function(value, name) { ret.push(`${name.toLowerCase()}: ${value}`); }); return ret.join('\n'); }
[ "function", "headersToString", "(", "headers", ")", "{", "let", "ret", "=", "[", "]", ";", "headers", ".", "forEach", "(", "function", "(", "value", ",", "name", ")", "{", "ret", ".", "push", "(", "`", "${", "name", ".", "toLowerCase", "(", ")", "}", "${", "value", "}", "`", ")", ";", "}", ")", ";", "return", "ret", ".", "join", "(", "'\\n'", ")", ";", "}" ]
Converts a headers map to a HTTP header block string. @param {!Map<string, string>} headers The map to convert. @return {string} The headers as a string.
[ "Converts", "a", "headers", "map", "to", "a", "HTTP", "header", "block", "string", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/http.js#L70-L76
478
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/tabs.js
getTabsWithURL
function getTabsWithURL(aUrl) { var tabs = [ ]; var uri = utils.createURI(aUrl, null, null); var wm = Cc["@mozilla.org/appshell/window-mediator;1"]. getService(Ci.nsIWindowMediator); var winEnum = wm.getEnumerator("navigator:browser"); // Iterate through all windows while (winEnum.hasMoreElements()) { var window = winEnum.getNext(); // Don't check windows which are about to close or don't have gBrowser set if (window.closed || !("gBrowser" in window)) continue; // Iterate through all tabs in the current window var browsers = window.gBrowser.browsers; for (var i = 0; i < browsers.length; i++) { var browser = browsers[i]; if (browser.currentURI.equals(uri)) { tabs.push({ controller : new mozmill.controller.MozMillController(window), index : i }); } } } return tabs; }
javascript
function getTabsWithURL(aUrl) { var tabs = [ ]; var uri = utils.createURI(aUrl, null, null); var wm = Cc["@mozilla.org/appshell/window-mediator;1"]. getService(Ci.nsIWindowMediator); var winEnum = wm.getEnumerator("navigator:browser"); // Iterate through all windows while (winEnum.hasMoreElements()) { var window = winEnum.getNext(); // Don't check windows which are about to close or don't have gBrowser set if (window.closed || !("gBrowser" in window)) continue; // Iterate through all tabs in the current window var browsers = window.gBrowser.browsers; for (var i = 0; i < browsers.length; i++) { var browser = browsers[i]; if (browser.currentURI.equals(uri)) { tabs.push({ controller : new mozmill.controller.MozMillController(window), index : i }); } } } return tabs; }
[ "function", "getTabsWithURL", "(", "aUrl", ")", "{", "var", "tabs", "=", "[", "]", ";", "var", "uri", "=", "utils", ".", "createURI", "(", "aUrl", ",", "null", ",", "null", ")", ";", "var", "wm", "=", "Cc", "[", "\"@mozilla.org/appshell/window-mediator;1\"", "]", ".", "getService", "(", "Ci", ".", "nsIWindowMediator", ")", ";", "var", "winEnum", "=", "wm", ".", "getEnumerator", "(", "\"navigator:browser\"", ")", ";", "// Iterate through all windows", "while", "(", "winEnum", ".", "hasMoreElements", "(", ")", ")", "{", "var", "window", "=", "winEnum", ".", "getNext", "(", ")", ";", "// Don't check windows which are about to close or don't have gBrowser set", "if", "(", "window", ".", "closed", "||", "!", "(", "\"gBrowser\"", "in", "window", ")", ")", "continue", ";", "// Iterate through all tabs in the current window", "var", "browsers", "=", "window", ".", "gBrowser", ".", "browsers", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "browsers", ".", "length", ";", "i", "++", ")", "{", "var", "browser", "=", "browsers", "[", "i", "]", ";", "if", "(", "browser", ".", "currentURI", ".", "equals", "(", "uri", ")", ")", "{", "tabs", ".", "push", "(", "{", "controller", ":", "new", "mozmill", ".", "controller", ".", "MozMillController", "(", "window", ")", ",", "index", ":", "i", "}", ")", ";", "}", "}", "}", "return", "tabs", ";", "}" ]
Check and return all open tabs with the specified URL @param {string} aUrl URL to check for @returns Array of tabs
[ "Check", "and", "return", "all", "open", "tabs", "with", "the", "specified", "URL" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabs.js#L80-L111
479
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/tabs.js
tabBrowser_closeAllTabs
function tabBrowser_closeAllTabs() { while (this._controller.tabs.length > 1) { this.closeTab({type: "menu"}); } this._controller.open("about:blank"); this._controller.waitForPageLoad(); }
javascript
function tabBrowser_closeAllTabs() { while (this._controller.tabs.length > 1) { this.closeTab({type: "menu"}); } this._controller.open("about:blank"); this._controller.waitForPageLoad(); }
[ "function", "tabBrowser_closeAllTabs", "(", ")", "{", "while", "(", "this", ".", "_controller", ".", "tabs", ".", "length", ">", "1", ")", "{", "this", ".", "closeTab", "(", "{", "type", ":", "\"menu\"", "}", ")", ";", "}", "this", ".", "_controller", ".", "open", "(", "\"about:blank\"", ")", ";", "this", ".", "_controller", ".", "waitForPageLoad", "(", ")", ";", "}" ]
Close all tabs of the window except the last one and open a blank page.
[ "Close", "all", "tabs", "of", "the", "window", "except", "the", "last", "one", "and", "open", "a", "blank", "page", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabs.js#L172-L180
480
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/tabs.js
tabBrowser_closeTab
function tabBrowser_closeTab(aEvent) { var event = aEvent || { }; var type = (event.type == undefined) ? "menu" : event.type; // Disable tab closing animation for default behavior prefs.preferences.setPref(PREF_TABS_ANIMATE, false); // Add event listener to wait until the tab has been closed var self = { closed: false }; function checkTabClosed() { self.closed = true; } this._controller.window.addEventListener("TabClose", checkTabClosed, false); switch (type) { case "closeButton": var button = this.getElement({type: "tabs_tabCloseButton", subtype: "tab", value: this.getTab()}); this._controller.click(button); break; case "menu": var menuitem = new elementslib.Elem(this._controller.menus['file-menu'].menu_close); this._controller.click(menuitem); break; case "middleClick": var tab = this.getTab(event.index); this._controller.middleClick(tab); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "closeCmd.key"); this._controller.keypress(null, cmdKey, {accelKey: true}); break; default: throw new Error(arguments.callee.name + ": Unknown event type - " + type); } try { this._controller.waitForEval("subject.tab.closed == true", TIMEOUT, 100, {tab: self}); } finally { this._controller.window.removeEventListener("TabClose", checkTabClosed, false); prefs.preferences.clearUserPref(PREF_TABS_ANIMATE); } }
javascript
function tabBrowser_closeTab(aEvent) { var event = aEvent || { }; var type = (event.type == undefined) ? "menu" : event.type; // Disable tab closing animation for default behavior prefs.preferences.setPref(PREF_TABS_ANIMATE, false); // Add event listener to wait until the tab has been closed var self = { closed: false }; function checkTabClosed() { self.closed = true; } this._controller.window.addEventListener("TabClose", checkTabClosed, false); switch (type) { case "closeButton": var button = this.getElement({type: "tabs_tabCloseButton", subtype: "tab", value: this.getTab()}); this._controller.click(button); break; case "menu": var menuitem = new elementslib.Elem(this._controller.menus['file-menu'].menu_close); this._controller.click(menuitem); break; case "middleClick": var tab = this.getTab(event.index); this._controller.middleClick(tab); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "closeCmd.key"); this._controller.keypress(null, cmdKey, {accelKey: true}); break; default: throw new Error(arguments.callee.name + ": Unknown event type - " + type); } try { this._controller.waitForEval("subject.tab.closed == true", TIMEOUT, 100, {tab: self}); } finally { this._controller.window.removeEventListener("TabClose", checkTabClosed, false); prefs.preferences.clearUserPref(PREF_TABS_ANIMATE); } }
[ "function", "tabBrowser_closeTab", "(", "aEvent", ")", "{", "var", "event", "=", "aEvent", "||", "{", "}", ";", "var", "type", "=", "(", "event", ".", "type", "==", "undefined", ")", "?", "\"menu\"", ":", "event", ".", "type", ";", "// Disable tab closing animation for default behavior", "prefs", ".", "preferences", ".", "setPref", "(", "PREF_TABS_ANIMATE", ",", "false", ")", ";", "// Add event listener to wait until the tab has been closed", "var", "self", "=", "{", "closed", ":", "false", "}", ";", "function", "checkTabClosed", "(", ")", "{", "self", ".", "closed", "=", "true", ";", "}", "this", ".", "_controller", ".", "window", ".", "addEventListener", "(", "\"TabClose\"", ",", "checkTabClosed", ",", "false", ")", ";", "switch", "(", "type", ")", "{", "case", "\"closeButton\"", ":", "var", "button", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"tabs_tabCloseButton\"", ",", "subtype", ":", "\"tab\"", ",", "value", ":", "this", ".", "getTab", "(", ")", "}", ")", ";", "this", ".", "_controller", ".", "click", "(", "button", ")", ";", "break", ";", "case", "\"menu\"", ":", "var", "menuitem", "=", "new", "elementslib", ".", "Elem", "(", "this", ".", "_controller", ".", "menus", "[", "'file-menu'", "]", ".", "menu_close", ")", ";", "this", ".", "_controller", ".", "click", "(", "menuitem", ")", ";", "break", ";", "case", "\"middleClick\"", ":", "var", "tab", "=", "this", ".", "getTab", "(", "event", ".", "index", ")", ";", "this", ".", "_controller", ".", "middleClick", "(", "tab", ")", ";", "break", ";", "case", "\"shortcut\"", ":", "var", "cmdKey", "=", "utils", ".", "getEntity", "(", "this", ".", "getDtds", "(", ")", ",", "\"closeCmd.key\"", ")", ";", "this", ".", "_controller", ".", "keypress", "(", "null", ",", "cmdKey", ",", "{", "accelKey", ":", "true", "}", ")", ";", "break", ";", "default", ":", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Unknown event type - \"", "+", "type", ")", ";", "}", "try", "{", "this", ".", "_controller", ".", "waitForEval", "(", "\"subject.tab.closed == true\"", ",", "TIMEOUT", ",", "100", ",", "{", "tab", ":", "self", "}", ")", ";", "}", "finally", "{", "this", ".", "_controller", ".", "window", ".", "removeEventListener", "(", "\"TabClose\"", ",", "checkTabClosed", ",", "false", ")", ";", "prefs", ".", "preferences", ".", "clearUserPref", "(", "PREF_TABS_ANIMATE", ")", ";", "}", "}" ]
Close an open tab @param {object} aEvent The event specifies how to close a tab Elements: type - Type of event (closeButton, menu, middleClick, shortcut) [optional - default: menu]
[ "Close", "an", "open", "tab" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabs.js#L190-L231
481
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/tabs.js
tabBrowser_getTab
function tabBrowser_getTab(index) { if (index === undefined) index = this.selectedIndex; return this.getElement({type: "tabs_tab", subtype: "index", value: index}); }
javascript
function tabBrowser_getTab(index) { if (index === undefined) index = this.selectedIndex; return this.getElement({type: "tabs_tab", subtype: "index", value: index}); }
[ "function", "tabBrowser_getTab", "(", "index", ")", "{", "if", "(", "index", "===", "undefined", ")", "index", "=", "this", ".", "selectedIndex", ";", "return", "this", ".", "getElement", "(", "{", "type", ":", "\"tabs_tab\"", ",", "subtype", ":", "\"index\"", ",", "value", ":", "index", "}", ")", ";", "}" ]
Get the tab at the specified index @param {number} index Index of the tab @returns The requested tab @type {ElemBase}
[ "Get", "the", "tab", "at", "the", "specified", "index" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabs.js#L335-L340
482
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/tabs.js
tabBrowser_getTabPanelElement
function tabBrowser_getTabPanelElement(tabIndex, elemString) { var index = tabIndex ? tabIndex : this.selectedIndex; var elemStr = elemString ? elemString : ""; // Get the tab panel and check if an element has to be fetched var panel = this.getElement({type: "tabs_tabPanel", subtype: "tab", value: this.getTab(index)}); var elem = new elementslib.Lookup(this._controller.window.document, panel.expression + elemStr); return elem; }
javascript
function tabBrowser_getTabPanelElement(tabIndex, elemString) { var index = tabIndex ? tabIndex : this.selectedIndex; var elemStr = elemString ? elemString : ""; // Get the tab panel and check if an element has to be fetched var panel = this.getElement({type: "tabs_tabPanel", subtype: "tab", value: this.getTab(index)}); var elem = new elementslib.Lookup(this._controller.window.document, panel.expression + elemStr); return elem; }
[ "function", "tabBrowser_getTabPanelElement", "(", "tabIndex", ",", "elemString", ")", "{", "var", "index", "=", "tabIndex", "?", "tabIndex", ":", "this", ".", "selectedIndex", ";", "var", "elemStr", "=", "elemString", "?", "elemString", ":", "\"\"", ";", "// Get the tab panel and check if an element has to be fetched", "var", "panel", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"tabs_tabPanel\"", ",", "subtype", ":", "\"tab\"", ",", "value", ":", "this", ".", "getTab", "(", "index", ")", "}", ")", ";", "var", "elem", "=", "new", "elementslib", ".", "Lookup", "(", "this", ".", "_controller", ".", "window", ".", "document", ",", "panel", ".", "expression", "+", "elemStr", ")", ";", "return", "elem", ";", "}" ]
Creates the child element of the tab's notification bar @param {number} tabIndex (Optional) Index of the tab to check @param {string} elemString (Optional) Lookup string of the notification bar's child element @return The created child element @type {ElemBase}
[ "Creates", "the", "child", "element", "of", "the", "tab", "s", "notification", "bar" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabs.js#L352-L362
483
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/tabs.js
tabBrowser_openTab
function tabBrowser_openTab(aEvent) { var event = aEvent || { }; var type = (event.type == undefined) ? "menu" : event.type; // Disable tab closing animation for default behavior prefs.preferences.setPref(PREF_TABS_ANIMATE, false); // Add event listener to wait until the tab has been opened var self = { opened: false }; function checkTabOpened() { self.opened = true; } this._controller.window.addEventListener("TabOpen", checkTabOpened, false); switch (type) { case "menu": var menuitem = new elementslib.Elem(this._controller.menus['file-menu'].menu_newNavigatorTab); this._controller.click(menuitem); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "tabCmd.commandkey"); this._controller.keypress(null, cmdKey, {accelKey: true}); break; case "newTabButton": var newTabButton = this.getElement({type: "tabs_newTabButton"}); this._controller.click(newTabButton); break; case "tabStrip": var tabStrip = this.getElement({type: "tabs_strip"}); // RTL-locales need to be treated separately if (utils.getEntity(this.getDtds(), "locale.dir") == "rtl") { // XXX: Workaround until bug 537968 has been fixed this._controller.click(tabStrip, 100, 3); // Todo: Calculate the correct x position this._controller.doubleClick(tabStrip, 100, 3); } else { // XXX: Workaround until bug 537968 has been fixed this._controller.click(tabStrip, tabStrip.getNode().clientWidth - 100, 3); // Todo: Calculate the correct x position this._controller.doubleClick(tabStrip, tabStrip.getNode().clientWidth - 100, 3); } break; default: throw new Error(arguments.callee.name + ": Unknown event type - " + type); } try { this._controller.waitForEval("subject.tab.opened == true", TIMEOUT, 100, {tab: self}); } finally { this._controller.window.removeEventListener("TabOpen", checkTabOpened, false); prefs.preferences.clearUserPref(PREF_TABS_ANIMATE); } }
javascript
function tabBrowser_openTab(aEvent) { var event = aEvent || { }; var type = (event.type == undefined) ? "menu" : event.type; // Disable tab closing animation for default behavior prefs.preferences.setPref(PREF_TABS_ANIMATE, false); // Add event listener to wait until the tab has been opened var self = { opened: false }; function checkTabOpened() { self.opened = true; } this._controller.window.addEventListener("TabOpen", checkTabOpened, false); switch (type) { case "menu": var menuitem = new elementslib.Elem(this._controller.menus['file-menu'].menu_newNavigatorTab); this._controller.click(menuitem); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "tabCmd.commandkey"); this._controller.keypress(null, cmdKey, {accelKey: true}); break; case "newTabButton": var newTabButton = this.getElement({type: "tabs_newTabButton"}); this._controller.click(newTabButton); break; case "tabStrip": var tabStrip = this.getElement({type: "tabs_strip"}); // RTL-locales need to be treated separately if (utils.getEntity(this.getDtds(), "locale.dir") == "rtl") { // XXX: Workaround until bug 537968 has been fixed this._controller.click(tabStrip, 100, 3); // Todo: Calculate the correct x position this._controller.doubleClick(tabStrip, 100, 3); } else { // XXX: Workaround until bug 537968 has been fixed this._controller.click(tabStrip, tabStrip.getNode().clientWidth - 100, 3); // Todo: Calculate the correct x position this._controller.doubleClick(tabStrip, tabStrip.getNode().clientWidth - 100, 3); } break; default: throw new Error(arguments.callee.name + ": Unknown event type - " + type); } try { this._controller.waitForEval("subject.tab.opened == true", TIMEOUT, 100, {tab: self}); } finally { this._controller.window.removeEventListener("TabOpen", checkTabOpened, false); prefs.preferences.clearUserPref(PREF_TABS_ANIMATE); } }
[ "function", "tabBrowser_openTab", "(", "aEvent", ")", "{", "var", "event", "=", "aEvent", "||", "{", "}", ";", "var", "type", "=", "(", "event", ".", "type", "==", "undefined", ")", "?", "\"menu\"", ":", "event", ".", "type", ";", "// Disable tab closing animation for default behavior", "prefs", ".", "preferences", ".", "setPref", "(", "PREF_TABS_ANIMATE", ",", "false", ")", ";", "// Add event listener to wait until the tab has been opened", "var", "self", "=", "{", "opened", ":", "false", "}", ";", "function", "checkTabOpened", "(", ")", "{", "self", ".", "opened", "=", "true", ";", "}", "this", ".", "_controller", ".", "window", ".", "addEventListener", "(", "\"TabOpen\"", ",", "checkTabOpened", ",", "false", ")", ";", "switch", "(", "type", ")", "{", "case", "\"menu\"", ":", "var", "menuitem", "=", "new", "elementslib", ".", "Elem", "(", "this", ".", "_controller", ".", "menus", "[", "'file-menu'", "]", ".", "menu_newNavigatorTab", ")", ";", "this", ".", "_controller", ".", "click", "(", "menuitem", ")", ";", "break", ";", "case", "\"shortcut\"", ":", "var", "cmdKey", "=", "utils", ".", "getEntity", "(", "this", ".", "getDtds", "(", ")", ",", "\"tabCmd.commandkey\"", ")", ";", "this", ".", "_controller", ".", "keypress", "(", "null", ",", "cmdKey", ",", "{", "accelKey", ":", "true", "}", ")", ";", "break", ";", "case", "\"newTabButton\"", ":", "var", "newTabButton", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"tabs_newTabButton\"", "}", ")", ";", "this", ".", "_controller", ".", "click", "(", "newTabButton", ")", ";", "break", ";", "case", "\"tabStrip\"", ":", "var", "tabStrip", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"tabs_strip\"", "}", ")", ";", "// RTL-locales need to be treated separately", "if", "(", "utils", ".", "getEntity", "(", "this", ".", "getDtds", "(", ")", ",", "\"locale.dir\"", ")", "==", "\"rtl\"", ")", "{", "// XXX: Workaround until bug 537968 has been fixed", "this", ".", "_controller", ".", "click", "(", "tabStrip", ",", "100", ",", "3", ")", ";", "// Todo: Calculate the correct x position", "this", ".", "_controller", ".", "doubleClick", "(", "tabStrip", ",", "100", ",", "3", ")", ";", "}", "else", "{", "// XXX: Workaround until bug 537968 has been fixed", "this", ".", "_controller", ".", "click", "(", "tabStrip", ",", "tabStrip", ".", "getNode", "(", ")", ".", "clientWidth", "-", "100", ",", "3", ")", ";", "// Todo: Calculate the correct x position", "this", ".", "_controller", ".", "doubleClick", "(", "tabStrip", ",", "tabStrip", ".", "getNode", "(", ")", ".", "clientWidth", "-", "100", ",", "3", ")", ";", "}", "break", ";", "default", ":", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Unknown event type - \"", "+", "type", ")", ";", "}", "try", "{", "this", ".", "_controller", ".", "waitForEval", "(", "\"subject.tab.opened == true\"", ",", "TIMEOUT", ",", "100", ",", "{", "tab", ":", "self", "}", ")", ";", "}", "finally", "{", "this", ".", "_controller", ".", "window", ".", "removeEventListener", "(", "\"TabOpen\"", ",", "checkTabOpened", ",", "false", ")", ";", "prefs", ".", "preferences", ".", "clearUserPref", "(", "PREF_TABS_ANIMATE", ")", ";", "}", "}" ]
Open a new tab @param {object} aEvent The event specifies how to open a new tab (menu, shortcut, Elements: type - Type of event (menu, newTabButton, shortcut, tabStrip) [optional - default: menu]
[ "Open", "a", "new", "tab" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabs.js#L416-L468
484
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/tabs.js
tabBrowser_waitForTabPanel
function tabBrowser_waitForTabPanel(tabIndex, elemString) { // Get the specified tab panel element var tabPanel = this.getTabPanelElement(tabIndex, elemString); // Get the style information for the tab panel element var style = this._controller.window.getComputedStyle(tabPanel.getNode(), null); // Wait for the top margin to be 0px - ie. has stopped animating // XXX: A notification bar starts at a negative pixel margin and drops down // to 0px. This creates a race condition where a test may click // before the notification bar appears at it's anticipated screen location this._controller.waitFor(function () { return style.marginTop == '0px'; }, "Expected notification bar to be visible: '" + elemString + "' "); }
javascript
function tabBrowser_waitForTabPanel(tabIndex, elemString) { // Get the specified tab panel element var tabPanel = this.getTabPanelElement(tabIndex, elemString); // Get the style information for the tab panel element var style = this._controller.window.getComputedStyle(tabPanel.getNode(), null); // Wait for the top margin to be 0px - ie. has stopped animating // XXX: A notification bar starts at a negative pixel margin and drops down // to 0px. This creates a race condition where a test may click // before the notification bar appears at it's anticipated screen location this._controller.waitFor(function () { return style.marginTop == '0px'; }, "Expected notification bar to be visible: '" + elemString + "' "); }
[ "function", "tabBrowser_waitForTabPanel", "(", "tabIndex", ",", "elemString", ")", "{", "// Get the specified tab panel element", "var", "tabPanel", "=", "this", ".", "getTabPanelElement", "(", "tabIndex", ",", "elemString", ")", ";", "// Get the style information for the tab panel element", "var", "style", "=", "this", ".", "_controller", ".", "window", ".", "getComputedStyle", "(", "tabPanel", ".", "getNode", "(", ")", ",", "null", ")", ";", "// Wait for the top margin to be 0px - ie. has stopped animating", "// XXX: A notification bar starts at a negative pixel margin and drops down", "// to 0px. This creates a race condition where a test may click", "// before the notification bar appears at it's anticipated screen location", "this", ".", "_controller", ".", "waitFor", "(", "function", "(", ")", "{", "return", "style", ".", "marginTop", "==", "'0px'", ";", "}", ",", "\"Expected notification bar to be visible: '\"", "+", "elemString", "+", "\"' \"", ")", ";", "}" ]
Waits for a particular tab panel element to display and stop animating @param {number} tabIndex Index of the tab to check @param {string} elemString Lookup string of the tab panel element
[ "Waits", "for", "a", "particular", "tab", "panel", "element", "to", "display", "and", "stop", "animating" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabs.js#L478-L492
485
SeleniumHQ/selenium
third_party/closure/goog/string/stringformat.js
replacerDemuxer
function replacerDemuxer( match, flags, width, dotp, precision, type, offset, wholeString) { // The % is too simple and doesn't take an argument. if (type == '%') { return '%'; } // Try to get the actual value from parent function. var value = args.shift(); // If we didn't get any arguments, fail. if (typeof value == 'undefined') { throw Error('[goog.string.format] Not enough arguments'); } // Patch the value argument to the beginning of our type specific call. arguments[0] = value; return goog.string.format.demuxes_[type].apply(null, arguments); }
javascript
function replacerDemuxer( match, flags, width, dotp, precision, type, offset, wholeString) { // The % is too simple and doesn't take an argument. if (type == '%') { return '%'; } // Try to get the actual value from parent function. var value = args.shift(); // If we didn't get any arguments, fail. if (typeof value == 'undefined') { throw Error('[goog.string.format] Not enough arguments'); } // Patch the value argument to the beginning of our type specific call. arguments[0] = value; return goog.string.format.demuxes_[type].apply(null, arguments); }
[ "function", "replacerDemuxer", "(", "match", ",", "flags", ",", "width", ",", "dotp", ",", "precision", ",", "type", ",", "offset", ",", "wholeString", ")", "{", "// The % is too simple and doesn't take an argument.", "if", "(", "type", "==", "'%'", ")", "{", "return", "'%'", ";", "}", "// Try to get the actual value from parent function.", "var", "value", "=", "args", ".", "shift", "(", ")", ";", "// If we didn't get any arguments, fail.", "if", "(", "typeof", "value", "==", "'undefined'", ")", "{", "throw", "Error", "(", "'[goog.string.format] Not enough arguments'", ")", ";", "}", "// Patch the value argument to the beginning of our type specific call.", "arguments", "[", "0", "]", "=", "value", ";", "return", "goog", ".", "string", ".", "format", ".", "demuxes_", "[", "type", "]", ".", "apply", "(", "null", ",", "arguments", ")", ";", "}" ]
Chooses which conversion function to call based on type conversion specifier. @param {string} match Contains the re matched string. @param {string} flags Formatting flags. @param {string} width Replacement string minimum width. @param {string} dotp Matched precision including a dot. @param {string} precision Specifies floating point precision. @param {string} type Type conversion specifier. @param {string} offset Matching location in the original string. @param {string} wholeString Has the actualString being searched. @return {string} Formatted parameter.
[ "Chooses", "which", "conversion", "function", "to", "call", "based", "on", "type", "conversion", "specifier", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/string/stringformat.js#L66-L85
486
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
getText
function getText(element) { var text = ""; var isRecentFirefox = (browserVersion.isFirefox && browserVersion.firefoxVersion >= "1.5"); if (isRecentFirefox || browserVersion.isKonqueror || browserVersion.isSafari || browserVersion.isOpera) { text = getTextContent(element); } else if (element.textContent) { text = element.textContent; } else if (element.innerText) { text = element.innerText; } text = normalizeNewlines(text); text = normalizeSpaces(text); return text.trim(); }
javascript
function getText(element) { var text = ""; var isRecentFirefox = (browserVersion.isFirefox && browserVersion.firefoxVersion >= "1.5"); if (isRecentFirefox || browserVersion.isKonqueror || browserVersion.isSafari || browserVersion.isOpera) { text = getTextContent(element); } else if (element.textContent) { text = element.textContent; } else if (element.innerText) { text = element.innerText; } text = normalizeNewlines(text); text = normalizeSpaces(text); return text.trim(); }
[ "function", "getText", "(", "element", ")", "{", "var", "text", "=", "\"\"", ";", "var", "isRecentFirefox", "=", "(", "browserVersion", ".", "isFirefox", "&&", "browserVersion", ".", "firefoxVersion", ">=", "\"1.5\"", ")", ";", "if", "(", "isRecentFirefox", "||", "browserVersion", ".", "isKonqueror", "||", "browserVersion", ".", "isSafari", "||", "browserVersion", ".", "isOpera", ")", "{", "text", "=", "getTextContent", "(", "element", ")", ";", "}", "else", "if", "(", "element", ".", "textContent", ")", "{", "text", "=", "element", ".", "textContent", ";", "}", "else", "if", "(", "element", ".", "innerText", ")", "{", "text", "=", "element", ".", "innerText", ";", "}", "text", "=", "normalizeNewlines", "(", "text", ")", ";", "text", "=", "normalizeSpaces", "(", "text", ")", ";", "return", "text", ".", "trim", "(", ")", ";", "}" ]
Returns the text in this element
[ "Returns", "the", "text", "in", "this", "element" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L161-L177
487
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
normalizeSpaces
function normalizeSpaces(text) { // IE has already done this conversion, so doing it again will remove multiple nbsp if (browserVersion.isIE) { return text; } // Replace multiple spaces with a single space // TODO - this shouldn't occur inside PRE elements text = text.replace(/\ +/g, " "); // Replace &nbsp; with a space var nbspPattern = new RegExp(String.fromCharCode(160), "g"); if (browserVersion.isSafari) { return replaceAll(text, String.fromCharCode(160), " "); } else { return text.replace(nbspPattern, " "); } }
javascript
function normalizeSpaces(text) { // IE has already done this conversion, so doing it again will remove multiple nbsp if (browserVersion.isIE) { return text; } // Replace multiple spaces with a single space // TODO - this shouldn't occur inside PRE elements text = text.replace(/\ +/g, " "); // Replace &nbsp; with a space var nbspPattern = new RegExp(String.fromCharCode(160), "g"); if (browserVersion.isSafari) { return replaceAll(text, String.fromCharCode(160), " "); } else { return text.replace(nbspPattern, " "); } }
[ "function", "normalizeSpaces", "(", "text", ")", "{", "// IE has already done this conversion, so doing it again will remove multiple nbsp", "if", "(", "browserVersion", ".", "isIE", ")", "{", "return", "text", ";", "}", "// Replace multiple spaces with a single space", "// TODO - this shouldn't occur inside PRE elements", "text", "=", "text", ".", "replace", "(", "/", "\\ +", "/", "g", ",", "\" \"", ")", ";", "// Replace &nbsp; with a space", "var", "nbspPattern", "=", "new", "RegExp", "(", "String", ".", "fromCharCode", "(", "160", ")", ",", "\"g\"", ")", ";", "if", "(", "browserVersion", ".", "isSafari", ")", "{", "return", "replaceAll", "(", "text", ",", "String", ".", "fromCharCode", "(", "160", ")", ",", "\" \"", ")", ";", "}", "else", "{", "return", "text", ".", "replace", "(", "nbspPattern", ",", "\" \"", ")", ";", "}", "}" ]
Replace multiple sequential spaces with a single space, and then convert &nbsp; to space.
[ "Replace", "multiple", "sequential", "spaces", "with", "a", "single", "space", "and", "then", "convert", "&nbsp", ";", "to", "space", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L221-L240
488
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
setText
function setText(element, text) { if (element.textContent != null) { element.textContent = text; } else if (element.innerText != null) { element.innerText = text; } }
javascript
function setText(element, text) { if (element.textContent != null) { element.textContent = text; } else if (element.innerText != null) { element.innerText = text; } }
[ "function", "setText", "(", "element", ",", "text", ")", "{", "if", "(", "element", ".", "textContent", "!=", "null", ")", "{", "element", ".", "textContent", "=", "text", ";", "}", "else", "if", "(", "element", ".", "innerText", "!=", "null", ")", "{", "element", ".", "innerText", "=", "text", ";", "}", "}" ]
Sets the text in this element
[ "Sets", "the", "text", "in", "this", "element" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L260-L266
489
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
AssertionArguments
function AssertionArguments(args) { if (args.length == 2) { this.comment = ""; this.expected = args[0]; this.actual = args[1]; } else { this.comment = args[0] + "; "; this.expected = args[1]; this.actual = args[2]; } }
javascript
function AssertionArguments(args) { if (args.length == 2) { this.comment = ""; this.expected = args[0]; this.actual = args[1]; } else { this.comment = args[0] + "; "; this.expected = args[1]; this.actual = args[2]; } }
[ "function", "AssertionArguments", "(", "args", ")", "{", "if", "(", "args", ".", "length", "==", "2", ")", "{", "this", ".", "comment", "=", "\"\"", ";", "this", ".", "expected", "=", "args", "[", "0", "]", ";", "this", ".", "actual", "=", "args", "[", "1", "]", ";", "}", "else", "{", "this", ".", "comment", "=", "args", "[", "0", "]", "+", "\"; \"", ";", "this", ".", "expected", "=", "args", "[", "1", "]", ";", "this", ".", "actual", "=", "args", "[", "2", "]", ";", "}", "}" ]
Preprocess the arguments to allow for an optional comment.
[ "Preprocess", "the", "arguments", "to", "allow", "for", "an", "optional", "comment", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L758-L768
490
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
o2s
function o2s(obj) { var s = ""; for (key in obj) { var line = key + "->" + obj[key]; line.replace("\n", " "); s += line + "\n"; } return s; }
javascript
function o2s(obj) { var s = ""; for (key in obj) { var line = key + "->" + obj[key]; line.replace("\n", " "); s += line + "\n"; } return s; }
[ "function", "o2s", "(", "obj", ")", "{", "var", "s", "=", "\"\"", ";", "for", "(", "key", "in", "obj", ")", "{", "var", "line", "=", "key", "+", "\"->\"", "+", "obj", "[", "key", "]", ";", "line", ".", "replace", "(", "\"\\n\"", ",", "\" \"", ")", ";", "s", "+=", "line", "+", "\"\\n\"", ";", "}", "return", "s", ";", "}" ]
for use from vs.2003 debugger
[ "for", "use", "from", "vs", ".", "2003", "debugger" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L821-L829
491
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
getTimeoutTime
function getTimeoutTime(timeout) { var now = new Date().getTime(); var timeoutLength = parseInt(timeout); if (isNaN(timeoutLength)) { throw new SeleniumError("Timeout is not a number: '" + timeout + "'"); } return now + timeoutLength; }
javascript
function getTimeoutTime(timeout) { var now = new Date().getTime(); var timeoutLength = parseInt(timeout); if (isNaN(timeoutLength)) { throw new SeleniumError("Timeout is not a number: '" + timeout + "'"); } return now + timeoutLength; }
[ "function", "getTimeoutTime", "(", "timeout", ")", "{", "var", "now", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "var", "timeoutLength", "=", "parseInt", "(", "timeout", ")", ";", "if", "(", "isNaN", "(", "timeoutLength", ")", ")", "{", "throw", "new", "SeleniumError", "(", "\"Timeout is not a number: '\"", "+", "timeout", "+", "\"'\"", ")", ";", "}", "return", "now", "+", "timeoutLength", ";", "}" ]
Returns the absolute time represented as an offset of the current time. Throws a SeleniumException if timeout is invalid. @param timeout the number of milliseconds from "now" whose absolute time to return
[ "Returns", "the", "absolute", "time", "represented", "as", "an", "offset", "of", "the", "current", "time", ".", "Throws", "a", "SeleniumException", "if", "timeout", "is", "invalid", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L943-L952
492
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
hasJavascriptHref
function hasJavascriptHref(element) { if (getTagName(element) != 'a') { return false; } if (element.getAttribute('onclick')) { return false; } if (! element.href) { return false; } if (! /\s*javascript:/i.test(element.href)) { return false; } return true; }
javascript
function hasJavascriptHref(element) { if (getTagName(element) != 'a') { return false; } if (element.getAttribute('onclick')) { return false; } if (! element.href) { return false; } if (! /\s*javascript:/i.test(element.href)) { return false; } return true; }
[ "function", "hasJavascriptHref", "(", "element", ")", "{", "if", "(", "getTagName", "(", "element", ")", "!=", "'a'", ")", "{", "return", "false", ";", "}", "if", "(", "element", ".", "getAttribute", "(", "'onclick'", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "element", ".", "href", ")", "{", "return", "false", ";", "}", "if", "(", "!", "/", "\\s*javascript:", "/", "i", ".", "test", "(", "element", ".", "href", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Returns true iff the given element represents a link with a javascript href attribute, and does not have an onclick attribute defined. @param element the element to test
[ "Returns", "true", "iff", "the", "given", "element", "represents", "a", "link", "with", "a", "javascript", "href", "attribute", "and", "does", "not", "have", "an", "onclick", "attribute", "defined", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1004-L1018
493
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
XPathEngine
function XPathEngine() { // public this.doc = null; /** * Returns whether the current runtime environment supports the use of this * engine. Needs override. */ this.isAvailable = function() { return false; }; /** * Sets the document to be used for evaluation. Always returns the current * engine object so as to be chainable. */ this.setDocument = function(newDocument) { this.doc = newDocument; return this; }; /** * Returns a possibly-empty list of nodes. Needs override. */ this.selectNodes = function(xpath, contextNode, namespaceResolver) { return []; }; /** * Returns a single node, or null if no nodes were selected. This default * implementation simply returns the first result of selectNodes(), or * null. */ this.selectSingleNode = function(xpath, contextNode, namespaceResolver) { var nodes = this.selectNodes(xpath, contextNode, namespaceResolver); return (nodes.length > 0 ? nodes[0] : null); }; /** * Returns the number of matching nodes. This default implementation simply * returns the length of the result of selectNodes(), which should be * adequate for most sub-implementations. */ this.countNodes = function(xpath, contextNode, namespaceResolver) { return this.selectNodes(xpath, contextNode, namespaceResolver).length; }; /** * An optimization; likely to be a no-op for many implementations. Always * returns the current engine object so as to be chainable. */ this.setIgnoreAttributesWithoutValue = function(ignore) { return this; }; }
javascript
function XPathEngine() { // public this.doc = null; /** * Returns whether the current runtime environment supports the use of this * engine. Needs override. */ this.isAvailable = function() { return false; }; /** * Sets the document to be used for evaluation. Always returns the current * engine object so as to be chainable. */ this.setDocument = function(newDocument) { this.doc = newDocument; return this; }; /** * Returns a possibly-empty list of nodes. Needs override. */ this.selectNodes = function(xpath, contextNode, namespaceResolver) { return []; }; /** * Returns a single node, or null if no nodes were selected. This default * implementation simply returns the first result of selectNodes(), or * null. */ this.selectSingleNode = function(xpath, contextNode, namespaceResolver) { var nodes = this.selectNodes(xpath, contextNode, namespaceResolver); return (nodes.length > 0 ? nodes[0] : null); }; /** * Returns the number of matching nodes. This default implementation simply * returns the length of the result of selectNodes(), which should be * adequate for most sub-implementations. */ this.countNodes = function(xpath, contextNode, namespaceResolver) { return this.selectNodes(xpath, contextNode, namespaceResolver).length; }; /** * An optimization; likely to be a no-op for many implementations. Always * returns the current engine object so as to be chainable. */ this.setIgnoreAttributesWithoutValue = function(ignore) { return this; }; }
[ "function", "XPathEngine", "(", ")", "{", "// public", "this", ".", "doc", "=", "null", ";", "/**\n * Returns whether the current runtime environment supports the use of this\n * engine. Needs override.\n */", "this", ".", "isAvailable", "=", "function", "(", ")", "{", "return", "false", ";", "}", ";", "/**\n * Sets the document to be used for evaluation. Always returns the current\n * engine object so as to be chainable.\n */", "this", ".", "setDocument", "=", "function", "(", "newDocument", ")", "{", "this", ".", "doc", "=", "newDocument", ";", "return", "this", ";", "}", ";", "/**\n * Returns a possibly-empty list of nodes. Needs override.\n */", "this", ".", "selectNodes", "=", "function", "(", "xpath", ",", "contextNode", ",", "namespaceResolver", ")", "{", "return", "[", "]", ";", "}", ";", "/**\n * Returns a single node, or null if no nodes were selected. This default\n * implementation simply returns the first result of selectNodes(), or\n * null.\n */", "this", ".", "selectSingleNode", "=", "function", "(", "xpath", ",", "contextNode", ",", "namespaceResolver", ")", "{", "var", "nodes", "=", "this", ".", "selectNodes", "(", "xpath", ",", "contextNode", ",", "namespaceResolver", ")", ";", "return", "(", "nodes", ".", "length", ">", "0", "?", "nodes", "[", "0", "]", ":", "null", ")", ";", "}", ";", "/**\n * Returns the number of matching nodes. This default implementation simply\n * returns the length of the result of selectNodes(), which should be\n * adequate for most sub-implementations.\n */", "this", ".", "countNodes", "=", "function", "(", "xpath", ",", "contextNode", ",", "namespaceResolver", ")", "{", "return", "this", ".", "selectNodes", "(", "xpath", ",", "contextNode", ",", "namespaceResolver", ")", ".", "length", ";", "}", ";", "/**\n * An optimization; likely to be a no-op for many implementations. Always\n * returns the current engine object so as to be chainable.\n */", "this", ".", "setIgnoreAttributesWithoutValue", "=", "function", "(", "ignore", ")", "{", "return", "this", ";", "}", ";", "}" ]
An interface definition for XPath engine implementations; an instance of XPathEngine should be their prototype. Sub-implementations need only define overrides of the methods provided here.
[ "An", "interface", "definition", "for", "XPath", "engine", "implementations", ";", "an", "instance", "of", "XPathEngine", "should", "be", "their", "prototype", ".", "Sub", "-", "implementations", "need", "only", "define", "overrides", "of", "the", "methods", "provided", "here", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1061-L1111
494
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
BoundedCache
function BoundedCache(newMaxSize) { var maxSize = newMaxSize; var map = {}; var size = 0; var counter = -1; /** * Adds a key-value pair to the cache. If the cache is at its size limit, * the least-recently used entry is evicted. */ this.put = function(key, value) { if (map[key]) { // entry already exists map[key] = { usage: ++counter, value: value }; } else { map[key] = { usage: ++counter, value: value }; ++size; if (size > maxSize) { // remove the least recently used item var minUsage = counter; var keyToRemove = key; for (var key in map) { if (map[key].usage < minUsage) { minUsage = map[key].usage; keyToRemove = key; } } this.remove(keyToRemove); } } }; /** * Returns a cache item by its key, and updates its use status. */ this.get = function(key) { if (map[key]) { map[key].usage = ++counter; return map[key].value; } return null; }; /** * Removes a cache item by its key. */ this.remove = function(key) { if (map[key]) { delete map[key]; --size; if (size == 0) { counter = -1; } } } /** * Clears all entries in the cache. */ this.clear = function() { map = {}; size = 0; counter = -1; }; }
javascript
function BoundedCache(newMaxSize) { var maxSize = newMaxSize; var map = {}; var size = 0; var counter = -1; /** * Adds a key-value pair to the cache. If the cache is at its size limit, * the least-recently used entry is evicted. */ this.put = function(key, value) { if (map[key]) { // entry already exists map[key] = { usage: ++counter, value: value }; } else { map[key] = { usage: ++counter, value: value }; ++size; if (size > maxSize) { // remove the least recently used item var minUsage = counter; var keyToRemove = key; for (var key in map) { if (map[key].usage < minUsage) { minUsage = map[key].usage; keyToRemove = key; } } this.remove(keyToRemove); } } }; /** * Returns a cache item by its key, and updates its use status. */ this.get = function(key) { if (map[key]) { map[key].usage = ++counter; return map[key].value; } return null; }; /** * Removes a cache item by its key. */ this.remove = function(key) { if (map[key]) { delete map[key]; --size; if (size == 0) { counter = -1; } } } /** * Clears all entries in the cache. */ this.clear = function() { map = {}; size = 0; counter = -1; }; }
[ "function", "BoundedCache", "(", "newMaxSize", ")", "{", "var", "maxSize", "=", "newMaxSize", ";", "var", "map", "=", "{", "}", ";", "var", "size", "=", "0", ";", "var", "counter", "=", "-", "1", ";", "/**\n * Adds a key-value pair to the cache. If the cache is at its size limit,\n * the least-recently used entry is evicted.\n */", "this", ".", "put", "=", "function", "(", "key", ",", "value", ")", "{", "if", "(", "map", "[", "key", "]", ")", "{", "// entry already exists", "map", "[", "key", "]", "=", "{", "usage", ":", "++", "counter", ",", "value", ":", "value", "}", ";", "}", "else", "{", "map", "[", "key", "]", "=", "{", "usage", ":", "++", "counter", ",", "value", ":", "value", "}", ";", "++", "size", ";", "if", "(", "size", ">", "maxSize", ")", "{", "// remove the least recently used item", "var", "minUsage", "=", "counter", ";", "var", "keyToRemove", "=", "key", ";", "for", "(", "var", "key", "in", "map", ")", "{", "if", "(", "map", "[", "key", "]", ".", "usage", "<", "minUsage", ")", "{", "minUsage", "=", "map", "[", "key", "]", ".", "usage", ";", "keyToRemove", "=", "key", ";", "}", "}", "this", ".", "remove", "(", "keyToRemove", ")", ";", "}", "}", "}", ";", "/**\n * Returns a cache item by its key, and updates its use status.\n */", "this", ".", "get", "=", "function", "(", "key", ")", "{", "if", "(", "map", "[", "key", "]", ")", "{", "map", "[", "key", "]", ".", "usage", "=", "++", "counter", ";", "return", "map", "[", "key", "]", ".", "value", ";", "}", "return", "null", ";", "}", ";", "/**\n * Removes a cache item by its key.\n */", "this", ".", "remove", "=", "function", "(", "key", ")", "{", "if", "(", "map", "[", "key", "]", ")", "{", "delete", "map", "[", "key", "]", ";", "--", "size", ";", "if", "(", "size", "==", "0", ")", "{", "counter", "=", "-", "1", ";", "}", "}", "}", "/**\n * Clears all entries in the cache.\n */", "this", ".", "clear", "=", "function", "(", ")", "{", "map", "=", "{", "}", ";", "size", "=", "0", ";", "counter", "=", "-", "1", ";", "}", ";", "}" ]
Cache class. @param newMaxSize the maximum number of entries to keep in the cache.
[ "Cache", "class", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1292-L1362
495
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
isXPathValid
function isXPathValid(xpath, node) { var contextNode = mirror.getReflection(); return (engine.setDocument(mirror.getReflection()) .selectSingleNode(xpath, contextNode, namespaceResolver) === node); }
javascript
function isXPathValid(xpath, node) { var contextNode = mirror.getReflection(); return (engine.setDocument(mirror.getReflection()) .selectSingleNode(xpath, contextNode, namespaceResolver) === node); }
[ "function", "isXPathValid", "(", "xpath", ",", "node", ")", "{", "var", "contextNode", "=", "mirror", ".", "getReflection", "(", ")", ";", "return", "(", "engine", ".", "setDocument", "(", "mirror", ".", "getReflection", "(", ")", ")", ".", "selectSingleNode", "(", "xpath", ",", "contextNode", ",", "namespaceResolver", ")", "===", "node", ")", ";", "}" ]
Returns whether the given XPath evaluates to the given node in the test document.
[ "Returns", "whether", "the", "given", "XPath", "evaluates", "to", "the", "given", "node", "in", "the", "test", "document", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1642-L1646
496
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
isDetached
function isDetached(node) { while (node = node.parentNode) { if (node.nodeType == 11) { // it's a document fragment; we're detached (IE) return true; } else if (node.nodeType == 9) { // it's a normal document; we're attached return false; } } // we didn't find a document; we're detached (most other browsers) return true; }
javascript
function isDetached(node) { while (node = node.parentNode) { if (node.nodeType == 11) { // it's a document fragment; we're detached (IE) return true; } else if (node.nodeType == 9) { // it's a normal document; we're attached return false; } } // we didn't find a document; we're detached (most other browsers) return true; }
[ "function", "isDetached", "(", "node", ")", "{", "while", "(", "node", "=", "node", ".", "parentNode", ")", "{", "if", "(", "node", ".", "nodeType", "==", "11", ")", "{", "// it's a document fragment; we're detached (IE)", "return", "true", ";", "}", "else", "if", "(", "node", ".", "nodeType", "==", "9", ")", "{", "// it's a normal document; we're attached", "return", "false", ";", "}", "}", "// we didn't find a document; we're detached (most other browsers)", "return", "true", ";", "}" ]
Returns whether a node is detached from any live documents. Detached nodes should be considered invalidated and evicted from any caches.
[ "Returns", "whether", "a", "node", "is", "detached", "from", "any", "live", "documents", ".", "Detached", "nodes", "should", "be", "considered", "invalidated", "and", "evicted", "from", "any", "caches", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1814-L1828
497
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
getEngineFor
function getEngineFor(inDocument) { if (allowNativeXPath && nativeEngine.setDocument(inDocument).isAvailable()) { return nativeEngine; } var currentEngine = engines[currentEngineName]; if (currentEngine && currentEngine.setDocument(inDocument).isAvailable()) { return currentEngine; } return engines[defaultEngineName].setDocument(inDocument); }
javascript
function getEngineFor(inDocument) { if (allowNativeXPath && nativeEngine.setDocument(inDocument).isAvailable()) { return nativeEngine; } var currentEngine = engines[currentEngineName]; if (currentEngine && currentEngine.setDocument(inDocument).isAvailable()) { return currentEngine; } return engines[defaultEngineName].setDocument(inDocument); }
[ "function", "getEngineFor", "(", "inDocument", ")", "{", "if", "(", "allowNativeXPath", "&&", "nativeEngine", ".", "setDocument", "(", "inDocument", ")", ".", "isAvailable", "(", ")", ")", "{", "return", "nativeEngine", ";", "}", "var", "currentEngine", "=", "engines", "[", "currentEngineName", "]", ";", "if", "(", "currentEngine", "&&", "currentEngine", ".", "setDocument", "(", "inDocument", ")", ".", "isAvailable", "(", ")", ")", "{", "return", "currentEngine", ";", "}", "return", "engines", "[", "defaultEngineName", "]", ".", "setDocument", "(", "inDocument", ")", ";", "}" ]
Returns the most sensible engine given the settings and the document object.
[ "Returns", "the", "most", "sensible", "engine", "given", "the", "settings", "and", "the", "document", "object", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1981-L1995
498
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
dispatch
function dispatch(methodName, inDocument, xpath, contextNode, namespaceResolver) { xpath = preprocess(xpath); if (! contextNode) { contextNode = inDocument; } var result = getEngineFor(inDocument) .setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue) [methodName](xpath, contextNode, namespaceResolver); return result; }
javascript
function dispatch(methodName, inDocument, xpath, contextNode, namespaceResolver) { xpath = preprocess(xpath); if (! contextNode) { contextNode = inDocument; } var result = getEngineFor(inDocument) .setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue) [methodName](xpath, contextNode, namespaceResolver); return result; }
[ "function", "dispatch", "(", "methodName", ",", "inDocument", ",", "xpath", ",", "contextNode", ",", "namespaceResolver", ")", "{", "xpath", "=", "preprocess", "(", "xpath", ")", ";", "if", "(", "!", "contextNode", ")", "{", "contextNode", "=", "inDocument", ";", "}", "var", "result", "=", "getEngineFor", "(", "inDocument", ")", ".", "setIgnoreAttributesWithoutValue", "(", "ignoreAttributesWithoutValue", ")", "[", "methodName", "]", "(", "xpath", ",", "contextNode", ",", "namespaceResolver", ")", ";", "return", "result", ";", "}" ]
Dispatches an XPath evaluation method on the relevant engine for the given document, and returns the result
[ "Dispatches", "an", "XPath", "evaluation", "method", "on", "the", "relevant", "engine", "for", "the", "given", "document", "and", "returns", "the", "result" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2001-L2013
499
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
eval_xpath
function eval_xpath(xpath, inDocument, opts) { if (! opts) { var opts = {}; } var contextNode = opts.contextNode ? opts.contextNode : inDocument; var namespaceResolver = opts.namespaceResolver ? opts.namespaceResolver : null; var xpathLibrary = opts.xpathLibrary ? opts.xpathLibrary : null; var allowNativeXpath = (opts.allowNativeXpath != undefined) ? opts.allowNativeXpath : true; var ignoreAttributesWithoutValue = (opts.ignoreAttributesWithoutValue != undefined) ? opts.ignoreAttributesWithoutValue : true; var returnOnFirstMatch = (opts.returnOnFirstMatch != undefined) ? opts.returnOnFirstMatch : false; if (! eval_xpath.xpathEvaluator) { eval_xpath.xpathEvaluator = new XPathEvaluator(); } var xpathEvaluator = eval_xpath.xpathEvaluator; xpathEvaluator.setCurrentEngine(xpathLibrary); xpathEvaluator.setAllowNativeXPath(allowNativeXpath); xpathEvaluator.setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue); if (returnOnFirstMatch) { var singleNode = xpathEvaluator.selectSingleNode(inDocument, xpath, contextNode, namespaceResolver); var results = (singleNode ? [ singleNode ] : []); } else { var results = xpathEvaluator.selectNodes(inDocument, xpath, contextNode, namespaceResolver); } return results; }
javascript
function eval_xpath(xpath, inDocument, opts) { if (! opts) { var opts = {}; } var contextNode = opts.contextNode ? opts.contextNode : inDocument; var namespaceResolver = opts.namespaceResolver ? opts.namespaceResolver : null; var xpathLibrary = opts.xpathLibrary ? opts.xpathLibrary : null; var allowNativeXpath = (opts.allowNativeXpath != undefined) ? opts.allowNativeXpath : true; var ignoreAttributesWithoutValue = (opts.ignoreAttributesWithoutValue != undefined) ? opts.ignoreAttributesWithoutValue : true; var returnOnFirstMatch = (opts.returnOnFirstMatch != undefined) ? opts.returnOnFirstMatch : false; if (! eval_xpath.xpathEvaluator) { eval_xpath.xpathEvaluator = new XPathEvaluator(); } var xpathEvaluator = eval_xpath.xpathEvaluator; xpathEvaluator.setCurrentEngine(xpathLibrary); xpathEvaluator.setAllowNativeXPath(allowNativeXpath); xpathEvaluator.setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue); if (returnOnFirstMatch) { var singleNode = xpathEvaluator.selectSingleNode(inDocument, xpath, contextNode, namespaceResolver); var results = (singleNode ? [ singleNode ] : []); } else { var results = xpathEvaluator.selectNodes(inDocument, xpath, contextNode, namespaceResolver); } return results; }
[ "function", "eval_xpath", "(", "xpath", ",", "inDocument", ",", "opts", ")", "{", "if", "(", "!", "opts", ")", "{", "var", "opts", "=", "{", "}", ";", "}", "var", "contextNode", "=", "opts", ".", "contextNode", "?", "opts", ".", "contextNode", ":", "inDocument", ";", "var", "namespaceResolver", "=", "opts", ".", "namespaceResolver", "?", "opts", ".", "namespaceResolver", ":", "null", ";", "var", "xpathLibrary", "=", "opts", ".", "xpathLibrary", "?", "opts", ".", "xpathLibrary", ":", "null", ";", "var", "allowNativeXpath", "=", "(", "opts", ".", "allowNativeXpath", "!=", "undefined", ")", "?", "opts", ".", "allowNativeXpath", ":", "true", ";", "var", "ignoreAttributesWithoutValue", "=", "(", "opts", ".", "ignoreAttributesWithoutValue", "!=", "undefined", ")", "?", "opts", ".", "ignoreAttributesWithoutValue", ":", "true", ";", "var", "returnOnFirstMatch", "=", "(", "opts", ".", "returnOnFirstMatch", "!=", "undefined", ")", "?", "opts", ".", "returnOnFirstMatch", ":", "false", ";", "if", "(", "!", "eval_xpath", ".", "xpathEvaluator", ")", "{", "eval_xpath", ".", "xpathEvaluator", "=", "new", "XPathEvaluator", "(", ")", ";", "}", "var", "xpathEvaluator", "=", "eval_xpath", ".", "xpathEvaluator", ";", "xpathEvaluator", ".", "setCurrentEngine", "(", "xpathLibrary", ")", ";", "xpathEvaluator", ".", "setAllowNativeXPath", "(", "allowNativeXpath", ")", ";", "xpathEvaluator", ".", "setIgnoreAttributesWithoutValue", "(", "ignoreAttributesWithoutValue", ")", ";", "if", "(", "returnOnFirstMatch", ")", "{", "var", "singleNode", "=", "xpathEvaluator", ".", "selectSingleNode", "(", "inDocument", ",", "xpath", ",", "contextNode", ",", "namespaceResolver", ")", ";", "var", "results", "=", "(", "singleNode", "?", "[", "singleNode", "]", ":", "[", "]", ")", ";", "}", "else", "{", "var", "results", "=", "xpathEvaluator", ".", "selectNodes", "(", "inDocument", ",", "xpath", ",", "contextNode", ",", "namespaceResolver", ")", ";", "}", "return", "results", ";", "}" ]
Evaluates an xpath on a document, and returns a list containing nodes in the resulting nodeset. The browserbot xpath methods are now backed by this function. A context node may optionally be provided, and the xpath will be evaluated from that context. @param xpath the xpath to evaluate @param inDocument the document in which to evaluate the xpath. @param opts (optional) An object containing various flags that can modify how the xpath is evaluated. Here's a listing of the meaningful keys: contextNode: the context node from which to evaluate the xpath. If unspecified, the context will be the root document element. namespaceResolver: the namespace resolver function. Defaults to null. xpathLibrary: the javascript library to use for XPath. "ajaxslt" is the default. "javascript-xpath" is newer and faster, but needs more testing. allowNativeXpath: whether to allow native evaluate(). Defaults to true. ignoreAttributesWithoutValue: whether it's ok to ignore attributes without value when evaluating the xpath. This can greatly improve performance in IE; however, if your xpaths depend on such attributes, you can't ignore them! Defaults to true. returnOnFirstMatch: whether to optimize the XPath evaluation to only return the first match. The match, if any, will still be returned in a list. Defaults to false.
[ "Evaluates", "an", "xpath", "on", "a", "document", "and", "returns", "a", "list", "containing", "nodes", "in", "the", "resulting", "nodeset", ".", "The", "browserbot", "xpath", "methods", "are", "now", "backed", "by", "this", "function", ".", "A", "context", "node", "may", "optionally", "be", "provided", "and", "the", "xpath", "will", "be", "evaluated", "from", "that", "context", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2140-L2181