File: windowIdForEvent.js

package info (click to toggle)
greasemonkey 2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 1,820 kB
  • sloc: xml: 171; makefile: 10
file content (14 lines) | stat: -rw-r--r-- 338 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Components.utils.import('resource://greasemonkey/util.js');

const EXPORTED_SYMBOLS = ['windowIdForEvent'];

function windowIdForEvent(aEvent) {
  var doc = aEvent.originalTarget;
  try {
    doc.QueryInterface(Components.interfaces.nsIDOMHTMLDocument);
  } catch (e) {
    return null;
  }

  return GM_util.windowId(doc.defaultView);
}