diff options
Diffstat (limited to 'Source/WebCore/inspector/front-end/AuditRules.js')
-rw-r--r-- | Source/WebCore/inspector/front-end/AuditRules.js | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/Source/WebCore/inspector/front-end/AuditRules.js b/Source/WebCore/inspector/front-end/AuditRules.js index 803e9e0..ddab1df 100644 --- a/Source/WebCore/inspector/front-end/AuditRules.js +++ b/Source/WebCore/inspector/front-end/AuditRules.js @@ -65,9 +65,9 @@ WebInspector.AuditRules.getDomainToResourcesMap = function(resources, types, nee WebInspector.AuditRules.evaluateInTargetWindow = function(func, args, callback) { - function mycallback(result) + function mycallback(error, result) { - if (result) + if (!error && result) callback(JSON.parse(result.description)); else callback(null); @@ -377,24 +377,28 @@ WebInspector.AuditRules.UnusedCssRule.prototype = { WebInspector.AuditRules.evaluateInTargetWindow(routine, [selectors], selectorsCallback.bind(null, callback, styleSheets, testedSelectors)); } - function styleSheetCallback(styleSheets, continuation, styleSheet) + function styleSheetCallback(styleSheets, sourceURL, continuation, styleSheet) { - if (styleSheet) + if (styleSheet) { + styleSheet.sourceURL = sourceURL; styleSheets.push(styleSheet); + } if (continuation) continuation(styleSheets); } - function allStylesCallback(styleSheetIds) + function allStylesCallback(error, styleSheetInfos) { - if (!styleSheetIds || !styleSheetIds.length) + if (error || !styleSheetInfos || !styleSheetInfos.length) return evalCallback([]); var styleSheets = []; - for (var i = 0; i < styleSheetIds.length; ++i) - WebInspector.CSSStyleSheet.createForId(styleSheetIds[i], styleSheetCallback.bind(null, styleSheets, i == styleSheetIds.length - 1 ? evalCallback : null)); + for (var i = 0; i < styleSheetInfos.length; ++i) { + var info = styleSheetInfos[i]; + WebInspector.CSSStyleSheet.createForId(info.styleSheetId, styleSheetCallback.bind(null, styleSheets, info.sourceURL, i == styleSheetInfos.length - 1 ? evalCallback : null)); + } } - CSSAgent.getAllStyles(allStylesCallback); + CSSAgent.getAllStyleSheets(allStylesCallback); } } @@ -717,13 +721,20 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = { doneCallback(); } - function getStyles(nodeIds) + function getStyles(error, nodeIds) { + if (error) + return; for (var i = 0; i < nodeIds.length; ++i) WebInspector.cssModel.getStylesAsync(nodeIds[i], imageStylesReady.bind(this, nodeIds[i], i === nodeIds.length - 1)); } - DOMAgent.querySelectorAll(0, "img[src]", true, getStyles); + function getImages() + { + DOMAgent.querySelectorAll(0, "img[src]", true, getStyles); + } + + WebInspector.domAgent.requestDocument(getImages); } } |