Skip to content

Commit

Permalink
Adding hack for detection of IE in full screen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Jan 30, 2019
1 parent 086ec3a commit c2fcaa4
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 13 deletions.
27 changes: 22 additions & 5 deletions cpp/iedriver/Browser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "BrowserFactory.h"
#include "CustomTypes.h"
#include "messages.h"
#include "Script.h"
#include "StringUtilities.h"
#include "WebDriverConstants.h"

Expand Down Expand Up @@ -722,11 +723,27 @@ HWND Browser::GetBrowserWindowHandle() {
}

bool Browser::SetFullScreen(bool is_full_screen) {
if (is_full_screen) {
this->browser_->put_FullScreen(VARIANT_TRUE);
} else {
this->browser_->put_FullScreen(VARIANT_FALSE);
}
VARIANT_BOOL full_screen_value = VARIANT_TRUE;
std::wstring full_screen_script = L"window.fullScreen = true;";
if (!is_full_screen) {
full_screen_value = VARIANT_FALSE;
full_screen_script = L"delete window.fullScreen;";
}
this->browser_->put_FullScreen(full_screen_value);

// IE does not support the W3C Fullscreen API (and likely never will).
// The prefixed version cannot be triggered via JavaScript outside of
// a user interaction, so we're going to cheat here and manually set
// the fullScreen property of the window object to the appropriate
// value. This may interfere with polyfills in use, and if that's
// the case, we'll revisit this hack.
CComPtr<IHTMLDocument2> doc;
this->GetDocument(true, &doc);
std::wstring script = ANONYMOUS_FUNCTION_START;
script += full_screen_script;
script += ANONYMOUS_FUNCTION_END;
Script script_wrapper(doc, script, 0);
script_wrapper.Execute();
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions cpp/iedriver/IEDriver.rc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,141,5,3
PRODUCTVERSION 3,141,5,3
FILEVERSION 3,141,5,4
PRODUCTVERSION 3,141,5,4
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -68,12 +68,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Software Freedom Conservancy"
VALUE "FileDescription", "Driver library for the IE driver"
VALUE "FileVersion", "3.141.5.3"
VALUE "FileVersion", "3.141.5.4"
VALUE "InternalName", "IEDriver.dll"
VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "IEDriver.dll"
VALUE "ProductName", "Selenium WebDriver"
VALUE "ProductVersion", "3.141.5.3"
VALUE "ProductVersion", "3.141.5.4"
END
END
BLOCK "VarFileInfo"
Expand Down
4 changes: 4 additions & 0 deletions cpp/iedriverserver/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ 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.

v3.141.5.4
==========
* Added hack for detection of IE in full screen mode.

v3.141.5.3
==========
* Again updated Unicode character processing for composition. The
Expand Down
8 changes: 4 additions & 4 deletions cpp/iedriverserver/IEDriverServer.rc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,141,5,3
PRODUCTVERSION 3,141,5,3
FILEVERSION 3,141,5,4
PRODUCTVERSION 3,141,5,4
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -68,12 +68,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Software Freedom Conservancy"
VALUE "FileDescription", "Command line server for the IE driver"
VALUE "FileVersion", "3.141.5.3"
VALUE "FileVersion", "3.141.5.4"
VALUE "InternalName", "IEDriverServer.exe"
VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "IEDriverServer.exe"
VALUE "ProductName", "Selenium WebDriver"
VALUE "ProductVersion", "3.141.5.3"
VALUE "ProductVersion", "3.141.5.4"
END
END
BLOCK "VarFileInfo"
Expand Down
Binary file modified cpp/prebuilt/Win32/Release/IEDriverServer.exe
Binary file not shown.
Binary file modified cpp/prebuilt/x64/Release/IEDriverServer.exe
Binary file not shown.

0 comments on commit c2fcaa4

Please sign in to comment.