mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 13:48:23 +02:00
--HG-- rename : parser/htmlparser/tests/mochitest/test_viewsource.html => parser/htmlparser/tests/mochitest/file_viewsource.html extra : commitid : IVqN6XUYvOk extra : rebase_source : 62b723f641b2c2843080ef7f586df1236237241c
22 lines
756 B
JavaScript
22 lines
756 B
JavaScript
"use strict";
|
|
|
|
add_task(function*() {
|
|
const PAGE_URL = getRootDirectory(gTestPath) + "file_viewsource.html";
|
|
let viewSourceTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "view-source:" + PAGE_URL);
|
|
|
|
let xhrPromise = new Promise(resolve => {
|
|
let xhr = new XMLHttpRequest();
|
|
xhr.open("GET", PAGE_URL, true);
|
|
xhr.onload = event => resolve(event.target.responseText);
|
|
xhr.send();
|
|
});
|
|
|
|
let viewSourceContentPromise = ContentTask.spawn(viewSourceTab.linkedBrowser, null, function*() {
|
|
return content.document.body.textContent;
|
|
});
|
|
|
|
let results = yield Promise.all([viewSourceContentPromise, xhrPromise]);
|
|
is(results[0], results[1], "Sources should match");
|
|
yield BrowserTestUtils.removeTab(viewSourceTab);
|
|
});
|
|
|