mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1276468 - Fix sheetToUrl
function for inline style. r=jwalker
The function was trying to access `stylesheet` parameter's ownerNode property, which is undefined when the parameter is a StyleSheetActor. In the latter case, we use nodeHref and styleSheetIndex properties to match what is done when the parameter is a StyleSheet. MozReview-Commit-ID: 7FNoKasFYLL
This commit is contained in:
parent
c37347cd35
commit
6901d27224
@ -697,6 +697,7 @@ exports.SEL_ALL = [
|
||||
|
||||
/**
|
||||
* Find a URL for a given stylesheet
|
||||
* @param stylesheet {StyleSheet|StyleSheetActor}
|
||||
*/
|
||||
const sheetToUrl = exports.sheetToUrl = function (stylesheet) {
|
||||
// For <link> elements
|
||||
@ -712,5 +713,10 @@ const sheetToUrl = exports.sheetToUrl = function (stylesheet) {
|
||||
return getURL(document) + " → <style> index " + index;
|
||||
}
|
||||
|
||||
// When `stylesheet` is a StyleSheetActor, we don't have access to ownerNode
|
||||
if (stylesheet.nodeHref) {
|
||||
return stylesheet.nodeHref + " → <style> index " + stylesheet.styleSheetIndex;
|
||||
}
|
||||
|
||||
throw new Error("Unknown sheet source");
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user