laurentsd
VMware Employee
VMware Employee

IMPORTANT fix for HTML plugins in Chrome version >= 55.0.2883.87

Chrome recent update introduced a bug for HTML plugins running in the vSphere Flex client.  APIs such as WEB_PLATFORM.getObjectId(), getActionUid(), getActionTargets() stop working (except for the very first time a plugin view is opened).

There is a simple fix that must be applied by all HTML plugins, change this line in web-platform.js

if (!WEB_PLATFORM) {

   WEB_PLATFORM = self.parent.document.getElementById("container_app");

into

if (!WEB_PLATFORM) {

   WEB_PLATFORM = Object.create(self.parent.document.getElementById("container_app"));

Again, this Chrome problem only affects HTML plugins running in the vSphere Flex client, not the new HTML client, but it is critical for all plugins to apply it.

6 Replies
laurentsd
VMware Employee
VMware Employee

FYI, the next vSphere Web Client 6.0 and 6.5 patches will include a fix to ensure that existing HTML plugins can run correctly with Chrome 55 (dates to be provided at a later time)

But if your HTML plugin is still under development the safest is to apply the change described here. This will make your plugin work with the current Web Client 6.0 and 6.5 releases.

0 Kudos
laurentsd
VMware Employee
VMware Employee

Important update on this topic.  The use of Object.create() is not compatible with IE 11, so we now recommend that you only do it for Chrome browser.

Please update your web-platform.js the following way, red lines are what needs to change:

var WEB_PLATFORM = self.parent.WEB_PLATFORM;

var isChromeBrowser = (window.navigator.userAgent.indexOf("Chrome/") >= 0);

var isFlexClient = !!self.parent.document.getElementById("container_app");

if (!WEB_PLATFORM || (isChromeBrowser && isFlexClient)) {

   WEB_PLATFORM = self.parent.document.getElementById("container_app");

  if (isChromeBrowser) {

      // Object.create is required to support Chrome version >= 55 on Flex client

      WEB_PLATFORM = Object.create(WEB_PLATFORM);

   }

   self.parent.WEB_PLATFORM = WEB_PLATFORM;

dloverin
Contributor
Contributor

I see problems when using this modified script in IE 11.0.9600.18537. To reproduce the problem I've modified the web_platform.js with these changes in the chassisB-sample in the 6.0 SDK.

When I open the Edit Chassis Dialog a second time I get the below error in the console:

SCRIPT5011: Can't execute code from a freed script

at

// The web context path to use for server requests, compatible with Flex and HTML clients

   com_vmware_samples_chassisb.webContextPath = WEB_PLATFORM.getRootPath() + "/chassisb";

I've attached the web_platform.js I'm using.

Are there any additional script changes required for IE 11?

Thanks,

-Darrell

0 Kudos
laurentsd
VMware Employee
VMware Employee

hi Darrell,

I was able to reproduce the same problem with Web Client 6.0  (it works with 6.5), it doesn't come from IE 11 per se. 

Here is the fix I found, let me know if it works also for you.

Move the definition of those 3 new APIs inside their own if block, below the first if block, like that:

if (isFlexClient) {

   // The web context starts with a different root path depending on which client is running.

   WEB_PLATFORM.getRootPath = function() { return "/vsphere-client"; }

   WEB_PLATFORM.getClientType = function() { return "flex"; }

   // Declare unknown client version explicitly.

   if (!WEB_PLATFORM.getClientVersion) {

      WEB_PLATFORM.getClientVersion = function() { return "6.0"; }

   }

}

0 Kudos
dloverin
Contributor
Contributor

Hi Laurent,

Thanks, the fix worked!

I'm seeing one other problem with the chassisB sample and I'm not sure if it is related.

After choosing the Edit Chassis action. I press "Cancel" in the dialog. I get an error in editChassisAction.js, line 12:

    var $form = $( this ),

SCRIPT5007: Object expected

Thanks for help,

-Darrell

0 Kudos
laurentsd
VMware Employee
VMware Employee

> After choosing the Edit Chassis action. I press "Cancel" in the dialog. I get an error in editChassisAction.js, line 12

Sorry I can't reproduce this problem. Let me know if you find other clues.

0 Kudos