Closed Bug 1146544 Opened 9 years ago Closed 7 years ago

stylesheet/utils.js causes unsafe CPOW usage warnings

Categories

(Add-on SDK Graveyard :: General, defect, P1)

x86
macOS
defect

Tracking

(e10s+)

RESOLVED INCOMPLETE
Tracking Status
e10s + ---

People

(Reporter: mconley, Unassigned)

References

Details

(Whiteboard: [unsafe-cpow-usage])

function getDOMWindowUtils(window) {
  return window.QueryInterface(Ci.nsIInterfaceRequestor).
                getInterface(Ci.nsIDOMWindowUtils); <-- causes unsafe CPOW usage
};

function loadSheet(window, url, type) {
  if (!(type && type in SHEET_TYPE))
    type = "author";

  type = SHEET_TYPE[type];

  if (url instanceof Ci.nsIURI)
    url = url.spec;

  let winUtils = getDOMWindowUtils(window);
  try {
    winUtils.loadSheetUsingURIString(url, winUtils[type]); <-- causes unsafe CPOW usage
  }
  catch (e) {};
};

function removeSheet(window, url, type) {
  if (!(type && type in SHEET_TYPE))
    type = "author";

  type = SHEET_TYPE[type];

  if (url instanceof Ci.nsIURI)
    url = url.spec;

  let winUtils = getDOMWindowUtils(window);

  try {
    winUtils.removeSheetUsingURIString(url, winUtils[type]); <-- causes unsafe CPOW usage
  }
  catch (e) {};
};
It would be helpful to include details on how you're seeing this code be called
Flags: needinfo?(mconley)
Blocks: e10s-sdk
Priority: -- → P1
tracking-e10s: m8+ → ---
Whiteboard: [unsafe-cpow-usage]
While it looks like it's a test triggering it, stylesheet/utils.js is used elsewhere in the SDK (by the devtools inspector.js and highlighter.js, it seems), and can be used by any add-on.

We should probably make this API cpow-safe, or deprecate it.
tracking-e10s: --- → ?
Assignee: nobody → wmccloskey
Assignee: wmccloskey → nobody
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.