Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Using HTMLLoader cause application crash with some websites #337

Closed
itlancer opened this issue May 26, 2020 · 5 comments
Closed

Comments

@itlancer
Copy link

Problem Description

Using HTMLLoader cause application crash with some websites. Just after website loaded application silently crashes and you can see crash log via Windows Event Viewer.
I know that HTMLLoader outdated but there is no other way right now with AIR to use HTML content in DisplayList. Our users could provide any URL and there is no way to modify external websites.

It has been tested with AIR 32.0.0.89 and latest AIR 33.1.1.98 with many different Windows 10 32/64-bit devices.
Same problem in all cases with some websites.
Handling and preventing HTMLUncaughtScriptExceptionEvent doesn't help.
Using new StageWebView(false) cause the same crash.
There is no such crash with macOS.

Related issue (not the same):
#183

Steps to Reproduce

Launch code below with any Windows device. It just try to load https://www.cherryblossomcakes.co.nz/ via HTMLLoader.

Application example with sources attached.
htmlloader_crash.zip

package {
	import flash.display.Sprite;
	import flash.html.HTMLLoader;
	import flash.net.URLRequest;
	
	public class HTMLLoaderCrash extends Sprite {
		private var htmlLoader:HTMLLoader;
		
		public function HTMLLoaderCrash() {
			htmlLoader = new HTMLLoader();
			htmlLoader.width = 640;
			htmlLoader.height = 480;
			addChild(htmlLoader);
			
			htmlLoader.load(new URLRequest("https://www.cherryblossomcakes.co.nz/"));
		}
	}
}

Actual Result:
It traces you will see:

ReferenceError: Can't find variable: performance

TypeError: Result of expression 'wixBiSession' [undefined] is not an object.
 at https://www.cherryblossomcakes.co.nz/ : 249
SyntaxError: Parse error
https://static.parastorage.com/unpkg-semver/mobile-app-banner/app.bundle.min.js : 1
SyntaxError: Parse error
https://static.parastorage.com/services/wix-bolt/1.5925.0/bolt-main/app/bolt-custom-elements.min.js : 1
TypeError: Result of expression 'wixBiSession' [undefined] is not an object.

Then application silently crash. Via Windows Event Viewer you can find crash log:

Faulting application name: htmlloader_crash.exe, version: 0.0.0.0, time stamp: 0x5e8d987b
Faulting module name: WebKit.dll, version: 6531.9.0.0, time stamp: 0x5e8d9f03
Exception code: 0xc0000005
Fault offset: 0x001ce089
Faulting process id: 0x6498
Faulting application start time: 0x01d6332f85f31b6c
Faulting application path: C:\htmlloader_crash.app\htmlloader_crash.exe
Faulting module path: C:\htmlloader_crash.app\Adobe AIR\Versions\1.0\Resources\WebKit.dll
Report Id: 33c5d0f6-1002-423e-ac8a-11c189340361
Faulting package full name: 
Faulting package-relative application ID: 

Expected Result:
Application should not crash.

Known Workarounds

none

@zwetan
Copy link

zwetan commented May 29, 2020

Using HTMLLoader cause application crash with some websites. Just after website loaded application silently crashes and you can see crash log via Windows Event Viewer.

Can you be clearer, how is it crashing exactly?

does it crash the AIR app, or is it just the web site not loading and crashing HTMLLoader it self ?

Using new StageWebView(false) cause the same crash.

you have to use new StageWebView(true) to use the system browser and not HTMLLoader

StageWebView

useNative:Boolean (default = false) — When useNative is false, a version of WebKit embedded within AIR is used as the source of the StageWebView created. When useNative is true, then AIR will use the the system's default web engine. Mobile platforms only support using the system web engine, so useNative is ignored on mobile platforms.

@itlancer
Copy link
Author

@zwetan, AIR application crashes, not just HTMLLoader
as I wrote above

Then application silently crash. Via Windows Event Viewer you can find crash log:

For other cases I can use new StageWebView(true) or some other webframe implementations (via native extensions or NativeProcess) like https://github.com/tuarua/WebViewANE
But in some cases I have to use HTMLLoader cause HTML content need to be overlapped by other AIR content via DisplayList.

@zwetan
Copy link

zwetan commented May 29, 2020

AIR application crashes, not just HTMLLoader

OK, do you use both HTMLLoader and StageWebView at the same time in your app?

if so in StageWebView
are you aware of that ?

On desktop computers (in the desktop and extended desktop profiles), the StageWebView class uses the system web control provided by the Flash Player plugin. The features available and rendering appearance are the same as those of the HTMLLoader class (without the close integration and script bridging between ActionScript and JavaScript provided by an HTMLLoader instance). Since the HTMLLoader class uses the internal AIR WebKit engine, concurrent use of StageWebView and HTMLLoader instances is strongly discouraged as it has undefined behavior and can possibly terminate the application.

I don't know your app but the crash you're experimenting is maybe because of that, the concurrent use of StageWebView and HTMLLoader.


now you already mentioned

I know that HTMLLoader outdated

all the ReferenceError and SyntaxError you're seeing is mainly caused by the difference in version/features support of JS, then HTML, sometimes CSS

the page you mention also create errors in Chrome but there it still display the page

so there are 2 short way to work around all that

  1. you use new StageWebView(true) and only that, no HTMLLoader
    and change some design/behaviour in your app to replace HTMLLoader by StageWebView

  2. you use only HTMLLoader and you change some loading mechanism to not make it crash the AIR app but then incompatible web sites or failing pages will not display anything

if you go using https://github.com/tuarua/WebViewANE, I would say about the same, do not use HTMLLoader or StageWebView at the same time, only use WebViewANE.

But in some cases I have to use HTMLLoader cause HTML content need to be overlapped by other AIR content via DisplayList.

Depending on what you do, you can replace the HTMLLoader by StageWebView and use the method drawViewPortToBitmapData() to place it inside the display list

@itlancer
Copy link
Author

OK, do you use both HTMLLoader and StageWebView at the same time in your app?

No.
Crash can be reproduced with isolated code above.

Other approaches cannot achieve goal that described in issue. There are some limitations about web page interactivity or application performance. At least yet.
May be only mouse/keyboard events proxying could avoid this.

@itlancer
Copy link
Author

With latest AIR versions HTMLLoader deprecated and removed. So there is no such problem anymore.

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

No branches or pull requests

3 participants