Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Created November 15, 2013 15:23
Show Gist options
  • Save jorendorff/7486043 to your computer and use it in GitHub Desktop.
Save jorendorff/7486043 to your computer and use it in GitHub Desktop.
Deobfuscated version of the loader pipeline :-|
load.metadata = {};
Promise.resolve(undefined).then(_ => {
// Call the locate hook.
return loader.locate(name, {
name: load.name,
metadata: load.metadata
});
}).then(address => {
if (load.linkSets.size === 0)
return;
// This load still matters. Call the fetch hook.
load.address = address;
return loader.fetch({
name: load.name,
metadata: load.metadata,
address: address
});
}).then(source => {
if (load.linkSets.size === 0)
return;
// This load still matters. Call the translate hook.
return loader.translate({
name: load.name,
metadata: load.metadata,
address: load.address,
source: source
});
}).then(source => {
if (load.linkSets.size === 0)
return;
// This load still matters. Call the instantiate hook.
if (callFunction(std_Set_get_size, load.linkSets) === 0)
return;
load.source = source;
return loader.instantiate({
name: load.name,
metadata: load.metadata,
address: load.address,
source: source
});
}).then(InstantiateSucceeded).catch(LoadFailed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment