diff --git a/cpp/iedriver/Browser.cpp b/cpp/iedriver/Browser.cpp index 683ebf27d7769..91f3cb3871dd9 100644 --- a/cpp/iedriver/Browser.cpp +++ b/cpp/iedriver/Browser.cpp @@ -52,14 +52,29 @@ void __stdcall Browser::NewWindow3(IDispatch** ppDisp, LOG(TRACE) << "Entering Browser::NewWindow3"; // Handle the NewWindow3 event to allow us to immediately hook // the events of the new browser window opened by the user action. + // The three ways we can respond to this event are documented at + // http://msdn.microsoft.com/en-us/library/aa768337%28v=vs.85%29.aspx + // We potentially use two of those response methods. // This will not allow us to handle windows created by the JavaScript // showModalDialog function(). IWebBrowser2* browser; LPSTREAM message_payload; - ::SendMessage(this->executor_handle(), - WD_BROWSER_NEW_WINDOW, - NULL, - reinterpret_cast(&message_payload)); + LRESULT create_result = ::SendMessage(this->executor_handle(), + WD_BROWSER_NEW_WINDOW, + NULL, + reinterpret_cast(&message_payload)); + if (create_result != 0) { + // The new, blank IWebBrowser2 object was not created, + // so we can't really do anything appropriate here. + // Note this is "response method 2" of the aforementioned + // documentation. + LOG(WARN) << "A valid IWebBrowser2 object could not be created."; + *pbCancel = VARIANT_TRUE; + return; + } + + // We received a valid IWebBrowser2 pointer, so deserialize it onto this + // thread, and pass the result back to the caller. HRESULT hr = ::CoGetInterfaceAndReleaseStream(message_payload, IID_IWebBrowser2, reinterpret_cast(&browser)); diff --git a/cpp/iedriver/BrowserFactory.cpp b/cpp/iedriver/BrowserFactory.cpp index a0fe423cfc95f..3953e4c667914 100755 --- a/cpp/iedriver/BrowserFactory.cpp +++ b/cpp/iedriver/BrowserFactory.cpp @@ -585,13 +585,7 @@ int BrowserFactory::GetZoomLevel(IHTMLDocument2* document, IHTMLWindow2* window) IWebBrowser2* BrowserFactory::CreateBrowser() { LOG(TRACE) << "Entering BrowserFactory::CreateBrowser"; - // TODO: Error and exception handling and return value checking. - IWebBrowser2* browser; - if (this->windows_major_version_ >= 6) { - // Only Windows Vista and above have mandatory integrity levels. - this->SetThreadIntegrityLevel(); - } - + IWebBrowser2* browser = NULL; DWORD context = CLSCTX_LOCAL_SERVER; if (this->ie_major_version_ == 7 && this->windows_major_version_ >= 6) { // ONLY for IE 7 on Windows Vista. XP and below do not have Protected Mode; @@ -599,18 +593,51 @@ IWebBrowser2* BrowserFactory::CreateBrowser() { context = context | CLSCTX_ENABLE_CLOAKING; } - ::CoCreateInstance(CLSID_InternetExplorer, - NULL, - context, - IID_IWebBrowser2, - reinterpret_cast(&browser)); + HRESULT hr = ::CoCreateInstance(CLSID_InternetExplorer, + NULL, + context, + IID_IWebBrowser2, + reinterpret_cast(&browser)); + // When IWebBrowser2::Quit() is called, the wrapper process doesn't + // exit right away. When that happens, CoCreateInstance can fail while + // the abandoned iexplore.exe instance is still valid. The "right" way + // to do this would be to call ::EnumProcesses before calling + // CoCreateInstance, finding all of the iexplore.exe processes, waiting + // for one to exit, and then proceed. However, there is no way to tell + // if a process ID belongs to an Internet Explorer instance, particularly + // when a 32-bit process tries to enumerate 64-bit processes on 64-bit + // Windows. So, we'll take the brute force way out, just retrying the call + // to CoCreateInstance until it succeeds (the old iexplore.exe process has + // exited), or we get a different error code. We'll also set a 45-second + // timeout, with 45 seconds being chosen because it's below the default + // 60 second HTTP request timeout of most language bindings. + if (FAILED(hr) && HRESULT_CODE(hr) == ERROR_SHUTDOWN_IS_SCHEDULED) { + LOG(DEBUG) << "CoCreateInstance for IWebBrowser2 failed due to a " + << "browser process that has not yet fully exited. Retrying " + << "until the browser process exits and a new instance can " + << "be successfully created."; + } + clock_t timeout = clock() + (45 * CLOCKS_PER_SEC); + while (FAILED(hr) && + HRESULT_CODE(hr) == ERROR_SHUTDOWN_IS_SCHEDULED && + clock() < timeout) { + ::Sleep(500); + hr = ::CoCreateInstance(CLSID_InternetExplorer, + NULL, + context, + IID_IWebBrowser2, + reinterpret_cast(&browser)); + } + if (FAILED(hr) && HRESULT_CODE(hr) != ERROR_SHUTDOWN_IS_SCHEDULED) { + // If we hit this branch, the CoCreateInstance failed due to an unexpected + // error, either before we looped, or at some point during the loop. In + // in either case, there's not much else we can do except log the failure. + LOGHR(WARN, hr) << "CoCreateInstance for IWebBrowser2 failed."; + } + if (browser != NULL) { browser->put_Visible(VARIANT_TRUE); } - if (this->windows_major_version_ >= 6) { - // Only Windows Vista and above have mandatory integrity levels. - this->ResetThreadIntegrityLevel(); - } return browser; } @@ -666,41 +693,6 @@ bool BrowserFactory::CreateLowIntegrityLevelToken(HANDLE* process_token_handle, return result == TRUE; } -void BrowserFactory::SetThreadIntegrityLevel() { - LOG(TRACE) << "Entering BrowserFactory::SetThreadIntegrityLevel"; - - HANDLE process_token = NULL; - HANDLE thread_token = NULL; - PSID sid = NULL; - bool token_created = this->CreateLowIntegrityLevelToken(&process_token, - &thread_token, - &sid); - if (token_created) { - HANDLE thread_handle = ::GetCurrentThread(); - BOOL result = ::SetThreadToken(&thread_handle, thread_token); - if (!result) { - // If we encounter an error, not bloody much we can do about it. - // Just log it and continue. - LOG(WARN) << "SetThreadToken returned FALSE"; - } - result = ::ImpersonateLoggedOnUser(thread_token); - if (!result) { - // If we encounter an error, not bloody much we can do about it. - // Just log it and continue. - LOG(WARN) << "ImpersonateLoggedOnUser returned FALSE"; - } - - ::CloseHandle(thread_token); - ::CloseHandle(process_token); - ::LocalFree(sid); - } -} - -void BrowserFactory::ResetThreadIntegrityLevel() { - LOG(TRACE) << "Entering BrowserFactory::ResetThreadIntegrityLevel"; - ::RevertToSelf(); -} - void BrowserFactory::InvokeClearCacheUtility(bool use_low_integrity_level) { HRESULT hr = S_OK; std::vector system_path_buffer(MAX_PATH); diff --git a/cpp/iedriver/BrowserFactory.h b/cpp/iedriver/BrowserFactory.h index 571189b50e599..260151b5dc3c3 100755 --- a/cpp/iedriver/BrowserFactory.h +++ b/cpp/iedriver/BrowserFactory.h @@ -142,8 +142,6 @@ class BrowserFactory { UINT html_getobject_msg_; HINSTANCE oleacc_instance_handle_; - void SetThreadIntegrityLevel(void); - void ResetThreadIntegrityLevel(void); bool CreateLowIntegrityLevelToken(HANDLE* process_token_handle, HANDLE* mic_token_handle, PSID* sid); diff --git a/cpp/iedriver/Generated/atoms.h b/cpp/iedriver/Generated/atoms.h index 165cbdd2012d2..1bec85b01f7d0 100644 --- a/cpp/iedriver/Generated/atoms.h +++ b/cpp/iedriver/Generated/atoms.h @@ -7433,180 +7433,185 @@ const wchar_t* const INPUTS[] = { L"&a.c(b))throw new u(13,\"Cannot press a modifier key that is already p", L"ressed.\");var c=null!==b.code&&bh(a,zf,b);if((c||z)&&((!ch(b)||bh(a,q", L"f,b,!c))&&c)&&(dh(a,b),a.oa))if(b.O){if(!eh){var c=fh(a,b),d=Kf(a.b(),", - L"!0)[0]+1;Nf(a.b(),c);Gf(a.b(),d);A&&a.P(xf);Jd||a.P(wf);a.s=d}}else sw", - L"itch(b){case ag:eh||(A&&a.P(xf),T(a.b(),\"TEXTAREA\")&&(c=Kf(a.b(),!0)", - L"[0]+$g.length,Nf(a.b(),$g),Gf(a.b(),c),y||a.P(wf),a.s=c));break;case Z", - L"f:case pg:eh||(c=Kf(a.b(),!1),c[0]==c[1]&&(b==Zf?(Gf(a.b(),\nc[1]-1),L", - L"f(a.b(),c[1])):Lf(a.b(),c[1]+1)),c=Kf(a.b(),!1),c=!(c[0]==a.b().value.", - L"length||0==c[1]),Nf(a.b(),\"\"),(!y&&c||z&&b==Zf)&&a.P(wf),c=Kf(a.b(),", - L"!1),a.s=c[1]);break;case kg:case mg:var c=a.b(),e=Kf(c,!0)[0],f=Kf(c,!", - L"1)[1],g=d=0;b==kg?a.c(Y)?a.s==e?(d=Math.max(e-1,0),g=f,e=d):(d=e,e=g=f", - L"-1):e=e==f?Math.max(e-1,0):e:a.c(Y)?a.s==f?(d=e,e=g=Math.min(f+1,c.val", - L"ue.length)):(d=e+1,g=f,e=d):e=e==f?Math.min(f+1,c.value.length):f;a.c(", - L"Y)?(Gf(c,d),Lf(c,g)):Mf(c,e);a.s=e;break;case jg:case ig:c=a.b(),d=Kf(", - L"c,!0)[0],\ng=Kf(c,!1)[1],b==jg?(a.c(Y)?(Gf(c,0),Lf(c,a.s==d?g:d)):Mf(c", - L",0),a.s=0):(a.c(Y)?(a.s==d&&Gf(c,g),Lf(c,c.value.length)):Mf(c,c.value", - L".length),a.s=c.value.length)}Wf(a,b,!0)}function ch(a){if(a.O||a==ag)r", - L"eturn!0;if(A)return!1;if(y)return a==eg;switch(a){case Y:case bg:case ", - L"cg:return!1;case qg:case rg:case sg:return z;default:return!0}}\nfunct", - L"ion dh(a,b){if(b==ag&&!z&&T(a.b(),\"INPUT\")){var c=Ib(a.b(),ef,!0);if", - L"(c){var d=c.getElementsByTagName(\"input\");(Da(d,function(a){return b", - L"f(a)})||1==d.length||A&&!Ad(534))&&ff(c)}}}function gh(a,b){if(!a.c(b)", - L")throw new u(13,\"Cannot release a key that is not pressed. (\"+b.code", - L"+\")\");null===b.code||bh(a,Af,b);Wf(a,b,!1)}function fh(a,b){if(!b.O)", - L"throw new u(13,\"not a character key\");return a.c(Y)?b.cb:b.O}var eh=", - L"z&&!Ad(12);\nfunction bh(a,b,c,d){if(null===c.code)throw new u(13,\"Ke", - L"y must have a keycode to be fired.\");c={altKey:a.c(cg),ctrlKey:a.c(bg", - L"),metaKey:a.c(qg),shiftKey:a.c(Y),keyCode:c.code,charCode:c.O&&b==qf?f", - L"h(a,c).charCodeAt(0):0,preventDefault:!!d};return a.pa(b,c)}function h", - L"h(a,b){He(a,b);a.oa=he(b)&&!be(b,\"readOnly\");var c=Ze(a);a.oa&&c&&(M", - L"f(b,b.value.length),a.s=b.value.length)}Vf.prototype.t=function(){retu", - L"rn{pressed:this.ha.S(),currentPos:this.s}};function ih(a,b,c){Ge.call(", - L"this,b,c);this.K=this.l=null;this.m=new B(0,0);this.da=this.T=!1;if(a)", - L"{da(a.buttonPressed)&&(this.l=a.buttonPressed);try{T(a.elementPressed)", - L"&&(this.K=a.elementPressed)}catch(d){this.l=null}this.m=new B(a.client", - L"XY.x,a.clientXY.y);this.T=!!a.nextClickIsDoubleClick;this.da=!!a.hasEv", - L"erInteracted;try{a.element&&T(a.element)&&He(this,a.element)}catch(e){", - L"this.l=null}}}r(ih,Ge);var Z={};\nJd?(Z[Me]=[0,0,0,null],Z[Ve]=[null,n", - L"ull,0,null],Z[Ye]=[1,4,2,null],Z[Le]=[0,0,0,0],Z[We]=[1,4,2,0]):A||Id?", - L"(Z[Me]=[0,1,2,null],Z[Ve]=[null,null,2,null],Z[Ye]=[0,1,2,null],Z[Le]=", - L"[0,1,2,0],Z[We]=[0,1,2,0]):(Z[Me]=[0,1,2,null],Z[Ve]=[null,null,2,null", - L"],Z[Ye]=[0,1,2,null],Z[Le]=[0,0,0,0],Z[We]=[0,0,0,0]);Kd&&(Z[Ue]=Z[Ye]", - L",Z[Ff]=Z[Ye],Z[Xe]=[-1,-1,-1,-1],Z[Te]=Z[Xe],Z[Se]=Z[Xe]);Z[yf]=Z[Me];", - L"Z[Ne]=Z[Ye];Z[Ke]=Z[Le];var jh={};jh[Ne]=Ue;jh[We]=Xe;jh[Le]=Te;jh[Ke]", - L"=Se;jh[Ye]=Ff;\nfunction kh(a,b){if(null!==a.l)throw new u(13,\"Cannot", - L" press more then one button or an already pressed button.\");a.l=b;a.K", - L"=a.b();var c;var d=z&&!Cd(4);if((A||d)&&(T(a.b(),\"OPTION\")||T(a.b(),", - L"\"SELECT\")))c=!0;else{(d=z||y)&&(c=Wd(a.b()));var e=lh(a,Ne);c=e&&d&&", - L"c!=Wd(a.b())?!1:e}c&&(Kd&&(0==a.l&&T(a.K,\"OPTION\"))&&a.L(Cf,a.m,0,1,", - L"MSPointerEvent.MSPOINTER_TYPE_MOUSE,!0),Ze(a))}\nfunction mh(a){if(nul", - L"l===a.l)throw new u(13,\"Cannot release a button when no button is pre", - L"ssed.\");if(a.r&&Xd(a.d)){var b=a.r,c=ae(a.d);if(!c||b.multiple)a.d.se", - L"lected=!c,(!A||!b.multiple||Zb&&Cd(28)||Yb&&Cd(4))&&V(b,vf)}lh(a,Ye);i", - L"f(0==a.l&&a.b()==a.K){if(!Ld||!T(a.K,\"OPTION\"))if(b=a.m,c=nh(a,Me),X", - L"d(a.d)){var d=null,e=null;if(!af)for(var f=a.d;f;f=f.parentNode)if(T(f", - L",\"A\")){d=f;break}else if(bf(f)){e=f;break}var g=(f=!a.r&&$d(a.d))&&a", - L"e(a.d);y&&e?e.click():a.R(Me,b,c,null,0,!1,void 0)&&(d&&cf(d)?(b=d,\nc", - L"=b.href,d=D(C(b)),y&&!Ad(8)&&(c=df(d.location,c)),b.target?d.open(c,b.", - L"target):d.location.href=c):!f||(z||A||g&&\"radio\"==a.d.type.toLowerCa", - L"se())||(a.d.checked=!g,x&&!Ad(11)&&V(a.d,vf)))}a.T&&lh(a,yf);a.T=!a.T;", - L"Kd&&(0==a.l&&T(a.K,\"OPTION\"))&&a.L(Df,new B(0,0),0,1,MSPointerEvent.", - L"MSPOINTER_TYPE_MOUSE,!1)}else 2==a.l&&lh(a,Ve);Oe={};a.l=null;a.K=null", - L"}\nih.prototype.move=function(a,b){var c=Xd(a),d=le(a);this.m.x=b.x+d.", - L"left;this.m.y=b.y+d.top;d=this.b();if(a!=d){try{D(C(d)).closed&&(d=nul", - L"l)}catch(e){d=null}if(d){var f=d===oa.document.documentElement||d===oa", - L".document.body,d=!this.da&&f?null:d;lh(this,Le,a)}He(this,a);y||lh(thi", - L"s,Ke,d,null,c)}lh(this,We,null,null,c);y&&a!=d&&lh(this,Ke,d,null,c);t", - L"his.T=!1};\nfunction lh(a,b,c,d,e){a.da=!0;if(Kd){var f=jh[b];if(f&&!a", - L".L(f,a.m,nh(a,f),1,MSPointerEvent.MSPOINTER_TYPE_MOUSE,!0,c,e))return!", - L"1}return a.R(b,a.m,nh(a,b),c,d,e)}function nh(a,b){if(!(b in Z))return", - L" 0;var c=Z[b][null===a.l?3:a.l];if(null===c)throw new u(13,\"Event doe", - L"s not permit the specified mouse button.\");return c}ih.prototype.t=fu", - L"nction(){return{buttonPressed:this.l,elementPressed:this.K,clientXY:{x", - L":this.m.x,y:this.m.y},nextClickIsDoubleClick:this.T,hasEverInteracted:", - L"this.da,element:this.b()}};function oh(){Ge.call(this);this.m=new B(0,", - L"0);this.ba=new B(0,0)}r(oh,Ge);k=oh.prototype;k.Ca=!1;k.xa=!1;k.aa=0;k", - L".ja=0;\nk.move=function(a,b,c){var d=this.b();this.c()&&!Kd||He(this,a", - L");var e=le(a);this.m.x=b.x+e.left;this.m.y=b.y+e.top;n(c)&&(this.ba.x=", - L"c.x+e.left,this.ba.y=c.y+e.top);if(this.c())if(Kd)this.xa||(a!=d&&(thi", - L"s.Ca=!0),ph(a)?(f=qh,f(this,this.b(),this.m,this.aa,!0),this.ja&&ph(th", - L"is.b())&&f(this,this.b(),this.ba,this.ja,!1)):(this.L(Te,b,-1,this.aa,", - L"MSPointerEvent.MSPOINTER_TYPE_TOUCH,!0),this.R(Le,b,0),this.L(Ef,b,0,t", - L"his.aa,MSPointerEvent.MSPOINTER_TYPE_TOUCH,!0),this.xa=!0,Oe={}));else", - L"{this.Ca=!0;a=Re;if(!this.c())throw new u(13,\n\"Should never fire eve", - L"nt when touchscreen is not pressed.\");var f,g;this.ja&&(f=this.ja,g=t", - L"his.ba);this.qa(a,this.aa,this.m,f,g)}};k.c=function(){return!!this.aa", - L"};function qh(a,b,c,d,e){a.L(Xe,c,-1,d,MSPointerEvent.MSPOINTER_TYPE_T", - L"OUCH,e);a.R(We,c,0,null,0,!1,d)}function ph(a){if(!Kd)throw Error(\"ha", - L"sMsTouchActionsEnable should only be called from IE 10\");if(\"none\"=", - L"=U(a,\"ms-touch-action\"))return!0;a=je(a);return!!a&&ph(a)};function ", - L"rh(a,b){this.x=a;this.y=b}r(rh,B);rh.prototype.scale=B.prototype.scale", - L";rh.prototype.add=function(a){this.x+=a.x;this.y+=a.y;return this};fun", - L"ction sh(a,b,c,d){function e(a){p(a)?t(a.split(\"\"),function(a){if(1!", - L"=a.length)throw new u(13,\"Argument not a single character: \"+a);var ", - L"b=Xf[a];b||(b=a.toUpperCase(),b=X(b.charCodeAt(0),a.toLowerCase(),b),b", - L"={key:b,shift:a!=b.O});a=b;b=f.c(Y);a.shift&&!b&&ah(f,Y);ah(f,a.key);g", - L"h(f,a.key);a.shift&&!b&&gh(f,Y)}):0<=za(Xg,a)?f.c(a)?gh(f,a):ah(f,a):(", - L"ah(f,a),gh(f,a))}if(a!=Wd(a)){if(!Xd(a))throw new u(12,\"Element is no", - L"t currently interactable and may not be manipulated\");th(a)}var f=c||", - L"new Vf;hh(f,a);\nif((!$b||$a)&&A&&\"date\"==a.type){c=\"array\"==ca(b)", - L"?b=b.join(\"\"):b;var g=/\\d{4}-\\d{2}-\\d{2}/;if(c.match(g)){$a&&$b&&", - L"(V(a,Qe),V(a,Bf));V(a,$e);a.value=c.match(g)[0];V(a,vf);V(a,uf);return", - L"}}\"array\"==ca(b)?t(b,e):e(b);d||t(Xg,function(a){f.c(a)&&gh(f,a)})}", - L"\nfunction uh(a){var b;if(\"none\"!=Od(a,\"display\"))b=Sd(a);else{b=a", - L".style;var c=b.display,d=b.visibility,e=b.position;b.visibility=\"hidd", - L"en\";b.position=\"absolute\";b.display=\"inline\";var f=Sd(a);b.displa", - L"y=c;b.position=e;b.visibility=d;b=f}return 0=a){var b=$[a];if(null===b)g.push(h=e()),f&&(h.Ja=!1,g.push(h=e", - L"()));else if(n(b))h.keys.push(b);else throw Error(\"Unsupported WebDri", - L"ver key: \\\\u\"+a.charCodeAt(0).toString(16));}else switch(a){case \"", - L"\\n\":h.keys.push(ag);break;case \"\\t\":h.keys.push($f);break;case \"", - L"\\b\":h.keys.push(Zf);break;default:h.keys.push(a)}})});t(g,function(b", - L"){sh(a,b.keys,c,b.Ja)})}\nvar $={\"\\ue000\":null};$[\"\\ue003\"]=Zf;$", - L"[\"\\ue004\"]=$f;$[\"\\ue006\"]=ag;$[\"\\ue007\"]=ag;$[\"\\ue008\"]=Y;", - L"$[\"\\ue009\"]=bg;$[\"\\ue00a\"]=cg;$[\"\\ue00b\"]=dg;$[\"\\ue00c\"]=e", - L"g;$[\"\\ue00d\"]=fg;$[\"\\ue00e\"]=gg;$[\"\\ue00f\"]=hg;$[\"\\ue010\"]", - L"=ig;$[\"\\ue011\"]=jg;$[\"\\ue012\"]=kg;$[\"\\ue013\"]=lg;$[\"\\ue014", - L"\"]=mg;$[\"\\ue015\"]=ng;$[\"\\ue016\"]=og;$[\"\\ue017\"]=pg;$[\"\\ue0", - L"18\"]=Wg;$[\"\\ue019\"]=Ug;$[\"\\ue01a\"]=tg;$[\"\\ue01b\"]=ug;$[\"\\u", - L"e01c\"]=vg;$[\"\\ue01d\"]=wg;$[\"\\ue01e\"]=xg;$[\"\\ue01f\"]=yg;$[\"", - L"\\ue020\"]=zg;$[\"\\ue021\"]=Ag;$[\"\\ue022\"]=Bg;$[\"\\ue023\"]=Cg;\n", - L"$[\"\\ue024\"]=Dg;$[\"\\ue025\"]=Eg;$[\"\\ue027\"]=Fg;$[\"\\ue028\"]=G", - L"g;$[\"\\ue029\"]=Hg;$[\"\\ue026\"]=Vg;$[\"\\ue031\"]=Ig;$[\"\\ue032\"]", - L"=Jg;$[\"\\ue033\"]=Kg;$[\"\\ue034\"]=Lg;$[\"\\ue035\"]=Mg;$[\"\\ue036", - L"\"]=Ng;$[\"\\ue037\"]=Og;$[\"\\ue038\"]=Pg;$[\"\\ue039\"]=Qg;$[\"\\ue0", - L"3a\"]=Rg;$[\"\\ue03b\"]=Sg;$[\"\\ue03c\"]=Tg;$[\"\\ue03d\"]=qg;na(\"we", - L"bdriver.atoms.inputs.click\",function(a,b){var c=new ih(b);a||(a=c.t()", - L".element);if(!a)throw Error(\"No element to send keys to\");var d=a,e;", - L"if(!Yd(d,!0))throw new u(11,\"Element is not currently visible and may", - L" not be manipulated\");th(d,void 0);e=uh(d);e=new rh(e.width/2,e.heigh", - L"t/2);var f=c||new ih;f.move(d,e);kh(f,0);mh(f);return c.t()});na(\"web", - L"driver.atoms.inputs.doubleClick\",function(a){a=new ih(a);kh(a,0);mh(a", - L");kh(a,0);mh(a);return a.t()});\nna(\"webdriver.atoms.inputs.rightClic", - L"k\",function(a){a=new ih(a);kh(a,2);mh(a);return a.t()});na(\"webdrive", - L"r.atoms.inputs.mouseButtonDown\",function(a){a=new ih(a);kh(a,0);retur", - L"n a.t()});na(\"webdriver.atoms.inputs.mouseButtonUp\",function(a){a=ne", - L"w ih(a);mh(a);return a.t()});\nna(\"webdriver.atoms.inputs.mouseMove\"", - L",function(a,b,c,d){d=new ih(d);var e=a||d.t().element,f=null!=b&&null!", - L"=c;b=b||0;c=c||0;if(a)f||(c=uh(a),b=Math.floor(c.width/2),c=Math.floor", - L"(c.height/2));else{var g;xa(e);if(1==e.nodeType){var h;if(e.getBoundin", - L"gClientRect)h=Qd(e),h=new B(h.left,h.top);else{a=Lb(tb(e));var l=C(e),", - L"v=Od(e,\"position\");ya(e,\"Parameter is required\");var P=z&&l.getBox", - L"ObjectFor&&!e.getBoundingClientRect&&\"absolute\"==v&&(h=l.getBoxObjec", - L"tFor(e))&&(0>h.screenX||0>h.screenY),f=new B(0,0),\nw=Pd(l);if(e!=w)if", - L"(e.getBoundingClientRect)h=Qd(e),l=Lb(tb(l)),f.x=h.left+l.x,f.y=h.top+", - L"l.y;else if(l.getBoxObjectFor&&!P)h=l.getBoxObjectFor(e),l=l.getBoxObj", - L"ectFor(w),f.x=h.screenX-l.screenX,f.y=h.screenY-l.screenY;else{h=e;do{", - L"f.x+=h.offsetLeft;f.y+=h.offsetTop;h!=e&&(f.x+=h.clientLeft||0,f.y+=h.", - L"clientTop||0);if(A&&\"fixed\"==Od(h,\"position\")){f.x+=l.body.scrollL", - L"eft;f.y+=l.body.scrollTop;break}h=h.offsetParent}while(h&&h!=e);if(x||", - L"A&&\"absolute\"==v)f.y-=l.body.offsetTop;for(h=e;(h=Rd(h))&&h!=l.body&", - L"&\nh!=w;)f.x-=h.scrollLeft,x&&\"TR\"==h.tagName||(f.y-=h.scrollTop)}h=", - L"new B(f.x-a.x,f.y-a.y)}if(z&&!lb(12)){y?g=\"-ms-transform\":A?g=\"-web", - L"kit-transform\":x?g=\"-o-transform\":z&&(g=\"-moz-transform\");var q;g", - L"&&(q=Od(e,g));q||(q=Od(e,\"transform\"));g=q?(g=q.match(Vd))?new B(par", - L"seFloat(g[1]),parseFloat(g[2])):new B(0,0):new B(0,0);g=new B(h.x+g.x,", - L"h.y+g.y)}else g=h}else g=ea(e.Ba),q=e,e.targetTouches?q=e.targetTouche", - L"s[0]:g&&e.Ba().targetTouches&&(q=e.Ba().targetTouches[0]),g=new B(q.cl", - L"ientX,q.clientY);b+=d.t().clientXY.x-\ng.x;c+=d.t().clientXY.y-g.y}th(", - L"e,new B(b,c));d.move(e,new B(b,c));return d.t()});na(\"webdriver.atoms", - L".inputs.sendKeys\",function(a,b,c,d){c=new Vf(c);a||(a=Wd(document));i", - L"f(!a)throw Error(\"No element to send keys to\");wh(a,b,c,d);return c.", - L"t()});", + L"!0)[0]+1;gh(a.b())?(Nf(a.b(),c),Gf(a.b(),d)):a.b().value+=c;A&&a.P(xf)", + L";Jd||a.P(wf);a.s=d}}else switch(b){case ag:eh||(A&&a.P(xf),T(a.b(),\"T", + L"EXTAREA\")&&(c=Kf(a.b(),!0)[0]+$g.length,gh(a.b())?(Nf(a.b(),$g),Gf(a.", + L"b(),c)):a.b().value+=$g,y||a.P(wf),a.s=c));break;case Zf:case pg:eh||", + L"\n(hh(a.b()),c=Kf(a.b(),!1),c[0]==c[1]&&(b==Zf?(Gf(a.b(),c[1]-1),Lf(a.", + L"b(),c[1])):Lf(a.b(),c[1]+1)),c=Kf(a.b(),!1),c=!(c[0]==a.b().value.leng", + L"th||0==c[1]),Nf(a.b(),\"\"),(!y&&c||z&&b==Zf)&&a.P(wf),c=Kf(a.b(),!1),", + L"a.s=c[1]);break;case kg:case mg:hh(a.b());var c=a.b(),e=Kf(c,!0)[0],f=", + L"Kf(c,!1)[1],g=d=0;b==kg?a.c(Y)?a.s==e?(d=Math.max(e-1,0),g=f,e=d):(d=e", + L",e=g=f-1):e=e==f?Math.max(e-1,0):e:a.c(Y)?a.s==f?(d=e,e=g=Math.min(f+1", + L",c.value.length)):(d=e+1,g=f,e=d):e=e==f?Math.min(f+1,c.value.length):", + L"f;a.c(Y)?(Gf(c,\nd),Lf(c,g)):Mf(c,e);a.s=e;break;case jg:case ig:hh(a.", + L"b()),c=a.b(),d=Kf(c,!0)[0],g=Kf(c,!1)[1],b==jg?(a.c(Y)?(Gf(c,0),Lf(c,a", + L".s==d?g:d)):Mf(c,0),a.s=0):(a.c(Y)?(a.s==d&&Gf(c,g),Lf(c,c.value.lengt", + L"h)):Mf(c,c.value.length),a.s=c.value.length)}Wf(a,b,!0)}function ch(a)", + L"{if(a.O||a==ag)return!0;if(A)return!1;if(y)return a==eg;switch(a){case", + L" Y:case bg:case cg:return!1;case qg:case rg:case sg:return z;default:r", + L"eturn!0}}\nfunction dh(a,b){if(b==ag&&!z&&T(a.b(),\"INPUT\")){var c=Ib", + L"(a.b(),ef,!0);if(c){var d=c.getElementsByTagName(\"input\");(Da(d,func", + L"tion(a){return bf(a)})||1==d.length||A&&!Ad(534))&&ff(c)}}}function ih", + L"(a,b){if(!a.c(b))throw new u(13,\"Cannot release a key that is not pre", + L"ssed. (\"+b.code+\")\");null===b.code||bh(a,Af,b);Wf(a,b,!1)}function ", + L"fh(a,b){if(!b.O)throw new u(13,\"not a character key\");return a.c(Y)?", + L"b.cb:b.O}var eh=z&&!Ad(12);\nfunction hh(a){try{a.selectionStart}catch", + L"(b){if(-1!=b.message.indexOf(\"does not support selection.\"))throw Er", + L"ror(b.message+\" (For more information, see https://code.google.com/p/", + L"chromium/issues/detail?id=330456)\");throw b;}}function gh(a){try{hh(a", + L")}catch(b){return!1}return!0}\nfunction bh(a,b,c,d){if(null===c.code)t", + L"hrow new u(13,\"Key must have a keycode to be fired.\");c={altKey:a.c(", + L"cg),ctrlKey:a.c(bg),metaKey:a.c(qg),shiftKey:a.c(Y),keyCode:c.code,cha", + L"rCode:c.O&&b==qf?fh(a,c).charCodeAt(0):0,preventDefault:!!d};return a.", + L"pa(b,c)}function jh(a,b){He(a,b);a.oa=he(b)&&!be(b,\"readOnly\");var c", + L"=Ze(a);a.oa&&c&&(Mf(b,b.value.length),a.s=b.value.length)}Vf.prototype", + L".t=function(){return{pressed:this.ha.S(),currentPos:this.s}};function ", + L"kh(a,b,c){Ge.call(this,b,c);this.K=this.l=null;this.m=new B(0,0);this.", + L"da=this.T=!1;if(a){da(a.buttonPressed)&&(this.l=a.buttonPressed);try{T", + L"(a.elementPressed)&&(this.K=a.elementPressed)}catch(d){this.l=null}thi", + L"s.m=new B(a.clientXY.x,a.clientXY.y);this.T=!!a.nextClickIsDoubleClick", + L";this.da=!!a.hasEverInteracted;try{a.element&&T(a.element)&&He(this,a.", + L"element)}catch(e){this.l=null}}}r(kh,Ge);var Z={};\nJd?(Z[Me]=[0,0,0,n", + L"ull],Z[Ve]=[null,null,0,null],Z[Ye]=[1,4,2,null],Z[Le]=[0,0,0,0],Z[We]", + L"=[1,4,2,0]):A||Id?(Z[Me]=[0,1,2,null],Z[Ve]=[null,null,2,null],Z[Ye]=[", + L"0,1,2,null],Z[Le]=[0,1,2,0],Z[We]=[0,1,2,0]):(Z[Me]=[0,1,2,null],Z[Ve]", + L"=[null,null,2,null],Z[Ye]=[0,1,2,null],Z[Le]=[0,0,0,0],Z[We]=[0,0,0,0]", + L");Kd&&(Z[Ue]=Z[Ye],Z[Ff]=Z[Ye],Z[Xe]=[-1,-1,-1,-1],Z[Te]=Z[Xe],Z[Se]=Z", + L"[Xe]);Z[yf]=Z[Me];Z[Ne]=Z[Ye];Z[Ke]=Z[Le];var lh={};lh[Ne]=Ue;lh[We]=X", + L"e;lh[Le]=Te;lh[Ke]=Se;lh[Ye]=Ff;\nfunction mh(a,b){if(null!==a.l)throw", + L" new u(13,\"Cannot press more then one button or an already pressed bu", + L"tton.\");a.l=b;a.K=a.b();var c;var d=z&&!Cd(4);if((A||d)&&(T(a.b(),\"O", + L"PTION\")||T(a.b(),\"SELECT\")))c=!0;else{(d=z||y)&&(c=Wd(a.b()));var e", + L"=nh(a,Ne);c=e&&d&&c!=Wd(a.b())?!1:e}c&&(Kd&&(0==a.l&&T(a.K,\"OPTION\")", + L")&&a.L(Cf,a.m,0,1,MSPointerEvent.MSPOINTER_TYPE_MOUSE,!0),Ze(a))}\nfun", + L"ction oh(a){if(null===a.l)throw new u(13,\"Cannot release a button whe", + L"n no button is pressed.\");if(a.r&&Xd(a.d)){var b=a.r,c=ae(a.d);if(!c|", + L"|b.multiple)a.d.selected=!c,(!A||!b.multiple||Zb&&Cd(28)||Yb&&Cd(4))&&", + L"V(b,vf)}nh(a,Ye);if(0==a.l&&a.b()==a.K){if(!Ld||!T(a.K,\"OPTION\"))if(", + L"b=a.m,c=ph(a,Me),Xd(a.d)){var d=null,e=null;if(!af)for(var f=a.d;f;f=f", + L".parentNode)if(T(f,\"A\")){d=f;break}else if(bf(f)){e=f;break}var g=(f", + L"=!a.r&&$d(a.d))&&ae(a.d);y&&e?e.click():a.R(Me,b,c,null,0,!1,void 0)&&", + L"(d&&cf(d)?(b=d,\nc=b.href,d=D(C(b)),y&&!Ad(8)&&(c=df(d.location,c)),b.", + L"target?d.open(c,b.target):d.location.href=c):!f||(z||A||g&&\"radio\"==", + L"a.d.type.toLowerCase())||(a.d.checked=!g,x&&!Ad(11)&&V(a.d,vf)))}a.T&&", + L"nh(a,yf);a.T=!a.T;Kd&&(0==a.l&&T(a.K,\"OPTION\"))&&a.L(Df,new B(0,0),0", + L",1,MSPointerEvent.MSPOINTER_TYPE_MOUSE,!1)}else 2==a.l&&nh(a,Ve);Oe={}", + L";a.l=null;a.K=null}\nkh.prototype.move=function(a,b){var c=Xd(a),d=le(", + L"a);this.m.x=b.x+d.left;this.m.y=b.y+d.top;d=this.b();if(a!=d){try{D(C(", + L"d)).closed&&(d=null)}catch(e){d=null}if(d){var f=d===oa.document.docum", + L"entElement||d===oa.document.body,d=!this.da&&f?null:d;nh(this,Le,a)}He", + L"(this,a);y||nh(this,Ke,d,null,c)}nh(this,We,null,null,c);y&&a!=d&&nh(t", + L"his,Ke,d,null,c);this.T=!1};\nfunction nh(a,b,c,d,e){a.da=!0;if(Kd){va", + L"r f=lh[b];if(f&&!a.L(f,a.m,ph(a,f),1,MSPointerEvent.MSPOINTER_TYPE_MOU", + L"SE,!0,c,e))return!1}return a.R(b,a.m,ph(a,b),c,d,e)}function ph(a,b){i", + L"f(!(b in Z))return 0;var c=Z[b][null===a.l?3:a.l];if(null===c)throw ne", + L"w u(13,\"Event does not permit the specified mouse button.\");return c", + L"}kh.prototype.t=function(){return{buttonPressed:this.l,elementPressed:", + L"this.K,clientXY:{x:this.m.x,y:this.m.y},nextClickIsDoubleClick:this.T,", + L"hasEverInteracted:this.da,element:this.b()}};function qh(){Ge.call(thi", + L"s);this.m=new B(0,0);this.ba=new B(0,0)}r(qh,Ge);k=qh.prototype;k.Ca=!", + L"1;k.xa=!1;k.aa=0;k.ja=0;\nk.move=function(a,b,c){var d=this.b();this.c", + L"()&&!Kd||He(this,a);var e=le(a);this.m.x=b.x+e.left;this.m.y=b.y+e.top", + L";n(c)&&(this.ba.x=c.x+e.left,this.ba.y=c.y+e.top);if(this.c())if(Kd)th", + L"is.xa||(a!=d&&(this.Ca=!0),rh(a)?(f=sh,f(this,this.b(),this.m,this.aa,", + L"!0),this.ja&&rh(this.b())&&f(this,this.b(),this.ba,this.ja,!1)):(this.", + L"L(Te,b,-1,this.aa,MSPointerEvent.MSPOINTER_TYPE_TOUCH,!0),this.R(Le,b,", + L"0),this.L(Ef,b,0,this.aa,MSPointerEvent.MSPOINTER_TYPE_TOUCH,!0),this.", + L"xa=!0,Oe={}));else{this.Ca=!0;a=Re;if(!this.c())throw new u(13,\n\"Sho", + L"uld never fire event when touchscreen is not pressed.\");var f,g;this.", + L"ja&&(f=this.ja,g=this.ba);this.qa(a,this.aa,this.m,f,g)}};k.c=function", + L"(){return!!this.aa};function sh(a,b,c,d,e){a.L(Xe,c,-1,d,MSPointerEven", + L"t.MSPOINTER_TYPE_TOUCH,e);a.R(We,c,0,null,0,!1,d)}function rh(a){if(!K", + L"d)throw Error(\"hasMsTouchActionsEnable should only be called from IE ", + L"10\");if(\"none\"==U(a,\"ms-touch-action\"))return!0;a=je(a);return!!a", + L"&&rh(a)};function th(a,b){this.x=a;this.y=b}r(th,B);th.prototype.scale", + L"=B.prototype.scale;th.prototype.add=function(a){this.x+=a.x;this.y+=a.", + L"y;return this};function uh(a,b,c,d){function e(a){p(a)?t(a.split(\"\")", + L",function(a){if(1!=a.length)throw new u(13,\"Argument not a single cha", + L"racter: \"+a);var b=Xf[a];b||(b=a.toUpperCase(),b=X(b.charCodeAt(0),a.", + L"toLowerCase(),b),b={key:b,shift:a!=b.O});a=b;b=f.c(Y);a.shift&&!b&&ah(", + L"f,Y);ah(f,a.key);ih(f,a.key);a.shift&&!b&&ih(f,Y)}):0<=za(Xg,a)?f.c(a)", + L"?ih(f,a):ah(f,a):(ah(f,a),ih(f,a))}if(a!=Wd(a)){if(!Xd(a))throw new u(", + L"12,\"Element is not currently interactable and may not be manipulated", + L"\");vh(a)}var f=c||new Vf;jh(f,a);\nif((!$b||$a)&&A&&\"date\"==a.type)", + L"{c=\"array\"==ca(b)?b=b.join(\"\"):b;var g=/\\d{4}-\\d{2}-\\d{2}/;if(c", + L".match(g)){$a&&$b&&(V(a,Qe),V(a,Bf));V(a,$e);a.value=c.match(g)[0];V(a", + L",vf);V(a,uf);return}}\"array\"==ca(b)?t(b,e):e(b);d||t(Xg,function(a){", + L"f.c(a)&&ih(f,a)})}\nfunction wh(a){var b;if(\"none\"!=Od(a,\"display\"", + L"))b=Sd(a);else{b=a.style;var c=b.display,d=b.visibility,e=b.position;b", + L".visibility=\"hidden\";b.position=\"absolute\";b.display=\"inline\";va", + L"r f=Sd(a);b.display=c;b.position=e;b.visibility=d;b=f}return 0=a){var b=$[a];if(null===b)g.push(h=e()),f&&", + L"(h.Ja=!1,g.push(h=e()));else if(n(b))h.keys.push(b);else throw Error(", + L"\"Unsupported WebDriver key: \\\\u\"+a.charCodeAt(0).toString(16));}el", + L"se switch(a){case \"\\n\":h.keys.push(ag);break;case \"\\t\":h.keys.pu", + L"sh($f);break;case \"\\b\":h.keys.push(Zf);break;default:h.keys.push(a)", + L"}})});t(g,function(b){uh(a,b.keys,c,b.Ja)})}\nvar $={\"\\ue000\":null}", + L";$[\"\\ue003\"]=Zf;$[\"\\ue004\"]=$f;$[\"\\ue006\"]=ag;$[\"\\ue007\"]=", + L"ag;$[\"\\ue008\"]=Y;$[\"\\ue009\"]=bg;$[\"\\ue00a\"]=cg;$[\"\\ue00b\"]", + L"=dg;$[\"\\ue00c\"]=eg;$[\"\\ue00d\"]=fg;$[\"\\ue00e\"]=gg;$[\"\\ue00f", + L"\"]=hg;$[\"\\ue010\"]=ig;$[\"\\ue011\"]=jg;$[\"\\ue012\"]=kg;$[\"\\ue0", + L"13\"]=lg;$[\"\\ue014\"]=mg;$[\"\\ue015\"]=ng;$[\"\\ue016\"]=og;$[\"\\u", + L"e017\"]=pg;$[\"\\ue018\"]=Wg;$[\"\\ue019\"]=Ug;$[\"\\ue01a\"]=tg;$[\"", + L"\\ue01b\"]=ug;$[\"\\ue01c\"]=vg;$[\"\\ue01d\"]=wg;$[\"\\ue01e\"]=xg;$[", + L"\"\\ue01f\"]=yg;$[\"\\ue020\"]=zg;$[\"\\ue021\"]=Ag;$[\"\\ue022\"]=Bg;", + L"$[\"\\ue023\"]=Cg;\n$[\"\\ue024\"]=Dg;$[\"\\ue025\"]=Eg;$[\"\\ue027\"]", + L"=Fg;$[\"\\ue028\"]=Gg;$[\"\\ue029\"]=Hg;$[\"\\ue026\"]=Vg;$[\"\\ue031", + L"\"]=Ig;$[\"\\ue032\"]=Jg;$[\"\\ue033\"]=Kg;$[\"\\ue034\"]=Lg;$[\"\\ue0", + L"35\"]=Mg;$[\"\\ue036\"]=Ng;$[\"\\ue037\"]=Og;$[\"\\ue038\"]=Pg;$[\"\\u", + L"e039\"]=Qg;$[\"\\ue03a\"]=Rg;$[\"\\ue03b\"]=Sg;$[\"\\ue03c\"]=Tg;$[\"", + L"\\ue03d\"]=qg;na(\"webdriver.atoms.inputs.click\",function(a,b){var c=", + L"new kh(b);a||(a=c.t().element);if(!a)throw Error(\"No element to send ", + L"keys to\");var d=a,e;if(!Yd(d,!0))throw new u(11,\"Element is not curr", + L"ently visible and may not be manipulated\");vh(d,void 0);e=wh(d);e=new", + L" th(e.width/2,e.height/2);var f=c||new kh;f.move(d,e);mh(f,0);oh(f);re", + L"turn c.t()});na(\"webdriver.atoms.inputs.doubleClick\",function(a){a=n", + L"ew kh(a);mh(a,0);oh(a);mh(a,0);oh(a);return a.t()});\nna(\"webdriver.a", + L"toms.inputs.rightClick\",function(a){a=new kh(a);mh(a,2);oh(a);return ", + L"a.t()});na(\"webdriver.atoms.inputs.mouseButtonDown\",function(a){a=ne", + L"w kh(a);mh(a,0);return a.t()});na(\"webdriver.atoms.inputs.mouseButton", + L"Up\",function(a){a=new kh(a);oh(a);return a.t()});\nna(\"webdriver.ato", + L"ms.inputs.mouseMove\",function(a,b,c,d){d=new kh(d);var e=a||d.t().ele", + L"ment,f=null!=b&&null!=c;b=b||0;c=c||0;if(a)f||(c=wh(a),b=Math.floor(c.", + L"width/2),c=Math.floor(c.height/2));else{var g;xa(e);if(1==e.nodeType){", + L"var h;if(e.getBoundingClientRect)h=Qd(e),h=new B(h.left,h.top);else{a=", + L"Lb(tb(e));var l=C(e),v=Od(e,\"position\");ya(e,\"Parameter is required", + L"\");var P=z&&l.getBoxObjectFor&&!e.getBoundingClientRect&&\"absolute\"", + L"==v&&(h=l.getBoxObjectFor(e))&&(0>h.screenX||0>h.screenY),f=new B(0,0)", + L",\nw=Pd(l);if(e!=w)if(e.getBoundingClientRect)h=Qd(e),l=Lb(tb(l)),f.x=", + L"h.left+l.x,f.y=h.top+l.y;else if(l.getBoxObjectFor&&!P)h=l.getBoxObjec", + L"tFor(e),l=l.getBoxObjectFor(w),f.x=h.screenX-l.screenX,f.y=h.screenY-l", + L".screenY;else{h=e;do{f.x+=h.offsetLeft;f.y+=h.offsetTop;h!=e&&(f.x+=h.", + L"clientLeft||0,f.y+=h.clientTop||0);if(A&&\"fixed\"==Od(h,\"position\")", + L"){f.x+=l.body.scrollLeft;f.y+=l.body.scrollTop;break}h=h.offsetParent}", + L"while(h&&h!=e);if(x||A&&\"absolute\"==v)f.y-=l.body.offsetTop;for(h=e;", + L"(h=Rd(h))&&h!=l.body&&\nh!=w;)f.x-=h.scrollLeft,x&&\"TR\"==h.tagName||", + L"(f.y-=h.scrollTop)}h=new B(f.x-a.x,f.y-a.y)}if(z&&!lb(12)){y?g=\"-ms-t", + L"ransform\":A?g=\"-webkit-transform\":x?g=\"-o-transform\":z&&(g=\"-moz", + L"-transform\");var q;g&&(q=Od(e,g));q||(q=Od(e,\"transform\"));g=q?(g=q", + L".match(Vd))?new B(parseFloat(g[1]),parseFloat(g[2])):new B(0,0):new B(", + L"0,0);g=new B(h.x+g.x,h.y+g.y)}else g=h}else g=ea(e.Ba),q=e,e.targetTou", + L"ches?q=e.targetTouches[0]:g&&e.Ba().targetTouches&&(q=e.Ba().targetTou", + L"ches[0]),g=new B(q.clientX,q.clientY);b+=d.t().clientXY.x-\ng.x;c+=d.t", + L"().clientXY.y-g.y}vh(e,new B(b,c));d.move(e,new B(b,c));return d.t()})", + L";na(\"webdriver.atoms.inputs.sendKeys\",function(a,b,c,d){c=new Vf(c);", + L"a||(a=Wd(document));if(!a)throw Error(\"No element to send keys to\");", + L"yh(a,b,c,d);return c.t()});", NULL }; diff --git a/cpp/iedriver/IECommandExecutor.cpp b/cpp/iedriver/IECommandExecutor.cpp index 1fde4a00985c2..5b20479297e2a 100755 --- a/cpp/iedriver/IECommandExecutor.cpp +++ b/cpp/iedriver/IECommandExecutor.cpp @@ -244,6 +244,11 @@ LRESULT IECommandExecutor::OnBrowserNewWindow(UINT uMsg, LOG(TRACE) << "Entering IECommandExecutor::OnBrowserNewWindow"; IWebBrowser2* browser = this->factory_->CreateBrowser(); + if (browser == NULL) { + // No browser was created, so we have to bail early. + // Check the log for the HRESULT why. + return 1; + } BrowserHandle new_window_wrapper(new Browser(browser, NULL, this->m_hWnd)); // TODO: This is a big assumption that this will work. We need a test case // to validate that it will or won't. diff --git a/cpp/iedriverserver/CHANGELOG b/cpp/iedriverserver/CHANGELOG index 14c5de5e5e4ca..401f0673ed7d3 100644 --- a/cpp/iedriverserver/CHANGELOG +++ b/cpp/iedriverserver/CHANGELOG @@ -9,6 +9,24 @@ available via the project downloads page. Changes in "revision" field indicate private releases checked into the prebuilts directory of the source tree, but not made generally available on the downloads page. +v2.41.0.1 +========= + * Updates to JavaScript automation atoms. + * Fixed crash when clicking on link that opens a new window. + When IWebBrowser2::Quit() is called, the wrapper process doesn't exit + right away. When that happens, CoCreateInstance can fail while the abandoned + iexplore.exe instance is still valid. The "right" way to do this would be to + call ::EnumProcesses before calling CoCreateInstance, finding all of the + iexplore.exe processes, waiting for one to exit, and then proceed. However, + there is no way to tell if a process ID belongs to an Internet Explorer + instance, particularly when a 32-bit process tries to enumerate 64-bit + processes on 64-bit Windows. So, we take the brute force way out, just + retrying the call to CoCreateInstance until it succeeds (the old + iexplore.exe process has exited), or we get a different error code. We also + set a 45-second timeout, with 45 seconds being chosen because it's below the + default 60 second HTTP request timeout of most language bindings. Fixes + issue #5848. Fixes issue #7021. + v2.41.0.0 ========= * Release to synchronize with release of Selenium project. diff --git a/cpp/iedriverserver/IEDriverServer.rc b/cpp/iedriverserver/IEDriverServer.rc index f0da435e36a48..b3a874f99f855 100644 Binary files a/cpp/iedriverserver/IEDriverServer.rc and b/cpp/iedriverserver/IEDriverServer.rc differ diff --git a/cpp/prebuilt/Win32/Release/IEDriverServer.exe b/cpp/prebuilt/Win32/Release/IEDriverServer.exe index 8cf1602f64e36..39f6100b25b06 100644 Binary files a/cpp/prebuilt/Win32/Release/IEDriverServer.exe and b/cpp/prebuilt/Win32/Release/IEDriverServer.exe differ diff --git a/cpp/prebuilt/x64/Release/IEDriverServer.exe b/cpp/prebuilt/x64/Release/IEDriverServer.exe index d2b119b0bbbe4..ecc033d3742e8 100644 Binary files a/cpp/prebuilt/x64/Release/IEDriverServer.exe and b/cpp/prebuilt/x64/Release/IEDriverServer.exe differ