run = function (doct, har, ruleset) {
            var i, j, page, pageId, entry, comp, doc, len, lenJ, split, status,
                content, baseHref, base, onloadTimestamp, cset, html, tDone,
                comps, favicons, favicon, type, response, head, body, score,
                yscontext = new YSLOW.context(doct),
                log = har.log || {},
                pages = log.pages || [],
                entries = log.entries || [];
                
            // pages loop (first page only for now)
            // TODO: think of a way to analyze all pages
            for (i = 0, len = (pages.length ? 1 : 0); i < len; i += 1) {
                page = pages[i];
                pageId = page.id;
                tDone = page.pageTimings.onLoad || 0;
                onloadTimestamp = new Date((new Date(page.startedDateTime))
                    .getTime() + tDone);
                comps = [];

                // page entries loop
                for (j = 0, lenJ = entries.length; j < lenJ; j += 1) {
                    entry = entries[j];
                    response = entry.response;
                    status = parseInt(response.status, 10);
                    content = response.content;
                    type = (content.mimeType || '').toLowerCase();
                    idx = type.indexOf(';');
                    if (idx > -1) {
                        type = type.slice(0, idx);
                    }
                    type = types[type];

                    if (status === 301 || status === 302) {
                        type = 'redirect';
                    }

                    if (!type || status === 204 || entry.pageref !== pageId) {
                        continue;
                    }

                    // get page info
                    // TODO: find a better way to get multiple docs
                    if (!baseHref && type === 'doc') {
                        baseHref = entry.request.url;
                        html = content.text;
                        base = YSLOW.util.makeAbsoluteUrl('', baseHref);
                        doc = doct.createElement('div');
                        doc.innerHTML = '<base href="' + base + '" />' + html;

                        cset = new YSLOW.ComponentSet(doc, onloadTimestamp);
                    }

                    comps.push({
                        type: type,
                        href: entry.request.url,
                        entry: entry
                    });
                }

                // use empty doc if none found (redirect chain with no content)
                if (!cset) {
                    doc = doct.createElement('div');
                    cset = new YSLOW.ComponentSet(doc, onloadTimestamp);
                    entry = entries.length && entries[0];
                    baseHref = entry && entry.request.url;
                    cset.doc_comp = {
                        url: baseHref
                    };
                }

                // build YSlow component set
                for (j = 0, lenJ = comps.length; j < lenJ; j += 1) {
                    comp = comps[j]; 
                    cset.addComponent(comp.href, comp.type, baseHref, {
                            entry: comp.entry,
                            comp: comp
                        }
                    );
                }
            }

            // if no doc was provided return error
            if (!doc) {
                throw new Error('No document found');
                return;
            }

            // set favicon
            favicons = YSLOW.peeler.findFavicon(doc, baseHref);
            comps = cset.components;
            for (i = 0, len = favicons.length; i < len; i += 1) {
                favicon = favicons[i];
                for (j = 0, lenJ = comps.length; j < lenJ; j += 1) {
                    comp = comps[j];
                    if (comp.url === favicon.href) {
                        comp.type = 'favicon';
                    }  
                }
            }

            // refinement
            if (base && html) {
                split = splitHtml(doct, base, html);
                head = split.head;
                body = split.body;
                setCssImages(cset);
                cset.inline = YSLOW.util.getInlineTags(null, head, body);
                cset.domElementsCount = YSLOW.util.countDOMElements(doc);
                cset.cookies = cset.doc_comp.cookie;
                cset.components = YSLOW.util.setInjected(doc,
                    cset.components, cset.doc_comp.body);
            }

            // run analysis
            yscontext.component_set = cset;
            YSLOW.controller.lint(doc, yscontext, ruleset || 'ydefault');
            yscontext.result_set.url = baseHref;
            score = yscontext.PAGE.overallScore;
            yscontext.PAGE.t_done = tDone;
            yscontext.collectStats();

            return {
                score: Math.round(score),
                resultSet: yscontext.result_set,
                componentSet: cset,
                grade: YSLOW.util.prettyScore(score),
                url: baseHref,
                context: yscontext
            };
        }
Import har file
@param doct host document to support dom level 0 methods
@param har the har object