[webkit-dev] Nesting Level of DOMTimer (non-one-shot timer)
陈浩
chenhao at ucweb.com
Fri Oct 10 08:19:49 PDT 2014
Hi, all,
I am confused about the nesting level of DOMTimer.
First, there is a long story which come from:
https://bugs.webkit.org/show_bug.cgi?id=42861
Current situation is the timer could forward the gesture state only if
the nesting level is zero. The problem is the nesting level is managed
in the Document (ScriptExecutionContext), that means all timers in the
same document share one nesting level. If one repeat timer was launched,
all other timers after that could not forward the gesture state, due to
all of them has a non-zero nesting level.
Below is my testing page, three images at the end of page could delay
the onload event. You could follow below steps to reproduce what I met:
1. Click "Start repeating timer" first
2. After the text change to "Running...", click "Goto next page"
3. When WebKit page come out, click back button.
What I see is the page before the testing page, because the
NavigationScheduler::mustLockBackForwardList refused the creation of new
history item.
<html>
<head>
</head>
<body>
<input type="button" value="Goto next page" onclick="gotoNextPage();">
<input type="button" value="Start repeating timer"
onclick="startRepeatingTimer();">
<p>
<div id="Timer">Paused</div>
</p>
<script type="text/javascript">
function gotoNextPage(){
setTimeout(function(){location.href="http://www.webkit.org/";},300);
}
function startRepeatingTimer(){
setInterval(function(){document.getElementById("Timer").innerHTML="Running...";},500);
}
</script>
<img
src="http://therecoveringpolitician.com/wp-content/uploads/2013/01/moderate.jpg"
width="640" height="480">
<img
src="http://cullogo.com/full/wallpapers-high-resolution-widescreen-hd-pk.jpg"
width="640" height="480">
<img
src="http://www.highresolutionwallpapers.net/wallpapers/autumn-1680x1050.jpg"
width="640" height="480">
</body>
</html>
According to Web App APIs
defintion(http://www.w3.org/html/wg/drafts/html/CR/webappapis.html#timer-nesting-level),
the nesting level of repeating timer will be increased in the loop. I
doubt that the nesting level should owned by the timer itself, do not
share with others. Just as described in the defintion, that is task's
nesting level.
That's appreciate to get your comment!
Thanks & Best Regards!
Hao
More information about the webkit-dev
mailing list