Initialize node integration after window object is cleared

This commit is contained in:
Cheng Zhao 2015-01-21 16:40:19 -08:00
parent 706f547287
commit ef15b670a9
3 changed files with 27 additions and 14 deletions

View file

@ -86,9 +86,15 @@ if nodeIntegration in ['true', 'all', 'except-iframe', 'manual-enable-iframe']
window.addEventListener 'unload', ->
process.emit 'exit'
else
delete global.process
delete global.setImmediate
delete global.clearImmediate
# The Module.runMain will run process._tickCallck() immediately, so we are
# able to delete the symbols in this tick even though we used process.nextTick
# to schedule it.
# It is important that we put this in process.nextTick, if we delete them now
# some code in node.js will complain about "process not defined".
process.nextTick ->
delete global.process
delete global.setImmediate
delete global.clearImmediate
# Load the script specfied by the "preload" attribute.
if preloadScript