Bug 750553 - Rename getAttributeValue to getElementAttribute, r=jgriffin, a=testonly, npotb

This commit is contained in:
Malini Das 2012-05-01 12:37:34 -07:00
Родитель c3b7194898
Коммит 2a47586403
4 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -150,8 +150,8 @@ function Z(a,b,c){a.va=i;return Rb(a,b,a.A,pd(a,b),c,h)}function pd(a,b){if(!(b
(b=zb(a),b=new C(b.width/2,b.height/2));c=c||new od;c.move(a,b);c.z!==k&&g(new y(13,"Cannot press more then one button or an already pressed button."));c.z=0;c.ha=c.m();!qb()&&(P(c.m(),"OPTION")||P(c.m(),"SELECT"))?a=i:(a=E(c.m()).activeElement,a=(b=Z(c,lc))&&a!=E(c.m()).activeElement?l:b);if(a&&(a=c.ba||c.l,b=E(a).activeElement,a!=b)){if(b&&u(b.blur))try{b.blur()}catch(B){g(B)}u(a.focus)&&a.focus()}c.z===k&&g(new y(13,"Cannot release a button when no button is pressed."));Z(c,nc);if(0==c.z&&c.m()==
c.ha){b=c.A;d=pd(c,ic);if(Ob(c.l,i)&&Hb(c.l)){a=k;if(Yb)for(e=c.l;e;e=e.parentNode)if(P(e,"A")){a=e;break}else{a:{if(P(e,"INPUT")&&(f=e.type.toLowerCase(),"submit"==f||"image"==f)){f=i;break a}if(P(e,"BUTTON")&&(f=e.type.toLowerCase(),"submit"==f)){f=i;break a}f=l}if(f)break}if(e=Bb(c.l)){e=c.l;Bb(e)||g(new y(15,"Element is not selectable"));f="selected";m=e.type&&e.type.toLowerCase();if("checkbox"==m||"radio"==m)f="checked";e=!!Eb(e,f)}if(c.ba&&(f=c.ba,!e||f.multiple))c.l.selected=!e,Ub(f,hc);Rb(c,
ic,b,d)&&a&&ac(a)&&(b=a.href,d=G(E(a)),a.target?d.open(b,a.target):d.location.href=b)}c.Z&&Z(c,kc);c.Z=!c.Z}else 2==c.z&&Z(c,jc);c.z=k;c.ha=k}var ud=["_"],$=q;!(ud[0]in $)&&$.execScript&&$.execScript("var "+ud[0]);for(var wd;ud.length&&(wd=ud.shift());)!ud.length&&r(td)?$[wd]=td:$=$[wd]?$[wd]:$[wd]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}
//getAttributeValue
var getAttributeValue = function(){return function(){var f=null,g=!1,h=this;
//getElementAttribute
var getElementAttribute = function(){return function(){var f=null,g=!1,h=this;
function i(a){var c=typeof a;if("object"==c)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return c;var b=Object.prototype.toString.call(a);if("[object Window]"==b)return"object";if("[object Array]"==b||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==b||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==
c&&"undefined"==typeof a.call)return"object";return c}function j(a,c){function b(){}b.prototype=c.prototype;a.f=c.prototype;a.prototype=new b};function k(a,c){for(var b=1;b<arguments.length;b++)var d=(""+arguments[b]).replace(/\$/g,"$$$$"),a=a.replace(/\%s/,d);return a}function l(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};var m,n="",o=/rv\:([^\);]+)(\)|;)/.exec(h.navigator?h.navigator.userAgent:f);m=n=o?o[1]:"";var p={};function q(a,c){this.code=a;this.message=c||"";this.name=r[a]||r[13];var b=Error(this.message);b.name=this.name;this.stack=b.stack||""}j(q,Error);
var r={7:"NoSuchElementError",8:"NoSuchFrameError",9:"UnknownCommandError",10:"StaleElementReferenceError",11:"ElementNotVisibleError",12:"InvalidElementStateError",13:"UnknownError",15:"ElementNotSelectableError",19:"XPathLookupError",23:"NoSuchWindowError",24:"InvalidCookieDomainError",25:"UnableToSetCookieError",26:"ModalDialogOpenedError",27:"NoModalDialogOpenError",28:"ScriptTimeoutError",32:"InvalidSelectorError",33:"SqlDatabaseError",34:"MoveTargetOutOfBoundsError"};

Просмотреть файл

@ -70,7 +70,7 @@ class HTMLElement(object):
return self.marionette.find_elements(method, target, self.id)
def get_attribute(self, attribute):
return self.marionette._send_message('getAttributeValue', 'value', element=self.id, name=attribute)
return self.marionette._send_message('getElementAttribute', 'value', element=self.id, name=attribute)
def click(self):
return self.marionette._send_message('clickElement', 'ok', element=self.id)

Просмотреть файл

@ -845,18 +845,18 @@ MarionetteDriverActor.prototype = {
* the element that will be inspected
* 'name' member holds the name of the attribute to retrieve
*/
getAttributeValue: function MDA_getAttributeValue(aRequest) {
getElementAttribute: function MDA_getElementAttribute(aRequest) {
if (this.context == "chrome") {
try {
let el = this.curBrowser.elementManager.getKnownElement(aRequest.element, this.getCurrentWindow());
this.sendResponse(utils.getAttributeValue(el, aRequest.name));
this.sendResponse(utils.getElementAttribute(el, aRequest.name));
}
catch (e) {
this.sendError(e.message, e.num, e.stack);
}
}
else {
this.sendAsync("getAttributeValue", {element: aRequest.element, name: aRequest.name});
this.sendAsync("getElementAttribute", {element: aRequest.element, name: aRequest.name});
}
},
@ -1137,7 +1137,7 @@ MarionetteDriverActor.prototype.requestTypes = {
"findElement": MarionetteDriverActor.prototype.findElement,
"findElements": MarionetteDriverActor.prototype.findElements,
"clickElement": MarionetteDriverActor.prototype.clickElement,
"getAttributeValue": MarionetteDriverActor.prototype.getAttributeValue,
"getElementAttribute": MarionetteDriverActor.prototype.getElementAttribute,
"getElementText": MarionetteDriverActor.prototype.getElementText,
"isElementDisplayed": MarionetteDriverActor.prototype.isElementDisplayed,
"isElementEnabled": MarionetteDriverActor.prototype.isElementEnabled,

Просмотреть файл

@ -61,7 +61,7 @@ function startListeners() {
addMessageListener("Marionette:findElementContent" + listenerId, findElementContent);
addMessageListener("Marionette:findElementsContent" + listenerId, findElementsContent);
addMessageListener("Marionette:clickElement" + listenerId, clickElement);
addMessageListener("Marionette:getAttributeValue" + listenerId, getAttributeValue);
addMessageListener("Marionette:getElementAttribute" + listenerId, getElementAttribute);
addMessageListener("Marionette:getElementText" + listenerId, getElementText);
addMessageListener("Marionette:isElementDisplayed" + listenerId, isElementDisplayed);
addMessageListener("Marionette:isElementEnabled" + listenerId, isElementEnabled);
@ -118,7 +118,7 @@ function deleteSession(msg) {
removeMessageListener("Marionette:findElementContent" + listenerId, findElementContent);
removeMessageListener("Marionette:findElementsContent" + listenerId, findElementsContent);
removeMessageListener("Marionette:clickElement" + listenerId, clickElement);
removeMessageListener("Marionette:getAttributeValue" + listenerId, getAttributeValue);
removeMessageListener("Marionette:getElementAttribute" + listenerId, getElementAttribute);
removeMessageListener("Marionette:getElementText" + listenerId, getElementText);
removeMessageListener("Marionette:isElementDisplayed" + listenerId, isElementDisplayed);
removeMessageListener("Marionette:isElementEnabled" + listenerId, isElementEnabled);
@ -487,10 +487,10 @@ function clickElement(msg) {
/**
* Get a given attribute of an element
*/
function getAttributeValue(msg) {
function getElementAttribute(msg) {
try {
let el = elementManager.getKnownElement(msg.json.element, win);
sendResponse({value: utils.getAttributeValue(el, msg.json.name)});
sendResponse({value: utils.getElementAttribute(el, msg.json.name)});
}
catch (e) {
sendError(e.message, e.num, e.stack);