Skip to content

Conversation

@mjkkirschner
Copy link
Member

@mjkkirschner mjkkirschner commented Apr 19, 2018

Purpose

to address an issue we assume is similar to:
cefsharp/CefSharp#1611
#8757

we switch the registerJsObject method to registerAsyncJSobject - apparently this is recommended for our CEFSharp version, and is faster than the other registration method. The work involved is minimal (appears so) because we only use methods on our cross language object anyway and we do not use the results of those method calls.

When an object is registered this way its methods return promises, but since we do not use the results of calls to the registered object on the js side, we should be able to just call them like before. In initial testing behavior seems the same if not a small bit faster. (not profiled).

I can not verify that this PR actually fixes the user's issue - I have tried installing Heimdal v2.2.2 and cannot reproduce the failure.

I do not yet have a copy of mcafee anti virus to test with.

I do not know how to get heimdall client to run - it may be a corporate only/ enterprise wide component.

Declarations

Check these if you believe they are true

  • The code base is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning, and are documented in the API Changes document.

Reviewers

@QilongTang @ramramps

FYIs

@Racel @jnealb @smangarole

…ss to methods here, and they return promises.
this.browser = browser;
sidebarGrid.Children.Add(view);
browser.RegisterJsObject("controller", this);
browser.RegisterAsyncJsObject("controller", this);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if anyother software uses a different version of cefsharp that requires RegisterJsObject? I believe it should not be the case. Is there a possible way to check if this object is registered and window["controller will return the right object?

Copy link
Member Author

@mjkkirschner mjkkirschner Apr 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these functions return void on the c# side so we can't check anything there. We could check in javascript but that wouldn't tell us much more than we knew before as we'll just avoid an exception only to have no functionality, I'd rather just see the exception.

Calling RegisterJsObject or RegisterAsyncJSobject again will throw an exception in CEF... :(

they are supported in version 51 - 63 according to the api docs... which only go back to version 51.

http://cefsharp.github.io/api/63.0.0/html/M_CefSharp_Wpf_ChromiumWebBrowser_RegisterAsyncJsObject.htm

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I understand that part..is it possible to add exception in JS? like if window["controller] is null, then throw (ex)..some clear message ?

@QilongTang
Copy link
Contributor

@mjkkirschner Can you attach this PR to the Jira task, we may want to inform Revit team about this issue as well

@mjkkirschner
Copy link
Member Author

@QilongTang attached.

@Racel
Copy link
Contributor

Racel commented Apr 19, 2018

@mjkkirschner Let's just buy the mcafee license so we can put it on your machine. It is only $45. Also, if we have a branch build, we can get it out to him for testing.

@mjkkirschner
Copy link
Member Author

@Racel it's not clear to me that the mcafee subscription will get us the same corporate deployment that is causing the problem. They have around 20 different products.

@Racel
Copy link
Contributor

Racel commented Apr 19, 2018

@mjkkirschner so is the best course of action to get the customer to test this? Can we get an installer?

@mjkkirschner
Copy link
Member Author

@Racel I think so yes, we can get an installer when we get this merged and then get a dev build or @smangarole enables daily builds for master.

@ramramps sure, I can do that but recall that window["controller"] wasn't exactly null - it was just an empty object, I'll try to check for that or check if a method we need is missing and throw a clear message.

@mjkkirschner
Copy link
Member Author

@ramramps PTAL - added a small check to the html.

//Get hold of object registered from C#
let csharpController = window["controller"];
//check if one of our methods does not exist
if (csharpController.closeNodeTooltip == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also check csharpController == null as well? Windows returns an empty object, and trying to access an property on the empty object will throw exception...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM then,.

review comments
@mjkkirschner mjkkirschner merged commit a20c285 into DynamoDS:master Apr 20, 2018
@mjkkirschner mjkkirschner mentioned this pull request May 7, 2018
@QilongTang QilongTang mentioned this pull request May 7, 2018
7 tasks
@jnealb
Copy link
Collaborator

jnealb commented Sep 12, 2018

@mjkkirschner @Racel @QilongTang @smangarole @ramramps An fyi from the black team team: we suspect that this issue also occurs with Refinery 0.3.12 and the Avast anti-virus, so using Dynamo 2.0.1 with Avast running may result in a blank library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants