@awayfl/avm2
Version:
Virtual machine for executing AS3 code
26 lines (25 loc) • 1.07 kB
text/typescript
import { AXSecurityDomain } from '../run/AXSecurityDomain';
import { Errors } from '../errors';
import { isNullOrUndefined } from '@awayjs/graphics';
export function FlashNetScript_navigateToURL(sec: AXSecurityDomain, request, window_) {
if (request === null || request === undefined) {
sec.throwError('TypeError', Errors.NullPointerError, 'request');
}
const RequestClass = (<any>sec).flash.net.URLRequest.axClass;
if (!RequestClass.axIsType(request)) {
sec.throwError('TypeError', Errors.CheckTypeFailedError, request, 'flash.net.URLRequest');
}
const url = request.url;
if (isNullOrUndefined(url)) {
sec.throwError('TypeError', Errors.NullPointerError, 'url');
}
if (url.toLowerCase().indexOf('fscommand:') === 0) {
const fscommand = (<any>sec).flash.system.fscommand.value;
fscommand(sec, url.substring('fscommand:'.length), window_);
return;
}
// TODO handle other methods than GET
//console.log("TODO: FlashNetScript_navigateToURL: FileLoadingService")
window.open(request.url, '_blank');
//FileLoadingService.navigateTo(url, window_);
}