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
list | docstring
stringlengths 4
11.8k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 86
226
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
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
|
train
|
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.\"",
")",
";",
"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
|
train
|
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
|
train
|
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",
";",
"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
|
train
|
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
|
train
|
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'",
")",
";",
"this",
".",
"dateIntervalSymbols_",
"=",
"opt_dateIntervalSymbols",
"||",
"dateIntervalSymbols",
".",
"getDateIntervalSymbols",
"(",
")",
";",
"this",
".",
"dateTimeSymbols_",
"=",
"opt_dateTimeSymbols",
"||",
"DateTimeSymbols",
";",
"this",
".",
"intervalPattern_",
"=",
"this",
".",
"getIntervalPattern_",
"(",
"pattern",
")",
";",
"this",
".",
"intervalPatternKeys_",
"=",
"object",
".",
"getKeys",
"(",
"this",
".",
"intervalPattern_",
")",
";",
"array",
".",
"remove",
"(",
"this",
".",
"intervalPatternKeys_",
",",
"DEFAULT_PATTERN_KEY_",
")",
";",
"this",
".",
"fallbackPattern_",
"=",
"this",
".",
"dateIntervalSymbols_",
".",
"FALLBACK",
"||",
"DEFAULT_FALLBACK_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'",
")",
";",
"}",
"this",
".",
"useFirstDateOnFirstPattern_",
"=",
"indexOfFirstDate",
"<=",
"indexOfSecondDate",
";",
"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
|
train
|
|
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",
")",
"{",
"this",
".",
"firstPartFormatter_",
"=",
"new",
"DateTimeFormat",
"(",
"firstPattern",
",",
"dateTimeSymbols",
")",
";",
"this",
".",
"secondPartFormatter_",
"=",
"new",
"DateTimeFormat",
"(",
"secondPattern",
",",
"dateTimeSymbols",
")",
";",
"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
|
train
|
|
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",
")",
"{",
"this",
".",
"dateTimePattern_",
"=",
"dateTimePattern",
";",
"this",
".",
"dateTimeFormatter_",
"=",
"new",
"DateTimeFormat",
"(",
"dateTimePattern",
",",
"dateTimeSymbols",
")",
";",
"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
|
train
|
|
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
|
train
|
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
|
train
|
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",
")",
"{",
"this",
".",
"selectedEngine",
"=",
"name",
";",
"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
|
train
|
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
|
train
|
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
|
train
|
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",
")",
"{",
"var",
"targetUrl",
"=",
"this",
".",
"_bss",
".",
"currentEngine",
".",
"getSubmission",
"(",
"searchTerm",
",",
"null",
")",
".",
"uri",
";",
"var",
"currentUrl",
"=",
"this",
".",
"_controller",
".",
"tabs",
".",
"activeTabWindow",
".",
"document",
".",
"location",
".",
"href",
";",
"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",
"}",
")",
";",
"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
|
train
|
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
|
train
|
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",
")",
";",
"}",
"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
|
train
|
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\"",
"}",
")",
";",
"this",
".",
"type",
"(",
"searchTerm",
")",
";",
"this",
".",
"_controller",
".",
"waitForEval",
"(",
"\"subject.popup.state == 'open'\"",
",",
"TIMEOUT",
",",
"100",
",",
"{",
"popup",
":",
"popup",
".",
"getNode",
"(",
")",
"}",
")",
";",
"this",
".",
"_controller",
".",
"waitForElement",
"(",
"treeElem",
",",
"TIMEOUT",
")",
";",
"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",
")",
")",
")",
";",
"}",
"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
|
train
|
|
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\"",
"}",
")",
";",
"md",
"=",
"new",
"modalDialog",
".",
"modalDialog",
"(",
"this",
".",
"_controller",
".",
"window",
")",
";",
"md",
".",
"start",
"(",
"handler",
")",
";",
"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
|
train
|
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
|
train
|
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
|
train
|
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
|
train
|
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",
")",
";",
"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
|
train
|
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
|
train
|
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",
")",
"{",
"var",
"info",
"=",
"updateData",
".",
"updates",
"[",
"updateData",
".",
"updateIndex",
"]",
";",
"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.\"",
")",
";",
"this",
".",
"_controller",
".",
"assert",
"(",
"function",
"(",
")",
"{",
"return",
"info",
".",
"build_post",
".",
"buildid",
"==",
"info",
".",
"patch",
".",
"buildid",
";",
"}",
",",
"\"The build id is equal to the build id of the update.\"",
")",
";",
"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
|
train
|
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
|
train
|
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",
";",
"this",
".",
"_controller",
".",
"assert",
"(",
"function",
"(",
")",
"{",
"return",
"channel",
"==",
"this",
".",
"channel",
";",
"}",
",",
"\"The current update channel is identical to the specified one.\"",
",",
"this",
")",
";",
"var",
"next",
"=",
"this",
".",
"getElement",
"(",
"{",
"type",
":",
"\"button\"",
",",
"subtype",
":",
"\"next\"",
"}",
")",
";",
"this",
".",
"_controller",
".",
"click",
"(",
"next",
")",
";",
"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
|
train
|
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",
")",
"{",
"var",
"appVersion",
"=",
"utils",
".",
"appInfo",
".",
"version",
";",
"if",
"(",
"this",
".",
"_vc",
".",
"compare",
"(",
"appVersion",
",",
"\"4.0b7pre\"",
")",
">=",
"0",
")",
"{",
"var",
"updatePrompt",
"=",
"Cc",
"[",
"\"@mozilla.org/updates/update-prompt;1\"",
"]",
".",
"createInstance",
"(",
"Ci",
".",
"nsIUpdatePrompt",
")",
";",
"updatePrompt",
".",
"checkForUpdates",
"(",
")",
";",
"}",
"else",
"{",
"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
|
train
|
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
|
train
|
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
|
train
|
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
|
train
|
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",
",",
"'\\\\'",
")",
";",
"}"
] |
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
|
train
|
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
|
train
|
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",
")",
";",
"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
|
train
|
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",
")",
"{",
"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
|
train
|
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",
")",
"{",
"var",
"processed",
"=",
"commandRequest",
".",
"replace",
"(",
"/",
"\\+",
"/",
"g",
",",
"\"%20\"",
")",
";",
"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
|
train
|
|
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",
")",
"||",
"(",
"c",
">=",
"0x0041",
"&&",
"c",
"<=",
"0x005A",
")",
"||",
"(",
"c",
">=",
"0x0061",
"&&",
"c",
"<=",
"0x007A",
")",
")",
"{",
"ret",
"+=",
"css",
".",
"charAt",
"(",
"i",
")",
";",
"continue",
";",
"}",
"}"
] |
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
|
train
|
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
|
train
|
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
|
train
|
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
|
train
|
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
|
train
|
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",
"(",
")",
";",
"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
|
train
|
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
|
train
|
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
|
train
|
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
|
train
|
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
|
train
|
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
|
train
|
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",
"(",
")",
"{",
"var",
"start",
"=",
"index",
";",
"var",
"end",
"=",
"null",
";",
"for",
"(",
"var",
"token",
"=",
"nextToken",
"(",
")",
";",
"token",
"!=",
"EOF",
";",
"token",
"=",
"nextToken",
"(",
")",
")",
"{",
"if",
"(",
"token",
"==",
"'\"'",
")",
"{",
"end",
"=",
"index",
"-",
"1",
";",
"token",
"=",
"nextToken",
"(",
")",
";",
"if",
"(",
"token",
"==",
"'\"'",
")",
"{",
"end",
"=",
"null",
";",
"continue",
";",
"}",
"if",
"(",
"token",
"==",
"delimiter",
"||",
"token",
"==",
"EOF",
"||",
"token",
"==",
"NEWLINE",
")",
"{",
"if",
"(",
"token",
"==",
"NEWLINE",
")",
"{",
"pushBack",
"(",
"token",
")",
";",
"}",
"break",
";",
"}",
"if",
"(",
"!",
"opt_ignoreErrors",
")",
"{",
"throw",
"new",
"goog",
".",
"labs",
".",
"format",
".",
"csv",
".",
"ParseError",
"(",
"text",
",",
"index",
"-",
"1",
",",
"'Unexpected character \"'",
"+",
"token",
"+",
"'\" after quote mark'",
")",
";",
"}",
"else",
"{",
"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",
";",
"}",
"}",
"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
|
train
|
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",
";",
"}",
"if",
"(",
"token",
"==",
"'\"'",
")",
"{",
"return",
"readQuotedField",
"(",
")",
";",
"}",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"token",
"==",
"EOF",
"||",
"token",
"==",
"NEWLINE",
")",
"{",
"pushBack",
"(",
"token",
")",
";",
"break",
";",
"}",
"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",
")",
":",
"text",
".",
"substring",
"(",
"start",
",",
"index",
"-",
"1",
")",
";",
"return",
"returnString",
".",
"replace",
"(",
"/",
"[\\r\\n]+",
"/",
"g",
",",
"''",
")",
";",
"}"
] |
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
|
train
|
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
|
train
|
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",
")",
")",
"{",
"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",
";",
"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
|
train
|
|
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
|
train
|
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",
")",
"{",
"var",
"type",
"=",
"event",
".",
"type",
"||",
"event",
";",
"if",
"(",
"!",
"bubbling",
")",
"{",
"event",
"=",
"typeof",
"event",
"===",
"\"object\"",
"?",
"event",
"[",
"expando",
"]",
"?",
"event",
":",
"jQuery",
".",
"extend",
"(",
"jQuery",
".",
"Event",
"(",
"type",
")",
",",
"event",
")",
":",
"jQuery",
".",
"Event",
"(",
"type",
")",
";",
"if",
"(",
"type",
".",
"indexOf",
"(",
"\"!\"",
")",
">=",
"0",
")",
"{",
"event",
".",
"type",
"=",
"type",
"=",
"type",
".",
"slice",
"(",
"0",
",",
"-",
"1",
")",
";",
"event",
".",
"exclusive",
"=",
"true",
";",
"}",
"if",
"(",
"!",
"elem",
")",
"{",
"event",
".",
"stopPropagation",
"(",
")",
";",
"if",
"(",
"this",
".",
"global",
"[",
"type",
"]",
")",
"jQuery",
".",
"each",
"(",
"jQuery",
".",
"cache",
",",
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"events",
"&&",
"this",
".",
"events",
"[",
"type",
"]",
")",
"jQuery",
".",
"event",
".",
"trigger",
"(",
"event",
",",
"data",
",",
"this",
".",
"handle",
".",
"elem",
")",
";",
"}",
")",
";",
"}",
"if",
"(",
"!",
"elem",
"||",
"elem",
".",
"nodeType",
"==",
"3",
"||",
"elem",
".",
"nodeType",
"==",
"8",
")",
"return",
"undefined",
";",
"event",
".",
"result",
"=",
"undefined",
";",
"event",
".",
"target",
"=",
"elem",
";",
"data",
"=",
"jQuery",
".",
"makeArray",
"(",
"data",
")",
";",
"data",
".",
"unshift",
"(",
"event",
")",
";",
"}",
"event",
".",
"currentTarget",
"=",
"elem",
";",
"var",
"handle",
"=",
"jQuery",
".",
"data",
"(",
"elem",
",",
"\"handle\"",
")",
";",
"if",
"(",
"handle",
")",
"handle",
".",
"apply",
"(",
"elem",
",",
"data",
")",
";",
"if",
"(",
"(",
"!",
"elem",
"[",
"type",
"]",
"||",
"(",
"jQuery",
".",
"nodeName",
"(",
"elem",
",",
"'a'",
")",
"&&",
"type",
"==",
"\"click\"",
")",
")",
"&&",
"elem",
"[",
"\"on\"",
"+",
"type",
"]",
"&&",
"elem",
"[",
"\"on\"",
"+",
"type",
"]",
".",
"apply",
"(",
"elem",
",",
"data",
")",
"===",
"false",
")",
"event",
".",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"bubbling",
"&&",
"elem",
"[",
"type",
"]",
"&&",
"!",
"event",
".",
"isDefaultPrevented",
"(",
")",
"&&",
"!",
"(",
"jQuery",
".",
"nodeName",
"(",
"elem",
",",
"'a'",
")",
"&&",
"type",
"==",
"\"click\"",
")",
")",
"{",
"this",
".",
"triggered",
"=",
"true",
";",
"try",
"{",
"elem",
"[",
"type",
"]",
"(",
")",
";",
"}",
"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
|
train
|
|
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",
")",
"{",
"if",
"(",
"xhr",
".",
"readyState",
"==",
"0",
")",
"{",
"if",
"(",
"ival",
")",
"{",
"clearInterval",
"(",
"ival",
")",
";",
"ival",
"=",
"null",
";",
"if",
"(",
"s",
".",
"global",
"&&",
"!",
"--",
"jQuery",
".",
"active",
")",
"jQuery",
".",
"event",
".",
"trigger",
"(",
"\"ajaxStop\"",
")",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"requestDone",
"&&",
"xhr",
"&&",
"(",
"xhr",
".",
"readyState",
"==",
"4",
"||",
"isTimeout",
"==",
"\"timeout\"",
")",
")",
"{",
"requestDone",
"=",
"true",
";",
"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\"",
")",
"{",
"try",
"{",
"data",
"=",
"jQuery",
".",
"httpData",
"(",
"xhr",
",",
"s",
".",
"dataType",
",",
"s",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"status",
"=",
"\"parsererror\"",
";",
"}",
"}",
"if",
"(",
"status",
"==",
"\"success\"",
")",
"{",
"var",
"modRes",
";",
"try",
"{",
"modRes",
"=",
"xhr",
".",
"getResponseHeader",
"(",
"\"Last-Modified\"",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"}",
"if",
"(",
"s",
".",
"ifModified",
"&&",
"modRes",
")",
"jQuery",
".",
"lastModified",
"[",
"s",
".",
"url",
"]",
"=",
"modRes",
";",
"if",
"(",
"!",
"jsonp",
")",
"success",
"(",
")",
";",
"}",
"else",
"jQuery",
".",
"handleError",
"(",
"s",
",",
"xhr",
",",
"status",
")",
";",
"complete",
"(",
")",
";",
"if",
"(",
"isTimeout",
")",
"xhr",
".",
"abort",
"(",
")",
";",
"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
|
train
|
|
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",
"{",
"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
|
train
|
|
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
|
train
|
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",
"(",
")",
"{",
"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",
"{",
"var",
"bookmarksURI",
"=",
"utils",
".",
"createURI",
"(",
"BOOKMARKS_RESOURCE",
")",
";",
"var",
"importer",
"=",
"Cc",
"[",
"\"@mozilla.org/browser/places/import-export-service;1\"",
"]",
".",
"getService",
"(",
"Ci",
".",
"nsIPlacesImportExportService",
")",
";",
"importer",
".",
"importHTMLFromURI",
"(",
"bookmarksURI",
",",
"true",
")",
";",
"mozmill",
".",
"utils",
".",
"waitFor",
"(",
"function",
"(",
")",
"{",
"return",
"importSuccessful",
";",
"}",
",",
"\"Default bookmarks have finished importing\"",
",",
"BOOKMARKS_TIMEOUT",
")",
";",
"}",
"finally",
"{",
"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
|
train
|
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
|
train
|
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
|
train
|
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
|
train
|
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\"",
")",
";",
"while",
"(",
"winEnum",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"var",
"window",
"=",
"winEnum",
".",
"getNext",
"(",
")",
";",
"if",
"(",
"window",
".",
"closed",
"||",
"!",
"(",
"\"gBrowser\"",
"in",
"window",
")",
")",
"continue",
";",
"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
|
train
|
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
|
train
|
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",
";",
"prefs",
".",
"preferences",
".",
"setPref",
"(",
"PREF_TABS_ANIMATE",
",",
"false",
")",
";",
"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
|
train
|
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
|
train
|
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",
":",
"\"\"",
";",
"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
|
train
|
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",
";",
"prefs",
".",
"preferences",
".",
"setPref",
"(",
"PREF_TABS_ANIMATE",
",",
"false",
")",
";",
"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\"",
"}",
")",
";",
"if",
"(",
"utils",
".",
"getEntity",
"(",
"this",
".",
"getDtds",
"(",
")",
",",
"\"locale.dir\"",
")",
"==",
"\"rtl\"",
")",
"{",
"this",
".",
"_controller",
".",
"click",
"(",
"tabStrip",
",",
"100",
",",
"3",
")",
";",
"this",
".",
"_controller",
".",
"doubleClick",
"(",
"tabStrip",
",",
"100",
",",
"3",
")",
";",
"}",
"else",
"{",
"this",
".",
"_controller",
".",
"click",
"(",
"tabStrip",
",",
"tabStrip",
".",
"getNode",
"(",
")",
".",
"clientWidth",
"-",
"100",
",",
"3",
")",
";",
"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
|
train
|
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",
")",
"{",
"var",
"tabPanel",
"=",
"this",
".",
"getTabPanelElement",
"(",
"tabIndex",
",",
"elemString",
")",
";",
"var",
"style",
"=",
"this",
".",
"_controller",
".",
"window",
".",
"getComputedStyle",
"(",
"tabPanel",
".",
"getNode",
"(",
")",
",",
"null",
")",
";",
"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
|
train
|
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",
")",
"{",
"if",
"(",
"type",
"==",
"'%'",
")",
"{",
"return",
"'%'",
";",
"}",
"var",
"value",
"=",
"args",
".",
"shift",
"(",
")",
";",
"if",
"(",
"typeof",
"value",
"==",
"'undefined'",
")",
"{",
"throw",
"Error",
"(",
"'[goog.string.format] Not enough arguments'",
")",
";",
"}",
"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
|
train
|
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
|
train
|
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 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 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",
")",
"{",
"if",
"(",
"browserVersion",
".",
"isIE",
")",
"{",
"return",
"text",
";",
"}",
"text",
"=",
"text",
".",
"replace",
"(",
"/",
"\\ +",
"/",
"g",
",",
"\" \"",
")",
";",
"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 to space.
|
[
"Replace",
"multiple",
"sequential",
"spaces",
"with",
"a",
"single",
"space",
"and",
"then",
"convert",
" ",
";",
"to",
"space",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L221-L240
|
train
|
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
|
train
|
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
|
train
|
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\"",
",",
"\\n",
")",
";",
"\" \"",
"}",
"s",
"+=",
"line",
"+",
"\"\\n\"",
";",
"}"
] |
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
|
train
|
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
|
train
|
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
|
train
|
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",
"(",
")",
"{",
"this",
".",
"doc",
"=",
"null",
";",
"this",
".",
"isAvailable",
"=",
"function",
"(",
")",
"{",
"return",
"false",
";",
"}",
";",
"this",
".",
"setDocument",
"=",
"function",
"(",
"newDocument",
")",
"{",
"this",
".",
"doc",
"=",
"newDocument",
";",
"return",
"this",
";",
"}",
";",
"this",
".",
"selectNodes",
"=",
"function",
"(",
"xpath",
",",
"contextNode",
",",
"namespaceResolver",
")",
"{",
"return",
"[",
"]",
";",
"}",
";",
"this",
".",
"selectSingleNode",
"=",
"function",
"(",
"xpath",
",",
"contextNode",
",",
"namespaceResolver",
")",
"{",
"var",
"nodes",
"=",
"this",
".",
"selectNodes",
"(",
"xpath",
",",
"contextNode",
",",
"namespaceResolver",
")",
";",
"return",
"(",
"nodes",
".",
"length",
">",
"0",
"?",
"nodes",
"[",
"0",
"]",
":",
"null",
")",
";",
"}",
";",
"this",
".",
"countNodes",
"=",
"function",
"(",
"xpath",
",",
"contextNode",
",",
"namespaceResolver",
")",
"{",
"return",
"this",
".",
"selectNodes",
"(",
"xpath",
",",
"contextNode",
",",
"namespaceResolver",
")",
".",
"length",
";",
"}",
";",
"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
|
train
|
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",
";",
"this",
".",
"put",
"=",
"function",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"map",
"[",
"key",
"]",
")",
"{",
"map",
"[",
"key",
"]",
"=",
"{",
"usage",
":",
"++",
"counter",
",",
"value",
":",
"value",
"}",
";",
"}",
"else",
"{",
"map",
"[",
"key",
"]",
"=",
"{",
"usage",
":",
"++",
"counter",
",",
"value",
":",
"value",
"}",
";",
"++",
"size",
";",
"if",
"(",
"size",
">",
"maxSize",
")",
"{",
"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",
")",
";",
"}",
"}",
"}",
";",
"this",
".",
"get",
"=",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"map",
"[",
"key",
"]",
")",
"{",
"map",
"[",
"key",
"]",
".",
"usage",
"=",
"++",
"counter",
";",
"return",
"map",
"[",
"key",
"]",
".",
"value",
";",
"}",
"return",
"null",
";",
"}",
";",
"this",
".",
"remove",
"=",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"map",
"[",
"key",
"]",
")",
"{",
"delete",
"map",
"[",
"key",
"]",
";",
"--",
"size",
";",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"counter",
"=",
"-",
"1",
";",
"}",
"}",
"}",
"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
|
train
|
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
|
train
|
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",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"node",
".",
"nodeType",
"==",
"9",
")",
"{",
"return",
"false",
";",
"}",
"}",
"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
|
train
|
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
|
train
|
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
|
train
|
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
|
train
|
SeleniumHQ/selenium
|
javascript/selenium-core/scripts/htmlutils.js
|
eval_css
|
function eval_css(locator, inDocument) {
var results = [];
try {
window.Sizzle(locator, inDocument, results);
} catch (ignored) {
// Presumably poor formatting
}
return results;
}
|
javascript
|
function eval_css(locator, inDocument) {
var results = [];
try {
window.Sizzle(locator, inDocument, results);
} catch (ignored) {
// Presumably poor formatting
}
return results;
}
|
[
"function",
"eval_css",
"(",
"locator",
",",
"inDocument",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"try",
"{",
"window",
".",
"Sizzle",
"(",
"locator",
",",
"inDocument",
",",
"results",
")",
";",
"}",
"catch",
"(",
"ignored",
")",
"{",
"}",
"return",
"results",
";",
"}"
] |
Returns the full resultset of a CSS selector evaluation.
|
[
"Returns",
"the",
"full",
"resultset",
"of",
"a",
"CSS",
"selector",
"evaluation",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2186-L2194
|
train
|
SeleniumHQ/selenium
|
javascript/selenium-core/scripts/htmlutils.js
|
are_equal
|
function are_equal(a1, a2)
{
if (typeof(a1) != typeof(a2))
return false;
switch(typeof(a1)) {
case 'object':
// arrays
if (a1.length) {
if (a1.length != a2.length)
return false;
for (var i = 0; i < a1.length; ++i) {
if (!are_equal(a1[i], a2[i]))
return false
}
}
// associative arrays
else {
var keys = {};
for (var key in a1) {
keys[key] = true;
}
for (var key in a2) {
keys[key] = true;
}
for (var key in keys) {
if (!are_equal(a1[key], a2[key]))
return false;
}
}
return true;
default:
return a1 == a2;
}
}
|
javascript
|
function are_equal(a1, a2)
{
if (typeof(a1) != typeof(a2))
return false;
switch(typeof(a1)) {
case 'object':
// arrays
if (a1.length) {
if (a1.length != a2.length)
return false;
for (var i = 0; i < a1.length; ++i) {
if (!are_equal(a1[i], a2[i]))
return false
}
}
// associative arrays
else {
var keys = {};
for (var key in a1) {
keys[key] = true;
}
for (var key in a2) {
keys[key] = true;
}
for (var key in keys) {
if (!are_equal(a1[key], a2[key]))
return false;
}
}
return true;
default:
return a1 == a2;
}
}
|
[
"function",
"are_equal",
"(",
"a1",
",",
"a2",
")",
"{",
"if",
"(",
"typeof",
"(",
"a1",
")",
"!=",
"typeof",
"(",
"a2",
")",
")",
"return",
"false",
";",
"switch",
"(",
"typeof",
"(",
"a1",
")",
")",
"{",
"case",
"'object'",
":",
"if",
"(",
"a1",
".",
"length",
")",
"{",
"if",
"(",
"a1",
".",
"length",
"!=",
"a2",
".",
"length",
")",
"return",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"a1",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"!",
"are_equal",
"(",
"a1",
"[",
"i",
"]",
",",
"a2",
"[",
"i",
"]",
")",
")",
"return",
"false",
"}",
"}",
"else",
"{",
"var",
"keys",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"key",
"in",
"a1",
")",
"{",
"keys",
"[",
"key",
"]",
"=",
"true",
";",
"}",
"for",
"(",
"var",
"key",
"in",
"a2",
")",
"{",
"keys",
"[",
"key",
"]",
"=",
"true",
";",
"}",
"for",
"(",
"var",
"key",
"in",
"keys",
")",
"{",
"if",
"(",
"!",
"are_equal",
"(",
"a1",
"[",
"key",
"]",
",",
"a2",
"[",
"key",
"]",
")",
")",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"default",
":",
"return",
"a1",
"==",
"a2",
";",
"}",
"}"
] |
Returns true if two arrays are identical, and false otherwise.
@param a1 the first array, may only contain simple values (strings or
numbers)
@param a2 the second array, same restricts on data as for a1
@return true if the arrays are equivalent, false otherwise.
|
[
"Returns",
"true",
"if",
"two",
"arrays",
"are",
"identical",
"and",
"false",
"otherwise",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2292-L2327
|
train
|
SeleniumHQ/selenium
|
javascript/selenium-core/scripts/htmlutils.js
|
clone
|
function clone(orig) {
var copy;
switch(typeof(orig)) {
case 'object':
copy = (orig.length) ? [] : {};
for (var attr in orig) {
copy[attr] = clone(orig[attr]);
}
break;
default:
copy = orig;
break;
}
return copy;
}
|
javascript
|
function clone(orig) {
var copy;
switch(typeof(orig)) {
case 'object':
copy = (orig.length) ? [] : {};
for (var attr in orig) {
copy[attr] = clone(orig[attr]);
}
break;
default:
copy = orig;
break;
}
return copy;
}
|
[
"function",
"clone",
"(",
"orig",
")",
"{",
"var",
"copy",
";",
"switch",
"(",
"typeof",
"(",
"orig",
")",
")",
"{",
"case",
"'object'",
":",
"copy",
"=",
"(",
"orig",
".",
"length",
")",
"?",
"[",
"]",
":",
"{",
"}",
";",
"for",
"(",
"var",
"attr",
"in",
"orig",
")",
"{",
"copy",
"[",
"attr",
"]",
"=",
"clone",
"(",
"orig",
"[",
"attr",
"]",
")",
";",
"}",
"break",
";",
"default",
":",
"copy",
"=",
"orig",
";",
"break",
";",
"}",
"return",
"copy",
";",
"}"
] |
Create a clone of an object and return it. This is a deep copy of everything
but functions, whose references are copied. You shouldn't expect a deep copy
of functions anyway.
@param orig the original object to copy
@return a deep copy of the original object. Any functions attached,
however, will have their references copied only.
|
[
"Create",
"a",
"clone",
"of",
"an",
"object",
"and",
"return",
"it",
".",
"This",
"is",
"a",
"deep",
"copy",
"of",
"everything",
"but",
"functions",
"whose",
"references",
"are",
"copied",
".",
"You",
"shouldn",
"t",
"expect",
"a",
"deep",
"copy",
"of",
"functions",
"anyway",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2339-L2353
|
train
|
SeleniumHQ/selenium
|
javascript/selenium-core/scripts/htmlutils.js
|
parse_kwargs
|
function parse_kwargs(kwargs)
{
var args = new Object();
var pairs = kwargs.split(/,/);
for (var i = 0; i < pairs.length;) {
if (i > 0 && pairs[i].indexOf('=') == -1) {
// the value string contained a comma. Glue the parts back together.
pairs[i-1] += ',' + pairs.splice(i, 1)[0];
}
else {
++i;
}
}
for (var i = 0; i < pairs.length; ++i) {
var splits = pairs[i].split(/=/);
if (splits.length == 1) {
continue;
}
var key = splits.shift();
var value = splits.join('=');
args[key.trim()] = value.trim();
}
return args;
}
|
javascript
|
function parse_kwargs(kwargs)
{
var args = new Object();
var pairs = kwargs.split(/,/);
for (var i = 0; i < pairs.length;) {
if (i > 0 && pairs[i].indexOf('=') == -1) {
// the value string contained a comma. Glue the parts back together.
pairs[i-1] += ',' + pairs.splice(i, 1)[0];
}
else {
++i;
}
}
for (var i = 0; i < pairs.length; ++i) {
var splits = pairs[i].split(/=/);
if (splits.length == 1) {
continue;
}
var key = splits.shift();
var value = splits.join('=');
args[key.trim()] = value.trim();
}
return args;
}
|
[
"function",
"parse_kwargs",
"(",
"kwargs",
")",
"{",
"var",
"args",
"=",
"new",
"Object",
"(",
")",
";",
"var",
"pairs",
"=",
"kwargs",
".",
"split",
"(",
"/",
",",
"/",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"pairs",
".",
"length",
";",
")",
"{",
"if",
"(",
"i",
">",
"0",
"&&",
"pairs",
"[",
"i",
"]",
".",
"indexOf",
"(",
"'='",
")",
"==",
"-",
"1",
")",
"{",
"pairs",
"[",
"i",
"-",
"1",
"]",
"+=",
"','",
"+",
"pairs",
".",
"splice",
"(",
"i",
",",
"1",
")",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"++",
"i",
";",
"}",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"pairs",
".",
"length",
";",
"++",
"i",
")",
"{",
"var",
"splits",
"=",
"pairs",
"[",
"i",
"]",
".",
"split",
"(",
"/",
"=",
"/",
")",
";",
"if",
"(",
"splits",
".",
"length",
"==",
"1",
")",
"{",
"continue",
";",
"}",
"var",
"key",
"=",
"splits",
".",
"shift",
"(",
")",
";",
"var",
"value",
"=",
"splits",
".",
"join",
"(",
"'='",
")",
";",
"args",
"[",
"key",
".",
"trim",
"(",
")",
"]",
"=",
"value",
".",
"trim",
"(",
")",
";",
"}",
"return",
"args",
";",
"}"
] |
Parses a python-style keyword arguments string and returns the pairs in a
new object.
@param kwargs a string representing a set of keyword arguments. It should
look like <tt>keyword1=value1, keyword2=value2, ...</tt>
@return an object mapping strings to strings
|
[
"Parses",
"a",
"python",
"-",
"style",
"keyword",
"arguments",
"string",
"and",
"returns",
"the",
"pairs",
"in",
"a",
"new",
"object",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2482-L2505
|
train
|
SeleniumHQ/selenium
|
javascript/selenium-core/scripts/htmlutils.js
|
to_kwargs
|
function to_kwargs(args, sortedKeys)
{
var s = '';
if (!sortedKeys) {
var sortedKeys = keys(args).sort();
}
for (var i = 0; i < sortedKeys.length; ++i) {
var k = sortedKeys[i];
if (args[k] != undefined) {
if (s) {
s += ', ';
}
s += k + '=' + args[k];
}
}
return s;
}
|
javascript
|
function to_kwargs(args, sortedKeys)
{
var s = '';
if (!sortedKeys) {
var sortedKeys = keys(args).sort();
}
for (var i = 0; i < sortedKeys.length; ++i) {
var k = sortedKeys[i];
if (args[k] != undefined) {
if (s) {
s += ', ';
}
s += k + '=' + args[k];
}
}
return s;
}
|
[
"function",
"to_kwargs",
"(",
"args",
",",
"sortedKeys",
")",
"{",
"var",
"s",
"=",
"''",
";",
"if",
"(",
"!",
"sortedKeys",
")",
"{",
"var",
"sortedKeys",
"=",
"keys",
"(",
"args",
")",
".",
"sort",
"(",
")",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"sortedKeys",
".",
"length",
";",
"++",
"i",
")",
"{",
"var",
"k",
"=",
"sortedKeys",
"[",
"i",
"]",
";",
"if",
"(",
"args",
"[",
"k",
"]",
"!=",
"undefined",
")",
"{",
"if",
"(",
"s",
")",
"{",
"s",
"+=",
"', '",
";",
"}",
"s",
"+=",
"k",
"+",
"'='",
"+",
"args",
"[",
"k",
"]",
";",
"}",
"}",
"return",
"s",
";",
"}"
] |
Creates a python-style keyword arguments string from an object.
@param args an associative array mapping strings to strings
@param sortedKeys (optional) a list of keys of the args parameter that
specifies the order in which the arguments will appear in
the returned kwargs string
@return a kwarg string representation of args
|
[
"Creates",
"a",
"python",
"-",
"style",
"keyword",
"arguments",
"string",
"from",
"an",
"object",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2517-L2533
|
train
|
SeleniumHQ/selenium
|
javascript/selenium-core/scripts/htmlutils.js
|
is_ancestor
|
function is_ancestor(node, target)
{
while (target.parentNode) {
target = target.parentNode;
if (node == target)
return true;
}
return false;
}
|
javascript
|
function is_ancestor(node, target)
{
while (target.parentNode) {
target = target.parentNode;
if (node == target)
return true;
}
return false;
}
|
[
"function",
"is_ancestor",
"(",
"node",
",",
"target",
")",
"{",
"while",
"(",
"target",
".",
"parentNode",
")",
"{",
"target",
"=",
"target",
".",
"parentNode",
";",
"if",
"(",
"node",
"==",
"target",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Returns true if a node is an ancestor node of a target node, and false
otherwise.
@param node the node being compared to the target node
@param target the target node
@return true if node is an ancestor node of target, false otherwise.
|
[
"Returns",
"true",
"if",
"a",
"node",
"is",
"an",
"ancestor",
"node",
"of",
"a",
"target",
"node",
"and",
"false",
"otherwise",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2543-L2551
|
train
|
SeleniumHQ/selenium
|
javascript/selenium-core/scripts/htmlutils.js
|
function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
// Set display property to block for height/width animations
if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) {
this.elem.style.display = "block";
}
}
|
javascript
|
function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
// Set display property to block for height/width animations
if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) {
this.elem.style.display = "block";
}
}
|
[
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"step",
")",
"{",
"this",
".",
"options",
".",
"step",
".",
"call",
"(",
"this",
".",
"elem",
",",
"this",
".",
"now",
",",
"this",
")",
";",
"}",
"(",
"jQuery",
".",
"fx",
".",
"step",
"[",
"this",
".",
"prop",
"]",
"||",
"jQuery",
".",
"fx",
".",
"step",
".",
"_default",
")",
"(",
"this",
")",
";",
"if",
"(",
"(",
"this",
".",
"prop",
"===",
"\"height\"",
"||",
"this",
".",
"prop",
"===",
"\"width\"",
")",
"&&",
"this",
".",
"elem",
".",
"style",
")",
"{",
"this",
".",
"elem",
".",
"style",
".",
"display",
"=",
"\"block\"",
";",
"}",
"}"
] |
Simple function for setting a style value
|
[
"Simple",
"function",
"for",
"setting",
"a",
"style",
"value"
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L8168-L8179
|
train
|
|
SeleniumHQ/selenium
|
third_party/js/mozmill/shared-modules/toolbars.js
|
locationBar_clear
|
function locationBar_clear() {
this.focus({type: "shortcut"});
this._controller.keypress(this.urlbar, "VK_DELETE", {});
this._controller.waitForEval("subject.value == ''",
TIMEOUT, 100, this.urlbar.getNode());
}
|
javascript
|
function locationBar_clear() {
this.focus({type: "shortcut"});
this._controller.keypress(this.urlbar, "VK_DELETE", {});
this._controller.waitForEval("subject.value == ''",
TIMEOUT, 100, this.urlbar.getNode());
}
|
[
"function",
"locationBar_clear",
"(",
")",
"{",
"this",
".",
"focus",
"(",
"{",
"type",
":",
"\"shortcut\"",
"}",
")",
";",
"this",
".",
"_controller",
".",
"keypress",
"(",
"this",
".",
"urlbar",
",",
"\"VK_DELETE\"",
",",
"{",
"}",
")",
";",
"this",
".",
"_controller",
".",
"waitForEval",
"(",
"\"subject.value == ''\"",
",",
"TIMEOUT",
",",
"100",
",",
"this",
".",
"urlbar",
".",
"getNode",
"(",
")",
")",
";",
"}"
] |
Clear the location bar
|
[
"Clear",
"the",
"location",
"bar"
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L301-L306
|
train
|
SeleniumHQ/selenium
|
third_party/js/mozmill/shared-modules/toolbars.js
|
locationBar_focus
|
function locationBar_focus(event) {
switch (event.type) {
case "click":
this._controller.click(this.urlbar);
break;
case "shortcut":
var cmdKey = utils.getEntity(this.getDtds(), "openCmd.commandkey");
this._controller.keypress(null, cmdKey, {accelKey: true});
break;
default:
throw new Error(arguments.callee.name + ": Unkown event type - " + event.type);
}
// Wait until the location bar has been focused
this._controller.waitForEval("subject.getAttribute('focused') == 'true'",
TIMEOUT, 100, this.urlbar.getNode());
}
|
javascript
|
function locationBar_focus(event) {
switch (event.type) {
case "click":
this._controller.click(this.urlbar);
break;
case "shortcut":
var cmdKey = utils.getEntity(this.getDtds(), "openCmd.commandkey");
this._controller.keypress(null, cmdKey, {accelKey: true});
break;
default:
throw new Error(arguments.callee.name + ": Unkown event type - " + event.type);
}
// Wait until the location bar has been focused
this._controller.waitForEval("subject.getAttribute('focused') == 'true'",
TIMEOUT, 100, this.urlbar.getNode());
}
|
[
"function",
"locationBar_focus",
"(",
"event",
")",
"{",
"switch",
"(",
"event",
".",
"type",
")",
"{",
"case",
"\"click\"",
":",
"this",
".",
"_controller",
".",
"click",
"(",
"this",
".",
"urlbar",
")",
";",
"break",
";",
"case",
"\"shortcut\"",
":",
"var",
"cmdKey",
"=",
"utils",
".",
"getEntity",
"(",
"this",
".",
"getDtds",
"(",
")",
",",
"\"openCmd.commandkey\"",
")",
";",
"this",
".",
"_controller",
".",
"keypress",
"(",
"null",
",",
"cmdKey",
",",
"{",
"accelKey",
":",
"true",
"}",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"arguments",
".",
"callee",
".",
"name",
"+",
"\": Unkown event type - \"",
"+",
"event",
".",
"type",
")",
";",
"}",
"this",
".",
"_controller",
".",
"waitForEval",
"(",
"\"subject.getAttribute('focused') == 'true'\"",
",",
"TIMEOUT",
",",
"100",
",",
"this",
".",
"urlbar",
".",
"getNode",
"(",
")",
")",
";",
"}"
] |
Focus the location bar
@param {object} event
Focus the location bar with the given event (click or shortcut)
|
[
"Focus",
"the",
"location",
"bar"
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L332-L348
|
train
|
SeleniumHQ/selenium
|
third_party/js/mozmill/shared-modules/toolbars.js
|
locationBar_getNotificationElement
|
function locationBar_getNotificationElement(aType, aLookupString)
{
var lookup = '/id("' + aType + '")';
lookup = aLookupString ? lookup + aLookupString : lookup;
// Get the notification and fetch the child element if wanted
return this.getElement({type: "notification_element", subtype: lookup});
}
|
javascript
|
function locationBar_getNotificationElement(aType, aLookupString)
{
var lookup = '/id("' + aType + '")';
lookup = aLookupString ? lookup + aLookupString : lookup;
// Get the notification and fetch the child element if wanted
return this.getElement({type: "notification_element", subtype: lookup});
}
|
[
"function",
"locationBar_getNotificationElement",
"(",
"aType",
",",
"aLookupString",
")",
"{",
"var",
"lookup",
"=",
"'/id(\"'",
"+",
"aType",
"+",
"'\")'",
";",
"lookup",
"=",
"aLookupString",
"?",
"lookup",
"+",
"aLookupString",
":",
"lookup",
";",
"return",
"this",
".",
"getElement",
"(",
"{",
"type",
":",
"\"notification_element\"",
",",
"subtype",
":",
"lookup",
"}",
")",
";",
"}"
] |
Retrieves the specified element of the door hanger notification bar
@param {string} aType
Type of the notification bar to look for
@param {string} aLookupString
Lookup string of the notification bar's child element
[optional - default: ""]
@return The created element
@type {ElemBase}
|
[
"Retrieves",
"the",
"specified",
"element",
"of",
"the",
"door",
"hanger",
"notification",
"bar"
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L450-L457
|
train
|
SeleniumHQ/selenium
|
third_party/js/mozmill/shared-modules/toolbars.js
|
locationBar_toggleAutocompletePopup
|
function locationBar_toggleAutocompletePopup() {
var dropdown = this.getElement({type: "historyDropMarker"});
var stateOpen = this.autoCompleteResults.isOpened;
this._controller.click(dropdown);
this._controller.waitForEval("subject.isOpened == " + stateOpen,
TIMEOUT, 100, this.autoCompleteResults);
}
|
javascript
|
function locationBar_toggleAutocompletePopup() {
var dropdown = this.getElement({type: "historyDropMarker"});
var stateOpen = this.autoCompleteResults.isOpened;
this._controller.click(dropdown);
this._controller.waitForEval("subject.isOpened == " + stateOpen,
TIMEOUT, 100, this.autoCompleteResults);
}
|
[
"function",
"locationBar_toggleAutocompletePopup",
"(",
")",
"{",
"var",
"dropdown",
"=",
"this",
".",
"getElement",
"(",
"{",
"type",
":",
"\"historyDropMarker\"",
"}",
")",
";",
"var",
"stateOpen",
"=",
"this",
".",
"autoCompleteResults",
".",
"isOpened",
";",
"this",
".",
"_controller",
".",
"click",
"(",
"dropdown",
")",
";",
"this",
".",
"_controller",
".",
"waitForEval",
"(",
"\"subject.isOpened == \"",
"+",
"stateOpen",
",",
"TIMEOUT",
",",
"100",
",",
"this",
".",
"autoCompleteResults",
")",
";",
"}"
] |
Toggles between the open and closed state of the auto-complete popup
|
[
"Toggles",
"between",
"the",
"open",
"and",
"closed",
"state",
"of",
"the",
"auto",
"-",
"complete",
"popup"
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L474-L481
|
train
|
SeleniumHQ/selenium
|
third_party/js/mozmill/shared-modules/prefs.js
|
preferencesDialog_close
|
function preferencesDialog_close(saveChanges) {
saveChanges = (saveChanges == undefined) ? false : saveChanges;
if (mozmill.isWindows) {
var button = this.getElement({type: "button", subtype: (saveChanges ? "accept" : "cancel")});
this._controller.click(button);
} else {
this._controller.keypress(null, 'w', {accelKey: true});
}
}
|
javascript
|
function preferencesDialog_close(saveChanges) {
saveChanges = (saveChanges == undefined) ? false : saveChanges;
if (mozmill.isWindows) {
var button = this.getElement({type: "button", subtype: (saveChanges ? "accept" : "cancel")});
this._controller.click(button);
} else {
this._controller.keypress(null, 'w', {accelKey: true});
}
}
|
[
"function",
"preferencesDialog_close",
"(",
"saveChanges",
")",
"{",
"saveChanges",
"=",
"(",
"saveChanges",
"==",
"undefined",
")",
"?",
"false",
":",
"saveChanges",
";",
"if",
"(",
"mozmill",
".",
"isWindows",
")",
"{",
"var",
"button",
"=",
"this",
".",
"getElement",
"(",
"{",
"type",
":",
"\"button\"",
",",
"subtype",
":",
"(",
"saveChanges",
"?",
"\"accept\"",
":",
"\"cancel\"",
")",
"}",
")",
";",
"this",
".",
"_controller",
".",
"click",
"(",
"button",
")",
";",
"}",
"else",
"{",
"this",
".",
"_controller",
".",
"keypress",
"(",
"null",
",",
"'w'",
",",
"{",
"accelKey",
":",
"true",
"}",
")",
";",
"}",
"}"
] |
Close the preferences dialog
@param {MozMillController} controller
MozMillController of the window to operate on
@param {boolean} saveChanges
(Optional) If true the OK button is clicked on Windows which saves
the changes. On OS X and Linux changes are applied immediately
|
[
"Close",
"the",
"preferences",
"dialog"
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/prefs.js#L131-L140
|
train
|
SeleniumHQ/selenium
|
third_party/js/mozmill/shared-modules/prefs.js
|
preferences_getPref
|
function preferences_getPref(prefName, defaultValue, defaultBranch,
interfaceType) {
try {
branch = defaultBranch ? this.defaultPrefBranch : this.prefBranch;
// If interfaceType has been set, handle it differently
if (interfaceType != undefined) {
return branch.getComplexValue(prefName, interfaceType);
}
switch (typeof defaultValue) {
case ('boolean'):
return branch.getBoolPref(prefName);
case ('string'):
return branch.getCharPref(prefName);
case ('number'):
return branch.getIntPref(prefName);
default:
return undefined;
}
} catch(e) {
return defaultValue;
}
}
|
javascript
|
function preferences_getPref(prefName, defaultValue, defaultBranch,
interfaceType) {
try {
branch = defaultBranch ? this.defaultPrefBranch : this.prefBranch;
// If interfaceType has been set, handle it differently
if (interfaceType != undefined) {
return branch.getComplexValue(prefName, interfaceType);
}
switch (typeof defaultValue) {
case ('boolean'):
return branch.getBoolPref(prefName);
case ('string'):
return branch.getCharPref(prefName);
case ('number'):
return branch.getIntPref(prefName);
default:
return undefined;
}
} catch(e) {
return defaultValue;
}
}
|
[
"function",
"preferences_getPref",
"(",
"prefName",
",",
"defaultValue",
",",
"defaultBranch",
",",
"interfaceType",
")",
"{",
"try",
"{",
"branch",
"=",
"defaultBranch",
"?",
"this",
".",
"defaultPrefBranch",
":",
"this",
".",
"prefBranch",
";",
"if",
"(",
"interfaceType",
"!=",
"undefined",
")",
"{",
"return",
"branch",
".",
"getComplexValue",
"(",
"prefName",
",",
"interfaceType",
")",
";",
"}",
"switch",
"(",
"typeof",
"defaultValue",
")",
"{",
"case",
"(",
"'boolean'",
")",
":",
"return",
"branch",
".",
"getBoolPref",
"(",
"prefName",
")",
";",
"case",
"(",
"'string'",
")",
":",
"return",
"branch",
".",
"getCharPref",
"(",
"prefName",
")",
";",
"case",
"(",
"'number'",
")",
":",
"return",
"branch",
".",
"getIntPref",
"(",
"prefName",
")",
";",
"default",
":",
"return",
"undefined",
";",
"}",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"defaultValue",
";",
"}",
"}"
] |
Retrieve the value of an individual preference.
@param {string} prefName
The preference to get the value of.
@param {boolean/number/string} defaultValue
The default value if preference cannot be found.
@param {boolean/number/string} defaultBranch
If true the value will be read from the default branch (optional)
@param {string} interfaceType
Interface to use for the complex value (optional)
(nsILocalFile, nsISupportsString, nsIPrefLocalizedString)
@return The value of the requested preference
@type boolean/int/string/complex
|
[
"Retrieve",
"the",
"value",
"of",
"an",
"individual",
"preference",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/prefs.js#L269-L292
|
train
|
SeleniumHQ/selenium
|
third_party/js/mozmill/shared-modules/prefs.js
|
preferences_setPref
|
function preferences_setPref(prefName, value, interfaceType) {
try {
switch (typeof value) {
case ('boolean'):
this.prefBranch.setBoolPref(prefName, value);
break;
case ('string'):
this.prefBranch.setCharPref(prefName, value);
break;
case ('number'):
this.prefBranch.setIntPref(prefName, value);
break;
default:
this.prefBranch.setComplexValue(prefName, interfaceType, value);
}
} catch(e) {
return false;
}
return true;
}
|
javascript
|
function preferences_setPref(prefName, value, interfaceType) {
try {
switch (typeof value) {
case ('boolean'):
this.prefBranch.setBoolPref(prefName, value);
break;
case ('string'):
this.prefBranch.setCharPref(prefName, value);
break;
case ('number'):
this.prefBranch.setIntPref(prefName, value);
break;
default:
this.prefBranch.setComplexValue(prefName, interfaceType, value);
}
} catch(e) {
return false;
}
return true;
}
|
[
"function",
"preferences_setPref",
"(",
"prefName",
",",
"value",
",",
"interfaceType",
")",
"{",
"try",
"{",
"switch",
"(",
"typeof",
"value",
")",
"{",
"case",
"(",
"'boolean'",
")",
":",
"this",
".",
"prefBranch",
".",
"setBoolPref",
"(",
"prefName",
",",
"value",
")",
";",
"break",
";",
"case",
"(",
"'string'",
")",
":",
"this",
".",
"prefBranch",
".",
"setCharPref",
"(",
"prefName",
",",
"value",
")",
";",
"break",
";",
"case",
"(",
"'number'",
")",
":",
"this",
".",
"prefBranch",
".",
"setIntPref",
"(",
"prefName",
",",
"value",
")",
";",
"break",
";",
"default",
":",
"this",
".",
"prefBranch",
".",
"setComplexValue",
"(",
"prefName",
",",
"interfaceType",
",",
"value",
")",
";",
"}",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Set the value of an individual preference.
@param {string} prefName
The preference to set the value of.
@param {boolean/number/string/complex} value
The value to set the preference to.
@param {string} interfaceType
Interface to use for the complex value
(nsILocalFile, nsISupportsString, nsIPrefLocalizedString)
@return Returns if the value was successfully set.
@type boolean
|
[
"Set",
"the",
"value",
"of",
"an",
"individual",
"preference",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/prefs.js#L308-L328
|
train
|
SeleniumHQ/selenium
|
third_party/js/mozmill/shared-modules/prefs.js
|
openPreferencesDialog
|
function openPreferencesDialog(controller, callback, launcher) {
if(!controller)
throw new Error("No controller given for Preferences Dialog");
if(typeof callback != "function")
throw new Error("No callback given for Preferences Dialog");
if (mozmill.isWindows) {
// Preference dialog is modal on windows, set up our callback
var prefModal = new modalDialog.modalDialog(controller.window);
prefModal.start(callback);
}
// Launch the preference dialog
if (launcher) {
launcher();
} else {
mozmill.getPreferencesController();
}
if (mozmill.isWindows) {
prefModal.waitForDialog();
} else {
// Get the window type of the preferences window depending on the application
var prefWindowType = null;
switch (mozmill.Application) {
case "Thunderbird":
prefWindowType = "Mail:Preferences";
break;
default:
prefWindowType = "Browser:Preferences";
}
utils.handleWindow("type", prefWindowType, callback);
}
}
|
javascript
|
function openPreferencesDialog(controller, callback, launcher) {
if(!controller)
throw new Error("No controller given for Preferences Dialog");
if(typeof callback != "function")
throw new Error("No callback given for Preferences Dialog");
if (mozmill.isWindows) {
// Preference dialog is modal on windows, set up our callback
var prefModal = new modalDialog.modalDialog(controller.window);
prefModal.start(callback);
}
// Launch the preference dialog
if (launcher) {
launcher();
} else {
mozmill.getPreferencesController();
}
if (mozmill.isWindows) {
prefModal.waitForDialog();
} else {
// Get the window type of the preferences window depending on the application
var prefWindowType = null;
switch (mozmill.Application) {
case "Thunderbird":
prefWindowType = "Mail:Preferences";
break;
default:
prefWindowType = "Browser:Preferences";
}
utils.handleWindow("type", prefWindowType, callback);
}
}
|
[
"function",
"openPreferencesDialog",
"(",
"controller",
",",
"callback",
",",
"launcher",
")",
"{",
"if",
"(",
"!",
"controller",
")",
"throw",
"new",
"Error",
"(",
"\"No controller given for Preferences Dialog\"",
")",
";",
"if",
"(",
"typeof",
"callback",
"!=",
"\"function\"",
")",
"throw",
"new",
"Error",
"(",
"\"No callback given for Preferences Dialog\"",
")",
";",
"if",
"(",
"mozmill",
".",
"isWindows",
")",
"{",
"var",
"prefModal",
"=",
"new",
"modalDialog",
".",
"modalDialog",
"(",
"controller",
".",
"window",
")",
";",
"prefModal",
".",
"start",
"(",
"callback",
")",
";",
"}",
"if",
"(",
"launcher",
")",
"{",
"launcher",
"(",
")",
";",
"}",
"else",
"{",
"mozmill",
".",
"getPreferencesController",
"(",
")",
";",
"}",
"if",
"(",
"mozmill",
".",
"isWindows",
")",
"{",
"prefModal",
".",
"waitForDialog",
"(",
")",
";",
"}",
"else",
"{",
"var",
"prefWindowType",
"=",
"null",
";",
"switch",
"(",
"mozmill",
".",
"Application",
")",
"{",
"case",
"\"Thunderbird\"",
":",
"prefWindowType",
"=",
"\"Mail:Preferences\"",
";",
"break",
";",
"default",
":",
"prefWindowType",
"=",
"\"Browser:Preferences\"",
";",
"}",
"utils",
".",
"handleWindow",
"(",
"\"type\"",
",",
"prefWindowType",
",",
"callback",
")",
";",
"}",
"}"
] |
Open the preferences dialog and call the given handler
@param {MozMillController} controller
MozMillController which is the opener of the preferences dialog
@param {function} callback
The callback handler to use to interact with the preference dialog
@param {function} launcher
(Optional) A callback handler to launch the preference dialog
|
[
"Open",
"the",
"preferences",
"dialog",
"and",
"call",
"the",
"given",
"handler"
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/prefs.js#L341-L375
|
train
|
SeleniumHQ/selenium
|
javascript/node/selenium-webdriver/lib/promise.js
|
map
|
async function map(array, fn, self = undefined) {
const v = await Promise.resolve(array);
if (!Array.isArray(v)) {
throw TypeError('not an array');
}
const arr = /** @type {!Array} */(v);
const n = arr.length;
const values = new Array(n);
for (let i = 0; i < n; i++) {
if (i in arr) {
values[i] = await Promise.resolve(fn.call(self, arr[i], i, arr));
}
}
return values;
}
|
javascript
|
async function map(array, fn, self = undefined) {
const v = await Promise.resolve(array);
if (!Array.isArray(v)) {
throw TypeError('not an array');
}
const arr = /** @type {!Array} */(v);
const n = arr.length;
const values = new Array(n);
for (let i = 0; i < n; i++) {
if (i in arr) {
values[i] = await Promise.resolve(fn.call(self, arr[i], i, arr));
}
}
return values;
}
|
[
"async",
"function",
"map",
"(",
"array",
",",
"fn",
",",
"self",
"=",
"undefined",
")",
"{",
"const",
"v",
"=",
"await",
"Promise",
".",
"resolve",
"(",
"array",
")",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"v",
")",
")",
"{",
"throw",
"TypeError",
"(",
"'not an array'",
")",
";",
"}",
"const",
"arr",
"=",
"(",
"v",
")",
";",
"const",
"n",
"=",
"arr",
".",
"length",
";",
"const",
"values",
"=",
"new",
"Array",
"(",
"n",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"in",
"arr",
")",
"{",
"values",
"[",
"i",
"]",
"=",
"await",
"Promise",
".",
"resolve",
"(",
"fn",
".",
"call",
"(",
"self",
",",
"arr",
"[",
"i",
"]",
",",
"i",
",",
"arr",
")",
")",
";",
"}",
"}",
"return",
"values",
";",
"}"
] |
Calls a function for each element in an array and inserts the result into a
new array, which is used as the fulfillment value of the promise returned
by this function.
If the return value of the mapping function is a promise, this function
will wait for it to be fulfilled before inserting it into the new array.
If the mapping function throws or returns a rejected promise, the
promise returned by this function will be rejected with the same reason.
Only the first failure will be reported; all subsequent errors will be
silently ignored.
@param {!(Array<TYPE>|IThenable<!Array<TYPE>>)} array The array to iterate
over, or a promise that will resolve to said array.
@param {function(this: SELF, TYPE, number, !Array<TYPE>): ?} fn The
function to call for each element in the array. This function should
expect three arguments (the element, the index, and the array itself.
@param {SELF=} self The object to be used as the value of 'this' within `fn`.
@template TYPE, SELF
|
[
"Calls",
"a",
"function",
"for",
"each",
"element",
"in",
"an",
"array",
"and",
"inserts",
"the",
"result",
"into",
"a",
"new",
"array",
"which",
"is",
"used",
"as",
"the",
"fulfillment",
"value",
"of",
"the",
"promise",
"returned",
"by",
"this",
"function",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/promise.js#L153-L169
|
train
|
SeleniumHQ/selenium
|
javascript/node/selenium-webdriver/lib/promise.js
|
filter
|
async function filter(array, fn, self = undefined) {
const v = await Promise.resolve(array);
if (!Array.isArray(v)) {
throw TypeError('not an array');
}
const arr = /** @type {!Array} */(v);
const n = arr.length;
const values = [];
let valuesLength = 0;
for (let i = 0; i < n; i++) {
if (i in arr) {
let value = arr[i];
let include = await fn.call(self, value, i, arr);
if (include) {
values[valuesLength++] = value;
}
}
}
return values;
}
|
javascript
|
async function filter(array, fn, self = undefined) {
const v = await Promise.resolve(array);
if (!Array.isArray(v)) {
throw TypeError('not an array');
}
const arr = /** @type {!Array} */(v);
const n = arr.length;
const values = [];
let valuesLength = 0;
for (let i = 0; i < n; i++) {
if (i in arr) {
let value = arr[i];
let include = await fn.call(self, value, i, arr);
if (include) {
values[valuesLength++] = value;
}
}
}
return values;
}
|
[
"async",
"function",
"filter",
"(",
"array",
",",
"fn",
",",
"self",
"=",
"undefined",
")",
"{",
"const",
"v",
"=",
"await",
"Promise",
".",
"resolve",
"(",
"array",
")",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"v",
")",
")",
"{",
"throw",
"TypeError",
"(",
"'not an array'",
")",
";",
"}",
"const",
"arr",
"=",
"(",
"v",
")",
";",
"const",
"n",
"=",
"arr",
".",
"length",
";",
"const",
"values",
"=",
"[",
"]",
";",
"let",
"valuesLength",
"=",
"0",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"in",
"arr",
")",
"{",
"let",
"value",
"=",
"arr",
"[",
"i",
"]",
";",
"let",
"include",
"=",
"await",
"fn",
".",
"call",
"(",
"self",
",",
"value",
",",
"i",
",",
"arr",
")",
";",
"if",
"(",
"include",
")",
"{",
"values",
"[",
"valuesLength",
"++",
"]",
"=",
"value",
";",
"}",
"}",
"}",
"return",
"values",
";",
"}"
] |
Calls a function for each element in an array, and if the function returns
true adds the element to a new array.
If the return value of the filter function is a promise, this function
will wait for it to be fulfilled before determining whether to insert the
element into the new array.
If the filter function throws or returns a rejected promise, the promise
returned by this function will be rejected with the same reason. Only the
first failure will be reported; all subsequent errors will be silently
ignored.
@param {!(Array<TYPE>|IThenable<!Array<TYPE>>)} array The array to iterate
over, or a promise that will resolve to said array.
@param {function(this: SELF, TYPE, number, !Array<TYPE>): (
boolean|IThenable<boolean>)} fn The function
to call for each element in the array.
@param {SELF=} self The object to be used as the value of 'this' within `fn`.
@template TYPE, SELF
|
[
"Calls",
"a",
"function",
"for",
"each",
"element",
"in",
"an",
"array",
"and",
"if",
"the",
"function",
"returns",
"true",
"adds",
"the",
"element",
"to",
"a",
"new",
"array",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/promise.js#L193-L214
|
train
|
SeleniumHQ/selenium
|
javascript/jsunit/app/xbDebug.js
|
xbDebugApplyFunction
|
function xbDebugApplyFunction(funcname, funcref, thisref, argumentsref)
{
var rv;
if (!funcref)
{
alert('xbDebugApplyFunction: funcref is null');
}
if (typeof(funcref.apply) != 'undefined')
return funcref.apply(thisref, argumentsref);
var applyexpr = 'thisref.xbDebug_orig_' + funcname + '(';
var i;
for (i = 0; i < argumentsref.length; i++)
{
applyexpr += 'argumentsref[' + i + '],';
}
if (argumentsref.length > 0)
{
applyexpr = applyexpr.substring(0, applyexpr.length - 1);
}
applyexpr += ')';
return eval(applyexpr);
}
|
javascript
|
function xbDebugApplyFunction(funcname, funcref, thisref, argumentsref)
{
var rv;
if (!funcref)
{
alert('xbDebugApplyFunction: funcref is null');
}
if (typeof(funcref.apply) != 'undefined')
return funcref.apply(thisref, argumentsref);
var applyexpr = 'thisref.xbDebug_orig_' + funcname + '(';
var i;
for (i = 0; i < argumentsref.length; i++)
{
applyexpr += 'argumentsref[' + i + '],';
}
if (argumentsref.length > 0)
{
applyexpr = applyexpr.substring(0, applyexpr.length - 1);
}
applyexpr += ')';
return eval(applyexpr);
}
|
[
"function",
"xbDebugApplyFunction",
"(",
"funcname",
",",
"funcref",
",",
"thisref",
",",
"argumentsref",
")",
"{",
"var",
"rv",
";",
"if",
"(",
"!",
"funcref",
")",
"{",
"alert",
"(",
"'xbDebugApplyFunction: funcref is null'",
")",
";",
"}",
"if",
"(",
"typeof",
"(",
"funcref",
".",
"apply",
")",
"!=",
"'undefined'",
")",
"return",
"funcref",
".",
"apply",
"(",
"thisref",
",",
"argumentsref",
")",
";",
"var",
"applyexpr",
"=",
"'thisref.xbDebug_orig_'",
"+",
"funcname",
"+",
"'('",
";",
"var",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"argumentsref",
".",
"length",
";",
"i",
"++",
")",
"{",
"applyexpr",
"+=",
"'argumentsref['",
"+",
"i",
"+",
"'],'",
";",
"}",
"if",
"(",
"argumentsref",
".",
"length",
">",
"0",
")",
"{",
"applyexpr",
"=",
"applyexpr",
".",
"substring",
"(",
"0",
",",
"applyexpr",
".",
"length",
"-",
"1",
")",
";",
"}",
"applyexpr",
"+=",
"')'",
";",
"return",
"eval",
"(",
"applyexpr",
")",
";",
"}"
] |
emulate functionref.apply for IE mac and IE win < 5.5
|
[
"emulate",
"functionref",
".",
"apply",
"for",
"IE",
"mac",
"and",
"IE",
"win",
"<",
"5",
".",
"5"
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/jsunit/app/xbDebug.js#L118-L146
|
train
|
SeleniumHQ/selenium
|
javascript/selenium-core/xpath/xpath.js
|
xpathCollectDescendants
|
function xpathCollectDescendants(nodelist, node, opt_tagName) {
if (opt_tagName && node.getElementsByTagName) {
copyArray(nodelist, node.getElementsByTagName(opt_tagName));
return;
}
for (var n = node.firstChild; n; n = n.nextSibling) {
nodelist.push(n);
xpathCollectDescendants(nodelist, n);
}
}
|
javascript
|
function xpathCollectDescendants(nodelist, node, opt_tagName) {
if (opt_tagName && node.getElementsByTagName) {
copyArray(nodelist, node.getElementsByTagName(opt_tagName));
return;
}
for (var n = node.firstChild; n; n = n.nextSibling) {
nodelist.push(n);
xpathCollectDescendants(nodelist, n);
}
}
|
[
"function",
"xpathCollectDescendants",
"(",
"nodelist",
",",
"node",
",",
"opt_tagName",
")",
"{",
"if",
"(",
"opt_tagName",
"&&",
"node",
".",
"getElementsByTagName",
")",
"{",
"copyArray",
"(",
"nodelist",
",",
"node",
".",
"getElementsByTagName",
"(",
"opt_tagName",
")",
")",
";",
"return",
";",
"}",
"for",
"(",
"var",
"n",
"=",
"node",
".",
"firstChild",
";",
"n",
";",
"n",
"=",
"n",
".",
"nextSibling",
")",
"{",
"nodelist",
".",
"push",
"(",
"n",
")",
";",
"xpathCollectDescendants",
"(",
"nodelist",
",",
"n",
")",
";",
"}",
"}"
] |
Local utility functions that are used by the lexer or parser.
|
[
"Local",
"utility",
"functions",
"that",
"are",
"used",
"by",
"the",
"lexer",
"or",
"parser",
"."
] |
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
|
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/xpath.js#L2362-L2371
|
train
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.