@@ -509,27 +509,28 @@ bool Browser::IsDocumentNavigating(const std::string& page_load_strategy,
509
509
510
510
// Starting WaitForDocumentComplete()
511
511
is_navigating = this ->is_navigation_started_ ;
512
- CComBSTR ready_state;
513
- HRESULT hr = doc->get_readyState (&ready_state);
514
- if (FAILED (hr) ||
515
- is_navigating ||
516
- _wcsicmp (ready_state, L" complete" ) != 0 ||
517
- (page_load_strategy == " eager" && _wcsicmp (ready_state, L" interactive" ) != 0 )) {
512
+ CComBSTR ready_state_bstr;
513
+ HRESULT hr = doc->get_readyState (&ready_state_bstr);
514
+ if (FAILED (hr) || is_navigating) {
518
515
if (FAILED (hr)) {
519
516
LOGHR (DEBUG, hr) << " IHTMLDocument2::get_readyState failed." ;
520
517
} else if (is_navigating) {
521
518
LOG (DEBUG) << " DocumentComplete event fired, indicating a new navigation." ;
519
+ }
520
+ return true ;
521
+ } else {
522
+ std::wstring ready_state = ready_state_bstr;
523
+ if ((ready_state == L" complete" ) ||
524
+ (page_load_strategy == " eager" && ready_state == L" interactive" )) {
525
+ is_navigating = false ;
522
526
} else {
523
- std::wstring state = ready_state;
524
527
if (page_load_strategy == " eager" ) {
525
- LOG (DEBUG) << " document.readyState is not 'complete' or 'interactive'; it was " << LOGWSTRING (state );
528
+ LOG (DEBUG) << " document.readyState is not 'complete' or 'interactive'; it was " << LOGWSTRING (ready_state );
526
529
} else {
527
- LOG (DEBUG) << " document.readyState is not 'complete'; it was " << LOGWSTRING (state );
530
+ LOG (DEBUG) << " document.readyState is not 'complete'; it was " << LOGWSTRING (ready_state );
528
531
}
532
+ return true ;
529
533
}
530
- return true ;
531
- } else {
532
- is_navigating = false ;
533
534
}
534
535
535
536
// document.readyState == complete
0 commit comments