@awayfl/avm1
Version:
Virtual machine for executing AS1 and AS2 code
112 lines • 4.27 kB
TypeScript
/**
* Copyright 2014 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AVM1Movie } from './AVM1Movie';
import { AnalyzerResults } from './analyze';
import { IAVM1Builtins, IAVM1Context } from './runtime';
import { AVM1Globals } from './lib/AVM1Globals';
import { AVMStage } from '@awayfl/swf-loader';
import { AVM1MovieClip } from './lib/AVM1MovieClip';
import { AVM1Object } from './runtime/AVM1Object';
import { AVM1Function } from './runtime/AVM1Function';
import { SecurityDomain } from './SecurityDomain';
import { AVM1Handler } from './AVM1Handler';
interface IEncryptedActionData {
data: Uint8Array;
size: ui32;
bytePos: ui32;
rawTagId: ui8;
}
export declare class AVM1ActionsData {
bytes: Uint8Array;
id: string;
parent: AVM1ActionsData;
encryptedData?: IEncryptedActionData;
ir: AnalyzerResults;
compiled: Function;
debugPath: string;
constructor(bytes: Uint8Array, id: string, parent?: AVM1ActionsData, encryptedData?: IEncryptedActionData);
}
export interface AVM1ExportedSymbol {
symbolId: number;
symbolProps: any;
}
export interface IAVM1RuntimeUtils {
hasProperty(obj: any, name: any): boolean;
getProperty(obj: any, name: any): any;
setProperty(obj: any, name: any, value: any): void;
warn(msg: string): void;
}
export interface IAVM1EventPropertyObserver {
onEventPropertyModified(name: string): any;
}
interface IActonBlock {
actionsData: Uint8Array;
encryptedData: any;
}
export declare class ActionsDataFactory {
private _cache;
createActionsData(actionData: Uint8Array | IActonBlock, id: string, parent?: AVM1ActionsData): AVM1ActionsData;
}
export declare class AVM1Context implements IAVM1Context {
sec: SecurityDomain;
globals: AVM1Globals;
builtins: IAVM1Builtins;
isPropertyCaseSensitive: boolean;
actionsDataFactory: ActionsDataFactory;
swfVersion: number;
levelsContainer: AVM1Movie;
private eventObservers;
private assets;
private awayAssets;
private assetsSymbols;
private assetsClasses;
private staticStates;
constructor(swfVersion: number);
utils: IAVM1RuntimeUtils;
static create: (swfVersion: number) => AVM1Context;
resolveTarget(target: any): any;
resolveRoot(): any;
checkTimeout(): void;
executeActions(actionsData: AVM1ActionsData, scopeObj: any): void;
executeFunction(fn: AVM1Function, thisArg: any, args: any): any;
/**
* Normalize the name according to the current AVM1Context's settings.
*
* This entails coercing it to number or string. For SWF versions < 7, it also means converting
* it to lower-case.
* To avoid runtime checks, the implementation is set during context initialization based on
* the SWF version.
*/
normalizeName: (name: any) => string;
private normalizeNameCaseSensitive;
private _nameCache;
private normalizeNameCaseInsensitive;
private _getEventPropertyObservers;
registerEventPropertyObserver(propertyName: string, observer: IAVM1EventPropertyObserver): void;
unregisterEventPropertyObserver(propertyName: string, observer: IAVM1EventPropertyObserver): void;
broadcastEventPropertyChange(propertyName: string): void;
addAsset(className: string, symbolId: number, symbolProps: any): void;
registerClass(className: string, theClass: AVM1Object): void;
getSymbolClass(symbolId: number): AVM1Object;
getAsset(className: string): AVM1ExportedSymbol;
reset(): void;
private htmlElement;
setStage(avmStage: AVMStage, avm1Handler: AVM1Handler, htmlElement: any): void;
getStaticState(cls: any): any;
resolveLevel(level: number): AVM1MovieClip;
}
export {};
//# sourceMappingURL=context.d.ts.map