JSContext and JSvalue Support?

Having trouble getting either of these to work. Fire won’t compile and I get an error message of “no such member” when I try to use JSContext.evaluatescript.

		public override void windowDidLoad() {
		base.windowDidLoad();
		
		this.webby.frameLoadDelegate = this;
		
		NSUserDefaults.standardUserDefaults.setBool(true) forKey("WebKitDeveloperExtras");
		NSUserDefaults.standardUserDefaults.synchronize();
		
		NSURLRequest req = new NSURLRequest withURL(new NSURL withString("http://demo.desktopjavascript.dev:8888/"));
		this.webby.mainFrame.loadRequest(req);
	}
	
	public void webView(WebView webView) didCreateJavaScriptContext(JSContextRef context) forFrame(WebFrame frame) {
		context.evaluateScript("console.log('hello from native');");
	}

Same code works in Objective-C and Xamarin.Mac. Below is the example for JSValue.

		public void webView(WebView webView) didFinishLoadForFrame(WebFrame frame) {
		JSValueRef callMeJs = this.jsContext["callMeJs"];
	}

Is there a way to see what methods are available once they’ve been included via “using”? Sometimes the auto-complete in Fire shows nothing. It would be good to have another place to reference method names in those instances. I’ve tried opening the .fx files in notepad but they’re difficult to read.

That’s really the core issue, and we need to narrow down why/where CC doesn’t work for you, rather than finding other ways to expose the info. Does CC work/fail consistently in the same places for you? Ilf so, can you send me a test project with details as to where specifically it fails? Or is it more random and unpredictable? How often does it fail, relatively speaking?

As for JSContext itself, i could imagine this is related to the other missing items from JavaScriptCore that we discussed in there other thread? I’ll need to investigate. I see a JSContext imported as void *, according to Peek at Definition, so clearly something is going wrong with the import for this framework :(. It also explains why it has no members.

Thanks, logged as bugs://72648: Nougat: JSContextRef & other import issues on JavaScriptCore

Thanks for logging the bugs. I’ll have a project to share on GitHub soon for easier troubleshooting. Fire CC is pretty flakey I’d day it doesn’t work about 50% of the time.

If I end up doing more development with Elements I’ll most likely get a VM going with VisualStudio and CrossBox.

Thanx. i do look forward to being able to have this looked at with concrete test cases. The goal, of course, is to ge this rock solid so that CC works everywhere. FWIW, CC is driven by the same back-end engine, so i’d hope that is works as good pr as bad in VS, as it does in Fire. I.e. if it’s broken in a specific place in Fire, it better be broken ion VS too :wink:

I’m more surprised that this is C#, which should be very solid for CC. for Swift, i’d be less surprised if there are corner cases where CC isn’t fully perfect yet.

I do hope it doesn’t come to that and you’ll find Fire well suited for your needs, once there issues are ironed out.

Finally got a chance to push the example desktop javascript projects to GitHub. Here is the RemObjects C# example. This shows the JSContext error. The other projects in the repo show similar implementations in Objective-C and Xamarin.Mac C#.

Please let me know if I can help troubleshoot further.

thanx! someone (not me :wink: will be looking at the import issue this coming week.

This is fixed for the next beta. Sorry that this took so long.

bugs://72648 got closed with status fixed.

Awesome news! Thanks for tackling this!

1 Like