Skip to content

Commit

Permalink
Bug 1261351: Look past ShadowRoots when looking for the parent for th…
Browse files Browse the repository at this point in the history
…e UndisplayedMap. r=dbaron
  • Loading branch information
khuey committed Jun 7, 2016
1 parent c172cd3 commit af57948
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
26 changes: 26 additions & 0 deletions layout/base/crashtests/1261351-iframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<body>
<script type="application/javascript">
'use strict';
// -sp-context: content
(function () {
let proto = Object.create(HTMLDivElement.prototype);
proto.template = `<style></style>`;
proto.createdCallback = function() {
let shadow = this.createShadowRoot();
if (this.template) {
let te = document.createElement('template');
te.innerHTML = this.template;
shadow.appendChild(document.importNode(te.content, true));
}
};

let UiComponentTest = document.registerElement('ui-component-test', {
prototype: proto,
});

let uic = new UiComponentTest();
document.body.appendChild(uic);

})();
</script>
</body>
7 changes: 7 additions & 0 deletions layout/base/crashtests/1261351.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<iframe id="iframe" src="1261351-iframe.html"></iframe>
<script type="application/javascript">
let iframe = document.getElementById("iframe");
iframe.addEventListener("load", function() {
document.getElementsByTagName("iframe")[0].marginWidth = "5";
});
</script>
1 change: 1 addition & 0 deletions layout/base/crashtests/crashtests.list
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,5 @@ load 1162813.xul
load 1163583.html
load 1234622-1.html
load 1235467-1.html
pref(dom.webcomponents.enabled,true) load 1261351.html
load 1270797-1.html
3 changes: 2 additions & 1 deletion layout/base/nsFrameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ nsFrameManager::SetStyleContextInMap(UndisplayedMap* aMap,
NS_ASSERTION(!GetStyleContextInMap(aMap, aContent),
"Already have an entry for aContent");

nsIContent* parent = aContent->GetParent();
nsIContent* parent = aContent->GetParentElementCrossingShadowRoot();
MOZ_ASSERT(parent || !aContent->GetParent(), "no non-elements");
#ifdef DEBUG
nsIPresShell* shell = aStyleContext->PresContext()->PresShell();
NS_ASSERTION(parent || (shell && shell->GetDocument() &&
Expand Down

0 comments on commit af57948

Please sign in to comment.