This should work from either content or an extension:
var s = '<div>html...</div>';
var parser = new DOMParser();
var doc = parser.parseFromString(s, 'text/html');
var div = doc.querySelector("div");
var style = window.getComputedStyle(div);
If you don't have access to a window e.g. from an extension then you could do it this way:
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
var s = '<div>html...</div>';
var parser = new DOMParser();
var doc = parser.parseFromString(s, 'text/html');
var div = doc.querySelector("div");
var win = Services.appShell.hiddenDOMWindow;
var style = win.getComputedStyle(div);