/* global WorkerGlobalScope
778720
function add(fn) {
    if (typeof WorkerGlobalScope === 'function' && self instanceof WorkerGlobalScope) {
        // this is run inside of a webworker
    } else {
        /**
         * for normal browser-windows, we use the beforeunload-event
         */
        window.addEventListener('beforeunload', () => {
            fn();
        }, true);

        /**
         * for iframes, we have to use the unload-event
         * @link https://stackoverflow.com/q/47533670/3443137
         */
        window.addEventListener('unload', () => {
            fn();
        }, true);
    }

    /**
     * TODO add fallback for safari-mobile
     * @link https://stackoverflow.com/a/26193516/3443137
     */
}
891243
function(scriptUrl) {
    goog.base(this, descriptor);

    /**
     * Tracking ID.
     * @type {number}
     * @private
     */
    this.workerId_ = nextWorkerId++;

    // Create the child worker.
    // If we are injecting generate a shim script and use that.
    var newScriptUrl = scriptUrl;
    if (injecting) {
      newScriptUrl = createInjectionShim(scriptUrl, this.workerId_);
    }
    var scope = workerCtorEvent(scriptUrl, this.workerId_);
    goog.global['Worker'] = originalWorker;
    var previousGlobalWorker = goog.global['Worker'];
    var handle;
    try {
      handle = new originalWorker(newScriptUrl);
    } finally {
      goog.global['Worker'] = previousGlobalWorker;
      wtf.trace.leaveScope(scope);
    }

    /**
     * Handle to the underlying worker instance.
     * @type {!Worker}
     * @private
     */
    this.handle_ = handle;

    /**
     * Event type trackers, by name.
     * @type {!Object.<Function>}
     * @private
     */
    this.trackers_ = {};

    this.setEventHook('error', function(e) {
      wtf.trace.appendScopeData('id', this.workerId_);
    }, this);
    this.setEventHook('message', function(e) {
      wtf.trace.appendScopeData('id', this.workerId_);
    }, this);

    // Always hook onmessage.
    // By doing it here we get first access to the event.
    var self = this;
    this.handle_.addEventListener('message', function(e) {
      // Sniff provider messages.
      if (!e.data['__wtf_worker_msg__']) {
        return;
      }
      e['__wtf_ignore__'] = true;

      var value = e.data['value'];
      switch (e.data['command']) {
        case 'snapshot':
          var result = pendingSnapshots[value['id']];
          delete pendingSnapshots[value['id']];
          if (!result.getError()) {
            result.setValue(value['data']);
          }
          break;
        case 'close':
          goog.array.remove(provider.childWorkers_, self);
          break;
      }
    }, false);

    provider.childWorkers_.push(this);
  }
1356681
function takeGlobalQueue() {
            //Push all the globalDefQueue items into the context's defQueue
            if (globalDefQueue.length) {
                //Array splice in the values since the context code has a
                //local var ref to defQueue, so cannot just reassign the one
                //on context.
                apsp.apply(defQueue,
                           [defQueue.length - 1, 0].concat(globalDefQueue));
                globalDefQueue = [];
            }
        }
1219991
def GLOBAL(self, node):
        """"""
        if isinstance(self.scope, FunctionScope):
            self.scope.globals.update(node.names)
87264
function(items)
	{
		var register = [];

		/// Export as module if running under nodejs
		if (typeof global === 'object') {
			register.push(global);
		}

		if (typeof window === 'object') {
			register.push(window);
		}

		// Browse all resolved global objects and bind pwf items
		for (var i = 0; i < register.length; i++) {
			var obj = register[i];

			// Bind all requested items as global
			for (var key in items) {
				if (!items.hasOwnProperty(key)) {
					continue;
				}

				obj[key] = items[key];
			}

			// Check for all callbacks bound to this global object and call them
			if (typeof obj.on_pwf !== 'undefined') {
				var calls = obj.on_pwf;

				// Expecting list/array
				if (!(calls instanceof Array)) {
					calls = [calls];
				}

				for (var j = 0; j < calls.length; j++) {
					if (typeof calls[j] !== 'function') {
						throw new Error('on_pwf:not-a-method:' + j);
					}

					calls[j].apply(obj.pwf);
				}
			}
		}
	}
914928
def _onGlobal(self, name, line, pos, absPosition, level):
        """"""
        # level is ignored
        for item in self.globals:
            if item.name == name:
                return
        self.globals.append(Global(name, line, pos, absPosition))
682607
private static Main mainEmbeddedImpl(ContextFactory factory,
                                         Object scopeProvider,
                                         String title) {
        if (title == null) {
            title = "Rhino JavaScript Debugger (embedded usage)";
        }
        Main main = new Main(title);
        main.doBreak();
        main.setExitAction(new IProxy(IProxy.EXIT_ACTION));

        main.attachTo(factory);
        if (scopeProvider instanceof ScopeProvider) {
            main.setScopeProvider((ScopeProvider)scopeProvider);
        } else {
            Scriptable scope = (Scriptable)scopeProvider;
            if (scope instanceof Global) {
                Global global = (Global)scope;
                global.setIn(main.getIn());
                global.setOut(main.getOut());
                global.setErr(main.getErr());
            }
            main.setScope(scope);
        }

        main.pack();
        main.setSize(600, 460);
        main.setVisible(true);
        return main;
    }
416686
public static function getGlobalScope($scope)
    {
        return array_first(static::$globalScopes[get_called_class()], function($key, $value) use ($scope)
        {
            return $scope instanceof $value;
        });
    }
523283
function getImportGlobalsSrc(ignore) {
    var key,
        value,
        src = "",
        globalObj = typeof global === "undefined"? window: global;

    ignore = ignore || [];
    // global itself can't be overridden because it's the only reference to our real global objects
    ignore.push("global");
    // ignore 'module', 'exports' and 'require' on the global scope, because otherwise our code would
    // shadow the module-internal variables
    // @see https://github.com/jhnns/rewire-webpack/pull/6
    ignore.push("module", "exports", "require");

    for (key in globalObj) { /* jshint forin: false */
        if (ignore.indexOf(key) !== -1) {
            continue;
        }
        value = globalObj[key];

        // key may be an invalid variable name (e.g. 'a-b')
        try {
          eval("var " + key + ";");
          src += "var " + key + " = global." + key + "; ";
        } catch(e) {}
    }

    return src;
}
1072642
function getGlobalThis() {
    return t.callExpression(
      t.sequenceExpression([t.valueToNode(0), t.identifier("eval")]),
      [t.valueToNode("this")]
    );
  }
983282
function reportAccessingEvalViaGlobalObject(globalScope) {
            for (let i = 0; i < candidatesOfGlobalObject.length; ++i) {
                const name = candidatesOfGlobalObject[i];
                const variable = astUtils.getVariableByName(globalScope, name);

                if (!variable) {
                    continue;
                }

                const references = variable.references;

                for (let j = 0; j < references.length; ++j) {
                    const identifier = references[j].identifier;
                    let node = identifier.parent;

                    // To detect code like `window.window.eval`.
                    while (isMember(node, name)) {
                        node = node.parent;
                    }

                    // Reports.
                    if (isMember(node, "eval")) {
                        report(node);
                    }
                }
            }
        }
714083
public final S getGlobalScope() {
    S result = thisScope();
    while (result.getParent() != null) {
      result = result.getParent();
    }
    return result;
  }
272340
def globals(self):
        """"""
        defglobal = lib.EnvGetNextDefglobal(self._env, ffi.NULL)

        while defglobal != ffi.NULL:
            yield Global(self._env, defglobal)

            defglobal = lib.EnvGetNextDefglobal(self._env, defglobal)
42085
private void executeGlobalPostProcessing(boolean processBundleFlag, StopWatch stopWatch) {
		// Launch global postprocessing
		if (resourceTypePostprocessor != null) {
			if (stopWatch != null) {
				stopWatch.start("Global postprocessing");
			}
			GlobalPostProcessingContext ctx = new GlobalPostProcessingContext(config, this, resourceHandler,
					processBundleFlag);

			resourceTypePostprocessor.processBundles(ctx, this.bundles);
			if (stopWatch != null) {
				stopWatch.stop();
			}
		}
	}
577437
function warnAboutGlobalCode (sandbox, path)
  {
    var msg = csprintf ('yellow', 'Incompatible code found on the global scope!'.red + NL +
      (path ? reportErrorLocation (path) : '') +
      getExplanation (
        'This kind of code will behave differently between release and debug builds.' + NL +
        'You should wrap it in a self-invoking function and/or assign global variables/functions ' +
        'directly to the window object.'
      )
    );
    if (context.verbose) {
      var found = false;
      util.forEachProperty (sandbox, function (k, v)
      {
        if (!found) {
          found = true;
          msg += '  Detected globals:'.yellow + NL;
        }
        msg += (typeof v === 'function' ? '    function '.blue : '    var      '.blue) + k.cyan + NL;
      });
    }
    warn (msg + '>>'.yellow);
  }
286962
function(data) {
			if (globalConfig.debug) {
				// We grab console via getGlobal() so we can stub it out in tests
				var globalConsole = this.getGlobal('console');
				if (globalConsole && globalConsole.info) {
					globalConsole.info(data);
				}
			}
		}
757289
function WorkerJob(msg, options, callback) {
  this.msg = msg || {};
  this.options = options || {};
  this.callback = callback;
}