Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

delete && performance == false; delete == bad; delete delete;

  • Loading branch information...
commit 7df5f47f6c42db0ae4b594e3a14e4a9f3725229e 1 parent c86b383
@tschneidereit tschneidereit authored
View
2  extension/firefox/content/web/avm-sandbox.js
@@ -227,7 +227,7 @@ var FileLoadingService = {
case "open": this.onopen(); break;
case "close":
this.onclose();
- delete FileLoadingService.sessions[sessionId];
+ FileLoadingService.sessions[sessionId] = null;
console.log('Session #' + sessionId +': closed');
break;
case "error":
View
2  src/flash/display/Loader.js
@@ -480,7 +480,7 @@ var LoaderDefinition = (function () {
loaderInfo._dispatchEvent("init");
};
img.src = URL.createObjectURL(imageInfo.data);
- delete imageInfo.data;
+ imageInfo.data = null;
},
_commitSymbol: function (symbol) {
var dictionary = this._dictionary;
View
2  src/flash/display/MovieClip.js
@@ -428,7 +428,7 @@ var MovieClipDefinition = (function () {
if (sound.channel) {
sound.channel.stop();
- delete sound.channel;
+ sound.channel = null;
}
if (!info.stop) {
// TODO envelope, in/out point
View
2  src/flash/display/Sprite.js
@@ -186,7 +186,7 @@ var SpriteDefinition = (function () {
for (var i = 0; i < children.length; i++) {
var instance = children[i];
if (instance._needLoadEvent) {
- delete instance._needLoadEvent;
+ instance._needLoadEvent = false;
instance._dispatchEvent("load");
}
}
View
6 src/flash/events/EventDispatcher.js
@@ -109,7 +109,7 @@ var EventDispatcherDefinition = (function () {
if (eventClass) {
event = new eventClass(event);
} else {
- if (event in mouseEvents) {
+ if (mouseEvents[event]) {
event = new flash.events.MouseEvent(event, mouseEvents[event]);
if (target._stage) {
event._localX = target.mouseX;
@@ -206,7 +206,7 @@ var EventDispatcherDefinition = (function () {
if (item.handleEvent === listener) {
queue.splice(i, 1);
if (!queue.length) {
- delete listeners[type];
+ listeners[type] = null;
}
return;
}
@@ -217,7 +217,7 @@ var EventDispatcherDefinition = (function () {
this._removeEventListenerImpl(type, listener, useCapture);
},
_hasEventListener: function hasEventListener(type) { // (type:String) -> Boolean
- return type in this._listeners || type in this._captureListeners;
+ return this._listeners[type] || this._captureListeners[type];
},
_dispatchEvent: function dispatchEvent(event, eventClass, bubbles) {
doDispatchEvent(this, event, eventClass, bubbles);
View
26 src/swf/inflate.js
@@ -87,8 +87,7 @@ function createInflatedStream(bytes, outputLength) {
var InflateNoDataError = {};
function inflateBlock(stream, output, state) {
- var header = state.header !== undefined ? state.header :
- (state.header = readBits(stream.bytes, stream, 3));
+ var header = state.header || (state.header = readBits(stream.bytes, stream, 3));
switch (header >> 1) {
case 0:
stream.align();
@@ -113,7 +112,7 @@ function inflateBlock(stream, output, state) {
break;
case 2:
var distanceTable, literalTable;
- if (state.distanceTable !== undefined) {
+ if (state.distanceTable) {
distanceTable = state.distanceTable;
literalTable = state.literalTable;
} else {
@@ -166,13 +165,13 @@ function inflateBlock(stream, output, state) {
literalTable = state.literalTable = makeHuffmanTable(bitLengths);
}
inflate(stream, output, literalTable, distanceTable, state);
- delete state.distanceTable;
- delete state.literalTable;
+ state.distanceTable = null;
+ state.literalTable = null;
break;
default:
fail('unknown block type', 'inflate');
}
- delete state.header;
+ state.header = null;
output.completed = !!(header & 1);
}
function readBits(bytes, stream, size) {
@@ -201,25 +200,22 @@ function inflate(stream, output, literalTable, distanceTable, state) {
var pos = output.available;
var dbytes = output.data;
var sbytes = stream.bytes;
- var sym = state.sym !== undefined ? state.sym :
- readCode(sbytes, stream, literalTable);
+ var sym = state.sym || readCode(sbytes, stream, literalTable);
while (sym !== 256) {
if (sym < 256) {
dbytes[pos++] = sym;
} else {
state.sym = sym;
sym -= 257;
- var len = state.len !== undefined ? state.len :
- (state.len = lengthCodes[sym] + readBits(sbytes, stream, lengthExtraBits[sym]));
- var sym2 = state.sym2 !== undefined ? state.sym2 :
- (state.sym2 = readCode(sbytes, stream, distanceTable));
+ var len = state.len || (state.len = lengthCodes[sym] + readBits(sbytes, stream, lengthExtraBits[sym]));
+ var sym2 = state.sym2 || (state.sym2 = readCode(sbytes, stream, distanceTable));
var distance = distanceCodes[sym2] + readBits(sbytes, stream, distanceExtraBits[sym2]);
var i = pos - distance;
while (len--)
dbytes[pos++] = dbytes[i++];
- delete state.sym2;
- delete state.len;
- delete state.sym;
+ state.sym2 = null;
+ state.len = null;
+ state.sym = null;
}
output.available = pos;
sym = readCode(sbytes, stream, literalTable);
View
2  src/swf/mp3worker.js
@@ -37,7 +37,7 @@ if (isWorker) {
var session = sessions[sessionId];
if (session) {
session.close();
- delete sessions[sessionId];
+ sessions[sessionId] = null;
}
break;
case 'decode':
View
2  src/swf/parser.js
@@ -29,7 +29,7 @@ function readTags(context, stream, swfVersion, final, onprogress, onexception) {
var tag = null;
if (context._readTag) {
tag = context._readTag;
- delete context._readTag;
+ context._readTag = null;
}
try {
Please sign in to comment.
Something went wrong with that request. Please try again.