зеркало из https://github.com/mozilla/gecko-dev.git
Back out 14715fd6b81c (bug 677122) because of frequent failures in its test
This commit is contained in:
Родитель
f6ce694430
Коммит
840bca261e
|
@ -63,7 +63,6 @@ protected:
|
|||
|
||||
// Sets document <title> to reflect the file name and description.
|
||||
void UpdateTitle(nsIChannel* aChannel);
|
||||
void InsertMediaFragmentScript();
|
||||
|
||||
nsresult CreateSyntheticVideoDocument(nsIChannel* aChannel,
|
||||
nsIStreamListener** aListener);
|
||||
|
@ -107,29 +106,6 @@ VideoDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
|
|||
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelVideoDocument.css"));
|
||||
LinkStylesheet(NS_LITERAL_STRING("chrome://global/skin/TopLevelVideoDocument.css"));
|
||||
}
|
||||
|
||||
if (aScriptGlobalObject) {
|
||||
InsertMediaFragmentScript();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
VideoDocument::InsertMediaFragmentScript()
|
||||
{
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::script, nsnull,
|
||||
kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
if (!nodeInfo)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<nsGenericHTMLElement> script = NS_NewHTMLScriptElement(nodeInfo.forget());
|
||||
script->SetTextContent(NS_LITERAL_STRING("window.addEventListener('hashchange',function(e){document.querySelector('audio,video').src=e.newURL;},false);"));
|
||||
|
||||
Element* head = GetHeadElement();
|
||||
head->AppendChildTo(script, false);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -104,11 +104,10 @@ _TEST_FILES = test_bug1682.html \
|
|||
bug499092.html \
|
||||
test_bug512367.html \
|
||||
test_bug571981.html \
|
||||
test_bug677122.html \
|
||||
test_bug677495.html \
|
||||
test_bug677495-1.html \
|
||||
test_bug741266.html \
|
||||
test_bug742261.html \
|
||||
test_bug741266.html \
|
||||
$(NULL)
|
||||
|
||||
ifneq (mobile,$(MOZ_BUILD_APP))
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media test: MediaDocument hashchange mediafragment.</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
var url = "../../../media/test/seek.ogv";
|
||||
var expects = 5;
|
||||
var count = 0;
|
||||
var test;
|
||||
var tests = [
|
||||
{ start: 1, end: 2 },
|
||||
{ start: 3, end: 4 }
|
||||
];
|
||||
|
||||
var next = function () {
|
||||
|
||||
test = tests.shift();
|
||||
if (test) {
|
||||
|
||||
iframe.src = url + "#t=" + test.start + "," + test.end;
|
||||
} else {
|
||||
|
||||
ok(expects === ++count, "Expected number of tests run. Expected: " + expects + " Actual: " + count);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
|
||||
iframe.addEventListener("load", function (e) {
|
||||
|
||||
var media = iframe.contentWindow.document.querySelector("audio,video");
|
||||
|
||||
media.addEventListener("seeked", function () {
|
||||
|
||||
var currentTime = Math.round(media.currentTime);
|
||||
|
||||
count++;
|
||||
ok(currentTime === test.start, "Hashchange mediafragment start. Expected: " + test.start + " Actual: " + currentTime);
|
||||
}, false);
|
||||
|
||||
media.addEventListener("pause", function () {
|
||||
|
||||
var currentTime = Math.round(media.currentTime);
|
||||
|
||||
if (count === 1) {
|
||||
|
||||
count++;
|
||||
ok(currentTime === test.end, "Hashchange mediafragment end. Expected: " + test.end + " Actual: " + currentTime);
|
||||
}
|
||||
|
||||
next();
|
||||
}, false);
|
||||
|
||||
// having an ended event ensures we're more likely to fail, instead of timing out.
|
||||
media.addEventListener("ended", function () {
|
||||
|
||||
var currentTime = Math.round(media.currentTime);
|
||||
|
||||
if (count === 3) {
|
||||
|
||||
count++;
|
||||
ok(currentTime === test.end, "Hashchange mediafragment end. Expected: " + test.end + " Actual: " + currentTime);
|
||||
}
|
||||
|
||||
next();
|
||||
}, false);
|
||||
|
||||
next();
|
||||
}, false);
|
||||
|
||||
iframe.src = url;
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче