Bug 72439 - Crash when ShadowRoot content is smaller than host element
Summary: Crash when ShadowRoot content is smaller than host element
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dominic Cooney
URL:
Keywords:
Depends on:
Blocks: 72352
  Show dependency treegraph
 
Reported: 2011-11-15 16:21 PST by Dominic Cooney
Modified: 2011-12-07 18:08 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominic Cooney 2011-11-15 16:21:11 PST
When the content of a ShadowRoot is smaller than the host element, clicking in the "void" tries to create a range without an associated DOM element and causes a crash.
Comment 1 Hajime Morrita 2011-12-05 00:32:44 PST
Signing up myself.
Comment 2 Hajime Morrita 2011-12-05 22:34:50 PST
I cannot reproduce this:

----
<!DOCTYPE html>                                                                                                                                                                                                                                                                                                                                                             
<html>                                                                                                                                                                                                                                                                                                                                                                      
<head>                                                                                                                                                                                                                                                                                                                                                                      
</head>                                                                                                                                                                                                                                                                                                                                                                     
<body>                                                                                                                                                                                                                                                                                                                                                                      
<pre id="console">                                                                                                                                                                                                                                                                                                                                                          
</pre>                                                                                                                                                                                                                                                                                                                                                                      
<div id="container"></div>                                                                                                                                                                                                                                                                                                                                                  
<script>                                                                                                                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                                                                                                            
var container = document.getElementById("container");                                                                                                                                                                                                                                                                                                                       
var shadowHost = document.createElement("div");                                                                                                                                                                                                                                                                                                                             
shadowHost.setAttribute("style", "width: 500px; height: 500px;");                                                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                                                                            
var shadowRoot = internals.ensureShadowRoot(shadowHost);                                                                                                                                                                                                                                                                                                                    
content = document.createElement("p");                                                                                                                                                                                                                                                                                                                                      
content.setAttribute("style", "width: 50px; height: 50px;");                                                                                                                                                                                                                                                                                                                
shadowRoot.appendChild(content);                                                                                                                                                                                                                                                                                                                                            
container.appendChild(shadowHost);                                                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                                                                            
shadowHost.onclick = function() { console.log('clicked'); }                                                                                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                                                                                            
var p = content;                                                                                                                                                                                                                                                                                                                                                            
var x = p.offsetLeft + p.offsetWidth + 10;                                                                                                                                                                                                                                                                                                                                  
var y = p.offsetTop + p.offsetHeight + 10;                                                                                                                                                                                                                                                                                                                                  
eventSender.mouseMoveTo(x , y);                                                                                                                                                                                                                                                                                                                                             
eventSender.mouseDown();                                                                                                                                                                                                                                                                                                                                                    
eventSender.mouseUp();                                                                                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                                                                                            
</script>                                                                                                                                                                                                                                                                                                                                                                   
</body>                                                                                                                                                                                                                                                                                                                                                                     
</html>
--
This printed "clicked" without any crash.
Comment 3 Hajime Morrita 2011-12-06 01:06:54 PST
Unassigning for now because the crash cannot be reproduced.
Comment 4 Dominic Cooney 2011-12-06 01:20:01 PST
Let me try to reproduce it.
Comment 5 Dominic Cooney 2011-12-07 18:08:05 PST
I can not reproduce this.