mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Merge mozilla-central to mozilla-inbound
This commit is contained in:
commit
b43c07a10c
@ -5,6 +5,9 @@
|
||||
^widget/android/GeneratedJNINatives.h
|
||||
^widget/android/GeneratedJNIWrappers.cpp
|
||||
^widget/android/GeneratedJNIWrappers.h
|
||||
^widget/android/fennec/FennecJNINatives.h
|
||||
^widget/android/fennec/FennecJNIWrappers.cpp
|
||||
^widget/android/fennec/FennecJNIWrappers.h
|
||||
|
||||
# Generated from ./tools/rewriting/ThirdPartyPaths.txt
|
||||
# awk '{print "^"$1".*"}' ./tools/rewriting/ThirdPartyPaths.txt
|
||||
|
@ -87,8 +87,6 @@ devtools/client/framework/**
|
||||
devtools/client/inspector/markup/test/doc_markup_events_*.html
|
||||
devtools/client/inspector/rules/test/doc_media_queries.html
|
||||
devtools/client/memory/test/chrome/*.html
|
||||
devtools/client/netmonitor/test/**
|
||||
devtools/client/netmonitor/har/test/**
|
||||
devtools/client/performance/components/test/test_jit_optimizations_01.html
|
||||
devtools/client/projecteditor/**
|
||||
devtools/client/responsive.html/test/browser/touch.html
|
||||
|
@ -118,6 +118,37 @@ function is_visible(element) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the contents of an individual permission string.
|
||||
* This function is fairly specific to the use here and probably not
|
||||
* suitable for re-use elsewhere...
|
||||
*
|
||||
* @param {string} string
|
||||
* The string value to check (i.e., pulled from the DOM)
|
||||
* @param {string} key
|
||||
* The key in browser.properties for the localized string to
|
||||
* compare with.
|
||||
* @param {string|null} param
|
||||
* Optional string to substitute for %S in the localized string.
|
||||
* @param {string} msg
|
||||
* The message to be emitted as part of the actual test.
|
||||
*/
|
||||
function checkPermissionString(string, key, param, msg) {
|
||||
let localizedString = param ?
|
||||
gBrowserBundle.formatStringFromName(key, [param], 1) :
|
||||
gBrowserBundle.GetStringFromName(key);
|
||||
|
||||
// If this is a parameterized string and the parameter isn't given,
|
||||
// just do a simple comparison of the text before and after the %S
|
||||
if (localizedString.includes("%S")) {
|
||||
let i = localizedString.indexOf("%S");
|
||||
ok(string.startsWith(localizedString.slice(0, i)), msg);
|
||||
ok(string.endsWith(localizedString.slice(i + 2)), msg);
|
||||
} else {
|
||||
is(string, localizedString, msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that install-time permission prompts work for a given
|
||||
* installation method.
|
||||
@ -196,7 +227,24 @@ async function testInstallMethod(installFn) {
|
||||
|
||||
is(header.getAttribute("hidden"), "", "Permission list header is visible");
|
||||
is(ul.childElementCount, 5, "Permissions list has 5 entries");
|
||||
// Real checking of the contents here is deferred until bug 1316996 lands
|
||||
|
||||
checkPermissionString(ul.children[0].textContent,
|
||||
"webextPerms.hostDescription.wildcard",
|
||||
"wildcard.domain",
|
||||
"First permission is domain permission");
|
||||
checkPermissionString(ul.children[1].textContent,
|
||||
"webextPerms.hostDescription.oneSite",
|
||||
"singlehost.domain",
|
||||
"Second permission is single host permission");
|
||||
checkPermissionString(ul.children[2].textContent,
|
||||
"webextPerms.description.nativeMessaging", null,
|
||||
"Third permission is nativeMessaging");
|
||||
checkPermissionString(ul.children[3].textContent,
|
||||
"webextPerms.description.tabs", null,
|
||||
"Fourth permission is tabs");
|
||||
checkPermissionString(ul.children[4].textContent,
|
||||
"webextPerms.description.history", null,
|
||||
"Fifth permission is history");
|
||||
} else if (filename == NO_PERMS_XPI) {
|
||||
// This extension has no icon, it should have the default
|
||||
ok(isDefaultIcon(icon), "Icon is the default extension icon");
|
||||
|
@ -1348,9 +1348,10 @@ var gApplicationsPane = {
|
||||
while (menuPopup.hasChildNodes())
|
||||
menuPopup.removeChild(menuPopup.lastChild);
|
||||
|
||||
let internalMenuItem;
|
||||
// Add the "Preview in Firefox" option for optional internal handlers.
|
||||
if (handlerInfo instanceof InternalHandlerInfoWrapper) {
|
||||
let internalMenuItem = document.createElement("menuitem");
|
||||
internalMenuItem = document.createElement("menuitem");
|
||||
internalMenuItem.setAttribute("action", Ci.nsIHandlerInfo.handleInternally);
|
||||
let label = this._prefsBundle.getFormattedString("previewInApp",
|
||||
[this._brandShortName]);
|
||||
@ -1392,7 +1393,7 @@ var gApplicationsPane = {
|
||||
|
||||
// If this is the feed type, add a Live Bookmarks item.
|
||||
if (isFeedType(handlerInfo.type)) {
|
||||
let internalMenuItem = document.createElement("menuitem");
|
||||
internalMenuItem = document.createElement("menuitem");
|
||||
internalMenuItem.setAttribute("action", Ci.nsIHandlerInfo.handleInternally);
|
||||
let label = this._prefsBundle.getFormattedString("addLiveBookmarksInApp",
|
||||
[this._brandShortName]);
|
||||
@ -1504,7 +1505,11 @@ var gApplicationsPane = {
|
||||
menu.selectedItem = askMenuItem;
|
||||
else switch (handlerInfo.preferredAction) {
|
||||
case Ci.nsIHandlerInfo.handleInternally:
|
||||
menu.selectedItem = internalMenuItem;
|
||||
if (internalMenuItem) {
|
||||
menu.selectedItem = internalMenuItem;
|
||||
} else {
|
||||
Cu.reportError("No menu item defined to set!")
|
||||
}
|
||||
break;
|
||||
case Ci.nsIHandlerInfo.useSystemDefault:
|
||||
menu.selectedItem = defaultMenuItem;
|
||||
|
@ -4,6 +4,7 @@ support-files =
|
||||
privacypane_tests_perwindow.js
|
||||
site_data_test.html
|
||||
|
||||
[browser_applications_selection.js]
|
||||
[browser_advanced_siteData.js]
|
||||
[browser_advanced_update.js]
|
||||
skip-if = !updater
|
||||
|
@ -0,0 +1,79 @@
|
||||
var win;
|
||||
var feedItem;
|
||||
var container;
|
||||
|
||||
SimpleTest.requestCompleteLog();
|
||||
|
||||
add_task(function* setup() {
|
||||
yield openPreferencesViaOpenPreferencesAPI("applications", null, {leaveOpen: true});
|
||||
info("Preferences page opened on the applications pane.");
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function* getFeedItem() {
|
||||
win = gBrowser.selectedBrowser.contentWindow;
|
||||
|
||||
container = win.document.getElementById("handlersView");
|
||||
feedItem = container.querySelector("richlistitem[type='application/vnd.mozilla.maybe.feed']");
|
||||
Assert.ok(feedItem, "feedItem is present in handlersView.");
|
||||
})
|
||||
|
||||
add_task(function* selectInternalOptionForFeed() {
|
||||
// Select the item.
|
||||
feedItem.scrollIntoView();
|
||||
container.selectItem(feedItem);
|
||||
Assert.ok(feedItem.selected, "Should be able to select our item.");
|
||||
|
||||
// Wait for the menu.
|
||||
let list = yield waitForCondition(() =>
|
||||
win.document.getAnonymousElementByAttribute(feedItem, "class", "actionsMenu"));
|
||||
info("Got list after item was selected");
|
||||
|
||||
// Find the "Add Live bookmarks option".
|
||||
let chooseItems = list.getElementsByAttribute("action", Ci.nsIHandlerInfo.handleInternally);
|
||||
Assert.equal(chooseItems.length, 1, "Should only be one action to handle internally");
|
||||
|
||||
// Select the option.
|
||||
let cmdEvent = win.document.createEvent("xulcommandevent");
|
||||
cmdEvent.initCommandEvent("command", true, true, win, 0, false, false, false, false, null);
|
||||
chooseItems[0].dispatchEvent(cmdEvent);
|
||||
|
||||
// Check that we display the correct result.
|
||||
list = yield waitForCondition(() =>
|
||||
win.document.getAnonymousElementByAttribute(feedItem, "class", "actionsMenu"));
|
||||
info("Got list after item was selected");
|
||||
Assert.ok(list.selectedItem, "Should have a selected item.");
|
||||
Assert.equal(list.selectedItem.getAttribute("action"),
|
||||
Ci.nsIHandlerInfo.handleInternally,
|
||||
"Newly selected item should be the expected one.");
|
||||
});
|
||||
|
||||
// This builds on the previous selectInternalOptionForFeed task.
|
||||
add_task(function* reselectInternalOptionForFeed() {
|
||||
// Now select a different option in the list - use the pdf item as that doesn't
|
||||
// need to load any favicons.
|
||||
let anotherItem = container.querySelector("richlistitem[type='application/pdf']");
|
||||
|
||||
container.selectItem(anotherItem);
|
||||
|
||||
// Wait for the menu so that we don't hit race conditions.
|
||||
yield waitForCondition(() =>
|
||||
win.document.getAnonymousElementByAttribute(anotherItem, "class", "actionsMenu"));
|
||||
info("Got list after item was selected");
|
||||
|
||||
// Now select the feed item again, and check what it is displaying.
|
||||
container.selectItem(feedItem);
|
||||
|
||||
let list = yield waitForCondition(() =>
|
||||
win.document.getAnonymousElementByAttribute(feedItem, "class", "actionsMenu"));
|
||||
info("Got list after item was selected");
|
||||
|
||||
Assert.ok(list.selectedItem,
|
||||
"Should have a selected item");
|
||||
Assert.equal(list.selectedItem.getAttribute("action"),
|
||||
Ci.nsIHandlerInfo.handleInternally,
|
||||
"Selected item should still be the same as the previously selected item.");
|
||||
});
|
@ -98,6 +98,13 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"be": {
|
||||
"default": {
|
||||
"visibleDefaultEngines": [
|
||||
"yandex-by", "google", "ddg", "wikipedia-be", "wikipedia-be-tarask"
|
||||
]
|
||||
}
|
||||
},
|
||||
"bg": {
|
||||
"default": {
|
||||
"visibleDefaultEngines": [
|
||||
|
19
browser/locales/searchplugins/wikipedia-be-tarask.xml
Normal file
19
browser/locales/searchplugins/wikipedia-be-tarask.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
|
||||
<ShortName>Вікіпэдыя (be-tarask)</ShortName>
|
||||
<Description>Вікіпэдыя, вольная энцыкляпэдыя</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<Image width="16" height="16">resource://search-plugins/images/wikipedia.ico</Image>
|
||||
<Url type="application/x-suggestions+json" method="GET" template="https://be-tarask.wikipedia.org/w/api.php">
|
||||
<Param name="action" value="opensearch"/>
|
||||
<Param name="search" value="{searchTerms}"/>
|
||||
</Url>
|
||||
<Url type="text/html" method="GET" template="https://be-tarask.wikipedia.org/wiki/Спэцыяльныя:Пошук"
|
||||
resultdomain="wikipedia.org" rel="searchform">
|
||||
<Param name="search" value="{searchTerms}"/>
|
||||
<Param name="sourceid" value="Mozilla-search"/>
|
||||
</Url>
|
||||
</SearchPlugin>
|
19
browser/locales/searchplugins/wikipedia-be.xml
Normal file
19
browser/locales/searchplugins/wikipedia-be.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
|
||||
<ShortName>Вікіпедыя (be)</ShortName>
|
||||
<Description>Вікіпедыя, свабодная энцыклапедыя</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<Image width="16" height="16">resource://search-plugins/images/wikipedia.ico</Image>
|
||||
<Url type="application/x-suggestions+json" method="GET" template="https://be.wikipedia.org/w/api.php">
|
||||
<Param name="action" value="opensearch"/>
|
||||
<Param name="search" value="{searchTerms}"/>
|
||||
</Url>
|
||||
<Url type="text/html" method="GET" template="https://be.wikipedia.org/wiki/Адмысловае:Search"
|
||||
resultdomain="wikipedia.org" rel="searchform">
|
||||
<Param name="search" value="{searchTerms}"/>
|
||||
<Param name="sourceid" value="Mozilla-search"/>
|
||||
</Url>
|
||||
</SearchPlugin>
|
22
browser/locales/searchplugins/yandex-by.xml
Normal file
22
browser/locales/searchplugins/yandex-by.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
|
||||
<ShortName>Яндекс</ShortName>
|
||||
<Description>Пошук з дапамогаю Яндекс</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAB50lEQVQ4T43SvWsacRgH8OcPCITSLRQ6BSRL1gxZTNZQsgYC3QKunVoMnTKFhBQSnDqIUa5gxNbBCgriC4pv50sJ1lIR5SROpRVbz+O4b5/flbvedekJH+557nvfH8chdbvdIFMYPAgBICdqt9uKpmnw8huNRuDnX8J5QKvVgmEYnqiqClmWwZ113kmger0OXdf/Wv6EIb0BTo+AgB94ceDKJ5MJuHPOMwlUqVSwWq1sevQaxqvn0O5l6HdvgaMdV75cLtFoNMC9Xd6JisWiedNiPNuB9l4yZ+1jEvBvuXJBURRwL8YzUT6fx2KxsGHrKdQPCXNW794Bvieu3CLegrsnlM1mMZ/PbfqeH6vToDkvb2+Bx49cuWU2m4G7bUqn0xiPx7ZpqYRf29v4cXyMxf4+tLU1V24ZDAbgbptSqRSGw6HL9OwM37n4bXPTvP6bC7lcDtw9oWQyiX6/b/vMH1XZ2MAoEMDXqytM+QBnLtRqNXAvxjNRPB5Hr9ez9Q8PMfD50OM/2P3FBb7wAc680+mIMri3yzuRJEloNpsmORTCJy7INzd/9stLc7dyIZPJgDvnPJNA0WgU1WrVkxJ/4FgsBu6s804CRSKRh0KhgHK5/F+JRAL8fJBnslA4HH7NHhg8CDnLwm8IYz560xw92AAAAABJRU5ErkJggg==</Image>
|
||||
<Url type="application/x-suggestions+json" method="GET" template="https://suggest.yandex.net/suggest-ff.cgi">
|
||||
<Param name="part" value="{searchTerms}"/>
|
||||
</Url>
|
||||
<Url type="text/html" method="GET" template="https://yandex.by/yandsearch" resultdomain="yandex.by">
|
||||
<MozParam name="clid" condition="purpose" purpose="searchbar" value="2186618"/>
|
||||
<MozParam name="clid" condition="purpose" purpose="keyword" value="2186621"/>
|
||||
<MozParam name="clid" condition="purpose" purpose="contextmenu" value="2186623"/>
|
||||
<MozParam name="clid" condition="purpose" purpose="homepage" value="2186617"/>
|
||||
<MozParam name="clid" condition="purpose" purpose="newtab" value="2186620"/>
|
||||
<Param name="text" value="{searchTerms}"/>
|
||||
</Url>
|
||||
<SearchForm>https://www.yandex.by/</SearchForm>
|
||||
</SearchPlugin>
|
@ -220,23 +220,7 @@ this.ExtensionsUI = {
|
||||
|
||||
let perms = info.permissions || {hosts: [], permissions: []};
|
||||
|
||||
result.msgs = [];
|
||||
for (let permission of perms.permissions) {
|
||||
let key = `webextPerms.description.${permission}`;
|
||||
if (permission == "nativeMessaging") {
|
||||
let brandBundle = Services.strings.createBundle(BRAND_PROPERTIES);
|
||||
let appName = brandBundle.GetStringFromName("brandShortName");
|
||||
result.msgs.push(bundle.formatStringFromName(key, [appName], 1));
|
||||
} else {
|
||||
try {
|
||||
result.msgs.push(bundle.GetStringFromName(key));
|
||||
} catch (err) {
|
||||
// We deliberately do not include all permissions in the prompt.
|
||||
// So if we don't find one then just skip it.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// First classify our host permissions
|
||||
let allUrls = false, wildcards = [], sites = [];
|
||||
for (let permission of perms.hosts) {
|
||||
if (permission == "<all_urls>") {
|
||||
@ -256,6 +240,10 @@ this.ExtensionsUI = {
|
||||
}
|
||||
}
|
||||
|
||||
// Format the host permissions. If we have a wildcard for all urls,
|
||||
// a single string will suffice. Otherwise, show domain wildcards
|
||||
// first, then individual host permissions.
|
||||
result.msgs = [];
|
||||
if (allUrls) {
|
||||
result.msgs.push(bundle.GetStringFromName("webextPerms.hostDescription.allUrls"));
|
||||
} else {
|
||||
@ -283,6 +271,30 @@ this.ExtensionsUI = {
|
||||
"webextPerms.hostDescription.tooManySites");
|
||||
}
|
||||
|
||||
let permissionKey = perm => `webextPerms.description.${perm}`;
|
||||
|
||||
// Next, show the native messaging permission if it is present.
|
||||
const NATIVE_MSG_PERM = "nativeMessaging";
|
||||
if (perms.permissions.includes(NATIVE_MSG_PERM)) {
|
||||
let brandBundle = Services.strings.createBundle(BRAND_PROPERTIES);
|
||||
let appName = brandBundle.GetStringFromName("brandShortName");
|
||||
result.msgs.push(bundle.formatStringFromName(permissionKey(NATIVE_MSG_PERM), [appName], 1));
|
||||
}
|
||||
|
||||
// Finally, show remaining permissions, in any order.
|
||||
for (let permission of perms.permissions) {
|
||||
// Handled above
|
||||
if (permission == "nativeMessaging") {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
result.msgs.push(bundle.GetStringFromName(permissionKey(permission)));
|
||||
} catch (err) {
|
||||
// We deliberately do not include all permissions in the prompt.
|
||||
// So if we don't find one then just skip it.
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
|
@ -590,6 +590,8 @@ toolbarpaletteitem[place="palette"] > toolbaritem > toolbarbutton {
|
||||
|
||||
#PanelUI-footer-addons > toolbarbutton {
|
||||
background-color: #FFEFBF;
|
||||
/* Force border to override `#PanelUI-footer-addons > toolbarbutton` selector below */
|
||||
border-top: 1px solid hsl(45, 100%, 77%) !important;
|
||||
display: flex;
|
||||
flex: 1 1 0%;
|
||||
width: calc(@menuPanelWidth@ + 30px);
|
||||
|
@ -144,6 +144,7 @@ skip-if = os == "mac" # Bug 1245996 : click on scrollbar not working on OSX
|
||||
[browser_rules_filtereditor-revert-on-ESC.js]
|
||||
skip-if = (os == "win" && debug) # bug 963492: win.
|
||||
[browser_rules_grid-highlighter-on-navigate.js]
|
||||
[browser_rules_grid-highlighter-on-reload.js]
|
||||
[browser_rules_grid-toggle_01.js]
|
||||
[browser_rules_grid-toggle_01b.js]
|
||||
[browser_rules_grid-toggle_02.js]
|
||||
|
@ -0,0 +1,53 @@
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that a grid highlighter showing grid gaps can be displayed after reloading the
|
||||
// page (Bug 1342051).
|
||||
|
||||
const TEST_URI = `
|
||||
<style type='text/css'>
|
||||
#grid {
|
||||
display: grid;
|
||||
grid-gap: 10px;
|
||||
}
|
||||
</style>
|
||||
<div id="grid">
|
||||
<div id="cell1">cell1</div>
|
||||
<div id="cell2">cell2</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
add_task(function* () {
|
||||
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
|
||||
|
||||
info("Check that the grid highlighter can be displayed");
|
||||
yield checkGridHighlighter();
|
||||
|
||||
info("Close the toolbox before reloading the tab");
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
yield gDevTools.closeToolbox(target);
|
||||
|
||||
yield refreshTab(gBrowser.selectedTab);
|
||||
|
||||
info("Check that the grid highlighter can be displayed after reloading the page");
|
||||
yield checkGridHighlighter();
|
||||
});
|
||||
|
||||
function* checkGridHighlighter() {
|
||||
let {inspector, view} = yield openRuleView();
|
||||
let {highlighters} = view;
|
||||
|
||||
yield selectNode("#grid", inspector);
|
||||
let container = getRuleViewProperty(view, "#grid", "display").valueSpan;
|
||||
let gridToggle = container.querySelector(".ruleview-grid");
|
||||
|
||||
info("Toggling ON the CSS grid highlighter from the rule-view.");
|
||||
let onHighlighterShown = highlighters.once("grid-highlighter-shown");
|
||||
gridToggle.click();
|
||||
yield onHighlighterShown;
|
||||
|
||||
ok(highlighters.gridHighlighterShown, "CSS grid highlighter is shown.");
|
||||
}
|
@ -11,7 +11,7 @@ add_task(function* () {
|
||||
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let { gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let RequestListContextMenu = windowRequire(
|
||||
"devtools/client/netmonitor/request-list-context-menu");
|
||||
|
@ -12,7 +12,7 @@ add_task(function* () {
|
||||
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let { gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let RequestListContextMenu = windowRequire(
|
||||
"devtools/client/netmonitor/request-list-context-menu");
|
||||
|
@ -16,7 +16,7 @@ function* throttleUploadTest(actuallyThrottle) {
|
||||
|
||||
info("Starting test... (actuallyThrottle = " + actuallyThrottle + ")");
|
||||
|
||||
let { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
|
||||
let { gStore, windowRequire, NetMonitorController } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let RequestListContextMenu = windowRequire(
|
||||
"devtools/client/netmonitor/request-list-context-menu");
|
||||
|
@ -16,22 +16,25 @@
|
||||
<p>HAR POST data test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function post(aAddress, aData) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", aAddress, true);
|
||||
/* exported executeTest, executeTest2 */
|
||||
"use strict";
|
||||
|
||||
function post(address, data) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", address, true);
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
xhr.send(aData);
|
||||
xhr.send(data);
|
||||
}
|
||||
|
||||
function executeTest() {
|
||||
var url = "html_har_post-data-test-page.html";
|
||||
var data = "{'first': 'John', 'last': 'Doe'}";
|
||||
const url = "html_har_post-data-test-page.html";
|
||||
const data = "{'first': 'John', 'last': 'Doe'}";
|
||||
post(url, data);
|
||||
}
|
||||
|
||||
function executeTest2(size) {
|
||||
var url = "html_har_post-data-test-page.html";
|
||||
var data = "x".repeat(size);
|
||||
const url = "html_har_post-data-test-page.html";
|
||||
const data = "x".repeat(size);
|
||||
post(url, data);
|
||||
}
|
||||
</script>
|
||||
|
@ -66,7 +66,7 @@ add_task(function* () {
|
||||
info("Waiting for one network request");
|
||||
yield waitForNetworkEvents(monitor, 1);
|
||||
console.log(requestsContainer.scrollHeight);
|
||||
console.log(requestsContainer.clientHeight)
|
||||
console.log(requestsContainer.clientHeight);
|
||||
if (requestsContainer.scrollHeight > requestsContainer.clientHeight) {
|
||||
info("The list is long enough, returning");
|
||||
return;
|
||||
|
@ -38,14 +38,14 @@ const EXPECTED_REQUESTS = [
|
||||
url: EXAMPLE_URL + "xhr_request",
|
||||
causeType: "xhr",
|
||||
causeUri: CAUSE_URL,
|
||||
stack: [{ fn: "performXhrRequest", file: CAUSE_FILE_NAME, line: 22 }]
|
||||
stack: [{ fn: "performXhrRequest", file: CAUSE_FILE_NAME, line: 24 }]
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
url: EXAMPLE_URL + "fetch_request",
|
||||
causeType: "fetch",
|
||||
causeUri: CAUSE_URL,
|
||||
stack: [{ fn: "performFetchRequest", file: CAUSE_FILE_NAME, line: 26 }]
|
||||
stack: [{ fn: "performFetchRequest", file: CAUSE_FILE_NAME, line: 28 }]
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
@ -53,8 +53,8 @@ const EXPECTED_REQUESTS = [
|
||||
causeType: "fetch",
|
||||
causeUri: CAUSE_URL,
|
||||
stack: [
|
||||
{ fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 38 },
|
||||
{ fn: null, file: CAUSE_FILE_NAME, line: 37, asyncCause: "promise callback" },
|
||||
{ fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 40 },
|
||||
{ fn: null, file: CAUSE_FILE_NAME, line: 39, asyncCause: "promise callback" },
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -63,8 +63,8 @@ const EXPECTED_REQUESTS = [
|
||||
causeType: "fetch",
|
||||
causeUri: CAUSE_URL,
|
||||
stack: [
|
||||
{ fn: "performTimeoutFetchRequest", file: CAUSE_FILE_NAME, line: 40 },
|
||||
{ fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 39,
|
||||
{ fn: "performTimeoutFetchRequest", file: CAUSE_FILE_NAME, line: 42 },
|
||||
{ fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 41,
|
||||
asyncCause: "setTimeout handler" },
|
||||
]
|
||||
},
|
||||
@ -73,7 +73,7 @@ const EXPECTED_REQUESTS = [
|
||||
url: EXAMPLE_URL + "beacon_request",
|
||||
causeType: "beacon",
|
||||
causeUri: CAUSE_URL,
|
||||
stack: [{ fn: "performBeaconRequest", file: CAUSE_FILE_NAME, line: 30 }]
|
||||
stack: [{ fn: "performBeaconRequest", file: CAUSE_FILE_NAME, line: 32 }]
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -67,7 +67,6 @@ add_task(function* () {
|
||||
is(rows[0].querySelectorAll("span")[1].textContent, "label2header",
|
||||
"The second column of the header displays the correct text.");
|
||||
|
||||
|
||||
ok(rows[1].querySelector(".table-chart-row-box.chart-colored-blob"),
|
||||
"A colored blob exists for the firt row.");
|
||||
is(rows[1].querySelectorAll("span")[0].getAttribute("name"), "label1",
|
||||
|
@ -14,7 +14,6 @@ add_task(function* () {
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
|
||||
let detailsPane = document.querySelector("#details-pane");
|
||||
let detailsPanelToggleButton = document.querySelector(".network-details-panel-toggle");
|
||||
let clearButton = document.querySelector(".requests-list-clear-button");
|
||||
|
||||
|
@ -41,8 +41,9 @@ add_task(function* () {
|
||||
fullMimeType: "text/xml; charset=utf-8",
|
||||
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 42),
|
||||
time: true
|
||||
});
|
||||
verifyRequestItemTarget(
|
||||
}
|
||||
);
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
getDisplayedRequests(gStore.getState()),
|
||||
getSortedRequests(gStore.getState()).get(1),
|
||||
@ -55,8 +56,9 @@ add_task(function* () {
|
||||
fullMimeType: "text/css; charset=utf-8",
|
||||
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 34),
|
||||
time: true
|
||||
});
|
||||
verifyRequestItemTarget(
|
||||
}
|
||||
);
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
getDisplayedRequests(gStore.getState()),
|
||||
getSortedRequests(gStore.getState()).get(2),
|
||||
@ -69,8 +71,9 @@ add_task(function* () {
|
||||
fullMimeType: "application/javascript; charset=utf-8",
|
||||
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 34),
|
||||
time: true
|
||||
});
|
||||
verifyRequestItemTarget(
|
||||
}
|
||||
);
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
getDisplayedRequests(gStore.getState()),
|
||||
getSortedRequests(gStore.getState()).get(3),
|
||||
@ -83,26 +86,30 @@ add_task(function* () {
|
||||
fullMimeType: "application/json; charset=utf-8",
|
||||
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
|
||||
time: true
|
||||
});
|
||||
verifyRequestItemTarget(
|
||||
}
|
||||
);
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
getDisplayedRequests(gStore.getState()),
|
||||
getSortedRequests(gStore.getState()).get(4),
|
||||
"GET",
|
||||
CONTENT_TYPE_SJS + "?fmt=bogus", {
|
||||
CONTENT_TYPE_SJS + "?fmt=bogus",
|
||||
{
|
||||
status: 404,
|
||||
statusText: "Not Found",
|
||||
type: "html",
|
||||
fullMimeType: "text/html; charset=utf-8",
|
||||
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 24),
|
||||
time: true
|
||||
});
|
||||
verifyRequestItemTarget(
|
||||
}
|
||||
);
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
getDisplayedRequests(gStore.getState()),
|
||||
getSortedRequests(gStore.getState()).get(5),
|
||||
"GET",
|
||||
TEST_IMAGE, {
|
||||
TEST_IMAGE,
|
||||
{
|
||||
fuzzyUrl: true,
|
||||
status: 200,
|
||||
statusText: "OK",
|
||||
@ -110,13 +117,15 @@ add_task(function* () {
|
||||
fullMimeType: "image/png",
|
||||
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 580),
|
||||
time: true
|
||||
});
|
||||
verifyRequestItemTarget(
|
||||
}
|
||||
);
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
getDisplayedRequests(gStore.getState()),
|
||||
getSortedRequests(gStore.getState()).get(6),
|
||||
"GET",
|
||||
CONTENT_TYPE_SJS + "?fmt=gzip", {
|
||||
CONTENT_TYPE_SJS + "?fmt=gzip",
|
||||
{
|
||||
status: 200,
|
||||
statusText: "OK",
|
||||
type: "plain",
|
||||
@ -124,7 +133,8 @@ add_task(function* () {
|
||||
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 73),
|
||||
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 10.73),
|
||||
time: true
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
yield selectIndexAndWaitForEditor(0);
|
||||
yield testResponseTab("xml");
|
||||
|
@ -41,8 +41,7 @@ add_task(function* () {
|
||||
header("Cache-Control: no-cache")
|
||||
];
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let { document } = monitor.panelWin;
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, function* (url) {
|
||||
|
@ -11,7 +11,7 @@ add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let { document } = monitor.panelWin;
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
@ -29,7 +29,7 @@ add_task(function* () {
|
||||
// toolbox.doc
|
||||
monitor.toolbox.doc
|
||||
.querySelector("#request-list-context-copy-image-as-data-uri").click();
|
||||
}, TEST_IMAGE_DATA_URI);
|
||||
}, TEST_IMAGE_DATA_URI);
|
||||
|
||||
ok(true, "Clipboard contains the currently selected image as data uri.");
|
||||
|
||||
|
@ -13,7 +13,7 @@ add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CURL_UTILS_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, gStore, windowRequire, gNetwork } = monitor.panelWin;
|
||||
let { gStore, windowRequire, gNetwork } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let { getSortedRequests } = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
|
@ -13,7 +13,6 @@ add_task(function* () {
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
|
@ -30,7 +30,8 @@ const REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS = REQUESTS_WITH_MEDIA_AND_FLASH.conca
|
||||
]);
|
||||
|
||||
add_task(function* () {
|
||||
Services.prefs.setCharPref("devtools.netmonitor.filters", '["bogus", "js", "alsobogus"]');
|
||||
Services.prefs.setCharPref("devtools.netmonitor.filters",
|
||||
'["bogus", "js", "alsobogus"]');
|
||||
|
||||
let { monitor } = yield initNetMonitor(FILTERING_URL);
|
||||
info("Starting test... ");
|
||||
|
@ -49,8 +49,9 @@ add_task(function* () {
|
||||
yield teardown(monitor);
|
||||
|
||||
function testStatus() {
|
||||
let value = document.querySelector(".requests-list-network-summary-button").textContent;
|
||||
info("Current summary: " + value);
|
||||
let value = document.querySelector(".requests-list-network-summary-button")
|
||||
.textContent;
|
||||
info("Current summary: " + value);
|
||||
|
||||
let state = gStore.getState();
|
||||
let totalRequestsCount = state.requests.requests.size;
|
||||
|
@ -39,14 +39,14 @@ const EXPECTED_REQUESTS_TOP = [
|
||||
url: EXAMPLE_URL + "xhr_request",
|
||||
causeType: "xhr",
|
||||
causeUri: TOP_URL,
|
||||
stack: [{ fn: "performXhrRequest", file: TOP_FILE_NAME, line: 23 }]
|
||||
stack: [{ fn: "performXhrRequest", file: TOP_FILE_NAME, line: 25 }]
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
url: EXAMPLE_URL + "fetch_request",
|
||||
causeType: "fetch",
|
||||
causeUri: TOP_URL,
|
||||
stack: [{ fn: "performFetchRequest", file: TOP_FILE_NAME, line: 27 }]
|
||||
stack: [{ fn: "performFetchRequest", file: TOP_FILE_NAME, line: 29 }]
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
@ -54,8 +54,8 @@ const EXPECTED_REQUESTS_TOP = [
|
||||
causeType: "fetch",
|
||||
causeUri: TOP_URL,
|
||||
stack: [
|
||||
{ fn: "performPromiseFetchRequest", file: TOP_FILE_NAME, line: 39 },
|
||||
{ fn: null, file: TOP_FILE_NAME, line: 38, asyncCause: "promise callback" },
|
||||
{ fn: "performPromiseFetchRequest", file: TOP_FILE_NAME, line: 41 },
|
||||
{ fn: null, file: TOP_FILE_NAME, line: 40, asyncCause: "promise callback" },
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -64,8 +64,8 @@ const EXPECTED_REQUESTS_TOP = [
|
||||
causeType: "fetch",
|
||||
causeUri: TOP_URL,
|
||||
stack: [
|
||||
{ fn: "performTimeoutFetchRequest", file: TOP_FILE_NAME, line: 41 },
|
||||
{ fn: "performPromiseFetchRequest", file: TOP_FILE_NAME, line: 40,
|
||||
{ fn: "performTimeoutFetchRequest", file: TOP_FILE_NAME, line: 43 },
|
||||
{ fn: "performPromiseFetchRequest", file: TOP_FILE_NAME, line: 42,
|
||||
asyncCause: "setTimeout handler" },
|
||||
]
|
||||
},
|
||||
@ -74,7 +74,7 @@ const EXPECTED_REQUESTS_TOP = [
|
||||
url: EXAMPLE_URL + "beacon_request",
|
||||
causeType: "beacon",
|
||||
causeUri: TOP_URL,
|
||||
stack: [{ fn: "performBeaconRequest", file: TOP_FILE_NAME, line: 31 }]
|
||||
stack: [{ fn: "performBeaconRequest", file: TOP_FILE_NAME, line: 33 }]
|
||||
},
|
||||
];
|
||||
|
||||
@ -105,14 +105,14 @@ const EXPECTED_REQUESTS_SUB = [
|
||||
url: EXAMPLE_URL + "xhr_request",
|
||||
causeType: "xhr",
|
||||
causeUri: SUB_URL,
|
||||
stack: [{ fn: "performXhrRequest", file: SUB_FILE_NAME, line: 22 }]
|
||||
stack: [{ fn: "performXhrRequest", file: SUB_FILE_NAME, line: 24 }]
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
url: EXAMPLE_URL + "fetch_request",
|
||||
causeType: "fetch",
|
||||
causeUri: SUB_URL,
|
||||
stack: [{ fn: "performFetchRequest", file: SUB_FILE_NAME, line: 26 }]
|
||||
stack: [{ fn: "performFetchRequest", file: SUB_FILE_NAME, line: 28 }]
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
@ -120,8 +120,8 @@ const EXPECTED_REQUESTS_SUB = [
|
||||
causeType: "fetch",
|
||||
causeUri: SUB_URL,
|
||||
stack: [
|
||||
{ fn: "performPromiseFetchRequest", file: SUB_FILE_NAME, line: 38 },
|
||||
{ fn: null, file: SUB_FILE_NAME, line: 37, asyncCause: "promise callback" },
|
||||
{ fn: "performPromiseFetchRequest", file: SUB_FILE_NAME, line: 40 },
|
||||
{ fn: null, file: SUB_FILE_NAME, line: 39, asyncCause: "promise callback" },
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -130,8 +130,8 @@ const EXPECTED_REQUESTS_SUB = [
|
||||
causeType: "fetch",
|
||||
causeUri: SUB_URL,
|
||||
stack: [
|
||||
{ fn: "performTimeoutFetchRequest", file: SUB_FILE_NAME, line: 40 },
|
||||
{ fn: "performPromiseFetchRequest", file: SUB_FILE_NAME, line: 39,
|
||||
{ fn: "performTimeoutFetchRequest", file: SUB_FILE_NAME, line: 42 },
|
||||
{ fn: "performPromiseFetchRequest", file: SUB_FILE_NAME, line: 41,
|
||||
asyncCause: "setTimeout handler" },
|
||||
]
|
||||
},
|
||||
@ -140,7 +140,7 @@ const EXPECTED_REQUESTS_SUB = [
|
||||
url: EXAMPLE_URL + "beacon_request",
|
||||
causeType: "beacon",
|
||||
causeUri: SUB_URL,
|
||||
stack: [{ fn: "performBeaconRequest", file: SUB_FILE_NAME, line: 30 }]
|
||||
stack: [{ fn: "performBeaconRequest", file: SUB_FILE_NAME, line: 32 }]
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -16,7 +16,6 @@ add_task(function* () {
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
@ -40,17 +39,19 @@ add_task(function* () {
|
||||
* and only if a header is documented in MDN.
|
||||
*/
|
||||
function testShowLearnMore(data) {
|
||||
document.querySelectorAll(".properties-view .treeRow.stringRow").forEach((rowEl, index) => {
|
||||
let headerName = rowEl.querySelectorAll(".treeLabelCell .treeLabel")[0].textContent;
|
||||
let selector = ".properties-view .treeRow.stringRow";
|
||||
document.querySelectorAll(selector).forEach((rowEl, index) => {
|
||||
let headerName = rowEl.querySelectorAll(".treeLabelCell .treeLabel")[0]
|
||||
.textContent;
|
||||
let headerDocURL = getHeadersURL(headerName);
|
||||
let learnMoreEl = rowEl.querySelectorAll(".treeValueCell .learn-more-link");
|
||||
|
||||
if (headerDocURL === null) {
|
||||
ok(learnMoreEl.length === 0,
|
||||
"undocumented header does not include a \"Learn More\" button");
|
||||
"undocumented header does not include a \"Learn More\" button");
|
||||
} else {
|
||||
ok(learnMoreEl[0].getAttribute("title") === headerDocURL,
|
||||
"documented header includes a \"Learn More\" button with a link to MDN");
|
||||
"documented header includes a \"Learn More\" button with a link to MDN");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -64,7 +64,8 @@ add_task(function* () {
|
||||
function checkImageThumbnail() {
|
||||
is(document.querySelectorAll(".requests-list-icon[data-type=thumbnail]").length, 1,
|
||||
"There should be only one image request with a thumbnail displayed.");
|
||||
is(document.querySelector(".requests-list-icon[data-type=thumbnail]").src, TEST_IMAGE_DATA_URI,
|
||||
is(document.querySelector(".requests-list-icon[data-type=thumbnail]").src,
|
||||
TEST_IMAGE_DATA_URI,
|
||||
"The image requests-list-icon thumbnail is displayed correctly.");
|
||||
is(document.querySelector(".requests-list-icon[data-type=thumbnail]").hidden, false,
|
||||
"The image requests-list-icon thumbnail should not be hidden.");
|
||||
|
@ -16,10 +16,6 @@ add_task(function* test() {
|
||||
let { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let { ACTIVITY_TYPE, EVENTS } = windowRequire("devtools/client/netmonitor/constants");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
let toolboxDoc = monitor.toolbox.doc;
|
||||
|
||||
gStore.dispatch(Actions.batchEnable(false));
|
||||
@ -31,14 +27,12 @@ add_task(function* test() {
|
||||
yield onThumbnail;
|
||||
|
||||
info("Checking the image thumbnail after a few requests were made...");
|
||||
yield showTooltipAndVerify(toolboxDoc,
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[0]);
|
||||
|
||||
// Hide tooltip before next test, to avoid the situation that tooltip covers
|
||||
// the icon for the request of the next test.
|
||||
info("Checking the image thumbnail gets hidden...");
|
||||
yield hideTooltipAndVerify(monitor.toolbox.doc,
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield hideTooltipAndVerify(document.querySelectorAll(".request-list-item")[0]);
|
||||
|
||||
// +1 extra document reload
|
||||
onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS + 1);
|
||||
@ -51,12 +45,12 @@ add_task(function* test() {
|
||||
yield onThumbnail;
|
||||
|
||||
info("Checking the image thumbnail after a reload.");
|
||||
yield showTooltipAndVerify(toolboxDoc,
|
||||
document.querySelectorAll(".request-list-item")[1]);
|
||||
yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[1]);
|
||||
|
||||
info("Checking if the image thumbnail is hidden when mouse leaves the menu widget");
|
||||
let requestsListContents = document.querySelector(".requests-list-contents");
|
||||
EventUtils.synthesizeMouse(requestsListContents, 0, 0, { type: "mouseout" }, monitor.panelWin);
|
||||
EventUtils.synthesizeMouse(requestsListContents, 0, 0, { type: "mouseout" },
|
||||
monitor.panelWin);
|
||||
yield waitUntil(() => !toolboxDoc.querySelector(".tooltip-container.tooltip-visible"));
|
||||
|
||||
yield teardown(monitor);
|
||||
@ -71,9 +65,9 @@ add_task(function* test() {
|
||||
* Show a tooltip on the {target} and verify that it was displayed
|
||||
* with the expected content.
|
||||
*/
|
||||
function* showTooltipAndVerify(toolboxDoc, target) {
|
||||
function* showTooltipAndVerify(target) {
|
||||
let anchor = target.querySelector(".requests-list-file");
|
||||
yield showTooltipOn(toolboxDoc, anchor);
|
||||
yield showTooltipOn(anchor);
|
||||
|
||||
info("Tooltip was successfully opened for the image request.");
|
||||
is(toolboxDoc.querySelector(".tooltip-panel img").src, TEST_IMAGE_DATA_URI,
|
||||
@ -84,7 +78,7 @@ add_task(function* test() {
|
||||
* Trigger a tooltip over an element by sending mousemove event.
|
||||
* @return a promise that resolves when the tooltip is shown
|
||||
*/
|
||||
function* showTooltipOn(toolboxDoc, element) {
|
||||
function* showTooltipOn(element) {
|
||||
let win = element.ownerDocument.defaultView;
|
||||
EventUtils.synthesizeMouseAtCenter(element, { type: "mousemove" }, win);
|
||||
yield waitUntil(() => toolboxDoc.querySelector(".tooltip-panel img"));
|
||||
@ -93,13 +87,14 @@ add_task(function* test() {
|
||||
/**
|
||||
* Hide a tooltip on the {target} and verify that it was closed.
|
||||
*/
|
||||
function* hideTooltipAndVerify(toolboxDoc, target) {
|
||||
function* hideTooltipAndVerify(target) {
|
||||
// Hovering over the "method" column hides the tooltip.
|
||||
let anchor = target.querySelector(".requests-list-method");
|
||||
let win = anchor.ownerDocument.defaultView;
|
||||
EventUtils.synthesizeMouseAtCenter(anchor, { type: "mousemove" }, win);
|
||||
|
||||
yield waitUntil(() => !toolboxDoc.querySelector(".tooltip-container.tooltip-visible"));
|
||||
yield waitUntil(
|
||||
() => !toolboxDoc.querySelector(".tooltip-container.tooltip-visible"));
|
||||
info("Tooltip was successfully closed.");
|
||||
}
|
||||
});
|
||||
|
@ -15,10 +15,6 @@ add_task(function* () {
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
gStore.dispatch(Actions.batchEnable(false));
|
||||
|
||||
|
@ -13,10 +13,6 @@ add_task(function* () {
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
gStore.dispatch(Actions.batchEnable(false));
|
||||
|
||||
|
@ -12,7 +12,7 @@ add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SINGLE_GET_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, windowRequire } = monitor.panelWin;
|
||||
let { document } = monitor.panelWin;
|
||||
|
||||
Services.prefs.setBoolPref("devtools.webconsole.persistlog", false);
|
||||
|
||||
|
@ -44,8 +44,9 @@ add_task(function* () {
|
||||
fullMimeType: "text/plain; charset=utf-8",
|
||||
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 12),
|
||||
time: true
|
||||
});
|
||||
verifyRequestItemTarget(
|
||||
}
|
||||
);
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
getDisplayedRequests(gStore.getState()),
|
||||
getSortedRequests(gStore.getState()).get(1),
|
||||
@ -58,7 +59,8 @@ add_task(function* () {
|
||||
fullMimeType: "text/plain; charset=utf-8",
|
||||
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 12),
|
||||
time: true
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Wait for all tree sections updated by react
|
||||
wait = waitForDOM(document, "#params-panel .tree-section", 2);
|
||||
@ -107,15 +109,18 @@ add_task(function* () {
|
||||
L10N.getStr(type == "urlencoded" ? "paramsFormData" : "paramsPostPayload"),
|
||||
"The post section doesn't have the correct title.");
|
||||
|
||||
let labels = tabpanel.querySelectorAll("tr:not(.tree-section) .treeLabelCell .treeLabel");
|
||||
let values = tabpanel.querySelectorAll("tr:not(.tree-section) .treeValueCell .objectBox");
|
||||
let labels = tabpanel
|
||||
.querySelectorAll("tr:not(.tree-section) .treeLabelCell .treeLabel");
|
||||
let values = tabpanel
|
||||
.querySelectorAll("tr:not(.tree-section) .treeValueCell .objectBox");
|
||||
|
||||
is(labels[0].textContent, "foo", "The first query param name was incorrect.");
|
||||
is(values[0].textContent, "\"bar\"", "The first query param value was incorrect.");
|
||||
is(labels[1].textContent, "baz", "The second query param name was incorrect.");
|
||||
is(values[1].textContent, "\"42\"", "The second query param value was incorrect.");
|
||||
is(labels[2].textContent, "type", "The third query param name was incorrect.");
|
||||
is(values[2].textContent, "\"" + type + "\"", "The third query param value was incorrect.");
|
||||
is(values[2].textContent, "\"" + type + "\"",
|
||||
"The third query param value was incorrect.");
|
||||
|
||||
if (type == "urlencoded") {
|
||||
checkVisibility("params");
|
||||
@ -129,7 +134,8 @@ add_task(function* () {
|
||||
|
||||
is(labels.length, 3, "There should be 3 param values displayed in this tabpanel.");
|
||||
|
||||
let text = editorFrames[0].contentDocument.querySelector(".CodeMirror-code").textContent;
|
||||
let text = editorFrames[0].contentDocument.querySelector(".CodeMirror-code")
|
||||
.textContent;
|
||||
|
||||
ok(text.includes("Content-Disposition: form-data; name=\"text\""),
|
||||
"The text shown in the source editor is incorrect (1.1).");
|
||||
|
@ -16,10 +16,6 @@ add_task(function* () {
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
gStore.dispatch(Actions.batchEnable(false));
|
||||
|
||||
|
@ -11,7 +11,8 @@ add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { getRequestFilterTypes } = monitor.panelWin
|
||||
.windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
let Actions = monitor.panelWin.windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let Actions = monitor.panelWin
|
||||
.windowRequire("devtools/client/netmonitor/actions/index");
|
||||
info("Starting test... ");
|
||||
|
||||
// This test reopens the network monitor a bunch of times, for different
|
||||
@ -22,7 +23,8 @@ add_task(function* () {
|
||||
// since the tool is reopened a bunch of times during this test
|
||||
// and the instances will differ.
|
||||
let getDoc = () => monitor.panelWin.document;
|
||||
let getPrefs = () => monitor.panelWin.windowRequire("devtools/client/netmonitor/utils/prefs").Prefs;
|
||||
let getPrefs = () => monitor.panelWin
|
||||
.windowRequire("devtools/client/netmonitor/utils/prefs").Prefs;
|
||||
let getStore = () => monitor.panelWin.gStore;
|
||||
let getState = () => getStore().getState();
|
||||
|
||||
@ -44,15 +46,19 @@ add_task(function* () {
|
||||
newValue: ~~(Math.random() * 200 + 100),
|
||||
validateValue: () =>
|
||||
getDoc().querySelector(".monitor-panel .split-box .controlled").clientWidth,
|
||||
modifyFrontend: (value) =>
|
||||
getDoc().querySelector(".monitor-panel .split-box .controlled").style.width = `${value}px`,
|
||||
modifyFrontend: function (value) {
|
||||
getDoc().querySelector(".monitor-panel .split-box .controlled")
|
||||
.style.width = `${value}px`;
|
||||
}
|
||||
},
|
||||
networkDetailsHeight: {
|
||||
newValue: ~~(Math.random() * 300 + 100),
|
||||
validateValue: () =>
|
||||
getDoc().querySelector(".monitor-panel .split-box .controlled").clientHeight,
|
||||
modifyFrontend: (value) =>
|
||||
getDoc().querySelector(".monitor-panel .split-box .controlled").style.height = `${value}px`
|
||||
modifyFrontend: function (value) {
|
||||
getDoc().querySelector(".monitor-panel .split-box .controlled")
|
||||
.style.height = `${value}px`;
|
||||
}
|
||||
}
|
||||
/* add more prefs here... */
|
||||
};
|
||||
@ -80,7 +86,7 @@ add_task(function* () {
|
||||
for (let name in prefsToCheck) {
|
||||
if ((isVerticalSplitter && name === "networkDetailsHeight") ||
|
||||
(!isVerticalSplitter && name === "networkDetailsWidth")) {
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
|
||||
let currentValue = getPrefs()[name];
|
||||
@ -100,7 +106,7 @@ add_task(function* () {
|
||||
for (let name in prefsToCheck) {
|
||||
if ((isVerticalSplitter && name === "networkDetailsHeight") ||
|
||||
(!isVerticalSplitter && name === "networkDetailsWidth")) {
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
|
||||
let currentValue = getPrefs()[name];
|
||||
@ -127,7 +133,7 @@ add_task(function* () {
|
||||
for (let name in prefsToCheck) {
|
||||
if ((isVerticalSplitter && name === "networkDetailsHeight") ||
|
||||
(!isVerticalSplitter && name === "networkDetailsWidth")) {
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
|
||||
let currentValue = getPrefs()[name];
|
||||
@ -150,7 +156,7 @@ add_task(function* () {
|
||||
for (let name in prefsToCheck) {
|
||||
if ((isVerticalSplitter && name === "networkDetailsHeight") ||
|
||||
(!isVerticalSplitter && name === "networkDetailsWidth")) {
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
|
||||
let currentValue = getPrefs()[name];
|
||||
|
@ -11,7 +11,7 @@ add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, windowRequire } = monitor.panelWin;
|
||||
let { document } = monitor.panelWin;
|
||||
let button = document.querySelector(".requests-list-reload-notice-button");
|
||||
button.click();
|
||||
|
||||
|
@ -74,7 +74,7 @@ add_task(function* () {
|
||||
/*
|
||||
* Test that the New Request form was populated correctly
|
||||
*/
|
||||
function testCustomForm(data) {
|
||||
function* testCustomForm(data) {
|
||||
yield waitUntil(() => document.querySelector(".custom-request-panel"));
|
||||
is(document.getElementById("custom-method-value").value, data.method,
|
||||
"new request form showing correct method");
|
||||
|
@ -12,10 +12,9 @@ add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CORS_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let { gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
@ -44,7 +43,7 @@ add_task(function* () {
|
||||
let onRequests = waitForNetworkEvents(monitor, 1, 0);
|
||||
ITEMS.forEach((item) => {
|
||||
info(`Selecting the ${item.method} request`);
|
||||
gStore.dispatch(Actions.selectRequest(item.id))
|
||||
gStore.dispatch(Actions.selectRequest(item.id));
|
||||
|
||||
info("Cloning the selected request into a custom clone");
|
||||
gStore.dispatch(Actions.cloneSelectedRequest());
|
||||
|
@ -11,10 +11,9 @@ add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_SJS);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
|
||||
let { gStore, windowRequire, NetMonitorController } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
|
@ -46,8 +46,8 @@ add_task(function* () {
|
||||
|
||||
// Host
|
||||
is(tabpanel.querySelectorAll(".treeLabel.objectLabel")[1].textContent,
|
||||
"Host example.com:",
|
||||
"Label has the expected value.");
|
||||
"Host example.com:",
|
||||
"Label has the expected value.");
|
||||
is(textboxes[2].value, "Disabled", "Label has the expected value.");
|
||||
is(textboxes[3].value, "Disabled", "Label has the expected value.");
|
||||
|
||||
@ -56,7 +56,8 @@ add_task(function* () {
|
||||
is(textboxes[5].value, "<Not Available>", "Label has the expected value.");
|
||||
is(textboxes[6].value, "<Not Available>", "Label has the expected value.");
|
||||
|
||||
is(textboxes[7].value, "Temporary Certificate Authority", "Label has the expected value.");
|
||||
is(textboxes[7].value, "Temporary Certificate Authority",
|
||||
"Label has the expected value.");
|
||||
is(textboxes[8].value, "Mozilla Testing", "Label has the expected value.");
|
||||
is(textboxes[9].value, "Profile Guided Optimization", "Label has the expected value.");
|
||||
|
||||
|
@ -11,10 +11,6 @@ add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
gStore.dispatch(Actions.batchEnable(false));
|
||||
|
||||
@ -54,6 +50,7 @@ add_task(function* () {
|
||||
info("Clicking security icon of the first request and waiting for panel update.");
|
||||
EventUtils.synthesizeMouseAtCenter(icon, {}, monitor.panelWin);
|
||||
|
||||
ok(document.querySelector("#security-tab[aria-selected=true]"), "Security tab is selected.");
|
||||
ok(document.querySelector("#security-tab[aria-selected=true]"),
|
||||
"Security tab is selected.");
|
||||
}
|
||||
});
|
||||
|
@ -12,10 +12,6 @@ add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
gStore.dispatch(Actions.batchEnable(false));
|
||||
|
||||
@ -25,13 +21,13 @@ add_task(function* () {
|
||||
});
|
||||
yield wait;
|
||||
|
||||
is(gStore.getState().requests.requests.size, 2, "There were two requests due to redirect.");
|
||||
is(gStore.getState().requests.requests.size, 2,
|
||||
"There were two requests due to redirect.");
|
||||
|
||||
let initial = getSortedRequests(gStore.getState()).get(0);
|
||||
let redirect = getSortedRequests(gStore.getState()).get(1);
|
||||
|
||||
let initialSecurityIcon = document.querySelectorAll(".requests-security-state-icon")[0];
|
||||
let redirectSecurityIcon = document.querySelectorAll(".requests-security-state-icon")[1];
|
||||
let [
|
||||
initialSecurityIcon,
|
||||
redirectSecurityIcon,
|
||||
] = document.querySelectorAll(".requests-security-state-icon");
|
||||
|
||||
ok(initialSecurityIcon.classList.contains("security-state-insecure"),
|
||||
"Initial request was marked insecure.");
|
||||
|
@ -19,10 +19,6 @@ add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
gStore.dispatch(Actions.batchEnable(false));
|
||||
|
||||
|
@ -34,7 +34,9 @@ add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let { getSelectedRequest } = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
let {
|
||||
getSelectedRequest,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
gStore.dispatch(Actions.batchEnable(false));
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SEND_BEACON_URL);
|
||||
let { gStore, windowRequire } = monitor.panelWin;
|
||||
let { gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let { getSortedRequests } = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
|
@ -223,12 +223,15 @@ function test() {
|
||||
|
||||
ok(requestItem.responseContent,
|
||||
"There should be a responseContent data available.");
|
||||
// eslint-disable-next-line mozilla/no-cpows-in-tests
|
||||
is(requestItem.responseContent.content.mimeType,
|
||||
"text/plain; charset=utf-8",
|
||||
"The responseContent data has an incorrect |content.mimeType| property.");
|
||||
// eslint-disable-next-line mozilla/no-cpows-in-tests
|
||||
is(requestItem.responseContent.content.text,
|
||||
"Hello world!",
|
||||
"The responseContent data has an incorrect |content.text| property.");
|
||||
// eslint-disable-next-line mozilla/no-cpows-in-tests
|
||||
is(requestItem.responseContent.content.size,
|
||||
12,
|
||||
"The responseContent data has an incorrect |content.size| property.");
|
||||
|
@ -13,13 +13,14 @@ add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_SJS);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let { document, gStore, windowRequire, NetMonitorView } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSelectedRequest,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
let Editor = require("devtools/client/sourceeditor/editor");
|
||||
|
||||
gStore.dispatch(Actions.batchEnable(false));
|
||||
|
||||
|
@ -18,11 +18,6 @@ add_task(function* () {
|
||||
|
||||
let { document, gStore, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
|
||||
let {
|
||||
getDisplayedRequests,
|
||||
getSortedRequests,
|
||||
} = windowRequire("devtools/client/netmonitor/selectors/index");
|
||||
|
||||
gStore.dispatch(Actions.batchEnable(false));
|
||||
|
||||
|
@ -27,21 +27,25 @@ add_task(function* () {
|
||||
info("Waiting for placeholder to display");
|
||||
|
||||
yield waitUntil(
|
||||
() => document.querySelectorAll(".pie-chart-container[placeholder=true]").length == 2);
|
||||
() => document.querySelectorAll(".pie-chart-container[placeholder=true]")
|
||||
.length == 2);
|
||||
ok(true, "Two placeholder pie charts appear to be rendered correctly.");
|
||||
|
||||
yield waitUntil(
|
||||
() => document.querySelectorAll(".table-chart-container[placeholder=true]").length == 2);
|
||||
() => document.querySelectorAll(".table-chart-container[placeholder=true]")
|
||||
.length == 2);
|
||||
ok(true, "Two placeholde table charts appear to be rendered correctly.");
|
||||
|
||||
info("Waiting for chart to display");
|
||||
|
||||
yield waitUntil(
|
||||
() => document.querySelectorAll(".pie-chart-container:not([placeholder=true])").length == 2);
|
||||
() => document.querySelectorAll(".pie-chart-container:not([placeholder=true])")
|
||||
.length == 2);
|
||||
ok(true, "Two real pie charts appear to be rendered correctly.");
|
||||
|
||||
yield waitUntil(
|
||||
() => document.querySelectorAll(".table-chart-container:not([placeholder=true])").length == 2);
|
||||
() => document.querySelectorAll(".table-chart-container:not([placeholder=true])")
|
||||
.length == 2);
|
||||
ok(true, "Two real table charts appear to be rendered correctly.");
|
||||
|
||||
yield teardown(monitor);
|
||||
|
@ -35,7 +35,8 @@ add_task(function* () {
|
||||
"The main panel is switched to the statistics panel.");
|
||||
|
||||
yield waitUntil(
|
||||
() => document.querySelectorAll(".pie-chart-container:not([placeholder=true])").length == 2);
|
||||
() => document.querySelectorAll(".pie-chart-container:not([placeholder=true])")
|
||||
.length == 2);
|
||||
ok(true, "Two real pie charts appear to be rendered correctly.");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
|
@ -14,8 +14,7 @@ function* throttleTest(actuallyThrottle) {
|
||||
requestLongerTimeout(2);
|
||||
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
|
||||
let { gStore, windowRequire, NetMonitorController } = monitor.panelWin;
|
||||
let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/constants");
|
||||
let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
|
||||
let {
|
||||
|
@ -39,20 +39,21 @@ add_task(function* () {
|
||||
secDivs.forEach(div => info(`Second division: ${div.textContent}`));
|
||||
minDivs.forEach(div => info(`Minute division: ${div.textContent}`));
|
||||
|
||||
is(gStore.getState().requests.requests.size, 2, "There should be only two requests made.");
|
||||
is(gStore.getState().requests.requests.size, 2,
|
||||
"There should be only two requests made.");
|
||||
|
||||
let firstRequest = getSortedRequests(gStore.getState()).get(0);
|
||||
let lastRequest = getSortedRequests(gStore.getState()).get(1);
|
||||
|
||||
info("First request happened at: " +
|
||||
firstRequest.responseHeaders.headers.find(e => e.name == "Date").value);
|
||||
firstRequest.responseHeaders.headers.find(e => e.name == "Date").value);
|
||||
info("Last request happened at: " +
|
||||
lastRequest.responseHeaders.headers.find(e => e.name == "Date").value);
|
||||
lastRequest.responseHeaders.headers.find(e => e.name == "Date").value);
|
||||
|
||||
ok(secDivs.length,
|
||||
"There should be at least one division on the seconds time scale.");
|
||||
"There should be at least one division on the seconds time scale.");
|
||||
ok(secDivs[0].textContent.match(/\d+\.\d{2}\s\w+/),
|
||||
"The division on the seconds time scale looks legit.");
|
||||
"The division on the seconds time scale looks legit.");
|
||||
|
||||
return teardown(monitor);
|
||||
});
|
||||
|
@ -2,6 +2,9 @@
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* import-globals-from ../../framework/test/shared-head.js */
|
||||
/* exported Toolbox, restartNetMonitor, teardown, waitForExplicitFinish,
|
||||
verifyRequestItemTarget, waitFor, testFilterButtons, loadCommonFrameScript,
|
||||
performRequestsInContent, waitForNetworkEvents */
|
||||
|
||||
"use strict";
|
||||
|
||||
@ -11,7 +14,7 @@ Services.scriptloader.loadSubScript(
|
||||
this);
|
||||
|
||||
const { EVENTS } = require("devtools/client/netmonitor/constants");
|
||||
var { Toolbox } = require("devtools/client/framework/toolbox");
|
||||
let { Toolbox } = require("devtools/client/framework/toolbox");
|
||||
const {
|
||||
decodeUnicodeUrl,
|
||||
getUrlBaseName,
|
||||
@ -19,6 +22,7 @@ const {
|
||||
getUrlHost,
|
||||
} = require("devtools/client/netmonitor/utils/request-utils");
|
||||
|
||||
/* eslint-disable no-unused-vars, max-len */
|
||||
const EXAMPLE_URL = "http://example.com/browser/devtools/client/netmonitor/test/";
|
||||
const HTTPS_EXAMPLE_URL = "https://example.com/browser/devtools/client/netmonitor/test/";
|
||||
|
||||
@ -69,6 +73,7 @@ const TEST_IMAGE = EXAMPLE_URL + "test-image.png";
|
||||
const TEST_IMAGE_DATA_URI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==";
|
||||
|
||||
const FRAME_SCRIPT_UTILS_URL = "chrome://devtools/content/shared/frame-script-utils.js";
|
||||
/* eslint-enable no-unused-vars, max-len */
|
||||
|
||||
// All tests are asynchronous.
|
||||
waitForExplicitFinish();
|
||||
@ -91,45 +96,45 @@ registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("devtools.cache.disabled");
|
||||
});
|
||||
|
||||
function waitForNavigation(aTarget) {
|
||||
function waitForNavigation(target) {
|
||||
let deferred = promise.defer();
|
||||
aTarget.once("will-navigate", () => {
|
||||
aTarget.once("navigate", () => {
|
||||
target.once("will-navigate", () => {
|
||||
target.once("navigate", () => {
|
||||
deferred.resolve();
|
||||
});
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function reconfigureTab(aTarget, aOptions) {
|
||||
function reconfigureTab(target, options) {
|
||||
let deferred = promise.defer();
|
||||
aTarget.activeTab.reconfigure(aOptions, deferred.resolve);
|
||||
target.activeTab.reconfigure(options, deferred.resolve);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function toggleCache(aTarget, aDisabled) {
|
||||
let options = { cacheDisabled: aDisabled, performReload: true };
|
||||
let navigationFinished = waitForNavigation(aTarget);
|
||||
function toggleCache(target, disabled) {
|
||||
let options = { cacheDisabled: disabled, performReload: true };
|
||||
let navigationFinished = waitForNavigation(target);
|
||||
|
||||
// Disable the cache for any toolbox that it is opened from this point on.
|
||||
Services.prefs.setBoolPref("devtools.cache.disabled", aDisabled);
|
||||
Services.prefs.setBoolPref("devtools.cache.disabled", disabled);
|
||||
|
||||
return reconfigureTab(aTarget, options).then(() => navigationFinished);
|
||||
return reconfigureTab(target, options).then(() => navigationFinished);
|
||||
}
|
||||
|
||||
function initNetMonitor(aUrl, aWindow, aEnableCache) {
|
||||
function initNetMonitor(url, window, enableCache) {
|
||||
info("Initializing a network monitor pane.");
|
||||
|
||||
return Task.spawn(function* () {
|
||||
let tab = yield addTab(aUrl);
|
||||
info("Net tab added successfully: " + aUrl);
|
||||
let tab = yield addTab(url);
|
||||
info("Net tab added successfully: " + url);
|
||||
|
||||
let target = TargetFactory.forTab(tab);
|
||||
|
||||
yield target.makeRemote();
|
||||
info("Target remoted.");
|
||||
|
||||
if (!aEnableCache) {
|
||||
if (!enableCache) {
|
||||
info("Disabling cache and reloading page.");
|
||||
yield toggleCache(target, true);
|
||||
info("Cache disabled when the current and all future toolboxes are open.");
|
||||
@ -175,9 +180,9 @@ function teardown(monitor) {
|
||||
});
|
||||
}
|
||||
|
||||
function waitForNetworkEvents(aMonitor, aGetRequests, aPostRequests = 0) {
|
||||
function waitForNetworkEvents(monitor, getRequests, postRequests = 0) {
|
||||
let deferred = promise.defer();
|
||||
let panel = aMonitor.panelWin;
|
||||
let panel = monitor.panelWin;
|
||||
let progress = {};
|
||||
let genericEvents = 0;
|
||||
let postEvents = 0;
|
||||
@ -200,9 +205,13 @@ function waitForNetworkEvents(aMonitor, aGetRequests, aPostRequests = 0) {
|
||||
];
|
||||
|
||||
function initProgressForURL(url) {
|
||||
if (progress[url]) return;
|
||||
if (progress[url]) {
|
||||
return;
|
||||
}
|
||||
progress[url] = {};
|
||||
awaitedEventsToListeners.forEach(([e]) => progress[url][e] = 0);
|
||||
awaitedEventsToListeners.forEach(function ([e]) {
|
||||
progress[url][e] = 0;
|
||||
});
|
||||
}
|
||||
|
||||
function updateProgressForURL(url, event) {
|
||||
@ -222,8 +231,8 @@ function waitForNetworkEvents(aMonitor, aGetRequests, aPostRequests = 0) {
|
||||
|
||||
function maybeResolve(event, actor) {
|
||||
info("> Network events progress: " +
|
||||
genericEvents + "/" + ((aGetRequests + aPostRequests) * 13) + ", " +
|
||||
postEvents + "/" + (aPostRequests * 2) + ", " +
|
||||
genericEvents + "/" + ((getRequests + postRequests) * 13) + ", " +
|
||||
postEvents + "/" + (postRequests * 2) + ", " +
|
||||
"got " + event + " for " + actor);
|
||||
|
||||
let networkInfo =
|
||||
@ -237,9 +246,8 @@ function waitForNetworkEvents(aMonitor, aGetRequests, aPostRequests = 0) {
|
||||
// There are 15 updates which need to be fired for a request to be
|
||||
// considered finished. The "requestPostData" packet isn't fired for
|
||||
// non-POST requests.
|
||||
if (genericEvents >= (aGetRequests + aPostRequests) * 13 &&
|
||||
postEvents >= aPostRequests * 2) {
|
||||
|
||||
if (genericEvents >= (getRequests + postRequests) * 13 &&
|
||||
postEvents >= postRequests * 2) {
|
||||
awaitedEventsToListeners.forEach(([e, l]) => panel.off(EVENTS[e], l));
|
||||
executeSoon(deferred.resolve);
|
||||
}
|
||||
@ -249,39 +257,40 @@ function waitForNetworkEvents(aMonitor, aGetRequests, aPostRequests = 0) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function verifyRequestItemTarget(document, requestList, requestItem, aMethod,
|
||||
aUrl, aData = {}) {
|
||||
info("> Verifying: " + aMethod + " " + aUrl + " " + aData.toSource());
|
||||
function verifyRequestItemTarget(document, requestList, requestItem, method,
|
||||
url, data = {}) {
|
||||
info("> Verifying: " + method + " " + url + " " + data.toSource());
|
||||
|
||||
let visibleIndex = requestList.indexOf(requestItem);
|
||||
|
||||
info("Visible index of item: " + visibleIndex);
|
||||
|
||||
let { fuzzyUrl, status, statusText, cause, type, fullMimeType,
|
||||
transferred, size, time, displayedStatus } = aData;
|
||||
transferred, size, time, displayedStatus } = data;
|
||||
|
||||
let target = document.querySelectorAll(".request-list-item")[visibleIndex];
|
||||
let unicodeUrl = decodeUnicodeUrl(aUrl);
|
||||
let name = getUrlBaseName(aUrl);
|
||||
let query = getUrlQuery(aUrl);
|
||||
let hostPort = getUrlHost(aUrl);
|
||||
let unicodeUrl = decodeUnicodeUrl(url);
|
||||
let name = getUrlBaseName(url);
|
||||
let query = getUrlQuery(url);
|
||||
let hostPort = getUrlHost(url);
|
||||
let remoteAddress = requestItem.remoteAddress;
|
||||
|
||||
if (fuzzyUrl) {
|
||||
ok(requestItem.method.startsWith(aMethod), "The attached method is correct.");
|
||||
ok(requestItem.url.startsWith(aUrl), "The attached url is correct.");
|
||||
ok(requestItem.method.startsWith(method), "The attached method is correct.");
|
||||
ok(requestItem.url.startsWith(url), "The attached url is correct.");
|
||||
} else {
|
||||
is(requestItem.method, aMethod, "The attached method is correct.");
|
||||
is(requestItem.url, aUrl, "The attached url is correct.");
|
||||
is(requestItem.method, method, "The attached method is correct.");
|
||||
is(requestItem.url, url, "The attached url is correct.");
|
||||
}
|
||||
|
||||
is(target.querySelector(".requests-list-method").textContent,
|
||||
aMethod, "The displayed method is correct.");
|
||||
method, "The displayed method is correct.");
|
||||
|
||||
if (fuzzyUrl) {
|
||||
ok(target.querySelector(".requests-list-file").textContent.startsWith(
|
||||
name + (query ? "?" + query : "")), "The displayed file is correct.");
|
||||
ok(target.querySelector(".requests-list-file").getAttribute("title").startsWith(unicodeUrl),
|
||||
ok(target.querySelector(".requests-list-file").getAttribute("title")
|
||||
.startsWith(unicodeUrl),
|
||||
"The tooltip file is correct.");
|
||||
} else {
|
||||
is(target.querySelector(".requests-list-file").textContent,
|
||||
@ -298,13 +307,15 @@ function verifyRequestItemTarget(document, requestList, requestItem, aMethod,
|
||||
domainTooltip, "The tooltip domain is correct.");
|
||||
|
||||
if (status !== undefined) {
|
||||
let value = target.querySelector(".requests-list-status-icon").getAttribute("data-code");
|
||||
let value = target.querySelector(".requests-list-status-icon")
|
||||
.getAttribute("data-code");
|
||||
let codeValue = target.querySelector(".requests-list-status-code").textContent;
|
||||
let tooltip = target.querySelector(".requests-list-status").getAttribute("title");
|
||||
info("Displayed status: " + value);
|
||||
info("Displayed code: " + codeValue);
|
||||
info("Tooltip status: " + tooltip);
|
||||
is(value, displayedStatus ? displayedStatus : status, "The displayed status is correct.");
|
||||
is(value, displayedStatus ? displayedStatus : status,
|
||||
"The displayed status is correct.");
|
||||
is(codeValue, status, "The displayed status code is correct.");
|
||||
is(tooltip, status + " " + statusText, "The tooltip status is correct.");
|
||||
}
|
||||
@ -314,7 +325,7 @@ function verifyRequestItemTarget(document, requestList, requestItem, aMethod,
|
||||
info("Displayed cause: " + value);
|
||||
info("Tooltip cause: " + tooltip);
|
||||
is(value, cause.type, "The displayed cause is correct.");
|
||||
is(tooltip, cause.loadingDocumentUri, "The tooltip cause is correct.")
|
||||
is(tooltip, cause.loadingDocumentUri, "The tooltip cause is correct.");
|
||||
}
|
||||
if (type !== undefined) {
|
||||
let value = target.querySelector(".requests-list-type").textContent;
|
||||
@ -326,7 +337,8 @@ function verifyRequestItemTarget(document, requestList, requestItem, aMethod,
|
||||
}
|
||||
if (transferred !== undefined) {
|
||||
let value = target.querySelector(".requests-list-transferred").textContent;
|
||||
let tooltip = target.querySelector(".requests-list-transferred").getAttribute("title");
|
||||
let tooltip = target.querySelector(".requests-list-transferred")
|
||||
.getAttribute("title");
|
||||
info("Displayed transferred size: " + value);
|
||||
info("Tooltip transferred size: " + tooltip);
|
||||
is(value, transferred, "The displayed transferred size is correct.");
|
||||
@ -342,7 +354,8 @@ function verifyRequestItemTarget(document, requestList, requestItem, aMethod,
|
||||
}
|
||||
if (time !== undefined) {
|
||||
let value = target.querySelector(".requests-list-timings-total").textContent;
|
||||
let tooltip = target.querySelector(".requests-list-timings-total").getAttribute("title");
|
||||
let tooltip = target.querySelector(".requests-list-timings-total")
|
||||
.getAttribute("title");
|
||||
info("Displayed time: " + value);
|
||||
info("Tooltip time: " + tooltip);
|
||||
ok(~~(value.match(/[0-9]+/)) >= 0, "The displayed time is correct.");
|
||||
@ -403,12 +416,12 @@ function testFilterButtons(monitor, filterType) {
|
||||
* 'checked' attribute. For example, if the third item of the array
|
||||
* evaluates to true, the third button should be checked.
|
||||
*/
|
||||
function testFilterButtonsCustom(aMonitor, aIsChecked) {
|
||||
let doc = aMonitor.panelWin.document;
|
||||
function testFilterButtonsCustom(monitor, isChecked) {
|
||||
let doc = monitor.panelWin.document;
|
||||
let buttons = doc.querySelectorAll("#requests-list-filter-buttons button");
|
||||
for (let i = 0; i < aIsChecked.length; i++) {
|
||||
for (let i = 0; i < isChecked.length; i++) {
|
||||
let button = buttons[i];
|
||||
if (aIsChecked[i]) {
|
||||
if (isChecked[i]) {
|
||||
is(button.classList.contains("checked"), true,
|
||||
"The " + button.id + " button should have a 'checked' class.");
|
||||
is(button.getAttribute("aria-pressed"), "true",
|
||||
@ -473,9 +486,8 @@ function executeInContent(name, data = {}, objects = {}, expectResponse = true)
|
||||
mm.sendAsyncMessage(name, data, objects);
|
||||
if (expectResponse) {
|
||||
return waitForContentMessage(name);
|
||||
} else {
|
||||
return promise.resolve();
|
||||
}
|
||||
return promise.resolve();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,30 +15,35 @@
|
||||
<p>API calls request test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("/api/fileName.xml", function() {
|
||||
get("/api/file%E2%98%A2.xml", function() {
|
||||
get("/api/ascii/get/", function() {
|
||||
get("/api/unicode/%E2%98%A2/", function() {
|
||||
get("/api/search/?q=search%E2%98%A2", function() {
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
get("/api/fileName.xml", function () {
|
||||
get("/api/file%E2%98%A2.xml", function () {
|
||||
get("/api/ascii/get/", function () {
|
||||
get("/api/unicode/%E2%98%A2/", function () {
|
||||
get("/api/search/?q=search%E2%98%A2", function () {
|
||||
// Done.
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@ -15,20 +15,23 @@
|
||||
<p>Brotli test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=br", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=br", function () {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
|
@ -16,8 +16,10 @@
|
||||
<p>Request cause test</p>
|
||||
<img src="img_request" />
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
function performXhrRequest() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "xhr_request", true);
|
||||
xhr.send();
|
||||
}
|
||||
|
@ -15,25 +15,29 @@
|
||||
<p>Content type test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=xml", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=css", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=js", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=bogus", function() {
|
||||
get("test-image.png", function() {
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
get("sjs_content-type-test-server.sjs?fmt=xml", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=css", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=js", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=bogus", function () {
|
||||
get("test-image.png", function () {
|
||||
// Done.
|
||||
});
|
||||
});
|
||||
@ -41,6 +45,7 @@
|
||||
});
|
||||
});
|
||||
});
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@ -15,27 +15,31 @@
|
||||
<p>Content type test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=xml", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=css", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=js", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=bogus", function() {
|
||||
get("test-image.png?v=" + Math.random(), function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=gzip", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=br", function() {
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
get("sjs_content-type-test-server.sjs?fmt=xml", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=css", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=js", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=bogus", function () {
|
||||
get("test-image.png?v=" + Math.random(), function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=gzip", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=br", function () {
|
||||
// Done.
|
||||
});
|
||||
});
|
||||
@ -45,6 +49,7 @@
|
||||
});
|
||||
});
|
||||
});
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@ -15,9 +15,12 @@
|
||||
<p>Performing a GET request</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function performRequest(aUrl) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aUrl, true);
|
||||
/* exported performRequest */
|
||||
"use strict";
|
||||
|
||||
function performRequest(url) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", url, true);
|
||||
xhr.setRequestHeader("Accept-Language", window.navigator.language);
|
||||
xhr.setRequestHeader("X-Custom-Header-1", "Custom value");
|
||||
xhr.setRequestHeader("X-Custom-Header-2", "8.8.8.8");
|
||||
|
@ -15,8 +15,11 @@
|
||||
<p>POST with CORS test page</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
function post(url, contentType, postData) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url, true);
|
||||
xhr.setRequestHeader("Content-Type", contentType);
|
||||
xhr.send(postData);
|
||||
|
@ -29,39 +29,41 @@
|
||||
<iframe name="target"></iframe>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
function ajaxGet(aUrl, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aUrl + "?param1=value1¶m2=value2¶m3=value3", true);
|
||||
function ajaxGet(url, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", url + "?param1=value1¶m2=value2¶m3=value3", true);
|
||||
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
||||
xhr.onload = function() {
|
||||
aCallback();
|
||||
xhr.onload = function () {
|
||||
callback();
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function ajaxPost(aUrl, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", aUrl, true);
|
||||
function ajaxPost(url, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url, true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
||||
xhr.onload = function() {
|
||||
aCallback();
|
||||
xhr.onload = function () {
|
||||
callback();
|
||||
};
|
||||
var params = "param1=value1¶m2=value2¶m3=value3";
|
||||
const params = "param1=value1¶m2=value2¶m3=value3";
|
||||
xhr.send(params);
|
||||
}
|
||||
|
||||
function ajaxMultipart(aUrl, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", aUrl, true);
|
||||
function ajaxMultipart(url, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url, true);
|
||||
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
||||
xhr.onload = function() {
|
||||
aCallback();
|
||||
xhr.onload = function () {
|
||||
callback();
|
||||
};
|
||||
|
||||
getCanvasElem().toBlob((blob) => {
|
||||
var formData = new FormData();
|
||||
let formData = new FormData();
|
||||
formData.append("param1", "value1");
|
||||
formData.append("file", blob, "filename.png");
|
||||
xhr.send(formData);
|
||||
@ -69,7 +71,7 @@
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
var form = document.querySelector("#post-form");
|
||||
let form = document.querySelector("#post-form");
|
||||
form.submit();
|
||||
}
|
||||
|
||||
@ -78,17 +80,17 @@
|
||||
}
|
||||
|
||||
function initCanvas() {
|
||||
var canvas = getCanvasElem();
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.fillRect(0,0,100,100);
|
||||
ctx.clearRect(20,20,60,60);
|
||||
ctx.strokeRect(25,25,50,50);
|
||||
let canvas = getCanvasElem();
|
||||
let ctx = canvas.getContext("2d");
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.clearRect(20, 20, 60, 60);
|
||||
ctx.strokeRect(25, 25, 50, 50);
|
||||
}
|
||||
|
||||
function performRequests(aUrl) {
|
||||
ajaxGet(aUrl, () => {
|
||||
ajaxPost(aUrl, () => {
|
||||
ajaxMultipart(aUrl, () => {
|
||||
function performRequests(url) {
|
||||
ajaxGet(url, () => {
|
||||
ajaxPost(url, () => {
|
||||
ajaxMultipart(url, () => {
|
||||
submitForm();
|
||||
});
|
||||
});
|
||||
|
@ -15,27 +15,30 @@
|
||||
<p>Performing a custom number of GETs</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
// Use a count parameter to defeat caching.
|
||||
var count = 0;
|
||||
let count = 0;
|
||||
|
||||
function performRequests(aTotal, aUrl, aTimeout = 0) {
|
||||
if (!aTotal) {
|
||||
function performRequests(total, url, timeout = 0) {
|
||||
if (!total) {
|
||||
return;
|
||||
}
|
||||
get(aUrl || "request_" + (count++), function() {
|
||||
setTimeout(performRequests.bind(this, --aTotal, aUrl, aTimeout), aTimeout);
|
||||
get(url || "request_" + (count++), function () {
|
||||
setTimeout(performRequests.bind(this, --total, url, timeout), timeout);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
@ -16,20 +16,23 @@
|
||||
<p>Братан, ты вообще качаешься?</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=txt", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=txt", function () {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
|
@ -15,44 +15,52 @@
|
||||
<p>Filtering test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
// Use a random parameter to defeat caching.
|
||||
xhr.open("GET", aAddress + "&" + Math.random(), true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
// Use a random parameter to defeat caching.
|
||||
xhr.open("GET", address + "&" + Math.random(), true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests(aOptions) {
|
||||
var options = JSON.parse(aOptions);
|
||||
get("sjs_content-type-test-server.sjs?fmt=html&res=" + options.htmlContent, function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=css", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=js", function() {
|
||||
if (!options.getMedia) {
|
||||
return;
|
||||
}
|
||||
get("sjs_content-type-test-server.sjs?fmt=font", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=image", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=audio", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=video", function() {
|
||||
if (!options.getFlash) {
|
||||
return;
|
||||
}
|
||||
get("sjs_content-type-test-server.sjs?fmt=flash", function() {
|
||||
// Done.
|
||||
function performRequests(optionsText) {
|
||||
const options = JSON.parse(optionsText);
|
||||
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
get("sjs_content-type-test-server.sjs?fmt=html&res=" + options.htmlContent,
|
||||
function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=css", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=js", function () {
|
||||
if (!options.getMedia) {
|
||||
return;
|
||||
}
|
||||
get("sjs_content-type-test-server.sjs?fmt=font", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=image", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=audio", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=video", function () {
|
||||
if (!options.getFlash) {
|
||||
return;
|
||||
}
|
||||
get("sjs_content-type-test-server.sjs?fmt=flash", function () {
|
||||
// Done.
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@ -16,8 +16,10 @@
|
||||
<p>Request frame test</p>
|
||||
<img src="img_request" />
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
function performXhrRequest() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "xhr_request", true);
|
||||
xhr.send();
|
||||
}
|
||||
|
@ -17,8 +17,10 @@
|
||||
<img src="img_request" />
|
||||
<iframe src="html_frame-subdocument.html"></iframe>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
function performXhrRequest() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "xhr_request", true);
|
||||
xhr.send();
|
||||
}
|
||||
|
@ -15,8 +15,11 @@
|
||||
<p>tooltip test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
function performRequests() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "test-image.png?v=" + Math.random(), true);
|
||||
xhr.send(null);
|
||||
}
|
||||
|
@ -15,23 +15,25 @@
|
||||
<p>Infinite GETs</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
// Use a count parameter to defeat caching.
|
||||
var count = 0;
|
||||
let count = 0;
|
||||
|
||||
(function performRequests() {
|
||||
get("request_" + (count++), function() {
|
||||
get("request_" + (count++), function () {
|
||||
setTimeout(performRequests, 50);
|
||||
});
|
||||
})();
|
||||
|
@ -15,20 +15,23 @@
|
||||
<p>JSON b64 test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json-b64", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json-b64", function () {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
|
@ -16,13 +16,16 @@
|
||||
<p>Pass the JSON name (as supported by sjs_json-test-server.sjs) as a query parameter</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
@ -30,7 +33,7 @@
|
||||
|
||||
function performRequests() {
|
||||
// Forward the query parameter for this page to sjs_json-test-server
|
||||
get("sjs_json-test-server.sjs" + window.location.search, function() {
|
||||
get("sjs_json-test-server.sjs" + window.location.search, function () {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
|
@ -15,20 +15,23 @@
|
||||
<p>JSONP test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json-custom-mime", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json-custom-mime", function () {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
|
@ -15,20 +15,23 @@
|
||||
<p>JSON long string test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json-long", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json-long", function () {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
|
@ -15,20 +15,23 @@
|
||||
<p>JSON malformed test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json-malformed", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json-malformed", function () {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
|
@ -15,20 +15,23 @@
|
||||
<p>JSON text test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json-text-mime", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=json-text-mime", function () {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
|
@ -15,21 +15,24 @@
|
||||
<p>JSONP test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=jsonp&jsonp=$_0123Fun", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=jsonp2&jsonp=$_4567Sad", function() {
|
||||
get("sjs_content-type-test-server.sjs?fmt=jsonp&jsonp=$_0123Fun", function () {
|
||||
get("sjs_content-type-test-server.sjs?fmt=jsonp2&jsonp=$_4567Sad", function () {
|
||||
// Done.
|
||||
});
|
||||
});
|
||||
|
@ -15,41 +15,45 @@
|
||||
<p>Request params type test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aQuery) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress + aQuery, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
function get(address, query) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address + query, true);
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function post(aAddress, aQuery, aContentType, aPostBody) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", aAddress + aQuery, true);
|
||||
xhr.setRequestHeader("content-type", aContentType);
|
||||
xhr.send(aPostBody);
|
||||
function post(address, query, contentType, postBody) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", address + query, true);
|
||||
xhr.setRequestHeader("content-type", contentType);
|
||||
xhr.send(postBody);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
var urlencoded = "application/x-www-form-urlencoded";
|
||||
const urlencoded = "application/x-www-form-urlencoded";
|
||||
|
||||
setTimeout(function() {
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
setTimeout(function () {
|
||||
post("baz", "?a", urlencoded, '{ "foo": "bar" }');
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
post("baz", "?a=b", urlencoded, '{ "foo": "bar" }');
|
||||
|
||||
setTimeout(function() {
|
||||
post("baz", "?a=b", urlencoded, '?foo=bar');
|
||||
setTimeout(function () {
|
||||
post("baz", "?a=b", urlencoded, "?foo=bar");
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
post("baz", "?a", undefined, '{ "foo": "bar" }');
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
post("baz", "?a=b", undefined, '{ "foo": "bar" }');
|
||||
|
||||
setTimeout(function() {
|
||||
post("baz", "?a=b", undefined, '?foo=bar');
|
||||
setTimeout(function () {
|
||||
post("baz", "?a=b", undefined, "?foo=bar");
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
get("baz", "");
|
||||
|
||||
// Done.
|
||||
@ -60,6 +64,7 @@
|
||||
}, 10);
|
||||
}, 10);
|
||||
}, 10);
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@ -27,46 +27,49 @@
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
function post(aAddress, aMessage, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
function post(address, message, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", address, true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
var data = "";
|
||||
for (var i in aMessage) {
|
||||
data += "&" + i + "=" + aMessage[i];
|
||||
let data = "";
|
||||
for (let i in message) {
|
||||
data += "&" + i + "=" + message[i];
|
||||
}
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(data);
|
||||
}
|
||||
|
||||
function form(aAddress, aForm, aCallback) {
|
||||
var formData = new FormData(document.forms.namedItem(aForm));
|
||||
function form(address, formName, callback) {
|
||||
let formData = new FormData(document.forms.namedItem(formName));
|
||||
formData.append("Custom field", "Extra data");
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", aAddress, true);
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", address, true);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(formData);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
var url = "sjs_simple-test-server.sjs";
|
||||
var url1 = url + "?foo=bar&baz=42&type=urlencoded";
|
||||
var url2 = url + "?foo=bar&baz=42&type=multipart";
|
||||
const url = "sjs_simple-test-server.sjs";
|
||||
const url1 = url + "?foo=bar&baz=42&type=urlencoded";
|
||||
const url2 = url + "?foo=bar&baz=42&type=multipart";
|
||||
|
||||
post(url1, { foo: "bar", baz: 123 }, function() {
|
||||
form(url2, "form-name", function() {
|
||||
post(url1, { foo: "bar", baz: 123 }, function () {
|
||||
form(url2, "form-name", function () {
|
||||
// Done.
|
||||
});
|
||||
});
|
||||
|
@ -15,6 +15,9 @@
|
||||
<p>POST raw test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
function post(address, message, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", address, true);
|
||||
|
@ -15,22 +15,25 @@
|
||||
<p>POST raw test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function post(aAddress, aMessage, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
function post(address, message, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", address, true);
|
||||
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(aMessage);
|
||||
xhr.send(message);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
var rawData = "foo=bar&baz=123";
|
||||
post("sjs_simple-test-server.sjs", rawData, function() {
|
||||
const rawData = "foo=bar&baz=123";
|
||||
post("sjs_simple-test-server.sjs", rawData, function () {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
|
@ -15,27 +15,30 @@
|
||||
<p>POST raw with headers test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function post(aAddress, aMessage, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", aAddress, true);
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function post(address, message, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(aMessage);
|
||||
xhr.send(message);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
var rawData = [
|
||||
let rawData = [
|
||||
"content-type: application/x-www-form-urlencoded\r",
|
||||
"custom-header: hello world!\r",
|
||||
"\r",
|
||||
"\r",
|
||||
"foo=bar&baz=123"
|
||||
];
|
||||
post("sjs_simple-test-server.sjs", rawData.join("\n"), function() {
|
||||
post("sjs_simple-test-server.sjs", rawData.join("\n"), function () {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
|
@ -15,6 +15,9 @@
|
||||
<p>Send beacon test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* exported performRequest */
|
||||
"use strict";
|
||||
|
||||
function performRequest() {
|
||||
navigator.sendBeacon("beacon_request");
|
||||
}
|
||||
|
@ -15,20 +15,22 @@
|
||||
<p>Performing a custom number of GETs</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
(function performRequests() {
|
||||
get("request_0", function() {});
|
||||
get("request_0", function () {});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
|
@ -15,9 +15,11 @@
|
||||
<p>Statistics test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
"use strict";
|
||||
|
||||
function get(address) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
|
@ -15,35 +15,40 @@
|
||||
<p>Status codes test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get(aAddress, aCallback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", aAddress, true);
|
||||
/* exported performRequests, performCachedRequests */
|
||||
"use strict";
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
function get(address, callback) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == this.DONE) {
|
||||
aCallback();
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
get("sjs_status-codes-test-server.sjs?sts=100", function() {
|
||||
get("sjs_status-codes-test-server.sjs?sts=200", function() {
|
||||
get("sjs_status-codes-test-server.sjs?sts=300", function() {
|
||||
get("sjs_status-codes-test-server.sjs?sts=400", function() {
|
||||
get("sjs_status-codes-test-server.sjs?sts=500", function() {
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
get("sjs_status-codes-test-server.sjs?sts=100", function () {
|
||||
get("sjs_status-codes-test-server.sjs?sts=200", function () {
|
||||
get("sjs_status-codes-test-server.sjs?sts=300", function () {
|
||||
get("sjs_status-codes-test-server.sjs?sts=400", function () {
|
||||
get("sjs_status-codes-test-server.sjs?sts=500", function () {
|
||||
// Done.
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
/* eslint-enable max-nested-callbacks */
|
||||
}
|
||||
|
||||
function performCachedRequests() {
|
||||
get("sjs_status-codes-test-server.sjs?sts=ok&cached", function() {
|
||||
get("sjs_status-codes-test-server.sjs?sts=redirect&cached", function() {
|
||||
get("sjs_status-codes-test-server.sjs?sts=ok&cached", function () {
|
||||
get("sjs_status-codes-test-server.sjs?sts=redirect&cached", function () {
|
||||
// Done.
|
||||
});
|
||||
});
|
||||
|
@ -31,4 +31,6 @@ requireHacker.global_hook("default", path => {
|
||||
case "devtools/client/shared/redux/create-store":
|
||||
return `module.exports = require("devtools/client/netmonitor/test/fixtures/create-store")`;
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
@ -16,6 +16,9 @@
|
||||
<p>Status codes test</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* exported registerServiceWorker, unregisterServiceWorker, performRequests */
|
||||
"use strict";
|
||||
|
||||
let swRegistration;
|
||||
|
||||
function registerServiceWorker() {
|
||||
@ -31,7 +34,7 @@
|
||||
if (sw.controller) {
|
||||
resolve();
|
||||
} else {
|
||||
sw.addEventListener('controllerchange', function () {
|
||||
sw.addEventListener("controllerchange", function () {
|
||||
resolve();
|
||||
}, {once: true});
|
||||
}
|
||||
|
@ -241,6 +241,9 @@ CssGridHighlighter.prototype = extend(AutoRefreshHighlighter.prototype, {
|
||||
pageListenerTarget.removeEventListener("pagehide", this.onPageHide);
|
||||
|
||||
this.markup.destroy();
|
||||
|
||||
// Clear the pattern cache to avoid dead object exceptions (Bug 1342051).
|
||||
this._clearCache();
|
||||
AutoRefreshHighlighter.prototype.destroy.call(this);
|
||||
},
|
||||
|
||||
|
@ -5266,6 +5266,9 @@ void HTMLMediaElement::DecodeError(const MediaResult& aError)
|
||||
const char16_t* params[] = { src.get() };
|
||||
ReportLoadError("MediaLoadDecodeError", params, ArrayLength(params));
|
||||
|
||||
DecoderDoctorDiagnostics diagnostics;
|
||||
diagnostics.StoreDecodeError(OwnerDoc(), aError, src, __func__);
|
||||
|
||||
AudioTracks()->EmptyTracks();
|
||||
VideoTracks()->EmptyTracks();
|
||||
if (mIsLoadingFromSourceChildren) {
|
||||
@ -5283,6 +5286,14 @@ void HTMLMediaElement::DecodeError(const MediaResult& aError)
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLMediaElement::DecodeWarning(const MediaResult& aError)
|
||||
{
|
||||
nsAutoString src;
|
||||
GetCurrentSrc(src);
|
||||
DecoderDoctorDiagnostics diagnostics;
|
||||
diagnostics.StoreDecodeError(OwnerDoc(), aError, src, __func__);
|
||||
}
|
||||
|
||||
bool HTMLMediaElement::HasError() const
|
||||
{
|
||||
return GetError();
|
||||
|
@ -175,6 +175,11 @@ public:
|
||||
// resource has a decode error during metadata loading or decoding.
|
||||
virtual void DecodeError(const MediaResult& aError) final override;
|
||||
|
||||
// Called by the decoder object, on the main thread, when the
|
||||
// resource has a decode issue during metadata loading or decoding, but can
|
||||
// continue decoding.
|
||||
virtual void DecodeWarning(const MediaResult& aError) final override;
|
||||
|
||||
// Return true if error attribute is not null.
|
||||
virtual bool HasError() const final override;
|
||||
|
||||
|
@ -454,11 +454,14 @@ DecoderDoctorDocumentWatcher::SynthesizeAnalysis()
|
||||
case DecoderDoctorDiagnostics::eEvent:
|
||||
MOZ_ASSERT_UNREACHABLE("Events shouldn't be stored for processing.");
|
||||
break;
|
||||
case DecoderDoctorDiagnostics::eDecodeError:
|
||||
// TODO
|
||||
break;
|
||||
case DecoderDoctorDiagnostics::eDecodeWarning:
|
||||
// TODO
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(diag.mDecoderDoctorDiagnostics.Type()
|
||||
== DecoderDoctorDiagnostics::eFormatSupportCheck
|
||||
|| diag.mDecoderDoctorDiagnostics.Type()
|
||||
== DecoderDoctorDiagnostics::eMediaKeySystemAccessRequest);
|
||||
MOZ_ASSERT_UNREACHABLE("Unhandled DecoderDoctorDiagnostics type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -779,6 +782,88 @@ DecoderDoctorDiagnostics::StoreEvent(nsIDocument* aDocument,
|
||||
#endif // MOZ_PULSEAUDIO
|
||||
}
|
||||
|
||||
void
|
||||
DecoderDoctorDiagnostics::StoreDecodeError(nsIDocument* aDocument,
|
||||
const MediaResult& aError,
|
||||
const nsString& aMediaSrc,
|
||||
const char* aCallSite)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
// Make sure we only store once.
|
||||
MOZ_ASSERT(mDiagnosticsType == eUnsaved);
|
||||
mDiagnosticsType = eDecodeError;
|
||||
|
||||
if (NS_WARN_IF(!aDocument)) {
|
||||
DD_WARN("DecoderDoctorDiagnostics[%p]::StoreDecodeError("
|
||||
"nsIDocument* aDocument=nullptr, aError=%s,"
|
||||
" aMediaSrc=<provided>, call site '%s')",
|
||||
this, aError.Description().get(), aCallSite);
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<DecoderDoctorDocumentWatcher> watcher =
|
||||
DecoderDoctorDocumentWatcher::RetrieveOrCreate(aDocument);
|
||||
|
||||
if (NS_WARN_IF(!watcher)) {
|
||||
DD_WARN("DecoderDoctorDiagnostics[%p]::StoreDecodeError("
|
||||
"nsIDocument* aDocument=%p, aError='%s', aMediaSrc=<provided>,"
|
||||
" call site '%s') - Could not create document watcher",
|
||||
this, aDocument, aError.Description().get(), aCallSite);
|
||||
return;
|
||||
}
|
||||
|
||||
mDecodeIssue = aError;
|
||||
mDecodeIssueMediaSrc = aMediaSrc;
|
||||
|
||||
// StoreDecodeError should only be called once, after all data is
|
||||
// available, so it is safe to Move() from this object.
|
||||
watcher->AddDiagnostics(Move(*this), aCallSite);
|
||||
// Even though it's moved-from, the type should stay set
|
||||
// (Only used to ensure that we do store only once.)
|
||||
MOZ_ASSERT(mDiagnosticsType == eDecodeError);
|
||||
}
|
||||
|
||||
void
|
||||
DecoderDoctorDiagnostics::StoreDecodeWarning(nsIDocument* aDocument,
|
||||
const MediaResult& aWarning,
|
||||
const nsString& aMediaSrc,
|
||||
const char* aCallSite)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
// Make sure we only store once.
|
||||
MOZ_ASSERT(mDiagnosticsType == eUnsaved);
|
||||
mDiagnosticsType = eDecodeWarning;
|
||||
|
||||
if (NS_WARN_IF(!aDocument)) {
|
||||
DD_WARN("DecoderDoctorDiagnostics[%p]::StoreDecodeWarning("
|
||||
"nsIDocument* aDocument=nullptr, aWarning=%s,"
|
||||
" aMediaSrc=<provided>, call site '%s')",
|
||||
this, aWarning.Description().get(), aCallSite);
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<DecoderDoctorDocumentWatcher> watcher =
|
||||
DecoderDoctorDocumentWatcher::RetrieveOrCreate(aDocument);
|
||||
|
||||
if (NS_WARN_IF(!watcher)) {
|
||||
DD_WARN("DecoderDoctorDiagnostics[%p]::StoreDecodeWarning("
|
||||
"nsIDocument* aDocument=%p, aWarning='%s', aMediaSrc=<provided>,"
|
||||
" call site '%s') - Could not create document watcher",
|
||||
this, aDocument, aWarning.Description().get(), aCallSite);
|
||||
return;
|
||||
}
|
||||
|
||||
mDecodeIssue = aWarning;
|
||||
mDecodeIssueMediaSrc = aMediaSrc;
|
||||
|
||||
// StoreDecodeWarning should only be called once, after all data is
|
||||
// available, so it is safe to Move() from this object.
|
||||
watcher->AddDiagnostics(Move(*this), aCallSite);
|
||||
// Even though it's moved-from, the type should stay set
|
||||
// (Only used to ensure that we do store only once.)
|
||||
MOZ_ASSERT(mDiagnosticsType == eDecodeWarning);
|
||||
}
|
||||
|
||||
static const char*
|
||||
EventDomainString(DecoderDoctorEvent::Domain aDomain)
|
||||
{
|
||||
@ -837,6 +922,20 @@ DecoderDoctorDiagnostics::GetDescription() const
|
||||
s = nsPrintfCString("event domain %s result=%" PRIu32,
|
||||
EventDomainString(mEvent.mDomain), static_cast<uint32_t>(mEvent.mResult));
|
||||
break;
|
||||
case eDecodeError:
|
||||
s = "decode error: ";
|
||||
s += mDecodeIssue.Description();
|
||||
s += ", src='";
|
||||
s += mDecodeIssueMediaSrc.IsEmpty() ? "<none>" : "<provided>";
|
||||
s += "'";
|
||||
break;
|
||||
case eDecodeWarning:
|
||||
s = "decode warning: ";
|
||||
s += mDecodeIssue.Description();
|
||||
s += ", src='";
|
||||
s += mDecodeIssueMediaSrc.IsEmpty() ? "<none>" : "<provided>";
|
||||
s += "'";
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected DiagnosticsType");
|
||||
s = "?";
|
||||
|
@ -7,6 +7,7 @@
|
||||
#ifndef DecoderDoctorDiagnostics_h_
|
||||
#define DecoderDoctorDiagnostics_h_
|
||||
|
||||
#include "MediaResult.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsIDocument;
|
||||
@ -57,11 +58,24 @@ public:
|
||||
const DecoderDoctorEvent& aEvent,
|
||||
const char* aCallSite);
|
||||
|
||||
enum DiagnosticsType {
|
||||
void StoreDecodeError(nsIDocument* aDocument,
|
||||
const MediaResult& aError,
|
||||
const nsString& aMediaSrc,
|
||||
const char* aCallSite);
|
||||
|
||||
void StoreDecodeWarning(nsIDocument* aDocument,
|
||||
const MediaResult& aWarning,
|
||||
const nsString& aMediaSrc,
|
||||
const char* aCallSite);
|
||||
|
||||
enum DiagnosticsType
|
||||
{
|
||||
eUnsaved,
|
||||
eFormatSupportCheck,
|
||||
eMediaKeySystemAccessRequest,
|
||||
eEvent
|
||||
eEvent,
|
||||
eDecodeError,
|
||||
eDecodeWarning
|
||||
};
|
||||
DiagnosticsType Type() const { return mDiagnosticsType; }
|
||||
|
||||
@ -108,6 +122,12 @@ public:
|
||||
return mEvent;
|
||||
}
|
||||
|
||||
const MediaResult& DecodeIssue() const { return mDecodeIssue; }
|
||||
const nsString& DecodeIssueMediaSrc() const
|
||||
{
|
||||
return mDecodeIssueMediaSrc;
|
||||
}
|
||||
|
||||
private:
|
||||
// Currently-known type of diagnostics. Set from one of the 'Store...' methods.
|
||||
// This helps ensure diagnostics are only stored once,
|
||||
@ -130,6 +150,9 @@ private:
|
||||
KeySystemIssue mKeySystemIssue = eUnset;
|
||||
|
||||
DecoderDoctorEvent mEvent;
|
||||
|
||||
MediaResult mDecodeIssue = NS_OK;
|
||||
nsString mDecodeIssueMediaSrc;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -74,6 +74,11 @@ public:
|
||||
// reference to the decoder to prevent further calls into the decoder.
|
||||
virtual void DecodeError(const MediaResult& aError) = 0;
|
||||
|
||||
// Called by the decoder object, on the main thread, when the
|
||||
// resource has a decode issue during metadata loading or decoding, but can
|
||||
// continue decoding.
|
||||
virtual void DecodeWarning(const MediaResult& aError) = 0;
|
||||
|
||||
// Return true if media element error attribute is not null.
|
||||
virtual bool HasError() const = 0;
|
||||
|
||||
|
@ -984,24 +984,6 @@ MediaFormatReader::DemuxerProxy::NotifyDataArrived()
|
||||
});
|
||||
}
|
||||
|
||||
static const char*
|
||||
TrackTypeToStr(TrackInfo::TrackType aTrack)
|
||||
{
|
||||
MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack
|
||||
|| aTrack == TrackInfo::kVideoTrack
|
||||
|| aTrack == TrackInfo::kTextTrack);
|
||||
switch (aTrack) {
|
||||
case TrackInfo::kAudioTrack:
|
||||
return "Audio";
|
||||
case TrackInfo::kVideoTrack:
|
||||
return "Video";
|
||||
case TrackInfo::kTextTrack:
|
||||
return "Text";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder,
|
||||
MediaDataDemuxer* aDemuxer,
|
||||
VideoFrameContainer* aVideoFrameContainer)
|
||||
|
@ -8,6 +8,24 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
const char*
|
||||
TrackTypeToStr(TrackInfo::TrackType aTrack)
|
||||
{
|
||||
MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack
|
||||
|| aTrack == TrackInfo::kVideoTrack
|
||||
|| aTrack == TrackInfo::kTextTrack);
|
||||
switch (aTrack) {
|
||||
case TrackInfo::kAudioTrack:
|
||||
return "Audio";
|
||||
case TrackInfo::kVideoTrack:
|
||||
return "Video";
|
||||
case TrackInfo::kTextTrack:
|
||||
return "Text";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
typedef AudioConfig::ChannelLayout ChannelLayout;
|
||||
|
||||
/**
|
||||
|
@ -178,6 +178,9 @@ private:
|
||||
TrackType mType;
|
||||
};
|
||||
|
||||
// String version of track type. Don't use with kUndefinedTrack.
|
||||
const char* TrackTypeToStr(TrackInfo::TrackType aTrack);
|
||||
|
||||
// Stores info relevant to presenting media frames.
|
||||
class VideoInfo : public TrackInfo
|
||||
{
|
||||
|
@ -124,14 +124,6 @@ MP4Demuxer::Init()
|
||||
{
|
||||
AutoPinned<mp4_demuxer::ResourceStream> stream(mStream);
|
||||
|
||||
// Check that we have enough data to read the metadata.
|
||||
if (!mp4_demuxer::MP4Metadata::HasCompleteMetadata(stream)) {
|
||||
return InitPromise::CreateAndReject(
|
||||
MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
|
||||
RESULT_DETAIL("Incomplete MP4 metadata")),
|
||||
__func__);
|
||||
}
|
||||
|
||||
RefPtr<MediaByteBuffer> initData = mp4_demuxer::MP4Metadata::Metadata(stream);
|
||||
if (!initData) {
|
||||
return InitPromise::CreateAndReject(
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user