Skip to content

Commit

Permalink
Adding hack for handling cases where document.designMode is on
Browse files Browse the repository at this point in the history
In IE, when document.designMode is turned on, the browser is put into
a state where anonymous JavaScript functions cannot be run. Obviously,
this breaks a huge portion of the driver, so the driver will now force
documents out of designMode when attempting to execute JavaScript.
There should be vanishingly few real-world cases where this has an
adverse effect, with most sites using the contentEditable attribute
instead.
  • Loading branch information
jimevans committed Jan 30, 2019
1 parent c2fcaa4 commit d176203
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
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,4
PRODUCTVERSION 3,141,5,4
FILEVERSION 3,141,5,5
PRODUCTVERSION 3,141,5,5
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.4"
VALUE "FileVersion", "3.141.5.5"
VALUE "InternalName", "IEDriver.dll"
VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "IEDriver.dll"
VALUE "ProductName", "Selenium WebDriver"
VALUE "ProductVersion", "3.141.5.4"
VALUE "ProductVersion", "3.141.5.5"
END
END
BLOCK "VarFileInfo"
Expand Down
9 changes: 9 additions & 0 deletions cpp/iedriver/Script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ int Script::Execute() {
LOG(WARN) << "Script engine host is NULL";
return ENOSUCHDOCUMENT;
}

CComBSTR design_mode = L"";
this->script_engine_host_->get_designMode(&design_mode);
design_mode.ToLower();
if (design_mode == "on") {
CComBSTR set_design_mode = "off";
this->script_engine_host_->put_designMode(set_design_mode);
}

CComVariant temp_function;
if (!this->CreateAnonymousFunction(&temp_function)) {
LOG(WARN) << "Cannot create anonymous function";
Expand Down
11 changes: 11 additions & 0 deletions cpp/iedriverserver/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ 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.5
==========
* Added hack for handling cases where document.designMode is on.
In IE, when document.designMode is turned on, the browser is put
into a state where anonymous JavaScript functions cannot be run.
Obviously, this breaks a huge portion of the driver, so the driver
will now force documents out of designMode when attempting to
execute script. There should be vanishingly few real-world cases
where this has an adverse effect, with most sites using the
contentEditable attribute instead.

v3.141.5.4
==========
* Added hack for detection of IE in full screen mode.
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,4
PRODUCTVERSION 3,141,5,4
FILEVERSION 3,141,5,5
PRODUCTVERSION 3,141,5,5
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.4"
VALUE "FileVersion", "3.141.5.5"
VALUE "InternalName", "IEDriverServer.exe"
VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "IEDriverServer.exe"
VALUE "ProductName", "Selenium WebDriver"
VALUE "ProductVersion", "3.141.5.4"
VALUE "ProductVersion", "3.141.5.5"
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 d176203

Please sign in to comment.