This file is indexed.

/usr/share/xul-ext/tabmixplus/modules/LinkNodeUtils.jsm is in xul-ext-tabmixplus 0.5.0.0-1~deb8u1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"use strict";

this.EXPORTED_SYMBOLS = ["LinkNodeUtils"];

const Cu = Components.utils;

Cu.import("resource://gre/modules/XPCOMUtils.jsm");

XPCOMUtils.defineLazyModuleGetter(this, "TabmixSvc",
  "resource://tabmixplus/Services.jsm");

const ATTRIBS = ["onclick", "rel", "onmousedown"];

this.LinkNodeUtils = {
  isFrameInContent: function(content, href, name) {
    if (!content)
      return false;
    if (content.location.href == href && content.name == name)
      return true;
    for (let i = 0; i < content.frames.length; i++) {
      let frame = content.frames[i];
      if (frame.location.href == href && frame.name == name)
        return true;
    }
    return false;
  },

  wrap: function(node, focusedWindow, getTargetIsFrame) {
    if (!node || typeof node.__tabmix == "boolean")
      return node;

    let doc = node.ownerDocument;
    let wrapper = {
      __tabmix: true,
      baseURI: node.baseURI,
      host: node.host,
      pathname: node.pathname,
      className: node.className,
      target: getTargetAttr(node.target, focusedWindow),
      ownerDocument: {
        URL: doc.URL,
        documentURI: doc.documentURI,
        defaultView: {
          frameElement: Boolean(doc.defaultView.frameElement)
        },
        location: {
          href: doc.location ? doc.location.href : ""
        }
      },
      parentNode: {
        baseURI: node.parentNode.baseURI,
        _attributes: getAttributes(node.parentNode, ["onclick"])
      },
      _focusedWindowHref: focusedWindow.top.location.href,
      _attributes: getAttributes(node, ATTRIBS)
    };
    if (getTargetIsFrame)
      wrapper.targetIsFrame = targetIsFrame(wrapper.target, focusedWindow);
    return wrapper;
  },

  getNodeWithOnClick: function(node) {
    // for safety reason look only 3 level up
    let i = 0;
    while (i < 3 && node && node.hasAttribute && !node.hasAttribute("onclick")) {
      node = node.parentNode;
      i++;
    }
    if (node && node.hasAttribute && node.hasAttribute("onclick"))
      return node;
    return null;
  }
};

function getAttributes(node, attribs) {
  let wrapper = {};
  for (let att of attribs) {
    if (node.hasAttribute(att)) {
      wrapper[att] = node.getAttribute(att);
    }
  }
  return wrapper;
}

function getTargetAttr(targetAttr, focusedWindow) {
  // If link has no target attribute, check if there is a <base> with a target attribute
  if (!targetAttr) {
    let b = focusedWindow.document.getElementsByTagName("base");
    if (b.length > 0)
      targetAttr = b[0].getAttribute("target");
  }
  return targetAttr;
}

/**
 * @brief check if target attribute exist and point to frame in the document
 *        frame pool
 */
function targetIsFrame(targetAttr, focusedWindow) {
  if (targetAttr) {
    let content = focusedWindow.top;
    if (existsFrameName(content, targetAttr))
      return true;
  }
  return false;
}

/**
 * @brief Check a document's frame pool and determine if
 * |targetFrame| is located inside of it.
 *
 * @param content           is a frame reference
 * @param targetFrame       The name of the frame that we are seeking.
 * @returns                 true if the frame exists within the given frame pool,
 *                          false if it does not.
 */
function existsFrameName(content, targetFrame) {
  for (let i = 0; i < content.frames.length; i++) {
    let frame = content.frames[i];
    if (frame.name == targetFrame || existsFrameName(frame, targetFrame))
      return true;
  }
  return false;
}