gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.51k stars 372 forks source link

GWT2.4RC applies wrong DOMImpl with disabled chrome frame #6664

Closed dankurka closed 9 years ago

dankurka commented 9 years ago

Originally reported on Google Code with ID 6665

Found in GWT Release (2.4RC):

Encountered on OS / Browser (WinXP, IE8):

Detailed description (please be as specific as possible):

I got some error when I used DOM.sinkEvents, then I tracked down and located wrong
WebKit DOM Impl is used for my IE8, I realized it could caused by chrome frame plugin,
it's user agent contains "chrome frame" even the plugin is disabled. then I uninstalled
chrome frame and it resolved the issue.

Workaround if you have one:
uninstall chrome frame

Reported by racke1983cn on 2011-08-06 10:34:04

dankurka commented 9 years ago
I find a workround, if I comment out the chromeframe check in UserAgentPropertyGenerator
it would be 
ok. 
I'm not sure why it's needed, it only checks the chromeframe plugin is 
installed but doesn't check if it's activated or not. 
in my IE8 + chromeframe 13, if it's activated, the userAgent would 
already contain "webkit". 
      // webkit family (chrome, safari and chromeframe). 
      new UserAgentPropertyGeneratorPredicate("safari") 
      .getPredicateBlock() 
        .println("return (") 
          .println("(ua.indexOf('webkit') != -1)") 
          .println("||") 
          .println("(function() {") 
/* 
  .println("if (ua.indexOf('chromeframe') != -1) {") 
              .println("return true;") 
            .println("}") 
            .println("if (typeof window['ActiveXObject'] != 
'undefined') {") 
              .println("try {") 
                .println("var obj = new 
ActiveXObject('ChromeTab.ChromeFrame');") 
                .println("if (obj) {") 
                  .println("obj.registerBhoIfNeeded();") 
                  .println("return true;") 
                .println("}") 
              .println("} catch(e) { }") 
            .println("}") 
*/ 
            .println("return false;") 
            .println("})()") 
        .println(")") 
      .returns("'safari'"), 

Reported by racke1983cn on 2011-08-13 10:08:43

dankurka commented 9 years ago
This occurs with version 13 and 15 of the chrome frame plugin. AFAIKT this is due to
a wontfix bug in chromium (http://code.google.com/p/chromium/issues/detail?id=22760).

Reported by terence.mackie on 2011-11-09 01:31:20

dankurka commented 9 years ago
Issue 6802 has been merged into this issue.

Reported by stephen.haberman on 2011-11-09 04:28:04

dankurka commented 9 years ago
I'm not a chrome frame user/expert, but, yes, it sounds like the user agent parsing
for chrome frame is missing something. Assigning to that chunk of code's author.

Please see this bug, the duplicate issue 6802, plus this mailing thread for details.

https://groups.google.com/d/msg/google-web-toolkit/M7SSjpC-cVo/YRknBxeCKWYJ

Reported by stephen.haberman on 2011-11-09 04:39:16

dankurka commented 9 years ago
can we get this fixed? this is blocking adoption of gwt 2.4

Reported by sunyucong on 2011-12-11 21:36:08

dankurka commented 9 years ago

Reported by fabiomfv@google.com on 2011-12-12 16:25:50

dankurka commented 9 years ago
Well, I'm not sure if that is enough, but maybe instead of only checking for the "chromeframe"
string in the UserAgent, we could also check if some variable exists that is defined
in IE and it's not defined in chromeframe (maybe the ActiveXObject).

Sample code of the detection would be something like:

      // webkit family (chrome, safari and chromeframe). 
      new UserAgentPropertyGeneratorPredicate("safari") 
      .getPredicateBlock() 
        .println("return (") 
          .println("(ua.indexOf('webkit') != -1)") 
          .println("||") 
          .println("(function() {") 
            .println("return ua.indexOf('chromeframe') != -1 && typeof window['ActiveXObject']
== 
'undefined'")
            .println("})()") 
        .println(")") 
      .returns("'safari'"), 

I tested it in GCF 16 on IE8 under Windows XP and it worked fine.

But this code just ignores the second part of the detection of Google Chrome Frame,
which I actually don't really know what it's meant for.

I tested including the second part when the ActiveXObject was defined, but it failed
to detect that it should use the IE8 permutation when you let Google Chrome Frame enabled
and disable the GCF BHO.

Reported by waltercacau on 2011-12-24 21:29:56

dankurka commented 9 years ago
According to this page [1]:
 1. there's no "chromeframe" in the UA string seen by scripts (only in the one sent
in HTTP requests)
 2. "The best way to detect if the content is running inside Chrome Frame is to check
for the existence of window.externalHost This is a special object that exists only
when Chrome is running in Chrome Frame mode."

[1] http://www.chromium.org/developers/how-tos/chrome-frame-getting-started/understanding-chrome-frame-user-agent

Reported by t.broyer on 2011-12-28 17:56:25

dankurka commented 9 years ago
dev channel are fine. but can we push this into stable channel as a bug
fix? its taking ages...

Reported by sunyucong on 2011-12-30 23:32:31

dankurka commented 9 years ago
Please note this causes GWT applications running as an IE9 HTA to display "ERROR: Possible
problem with your *.gwt.xml module file. The compile time user.agent value (ie9) does
not match the runtime user.agent value (safari). Expect more errors."

IE throws an exception when the application tries to call obj.registerBhoIfNeeded()
with the error: "Could not complete the operation due to error 8070000c"

Reported by shang.xiao.sanders on 2012-01-17 06:29:39

dankurka commented 9 years ago
The chrome frame detection is really flawed, and shouldn't be there in the first place.
As comment 8 notices, chrome frame is automatically enabled if chrome=1 is in the X-UA-Compatible
header, and then the UA string will just be a normal Webkit browser (which GWT already
detects). Manually instantiating the ActiveX object is not necessary in that case.
If chrome=1 is not in the X-UA-Compatible header, I doubt the developer wants chrome
frame to be used.

Older chrome frame versions had a bug where chromeframe was in the UA string, even
if it wasn't enabled. This bug is still seen with recent installs that did a non-clean
upgrade to the latest chrome frame version. GWT should _not_ check for chromeframe
in the UA string. It's broken and it actually means chromeframe is _disabled_ instead
of _enabled_ (otherwise the script would see a Webkit UA).

Reported by mike@normi.net on 2012-01-31 09:41:10

dankurka commented 9 years ago
Issue 7202 has been merged into this issue.

Reported by t.broyer on 2012-02-21 19:01:26

dankurka commented 9 years ago
Has there been a work around or fix for this issue?

Thanks

Reported by al.lehman@fisglobal.com on 2012-03-29 13:10:55

dankurka commented 9 years ago
Just put chrome=1 in the X-UA-Compatible metatag, should fix most cases (all cases where
the user doesnt have a broken chromeframe install).

Reported by mike@eveoh.nl on 2012-03-29 13:24:29

dankurka commented 9 years ago
I have that already set. If a user (me)has Chrome-Frame installed but disabled, our
site does not function after installing GWT 2.4. 

Reported by al.lehman@fisglobal.com on 2012-03-29 18:00:08

dankurka commented 9 years ago
In that case your Chrome Frame install is flawed. It should not report itself in any
way if it's disabled (but it did in older releases).

Reported by mike@eveoh.nl on 2012-03-29 19:11:46

dankurka commented 9 years ago
I have un-installed and re-installed the latest version and I still have the problem.

Google Chrome   18.0.1025.142 (Official Build 129054)
OS  Windows
WebKit  535.19 (@111933)
JavaScript  V8 3.8.9.16
Flash   11,2,202,228
User Agent  Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142
Safari/535.19
Command Line    "C:\Program Files\Google\Chrome Frame\Application\chrome.exe" --automation-channel=ChromeTestingInterface:3100.1
--chrome-frame --no-first-run --disable-background-mode --disable-popup-blocking --disable-print-preview
--user-data-dir="C:\Users\e1032368\AppData\Local\Google\Chrome Frame\User Data\iexplore"
--chrome-version=18.0.1025.142 --lang=en-US --flag-switches-begin --flag-switches-end
Executable Path C:\Program Files\Google\Chrome Frame\Application\chrome.exe
Profile Path    C:\Users\e1032368\AppData\Local\Google\Chrome Frame\User Data\iexplore\Default

Reported by al.lehman@fisglobal.com on 2012-03-29 20:24:07

dankurka commented 9 years ago
Just some more investigation:

There's 2 add-ons
"Chrome Frame"
"ChromeFrame BHO"
http://gwt.google.com/samples/Showcase/Showcase.html#!CwFileUpload

Going to the google showcase with add-on's as per normal:
Message: Object doesn't support this property or method
Line: 1537
Char: 127
Code: 0
URI: http://gwt.google.com/samples/Showcase/showcase/E3B6F0CF9AB17DE034BD83ECFB268207.cache.html

Disable "ChromeFrame BHO". No change.

Disable "Chrome Frame", page works.

Checking http://whatsmyuseragent.com/, when "ChromeFrame BHO" is enabled "chromeframe/18.0.1025.151"
will always be shown, disable it but leave the other add-on enabled and it's not shown.

There's also a useragent string defined here:
HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform
http://code.google.com/p/chromium/issues/detail?id=22760#c13
Not sure what effect it has.

SO, having the useragent string sent to the server makes no difference.
It's purely what's in the browser at the time.
So chromeframe SHOUDLN'T be adding chromeframe to UA string when it hasn't been enabled
by X-UA-Compatible chrome=1.

Reported by watts.chris on 2012-04-12 03:19:01

dankurka commented 9 years ago
Hi,

I still have the same issue today using Chrome Frame 18 and last GWT 2.4 release.

As a company we deployed massively Google Chrome Frame on our IE browsers to offer
an alternative to have full-javascript web sites working better. 

But in the case of GWT, this issue made things worse, because for our users having
Chrome Frame installed and trying to browse GWT base sites outside the company (so
sites we don't have the hand on to enable use of Chrome Frame) like even GWT showcase
or GXT showcase or whatever, those sites won't work AT ALL unless we uninstall Google
Chrome Frame.

So we deployed massively Chrome Frame to better our users experience of javascript
sites, but GWT sites won't work at all (except the internal sites where we activated
the use of chrome frame).

Please do something about this !!

Reported by baudryvincent on 2012-05-04 11:48:52

dankurka commented 9 years ago
Created this issue in chromium tracker, hopefully the two team could work this out together
? 

https://code.google.com/p/chromium/issues/detail?id=126231

Reported by baudryvincent on 2012-05-04 11:59:52

dankurka commented 9 years ago
Came across a nice new corner case. If a GWT app is opened in an Iframe with Chrome
Frame installed, it won't work (since the chrome=1 detection only works on top-level
URLs and not in frames). Please fix this, it's a really trivial fix (don't try to detect
chrome frame/revert the 2.4 change). If required I can provide a changeset (but tbh
you should be able to figure it out yourself by diffing with 2.3).

Reported by mike@eveoh.nl on 2012-05-22 14:52:20

dankurka commented 9 years ago
OK so, basically, this issue is about reverting the change suggested by a Chromium developer:
issue 5165. That was nearly 2 years ago though, and given comment #8 and [1], I think
it's safe to revert the change (and we should indeed do it).

[1] http://code.google.com/p/chromium/issues/detail?id=66139

Reported by t.broyer on 2012-05-22 16:02:24

dankurka commented 9 years ago
http://gwt-code-reviews.appspot.com/1713803/

Reported by t.broyer on 2012-05-22 16:13:04

dankurka commented 9 years ago
This issue was closed by revision r11045.

Reported by gwt.mirrorbot on 2012-06-13 16:18:39

dankurka commented 9 years ago

Reported by t.broyer on 2012-06-13 16:55:18

dankurka commented 9 years ago

Reported by stephen.haberman on 2012-06-13 19:16:38

dankurka commented 9 years ago
Bulk edit: should be fixed in the GWT 2.5 release candidate.

Reported by skybrian@google.com on 2012-06-27 03:38:12

dankurka commented 9 years ago
Is this fix in 2.5 RC 1 or 2.5 RC2 (or neither)?

thanks

Reported by ljw1001 on 2012-10-07 20:45:25

dankurka commented 9 years ago
Fixed since 2.5.0-rc1

Reported by t.broyer on 2012-10-07 22:16:53