Permalink
Browse files

Check property existence before trying to use them

  • Loading branch information...
1 parent 970dbcf commit 528d0d2bee5207feeae672307cd61a8268fbbb3e @Mossop committed Apr 25, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 packages/api-utils/lib/cuddlefish.js
  2. +1 −1 packages/api-utils/lib/xpcom.js
View
2 packages/api-utils/lib/cuddlefish.js
@@ -191,7 +191,7 @@ const Require = iced(function Require(loader, module) {
let { prefixURI, modules } = loader;
let base = module.path; // base module path.
let manifest = loader.manifest[base]; // manifest of base module.
- let requirer = modules[base]; // same module, but from loader cache.
+ let requirer = base in modules ? modules[base] : null; // same module, but from loader cache.
return iced(override(function require(id) {
if (!id)
throw Error("you must provide a module name when calling require() from "
View
2 packages/api-utils/lib/xpcom.js
@@ -16,7 +16,7 @@ const { uuid } = require('./uuid');
// components can be easily implement by extending it.
const Unknown = new function() {
function hasInterface(component, iid) {
- return component &&
+ return component && component.interfaces &&
( component.interfaces.some(function(id) iid.equals(Ci[id])) ||
component.implements.some(function($) hasInterface($, iid)) ||
hasInterface(Object.getPrototypeOf(component), iid));

0 comments on commit 528d0d2

Please sign in to comment.