mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Merge mozilla-central to mozilla-inbound. a=merge
This commit is contained in:
commit
2ad5744e7f
@ -240,7 +240,13 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec
|
||||
}
|
||||
|
||||
function denyGUMRequest(aData) {
|
||||
Services.obs.notifyObservers(null, "getUserMedia:response:deny", aData.callID);
|
||||
let subject;
|
||||
if (aData.noOSPermission) {
|
||||
subject = "getUserMedia:response:noOSPermission";
|
||||
} else {
|
||||
subject = "getUserMedia:response:deny";
|
||||
}
|
||||
Services.obs.notifyObservers(null, subject, aData.callID);
|
||||
|
||||
if (!aData.windowID)
|
||||
return;
|
||||
|
@ -1,8 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const DEFAULT_PROCESS_COUNT = Services.prefs.getDefaultBranch(null).getIntPref("dom.ipc.processCount");
|
||||
|
||||
/**
|
||||
* A test that checks whether any preference getter from the given list
|
||||
* of stats was called more often than the max parameter.
|
||||
@ -122,10 +120,7 @@ add_task(async function startup() {
|
||||
|
||||
// This opens 10 tabs and checks pref getters.
|
||||
add_task(async function open_10_tabs() {
|
||||
// This is somewhat arbitrary. When we had a default of 4 content processes
|
||||
// the value was 15. We need to scale it as we increase the number of
|
||||
// content processes so we approximate with 4 * process_count.
|
||||
const max = 4 * DEFAULT_PROCESS_COUNT;
|
||||
let max = 15;
|
||||
|
||||
let whitelist = {
|
||||
"layout.css.dpi": {
|
||||
@ -151,6 +146,10 @@ add_task(async function open_10_tabs() {
|
||||
min: 10,
|
||||
max: 18,
|
||||
},
|
||||
"dom.ipc.processCount": {
|
||||
min: 10,
|
||||
max: 15,
|
||||
},
|
||||
"browser.startup.record": {
|
||||
max: 20,
|
||||
},
|
||||
|
@ -96,6 +96,10 @@ support-files =
|
||||
searchSuggestionEngine.xml
|
||||
searchSuggestionEngine.sjs
|
||||
[browser_urlbarOneOffs_searchSuggestions.js]
|
||||
support-files =
|
||||
searchSuggestionEngine.xml
|
||||
searchSuggestionEngine.sjs
|
||||
[browser_urlbarOneOffs_settings.js]
|
||||
support-files =
|
||||
searchSuggestionEngine.xml
|
||||
searchSuggestionEngine.sjs
|
||||
|
@ -0,0 +1,78 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
|
||||
|
||||
let gMaxResults;
|
||||
|
||||
add_task(async function init() {
|
||||
Services.prefs.setBoolPref("browser.urlbar.oneOffSearches", true);
|
||||
gMaxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
|
||||
|
||||
// Add a search suggestion engine and move it to the front so that it appears
|
||||
// as the first one-off.
|
||||
let engine = await SearchTestUtils.promiseNewSearchEngine(
|
||||
getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
|
||||
Services.search.moveEngine(engine, 0);
|
||||
|
||||
registerCleanupFunction(async function() {
|
||||
await hidePopup();
|
||||
await PlacesUtils.history.clear();
|
||||
});
|
||||
|
||||
await PlacesUtils.history.clear();
|
||||
|
||||
let visits = [];
|
||||
for (let i = 0; i < gMaxResults; i++) {
|
||||
visits.push({
|
||||
uri: makeURI("http://example.com/browser_urlbarOneOffs.js/?" + i),
|
||||
// TYPED so that the visit shows up when the urlbar's drop-down arrow is
|
||||
// pressed.
|
||||
transition: Ci.nsINavHistoryService.TRANSITION_TYPED,
|
||||
});
|
||||
}
|
||||
await PlacesTestUtils.addVisits(visits);
|
||||
});
|
||||
|
||||
|
||||
async function selectSettings(activateFn) {
|
||||
await BrowserTestUtils.withNewTab({gBrowser, url: "about:blank"}, async browser => {
|
||||
gURLBar.focus();
|
||||
EventUtils.synthesizeKey("KEY_ArrowDown");
|
||||
await promisePopupShown(gURLBar.popup);
|
||||
await waitForAutocompleteResultAt(gMaxResults - 1);
|
||||
|
||||
let promiseHidden = promisePopupHidden(gURLBar.popup);
|
||||
let prefPaneLoaded = TestUtils.topicObserved("sync-pane-loaded", () => true);
|
||||
|
||||
activateFn();
|
||||
|
||||
await prefPaneLoaded;
|
||||
await promiseHidden;
|
||||
|
||||
Assert.equal(gBrowser.contentWindow.history.state, "paneSearch",
|
||||
"Should have opened the search preferences pane");
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function test_open_settings_with_enter() {
|
||||
await selectSettings(() => {
|
||||
EventUtils.synthesizeKey("KEY_ArrowUp");
|
||||
|
||||
Assert.equal(gURLBar.popup.oneOffSearchButtons.selectedButton.getAttribute("anonid"),
|
||||
"search-settings-compact", "Should have selected the settings button");
|
||||
|
||||
EventUtils.synthesizeKey("KEY_Enter");
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_open_settings_with_click() {
|
||||
await selectSettings(() => {
|
||||
gURLBar.popup.oneOffSearchButtons.settingsButton.click();
|
||||
});
|
||||
});
|
||||
|
||||
async function hidePopup() {
|
||||
EventUtils.synthesizeKey("KEY_Escape");
|
||||
await promisePopupHidden(gURLBar.popup);
|
||||
}
|
@ -652,9 +652,6 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
return;
|
||||
}
|
||||
|
||||
BrowserUsageTelemetry.recordUrlbarSelectedResultMethod(
|
||||
event, this.userSelectionBehavior);
|
||||
|
||||
// Determine whether to use the selected one-off search button. In
|
||||
// one-off search buttons parlance, "selected" means that the button
|
||||
// has been navigated to via the keyboard. So we want to use it if
|
||||
@ -673,6 +670,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
return;
|
||||
}
|
||||
|
||||
BrowserUsageTelemetry.recordUrlbarSelectedResultMethod(
|
||||
event, this.userSelectionBehavior);
|
||||
|
||||
let where = openUILinkWhere || this._whereToOpen(event);
|
||||
|
||||
let url = this.value;
|
||||
|
@ -2,8 +2,6 @@
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
const DEFAULT_PROCESS_COUNT = Services.prefs.getDefaultBranch(null).getIntPref("dom.ipc.processCount");
|
||||
|
||||
add_task(async function test_slow_content_script() {
|
||||
// Make sure we get a new process for our tab, or our reportProcessHangs
|
||||
// preferences value won't apply to it.
|
||||
@ -17,7 +15,7 @@ add_task(async function test_slow_content_script() {
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["dom.ipc.processCount", DEFAULT_PROCESS_COUNT * 2],
|
||||
["dom.ipc.processCount", 8],
|
||||
["dom.ipc.processPrelaunch.enabled", false],
|
||||
["dom.ipc.reportProcessHangs", true],
|
||||
],
|
||||
|
@ -613,7 +613,6 @@
|
||||
<menuitem label="5" value="5"/>
|
||||
<menuitem label="6" value="6"/>
|
||||
<menuitem label="7" value="7"/>
|
||||
<menuitem label="8" value="8"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
|
@ -44,9 +44,7 @@ add_task(async function testPrefsAreDefault() {
|
||||
});
|
||||
|
||||
add_task(async function testPrefsSetByUser() {
|
||||
const kNewCount = DEFAULT_PROCESS_COUNT - 2;
|
||||
|
||||
Services.prefs.setIntPref("dom.ipc.processCount", kNewCount);
|
||||
Services.prefs.setIntPref("dom.ipc.processCount", DEFAULT_PROCESS_COUNT + 2);
|
||||
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", false);
|
||||
|
||||
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
|
||||
@ -58,8 +56,8 @@ add_task(async function testPrefsSetByUser() {
|
||||
|
||||
let contentProcessCount = doc.querySelector("#contentProcessCount");
|
||||
is(contentProcessCount.disabled, false, "process count control should be enabled");
|
||||
is(Services.prefs.getIntPref("dom.ipc.processCount"), kNewCount, "process count should be the set value");
|
||||
is(contentProcessCount.selectedItem.value, kNewCount, "selected item should be the set one");
|
||||
is(Services.prefs.getIntPref("dom.ipc.processCount"), DEFAULT_PROCESS_COUNT + 2, "process count should be the set value");
|
||||
is(contentProcessCount.selectedItem.value, DEFAULT_PROCESS_COUNT + 2, "selected item should be the set one");
|
||||
|
||||
let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings");
|
||||
useRecommendedPerformanceSettings.click();
|
||||
|
@ -23,6 +23,10 @@ XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() {
|
||||
return Services.strings.createBundle("chrome://branding/locale/brand.properties");
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "OSPermissions",
|
||||
"@mozilla.org/ospermissionrequest;1",
|
||||
"nsIOSPermissionRequest");
|
||||
|
||||
var webrtcUI = {
|
||||
peerConnectionBlockers: new Set(),
|
||||
emitter: new EventEmitter(),
|
||||
@ -300,6 +304,67 @@ function denyRequest(aBrowser, aRequest) {
|
||||
windowID: aRequest.windowID});
|
||||
}
|
||||
|
||||
//
|
||||
// Deny the request because the browser does not have access to the
|
||||
// camera or microphone due to OS security restrictions. The user may
|
||||
// have granted camera/microphone access to the site, but not have
|
||||
// allowed the browser access in OS settings.
|
||||
//
|
||||
function denyRequestNoPermission(aBrowser, aRequest) {
|
||||
aBrowser.messageManager.sendAsyncMessage("webrtc:Deny",
|
||||
{callID: aRequest.callID,
|
||||
windowID: aRequest.windowID,
|
||||
noOSPermission: true});
|
||||
}
|
||||
|
||||
//
|
||||
// Check if we have permission to access the camera and or microphone at the
|
||||
// OS level. Triggers a request to access the device if access is needed and
|
||||
// the permission state has not yet been determined.
|
||||
//
|
||||
async function checkOSPermission(camNeeded, micNeeded) {
|
||||
let camStatus = {}, micStatus = {};
|
||||
OSPermissions.getMediaCapturePermissionState(camStatus, micStatus);
|
||||
if (camNeeded) {
|
||||
let camPermission = camStatus.value;
|
||||
let camAccessible = await checkAndGetOSPermission(camPermission,
|
||||
OSPermissions.requestVideoCapturePermission);
|
||||
if (!camAccessible) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (micNeeded) {
|
||||
let micPermission = micStatus.value;
|
||||
let micAccessible = await checkAndGetOSPermission(micPermission,
|
||||
OSPermissions.requestAudioCapturePermission);
|
||||
if (!micAccessible) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// Given a device's permission, return true if the device is accessible. If
|
||||
// the device's permission is not yet determined, request access to the device.
|
||||
// |requestPermissionFunc| must return a promise that resolves with true
|
||||
// if the device is accessible and false otherwise.
|
||||
//
|
||||
async function checkAndGetOSPermission(devicePermission,
|
||||
requestPermissionFunc) {
|
||||
if (devicePermission == OSPermissions.PERMISSION_STATE_DENIED ||
|
||||
devicePermission == OSPermissions.PERMISSION_STATE_RESTRICTED) {
|
||||
return false;
|
||||
}
|
||||
if (devicePermission == OSPermissions.PERMISSION_STATE_NOTDETERMINED) {
|
||||
let deviceAllowed = await requestPermissionFunc();
|
||||
if (!deviceAllowed) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function getHostOrExtensionName(uri, href) {
|
||||
let host;
|
||||
try {
|
||||
@ -517,10 +582,19 @@ function prompt(aBrowser, aRequest) {
|
||||
browser._devicePermissionURIs = browser._devicePermissionURIs || [];
|
||||
browser._devicePermissionURIs.push(uri);
|
||||
|
||||
let mm = browser.messageManager;
|
||||
mm.sendAsyncMessage("webrtc:Allow", {callID: aRequest.callID,
|
||||
windowID: aRequest.windowID,
|
||||
devices: allowedDevices});
|
||||
let camNeeded = videoDevices.length > 0;
|
||||
let micNeeded = audioDevices.length > 0;
|
||||
checkOSPermission(camNeeded, micNeeded).then((havePermission) => {
|
||||
if (havePermission) {
|
||||
let mm = browser.messageManager;
|
||||
mm.sendAsyncMessage("webrtc:Allow", {callID: aRequest.callID,
|
||||
windowID: aRequest.windowID,
|
||||
devices: allowedDevices});
|
||||
} else {
|
||||
denyRequestNoPermission(browser, aRequest);
|
||||
}
|
||||
});
|
||||
|
||||
this.remove();
|
||||
return true;
|
||||
}
|
||||
@ -717,7 +791,7 @@ function prompt(aBrowser, aRequest) {
|
||||
if (!sharingAudio)
|
||||
listDevices(micMenupopup, audioDevices);
|
||||
|
||||
this.mainAction.callback = function(aState) {
|
||||
this.mainAction.callback = async function(aState) {
|
||||
let remember = aState && aState.checkboxChecked;
|
||||
let allowedDevices = [];
|
||||
let perms = Services.perms;
|
||||
@ -784,6 +858,14 @@ function prompt(aBrowser, aRequest) {
|
||||
aBrowser._devicePermissionURIs.push(uri);
|
||||
}
|
||||
|
||||
let camNeeded = videoDevices.length > 0;
|
||||
let micNeeded = audioDevices.length > 0;
|
||||
let havePermission = await checkOSPermission(camNeeded, micNeeded);
|
||||
if (!havePermission) {
|
||||
denyRequestNoPermission(notification.browser, aRequest);
|
||||
return;
|
||||
}
|
||||
|
||||
let mm = notification.browser.messageManager;
|
||||
mm.sendAsyncMessage("webrtc:Allow", {callID: aRequest.callID,
|
||||
windowID: aRequest.windowID,
|
||||
|
@ -30,7 +30,7 @@ const RESPONSE_PREVIEW = L10N.getStr("responsePreview");
|
||||
|
||||
const JSON_VIEW_MIME_TYPE = "application/vnd.mozilla.json.view";
|
||||
|
||||
/*
|
||||
/**
|
||||
* Response panel component
|
||||
* Displays the GET parameters and POST data of a request
|
||||
*/
|
||||
@ -53,8 +53,7 @@ class ResponsePanel extends Component {
|
||||
},
|
||||
};
|
||||
|
||||
this.updateImageDimemsions = this.updateImageDimemsions.bind(this);
|
||||
this.isJSON = this.isJSON.bind(this);
|
||||
this.updateImageDimensions = this.updateImageDimensions.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@ -67,7 +66,7 @@ class ResponsePanel extends Component {
|
||||
fetchNetworkUpdatePacket(connector.requestData, request, ["responseContent"]);
|
||||
}
|
||||
|
||||
updateImageDimemsions({ target }) {
|
||||
updateImageDimensions({ target }) {
|
||||
this.setState({
|
||||
imageDimensions: {
|
||||
width: target.naturalWidth,
|
||||
@ -76,20 +75,45 @@ class ResponsePanel extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
// Handle json, which we tentatively identify by checking the MIME type
|
||||
// for "json" after any word boundary. This works for the standard
|
||||
// "application/json", and also for custom types like "x-bigcorp-json".
|
||||
// Additionally, we also directly parse the response text content to
|
||||
// verify whether it's json or not, to handle responses incorrectly
|
||||
// labeled as text/plain instead.
|
||||
/**
|
||||
* This method checks that the response is base64 encoded by
|
||||
* comparing these 2 values:
|
||||
* 1. The original response
|
||||
* 2. The value of doing a base64 decode on the
|
||||
* response and then base64 encoding the result.
|
||||
* If the values are different or an error is thrown,
|
||||
* the method will return false.
|
||||
*/
|
||||
isBase64(response) {
|
||||
try {
|
||||
return btoa(atob(response)) == response;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle json, which we tentatively identify by checking the
|
||||
* MIME type for "json" after any word boundary. This works
|
||||
* for the standard "application/json", and also for custom
|
||||
* types like "x-bigcorp-json". Additionally, we also
|
||||
* directly parse the response text content to verify whether
|
||||
* it's json or not, to handle responses incorrectly labeled
|
||||
* as text/plain instead.
|
||||
*/
|
||||
isJSON(mimeType, response) {
|
||||
let json, error;
|
||||
|
||||
try {
|
||||
json = JSON.parse(response);
|
||||
} catch (err) {
|
||||
try {
|
||||
json = JSON.parse(atob(response));
|
||||
} catch (err64) {
|
||||
if (this.isBase64(response)) {
|
||||
try {
|
||||
json = JSON.parse(atob(response));
|
||||
} catch (err64) {
|
||||
error = err;
|
||||
}
|
||||
} else {
|
||||
error = err;
|
||||
}
|
||||
}
|
||||
@ -150,7 +174,7 @@ class ResponsePanel extends Component {
|
||||
img({
|
||||
className: "response-image",
|
||||
src: formDataURI(mimeType, encoding, text),
|
||||
onLoad: this.updateImageDimemsions,
|
||||
onLoad: this.updateImageDimensions,
|
||||
}),
|
||||
div({ className: "response-summary" },
|
||||
div({ className: "tabpanel-summary-label" }, RESPONSE_IMG_NAME),
|
||||
|
@ -18,6 +18,7 @@ support-files =
|
||||
html_json-b64.html
|
||||
html_json-basic.html
|
||||
html_json-custom-mime-test-page.html
|
||||
html_json-empty.html
|
||||
html_json-long-test-page.html
|
||||
html_json-malformed-test-page.html
|
||||
html_json-text-mime-test-page.html
|
||||
@ -133,6 +134,7 @@ skip-if = (os == 'mac') # Bug 1479782
|
||||
[browser_net_headers_sorted.js]
|
||||
[browser_net_image-tooltip.js]
|
||||
[browser_net_json-b64.js]
|
||||
[browser_net_json-empty.js]
|
||||
[browser_net_json-null.js]
|
||||
[browser_net_json-long.js]
|
||||
[browser_net_json-malformed.js]
|
||||
|
47
devtools/client/netmonitor/test/browser_net_json-empty.js
Normal file
47
devtools/client/netmonitor/test/browser_net_json-empty.js
Normal file
@ -0,0 +1,47 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Tests if empty JSON responses are properly displayed.
|
||||
*/
|
||||
|
||||
add_task(async function() {
|
||||
const { tab, monitor } = await initNetMonitor(JSON_EMPTY_URL + "?name=empty");
|
||||
info("Starting test... ");
|
||||
|
||||
const { document, store, windowRequire } = monitor.panelWin;
|
||||
const { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
|
||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
// Execute requests.
|
||||
await performRequests(monitor, tab, 1);
|
||||
|
||||
const onResponsePanelReady = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
store.dispatch(Actions.toggleNetworkDetails());
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
await onResponsePanelReady;
|
||||
|
||||
const tabpanel = document.querySelector("#response-panel");
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 2,
|
||||
"There should be 2 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".empty-notice").length, 0,
|
||||
"The empty notice should not be displayed in this tabpanel.");
|
||||
|
||||
is(tabpanel.querySelector(".response-error-header") === null, true,
|
||||
"The response error header doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, false,
|
||||
"The response editor has the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
||||
const jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
|
||||
await teardown(monitor);
|
||||
});
|
@ -20,11 +20,11 @@ add_task(async function() {
|
||||
// Execute requests.
|
||||
await performRequests(monitor, tab, 1);
|
||||
|
||||
const onReponsePanelReady = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
const onResponsePanelReady = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
store.dispatch(Actions.toggleNetworkDetails());
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
await onReponsePanelReady;
|
||||
await onResponsePanelReady;
|
||||
|
||||
checkResponsePanelDisplaysJSON();
|
||||
|
||||
|
@ -61,6 +61,7 @@ const JSON_CUSTOM_MIME_URL = EXAMPLE_URL + "html_json-custom-mime-test-page.html
|
||||
const JSON_TEXT_MIME_URL = EXAMPLE_URL + "html_json-text-mime-test-page.html";
|
||||
const JSON_B64_URL = EXAMPLE_URL + "html_json-b64.html";
|
||||
const JSON_BASIC_URL = EXAMPLE_URL + "html_json-basic.html";
|
||||
const JSON_EMPTY_URL = EXAMPLE_URL + "html_json-empty.html";
|
||||
const SORTING_URL = EXAMPLE_URL + "html_sorting-test-page.html";
|
||||
const FILTERING_URL = EXAMPLE_URL + "html_filter-test-page.html";
|
||||
const INFINITE_GET_URL = EXAMPLE_URL + "html_infinite-get-page.html";
|
||||
|
42
devtools/client/netmonitor/test/html_json-empty.html
Normal file
42
devtools/client/netmonitor/test/html_json-empty.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!doctype html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
<meta http-equiv="Expires" content="0" />
|
||||
<title>Network Monitor test page</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Empty JSON test page</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* exported performRequests */
|
||||
"use strict";
|
||||
|
||||
function get(address, callback) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", address, true);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (this.readyState == this.DONE) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function performRequests() {
|
||||
// Forward the query parameter for this page to sjs_json-test-server
|
||||
get("sjs_json-test-server.sjs" + window.location.search, function() {
|
||||
// Done.
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -21,5 +21,8 @@ function handleRequest(request, response) {
|
||||
case "nogrip":
|
||||
response.write("{\"obj\": {\"type\": \"string\" }}");
|
||||
break;
|
||||
case "empty":
|
||||
response.write("{}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ Element::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
if (bindingURL) {
|
||||
nsCOMPtr<nsIURI> uri = bindingURL->GetURI();
|
||||
nsCOMPtr<nsIPrincipal> principal = bindingURL->mExtraData->GetPrincipal();
|
||||
nsCOMPtr<nsIPrincipal> principal = bindingURL->mExtraData->Principal();
|
||||
|
||||
// We have a binding that must be installed.
|
||||
bool dummy;
|
||||
|
@ -3799,7 +3799,7 @@ nsIDocument::DefaultStyleAttrURLData()
|
||||
mCachedURLData->BaseURI() != baseURI ||
|
||||
mCachedURLData->GetReferrer() != docURI ||
|
||||
mCachedURLData->GetReferrerPolicy() != policy ||
|
||||
mCachedURLData->GetPrincipal() != principal) {
|
||||
mCachedURLData->Principal() != principal) {
|
||||
mCachedURLData = new URLExtraData(baseURI, docURI, principal, policy);
|
||||
}
|
||||
return mCachedURLData;
|
||||
|
@ -5,11 +5,14 @@ const CONTENT_CREATED = "ipc:content-created";
|
||||
// Make sure that BTU.withNewTab({ ..., forceNewProcess: true }) loads
|
||||
// new tabs in their own process.
|
||||
async function spawnNewAndTest(recur, pids) {
|
||||
let processCreated = TestUtils.topicObserved(CONTENT_CREATED);
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank", forceNewProcess: true },
|
||||
async function(browser) {
|
||||
// Make sure our new browser is in its own process.
|
||||
// Make sure our new browser is in its own process. The processCreated
|
||||
// promise should have already resolved by this point.
|
||||
await processCreated;
|
||||
let newPid = browser.frameLoader.tabParent.osPid;
|
||||
ok(!pids.has(newPid), "new tab is in its own process: " + recur);
|
||||
ok(!pids.has(newPid), "new tab is in its own process");
|
||||
pids.add(newPid);
|
||||
|
||||
if (recur) {
|
||||
|
@ -2260,6 +2260,7 @@ MediaManager::Get() {
|
||||
obs->AddObserver(sSingleton, "getUserMedia:privileged:allow", false);
|
||||
obs->AddObserver(sSingleton, "getUserMedia:response:allow", false);
|
||||
obs->AddObserver(sSingleton, "getUserMedia:response:deny", false);
|
||||
obs->AddObserver(sSingleton, "getUserMedia:response:noOSPermission", false);
|
||||
obs->AddObserver(sSingleton, "getUserMedia:revoke", false);
|
||||
}
|
||||
// else MediaManager won't work properly and will leak (see bug 837874)
|
||||
@ -3634,6 +3635,7 @@ MediaManager::Shutdown()
|
||||
obs->RemoveObserver(this, "getUserMedia:privileged:allow");
|
||||
obs->RemoveObserver(this, "getUserMedia:response:allow");
|
||||
obs->RemoveObserver(this, "getUserMedia:response:deny");
|
||||
obs->RemoveObserver(this, "getUserMedia:response:noOSPermission");
|
||||
obs->RemoveObserver(this, "getUserMedia:revoke");
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
@ -3769,12 +3771,30 @@ MediaManager::SendPendingGUMRequest()
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
IsGUMResponseNoAccess(const char* aTopic, MediaMgrError::Name& aErrorName)
|
||||
{
|
||||
if (!strcmp(aTopic, "getUserMedia:response:deny")) {
|
||||
aErrorName = MediaMgrError::Name::NotAllowedError;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, "getUserMedia:response:noOSPermission")) {
|
||||
aErrorName = MediaMgrError::Name::NotFoundError;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult
|
||||
MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
const char16_t* aData)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
MediaMgrError::Name gumNoAccessError = MediaMgrError::Name::NotAllowedError;
|
||||
|
||||
if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
|
||||
nsCOMPtr<nsIPrefBranch> branch( do_QueryInterface(aSubject) );
|
||||
if (branch) {
|
||||
@ -3860,12 +3880,12 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
MediaManager::PostTask(task.forget());
|
||||
return NS_OK;
|
||||
|
||||
} else if (!strcmp(aTopic, "getUserMedia:response:deny")) {
|
||||
} else if (IsGUMResponseNoAccess(aTopic, gumNoAccessError)) {
|
||||
nsString key(aData);
|
||||
RefPtr<GetUserMediaTask> task;
|
||||
mActiveCallbacks.Remove(key, getter_AddRefs(task));
|
||||
if (task) {
|
||||
task->Denied(MediaMgrError::Name::NotAllowedError);
|
||||
task->Denied(gumNoAccessError);
|
||||
nsTArray<nsString>* array;
|
||||
if (!mCallIds.Get(task->GetWindowID(), &array)) {
|
||||
return NS_OK;
|
||||
|
@ -3514,7 +3514,6 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
|
||||
RefPtr<gfxImageSurface> blackImage;
|
||||
gfxRect targetRect(rect.x, rect.y, rect.width, rect.height);
|
||||
IntSize targetSize(rect.width, rect.height);
|
||||
gfxPoint deviceOffset = -targetRect.TopLeft();
|
||||
|
||||
// We always use a temporary "white image"
|
||||
whiteImage = new gfxImageSurface(targetSize, SurfaceFormat::X8R8G8B8_UINT32);
|
||||
@ -3549,6 +3548,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
|
||||
blackImage = image->GetSubimage(targetRect);
|
||||
|
||||
#else
|
||||
gfxPoint deviceOffset = -targetRect.TopLeft();
|
||||
// Paint onto white background
|
||||
whiteImage->SetDeviceOffset(deviceOffset);
|
||||
PaintRectToSurface(rect, whiteImage, Color(1.f, 1.f, 1.f));
|
||||
|
@ -124,7 +124,6 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent,
|
||||
, mChildPluginHWND(nullptr)
|
||||
, mChildPluginsParentHWND(nullptr)
|
||||
, mPluginWndProc(nullptr)
|
||||
, mNestedEventState(false)
|
||||
#endif // defined(XP_WIN)
|
||||
#if defined(XP_MACOSX)
|
||||
, mShWidth(0)
|
||||
|
@ -402,7 +402,6 @@ private:
|
||||
HWND mChildPluginHWND;
|
||||
HWND mChildPluginsParentHWND;
|
||||
WNDPROC mPluginWndProc;
|
||||
bool mNestedEventState;
|
||||
#endif // defined(XP_WIN)
|
||||
#if defined(MOZ_WIDGET_COCOA)
|
||||
private:
|
||||
|
@ -495,7 +495,7 @@ PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId,
|
||||
parent->mBrokerParent =
|
||||
FunctionBrokerParent::Create(std::move(brokerParentEnd));
|
||||
if (parent->mBrokerParent) {
|
||||
parent->SendInitPluginFunctionBroker(std::move(brokerChildEnd));
|
||||
Unused << parent->SendInitPluginFunctionBroker(std::move(brokerChildEnd));
|
||||
}
|
||||
#endif
|
||||
return parent.forget();
|
||||
|
@ -475,21 +475,14 @@ struct DIGroup
|
||||
// smaller areas
|
||||
InvalidateRect(aData->mRect.Intersect(imageRect)); // invalidate the old area -- in theory combined should take care of this
|
||||
UniquePtr<nsDisplayItemGeometry> geometry(aItem->AllocateGeometry(aBuilder));
|
||||
aData->mClip.AddOffsetAndComputeDifference(nsPoint(), aData->mGeometry->ComputeInvalidationRegion(), clip,
|
||||
geometry ? geometry->ComputeInvalidationRegion() :
|
||||
aData->mGeometry->ComputeInvalidationRegion(),
|
||||
&combined);
|
||||
IntRect transformedRect = ToDeviceSpace(combined.GetBounds(), aMatrix, appUnitsPerDevPixel, mLayerBounds.TopLeft());
|
||||
IntRect invalidRect = transformedRect.Intersect(imageRect);
|
||||
GP("combined not empty: mRect %d %d %d %d\n", invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height);
|
||||
// invalidate the invalidated area.
|
||||
InvalidateRect(invalidRect);
|
||||
|
||||
aData->mGeometry = std::move(geometry);
|
||||
|
||||
combined = clip.ApplyNonRoundedIntersection(aData->mGeometry->ComputeInvalidationRegion());
|
||||
transformedRect = ToDeviceSpace(combined.GetBounds(), aMatrix, appUnitsPerDevPixel, mLayerBounds.TopLeft());
|
||||
IntRect transformedRect = ToDeviceSpace(combined.GetBounds(), aMatrix, appUnitsPerDevPixel, mLayerBounds.TopLeft());
|
||||
aData->mRect = transformedRect.Intersect(imageRect);
|
||||
InvalidateRect(aData->mRect);
|
||||
|
||||
// CGC invariant broken
|
||||
if (!mInvalidRect.Contains(aData->mRect)) {
|
||||
@ -498,10 +491,6 @@ struct DIGroup
|
||||
"-" << aData->mRect.y <<
|
||||
"-" << aData->mRect.width <<
|
||||
"-" << aData->mRect.height <<
|
||||
"," << invalidRect.x <<
|
||||
"-" << invalidRect.y <<
|
||||
"-" << invalidRect.width <<
|
||||
"-" << invalidRect.height <<
|
||||
"-ib";
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "mozilla/ThreadLocal.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsExceptionHandler.h"
|
||||
@ -277,6 +277,7 @@ Interceptor::Interceptor(IInterceptorSink* aSink)
|
||||
{
|
||||
static const bool kHasTls = tlsCreatingStdMarshal.init();
|
||||
MOZ_ASSERT(kHasTls);
|
||||
Unused << kHasTls;
|
||||
|
||||
MOZ_ASSERT(aSink);
|
||||
RefPtr<IWeakReference> weakRef;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "mozilla/mscom/Utils.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/ThreadLocal.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsProxyRelease.h"
|
||||
|
||||
@ -166,6 +167,7 @@ public:
|
||||
MOZ_ASSERT(sIsInit);
|
||||
MOZ_ASSERT(!tlsFrame.get());
|
||||
tlsFrame.set(this);
|
||||
Unused << sIsInit;
|
||||
}
|
||||
|
||||
~SavedCallFrame()
|
||||
|
@ -11,10 +11,10 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/BackgroundHangMonitor.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/mscom/SpinEvent.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/SystemGroup.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "private/prpriv.h" // For PR_GetThreadID
|
||||
#include <winternl.h> // For NTSTATUS and NTAPI
|
||||
|
||||
@ -38,6 +38,7 @@ public:
|
||||
{
|
||||
static const bool gotStatics = InitStatics();
|
||||
MOZ_ASSERT(gotStatics);
|
||||
Unused << gotStatics;
|
||||
}
|
||||
|
||||
~SyncRunnable() = default;
|
||||
@ -131,6 +132,7 @@ MainThreadInvoker::MainThreadInvoker()
|
||||
{
|
||||
static const bool gotStatics = InitStatics();
|
||||
MOZ_ASSERT(gotStatics);
|
||||
Unused << gotStatics;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -296,7 +296,7 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
|
||||
|
||||
nsAutoString manifestPath;
|
||||
|
||||
auto marshalFn = [this, &aIID, aObject, mshlFlags, &stream, &streamSize,
|
||||
auto marshalFn = [&aIID, aObject, mshlFlags, &stream, &streamSize,
|
||||
&hglobal, &createStreamResult, &marshalResult, &statResult,
|
||||
&getHGlobalResult, aEnv, &manifestPath]() -> void
|
||||
{
|
||||
|
@ -2426,7 +2426,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
|
||||
|
||||
RefPtr<nsXBLBinding> binding;
|
||||
rv = xblService->LoadBindings(aDocElement, display->mBinding->GetURI(),
|
||||
display->mBinding->mExtraData->GetPrincipal(),
|
||||
display->mBinding->mExtraData->Principal(),
|
||||
getter_AddRefs(binding), &resolveStyle);
|
||||
if (NS_FAILED(rv) && rv != NS_ERROR_XBL_BLOCKED) {
|
||||
// Binding will load asynchronously.
|
||||
@ -5579,7 +5579,7 @@ nsCSSFrameConstructor::LoadXBLBindingIfNeeded(nsIContent& aContent,
|
||||
bool resolveStyle;
|
||||
nsresult rv = xblService->LoadBindings(aContent.AsElement(),
|
||||
binding->GetURI(),
|
||||
binding->mExtraData->GetPrincipal(),
|
||||
binding->mExtraData->Principal(),
|
||||
getter_AddRefs(newPendingBinding->mBinding),
|
||||
&resolveStyle);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -1105,8 +1105,7 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsACString& aFamilyName
|
||||
face->mReferrer = url->mExtraData->GetReferrer();
|
||||
face->mReferrerPolicy = url->mExtraData->GetReferrerPolicy();
|
||||
face->mOriginPrincipal =
|
||||
new gfxFontSrcPrincipal(url->mExtraData->GetPrincipal());
|
||||
NS_ASSERTION(face->mOriginPrincipal, "null origin principal in @font-face rule");
|
||||
new gfxFontSrcPrincipal(url->mExtraData->Principal());
|
||||
|
||||
// agent and user stylesheets are treated slightly differently,
|
||||
// the same-site origin check and access control headers are
|
||||
|
@ -53,7 +53,7 @@ ImageLoader::DropDocumentReference()
|
||||
request->CancelAndForgetObserver(NS_BINDING_ABORTED);
|
||||
}
|
||||
|
||||
// Need to check whether the entry exists, since the css::ImageValue might
|
||||
// Need to check whether the entry exists, since the css::URLValue might
|
||||
// go away before ImageLoader::DropDocumentReference is called.
|
||||
uint64_t imageLoadID = it.Key();
|
||||
if (auto entry = sImages->Lookup(imageLoadID)) {
|
||||
@ -208,7 +208,7 @@ ImageLoader::AssociateRequestToFrame(imgIRequest* aRequest,
|
||||
}
|
||||
|
||||
imgRequestProxy*
|
||||
ImageLoader::RegisterCSSImage(ImageLoader::Image* aImage)
|
||||
ImageLoader::RegisterCSSImage(URLValue* aImage)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aImage);
|
||||
@ -254,7 +254,7 @@ ImageLoader::RegisterCSSImage(ImageLoader::Image* aImage)
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
ImageLoader::DeregisterCSSImageFromAllLoaders(ImageLoader::Image* aImage)
|
||||
ImageLoader::DeregisterCSSImageFromAllLoaders(URLValue* aImage)
|
||||
{
|
||||
MOZ_ASSERT(aImage);
|
||||
|
||||
@ -455,7 +455,7 @@ ImageLoader::LoadImage(nsIURI* aURI,
|
||||
nsIURI* aReferrer,
|
||||
mozilla::net::ReferrerPolicy aPolicy,
|
||||
nsIDocument* aDocument,
|
||||
ImageLoader::Image* aImage,
|
||||
URLValue* aImage,
|
||||
CORSMode aCorsMode)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -469,7 +469,7 @@ ImageLoader::LoadImage(nsIURI* aURI,
|
||||
}
|
||||
|
||||
if (sImages->Contains(aImage->LoadID())) {
|
||||
// This css::ImageValue has already been loaded.
|
||||
// This css::URLValue has already been loaded.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class nsIPrincipal;
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
|
||||
struct ImageValue;
|
||||
struct URLValue;
|
||||
|
||||
/**
|
||||
* NOTE: All methods must be called from the main thread unless otherwise
|
||||
@ -51,8 +51,6 @@ public:
|
||||
REQUEST_HAS_BLOCKED_ONLOAD = 1u << 1,
|
||||
};
|
||||
|
||||
typedef mozilla::css::ImageValue Image;
|
||||
|
||||
explicit ImageLoader(nsIDocument* aDocument)
|
||||
: mDocument(aDocument),
|
||||
mInClone(false)
|
||||
@ -65,7 +63,7 @@ public:
|
||||
|
||||
void DropDocumentReference();
|
||||
|
||||
imgRequestProxy* RegisterCSSImage(Image* aImage);
|
||||
imgRequestProxy* RegisterCSSImage(URLValue* aImage);
|
||||
|
||||
void AssociateRequestToFrame(imgIRequest* aRequest,
|
||||
nsIFrame* aFrame,
|
||||
@ -88,14 +86,14 @@ public:
|
||||
nsIURI* aReferrer,
|
||||
mozilla::net::ReferrerPolicy aPolicy,
|
||||
nsIDocument* aDocument,
|
||||
Image* aCSSValue,
|
||||
URLValue* aImage,
|
||||
CORSMode aCorsMode);
|
||||
|
||||
// Cancels the image load for the given css::ImageValue and deregisters
|
||||
// Cancels the image load for the given css::URLValue and deregisters
|
||||
// it from any ImageLoaders it was registered with.
|
||||
//
|
||||
// May be called from any thread.
|
||||
static void DeregisterCSSImageFromAllLoaders(Image* aImage);
|
||||
static void DeregisterCSSImageFromAllLoaders(URLValue* aImage);
|
||||
|
||||
void FlushUseCounters();
|
||||
|
||||
@ -187,39 +185,39 @@ private:
|
||||
// A weak pointer to our document. Nulled out by DropDocumentReference.
|
||||
nsIDocument* mDocument;
|
||||
|
||||
// A map of css::ImageValues, keyed by their LoadID(), to the imgRequestProxy
|
||||
// A map of css::URLValues, keyed by their LoadID(), to the imgRequestProxy
|
||||
// representing the load of the image for this ImageLoader's document.
|
||||
//
|
||||
// We use the LoadID() as the key since we can only access mRegisteredImages
|
||||
// on the main thread, but css::ImageValues might be destroyed from other
|
||||
// on the main thread, but css::URLValues might be destroyed from other
|
||||
// threads, and we don't want to leave dangling pointers around.
|
||||
nsRefPtrHashtable<nsUint64HashKey, imgRequestProxy> mRegisteredImages;
|
||||
|
||||
// Are we cloning? If so, ignore any notifications we get.
|
||||
bool mInClone;
|
||||
|
||||
// Data associated with every css::ImageValue object that has had a load
|
||||
// Data associated with every css::URLValue object that has had a load
|
||||
// started.
|
||||
struct ImageTableEntry
|
||||
{
|
||||
// Set of all ImageLoaders that have registered this css::ImageValue.
|
||||
// Set of all ImageLoaders that have registered this css::URLValue.
|
||||
nsTHashtable<nsPtrHashKey<ImageLoader>> mImageLoaders;
|
||||
|
||||
// The "canonical" image request for this css::ImageValue.
|
||||
// The "canonical" image request for this css::URLValue.
|
||||
//
|
||||
// This request is held on to as long as the specified css::ImageValue
|
||||
// This request is held on to as long as the specified css::URLValue
|
||||
// object is, so that any image that has already started loading (or
|
||||
// has completed loading) will stay alive even if all computed values
|
||||
// referencing the image requesst have gone away.
|
||||
RefPtr<imgRequestProxy> mCanonicalRequest;
|
||||
};
|
||||
|
||||
// A table of all css::ImageValues that have been loaded, keyed by their
|
||||
// A table of all css::URLValues that have been loaded, keyed by their
|
||||
// LoadID(), mapping them to the set of ImageLoaders they have been registered
|
||||
// in, and recording their "canonical" image request.
|
||||
//
|
||||
// We use the LoadID() as the key since we can only access sImages on the
|
||||
// main thread, but css::ImageValues might be destroyed from other threads,
|
||||
// main thread, but css::URLValues might be destroyed from other threads,
|
||||
// and we don't want to leave dangling pointers around.
|
||||
static nsClassHashtable<nsUint64HashKey, ImageTableEntry>* sImages;
|
||||
};
|
||||
|
@ -1386,21 +1386,10 @@ Gecko_CounterStyle_GetAnonymous(const CounterStylePtr* aPtr)
|
||||
}
|
||||
|
||||
already_AddRefed<css::URLValue>
|
||||
ServoBundledURI::IntoCssUrl()
|
||||
ServoBundledURI::IntoCssUrl(CORSMode aCorsMode)
|
||||
{
|
||||
MOZ_ASSERT(mExtraData->GetReferrer());
|
||||
MOZ_ASSERT(mExtraData->GetPrincipal());
|
||||
|
||||
RefPtr<css::URLValue> urlValue =
|
||||
new css::URLValue(mURLString, do_AddRef(mExtraData));
|
||||
return urlValue.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<css::ImageValue>
|
||||
ServoBundledURI::IntoCssImage(mozilla::CORSMode aCorsMode)
|
||||
{
|
||||
RefPtr<css::ImageValue> urlValue =
|
||||
new css::ImageValue(mURLString, do_AddRef(mExtraData), aCorsMode);
|
||||
new css::URLValue(mURLString, do_AddRef(mExtraData), aCorsMode);
|
||||
return urlValue.forget();
|
||||
}
|
||||
|
||||
@ -1418,35 +1407,18 @@ Gecko_SetGradientImageValue(nsStyleImage* aImage, nsStyleGradient* aGradient)
|
||||
aImage->SetGradientData(aGradient);
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::ImageValue, ImageValue);
|
||||
|
||||
static already_AddRefed<nsStyleImageRequest>
|
||||
CreateStyleImageRequest(nsStyleImageRequest::Mode aModeFlags,
|
||||
mozilla::css::ImageValue* aImageValue)
|
||||
URLValue* aImageValue)
|
||||
{
|
||||
RefPtr<nsStyleImageRequest> req =
|
||||
new nsStyleImageRequest(aModeFlags, aImageValue);
|
||||
return req.forget();
|
||||
}
|
||||
|
||||
mozilla::css::ImageValue*
|
||||
Gecko_ImageValue_Create(ServoBundledURI aURI, mozilla::CORSMode aCORSMode)
|
||||
{
|
||||
return aURI.IntoCssImage(aCORSMode).take();
|
||||
}
|
||||
|
||||
MOZ_DEFINE_MALLOC_SIZE_OF(GeckoImageValueMallocSizeOf)
|
||||
|
||||
size_t
|
||||
Gecko_ImageValue_SizeOfIncludingThis(mozilla::css::ImageValue* aImageValue)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return aImageValue->SizeOfIncludingThis(GeckoImageValueMallocSizeOf);
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_SetLayerImageImageValue(nsStyleImage* aImage,
|
||||
mozilla::css::ImageValue* aImageValue)
|
||||
URLValue* aImageValue)
|
||||
{
|
||||
MOZ_ASSERT(aImage && aImageValue);
|
||||
|
||||
@ -1486,7 +1458,7 @@ Gecko_SetCursorArrayLength(nsStyleUI* aStyleUI, size_t aLen)
|
||||
|
||||
void
|
||||
Gecko_SetCursorImageValue(nsCursorImage* aCursor,
|
||||
mozilla::css::ImageValue* aImageValue)
|
||||
URLValue* aImageValue)
|
||||
{
|
||||
MOZ_ASSERT(aCursor && aImageValue);
|
||||
|
||||
@ -1502,7 +1474,7 @@ Gecko_CopyCursorArrayFrom(nsStyleUI* aDest, const nsStyleUI* aSrc)
|
||||
|
||||
void
|
||||
Gecko_SetContentDataImageValue(nsStyleContentData* aContent,
|
||||
mozilla::css::ImageValue* aImageValue)
|
||||
URLValue* aImageValue)
|
||||
{
|
||||
MOZ_ASSERT(aContent && aImageValue);
|
||||
|
||||
@ -1584,7 +1556,7 @@ Gecko_SetListStyleImageNone(nsStyleList* aList)
|
||||
|
||||
void
|
||||
Gecko_SetListStyleImageImageValue(nsStyleList* aList,
|
||||
mozilla::css::ImageValue* aImageValue)
|
||||
URLValue* aImageValue)
|
||||
{
|
||||
MOZ_ASSERT(aList && aImageValue);
|
||||
|
||||
@ -1652,17 +1624,17 @@ Gecko_CopyStyleGridTemplateValues(UniquePtr<nsStyleGridTemplate>* aGridTemplate,
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::css::GridTemplateAreasValue*
|
||||
GridTemplateAreasValue*
|
||||
Gecko_NewGridTemplateAreasValue(uint32_t aAreas, uint32_t aTemplates, uint32_t aColumns)
|
||||
{
|
||||
RefPtr<mozilla::css::GridTemplateAreasValue> value = new mozilla::css::GridTemplateAreasValue;
|
||||
RefPtr<GridTemplateAreasValue> value = new GridTemplateAreasValue;
|
||||
value->mNamedAreas.SetLength(aAreas);
|
||||
value->mTemplates.SetLength(aTemplates);
|
||||
value->mNColumns = aColumns;
|
||||
return value.forget().take();
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::GridTemplateAreasValue, GridTemplateAreasValue);
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(GridTemplateAreasValue, GridTemplateAreasValue);
|
||||
|
||||
void
|
||||
Gecko_ClearAndResizeStyleContents(nsStyleContent* aContent, uint32_t aHowMany)
|
||||
@ -2037,9 +2009,9 @@ Gecko_nsStyleSVG_CopyContextProperties(nsStyleSVG* aDst, const nsStyleSVG* aSrc)
|
||||
|
||||
|
||||
css::URLValue*
|
||||
Gecko_NewURLValue(ServoBundledURI aURI)
|
||||
Gecko_URLValue_Create(ServoBundledURI aURI, mozilla::CORSMode aCORSMode)
|
||||
{
|
||||
RefPtr<css::URLValue> url = aURI.IntoCssUrl();
|
||||
RefPtr<css::URLValue> url = aURI.IntoCssUrl(aCORSMode);
|
||||
return url.forget().take();
|
||||
}
|
||||
|
||||
@ -2053,7 +2025,7 @@ Gecko_URLValue_SizeOfIncludingThis(URLValue* aURL)
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_GetComputedURLSpec(const URLValueData* aURL, nsCString* aOut)
|
||||
Gecko_GetComputedURLSpec(const URLValue* aURL, nsCString* aOut)
|
||||
{
|
||||
MOZ_ASSERT(aURL);
|
||||
MOZ_ASSERT(aOut);
|
||||
@ -2065,7 +2037,7 @@ Gecko_GetComputedURLSpec(const URLValueData* aURL, nsCString* aOut)
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_GetComputedImageURLSpec(const URLValueData* aURL, nsCString* aOut)
|
||||
Gecko_GetComputedImageURLSpec(const URLValue* aURL, nsCString* aOut)
|
||||
{
|
||||
// Image URIs don't serialize local refs as local.
|
||||
if (nsIURI* uri = aURL->GetURI()) {
|
||||
@ -2607,7 +2579,7 @@ LoadImportSheet(css::Loader* aLoader,
|
||||
NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("about:invalid"));
|
||||
}
|
||||
emptySheet->SetURIs(uri, uri, uri);
|
||||
emptySheet->SetPrincipal(aURL->mExtraData->GetPrincipal());
|
||||
emptySheet->SetPrincipal(aURL->mExtraData->Principal());
|
||||
emptySheet->SetComplete();
|
||||
aParent->PrependStyleSheet(emptySheet);
|
||||
return emptySheet.forget();
|
||||
@ -2627,7 +2599,10 @@ Gecko_LoadStyleSheet(css::Loader* aLoader,
|
||||
RawServoMediaListStrong aMediaList)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
RefPtr<css::URLValue> url = aServoURL.IntoCssUrl();
|
||||
|
||||
// The CORS mode in the URLValue is irrelevant here.
|
||||
// (CORS_NONE is used for all imported sheets in Load::LoadChildSheet.)
|
||||
RefPtr<css::URLValue> url = aServoURL.IntoCssUrl(CORS_NONE);
|
||||
return LoadImportSheet(aLoader, aParent, aParentLoadData, aReusableSheets,
|
||||
url, aMediaList.Consume()).take();
|
||||
}
|
||||
@ -2639,7 +2614,9 @@ Gecko_LoadStyleSheetAsync(css::SheetLoadDataHolder* aParentData,
|
||||
RawServoImportRuleStrong aImportRule)
|
||||
{
|
||||
RefPtr<SheetLoadDataHolder> loadData = aParentData;
|
||||
RefPtr<css::URLValue> urlVal = aServoURL.IntoCssUrl();
|
||||
// The CORS mode in the URLValue is irrelevant here.
|
||||
// (CORS_NONE is used for all imported sheets in Load::LoadChildSheet.)
|
||||
RefPtr<css::URLValue> urlVal = aServoURL.IntoCssUrl(CORS_NONE);
|
||||
RefPtr<RawServoMediaList> mediaList = aMediaList.Consume();
|
||||
RefPtr<RawServoImportRule> importRule = aImportRule.Consume();
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction(__func__,
|
||||
|
@ -44,7 +44,6 @@ namespace mozilla {
|
||||
namespace css {
|
||||
class ErrorReporter;
|
||||
struct URLValue;
|
||||
struct ImageValue;
|
||||
class LoaderReusableStyleSheets;
|
||||
};
|
||||
namespace dom {
|
||||
@ -114,10 +113,9 @@ extern "C" {
|
||||
class ServoBundledURI
|
||||
{
|
||||
public:
|
||||
// NOTE(emilio): Not calling IntoCssUrl or IntoCssImage will cause to leak the
|
||||
// NOTE(emilio): Not calling IntoCssUrl will cause to leak the
|
||||
// string, so don't do that :)
|
||||
already_AddRefed<mozilla::css::URLValue> IntoCssUrl();
|
||||
already_AddRefed<mozilla::css::ImageValue> IntoCssImage(mozilla::CORSMode);
|
||||
already_AddRefed<mozilla::css::URLValue> IntoCssUrl(mozilla::CORSMode);
|
||||
mozilla::ServoRawOffsetArc<RustString> mURLString;
|
||||
mozilla::URLExtraData* mExtraData;
|
||||
};
|
||||
@ -352,12 +350,8 @@ Gecko_CounterStyle_GetAnonymous(const mozilla::CounterStylePtr* ptr);
|
||||
// background-image style.
|
||||
void Gecko_SetNullImageValue(nsStyleImage* image);
|
||||
void Gecko_SetGradientImageValue(nsStyleImage* image, nsStyleGradient* gradient);
|
||||
NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::ImageValue, ImageValue);
|
||||
mozilla::css::ImageValue* Gecko_ImageValue_Create(ServoBundledURI aURI,
|
||||
mozilla::CORSMode aCORSMode);
|
||||
size_t Gecko_ImageValue_SizeOfIncludingThis(mozilla::css::ImageValue* aImageValue);
|
||||
void Gecko_SetLayerImageImageValue(nsStyleImage* image,
|
||||
mozilla::css::ImageValue* aImageValue);
|
||||
mozilla::css::URLValue* image_value);
|
||||
|
||||
void Gecko_SetImageElement(nsStyleImage* image, nsAtom* atom);
|
||||
void Gecko_CopyImageValueFrom(nsStyleImage* image, const nsStyleImage* other);
|
||||
@ -377,17 +371,17 @@ const nsStyleGradient* Gecko_GetGradientImageValue(const nsStyleImage* image);
|
||||
// list-style-image style.
|
||||
void Gecko_SetListStyleImageNone(nsStyleList* style_struct);
|
||||
void Gecko_SetListStyleImageImageValue(nsStyleList* style_struct,
|
||||
mozilla::css::ImageValue* aImageValue);
|
||||
mozilla::css::URLValue* aImageValue);
|
||||
void Gecko_CopyListStyleImageFrom(nsStyleList* dest, const nsStyleList* src);
|
||||
|
||||
// cursor style.
|
||||
void Gecko_SetCursorArrayLength(nsStyleUI* ui, size_t len);
|
||||
void Gecko_SetCursorImageValue(nsCursorImage* aCursor,
|
||||
mozilla::css::ImageValue* aImageValue);
|
||||
mozilla::css::URLValue* aImageValue);
|
||||
void Gecko_CopyCursorArrayFrom(nsStyleUI* dest, const nsStyleUI* src);
|
||||
|
||||
void Gecko_SetContentDataImageValue(nsStyleContentData* aList,
|
||||
mozilla::css::ImageValue* aImageValue);
|
||||
mozilla::css::URLValue* aImageValue);
|
||||
nsStyleContentData::CounterFunction* Gecko_SetCounterFunction(
|
||||
nsStyleContentData* content_data, mozilla::StyleContentType);
|
||||
|
||||
@ -547,10 +541,10 @@ void Gecko_nsStyleSVG_CopyDashArray(nsStyleSVG* dst, const nsStyleSVG* src);
|
||||
void Gecko_nsStyleSVG_SetContextPropertiesLength(nsStyleSVG* svg, uint32_t len);
|
||||
void Gecko_nsStyleSVG_CopyContextProperties(nsStyleSVG* dst, const nsStyleSVG* src);
|
||||
|
||||
mozilla::css::URLValue* Gecko_NewURLValue(ServoBundledURI uri);
|
||||
mozilla::css::URLValue* Gecko_URLValue_Create(ServoBundledURI uri, mozilla::CORSMode aCORSMode);
|
||||
size_t Gecko_URLValue_SizeOfIncludingThis(mozilla::css::URLValue* url);
|
||||
void Gecko_GetComputedURLSpec(const mozilla::css::URLValueData* url, nsCString* spec);
|
||||
void Gecko_GetComputedImageURLSpec(const mozilla::css::URLValueData* url, nsCString* spec);
|
||||
void Gecko_GetComputedURLSpec(const mozilla::css::URLValue* url, nsCString* spec);
|
||||
void Gecko_GetComputedImageURLSpec(const mozilla::css::URLValue* url, nsCString* spec);
|
||||
void Gecko_nsIURI_Debug(nsIURI*, nsCString* spec);
|
||||
|
||||
NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::URLValue, CSSURLValue);
|
||||
|
@ -480,9 +480,7 @@ raw-lines = [
|
||||
whitelist-functions = ["Servo_.*", "Gecko_.*"]
|
||||
structs-types = [
|
||||
"mozilla::css::GridTemplateAreasValue",
|
||||
"mozilla::css::ImageValue",
|
||||
"mozilla::css::URLValue",
|
||||
"mozilla::css::URLValueData",
|
||||
"mozilla::dom::CallerType",
|
||||
"mozilla::dom::ShadowRoot",
|
||||
"mozilla::AnonymousCounterStyle",
|
||||
|
@ -35,6 +35,7 @@ struct URLExtraData
|
||||
, mIsChrome(mReferrer ? dom::IsChromeURI(mReferrer) : false)
|
||||
{
|
||||
MOZ_ASSERT(mBaseURI);
|
||||
MOZ_ASSERT(mPrincipal);
|
||||
}
|
||||
|
||||
URLExtraData(nsIURI* aBaseURI, nsIURI* aReferrer, nsIPrincipal* aPrincipal,
|
||||
@ -49,7 +50,7 @@ struct URLExtraData
|
||||
nsIURI* BaseURI() const { return mBaseURI; }
|
||||
nsIURI* GetReferrer() const { return mReferrer; }
|
||||
net::ReferrerPolicy GetReferrerPolicy() const { return mReferrerPolicy;}
|
||||
nsIPrincipal* GetPrincipal() const { return mPrincipal; }
|
||||
nsIPrincipal* Principal() const { return mPrincipal; }
|
||||
|
||||
static URLExtraData* Dummy() {
|
||||
MOZ_ASSERT(sDummy);
|
||||
|
@ -885,39 +885,17 @@ nsCSSValue::Array::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) cons
|
||||
return n;
|
||||
}
|
||||
|
||||
css::URLValueData::URLValueData(already_AddRefed<nsIURI> aURI,
|
||||
ServoRawOffsetArc<RustString> aString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
CORSMode aCORSMode)
|
||||
: mURI(std::move(aURI))
|
||||
, mExtraData(std::move(aExtraData))
|
||||
, mURIResolved(true)
|
||||
, mString(aString)
|
||||
, mCORSMode(aCORSMode)
|
||||
css::URLValue::~URLValue()
|
||||
{
|
||||
MOZ_ASSERT(mExtraData);
|
||||
MOZ_ASSERT(mExtraData->GetPrincipal());
|
||||
}
|
||||
if (mLoadID != 0) {
|
||||
ImageLoader::DeregisterCSSImageFromAllLoaders(this);
|
||||
}
|
||||
|
||||
css::URLValueData::URLValueData(ServoRawOffsetArc<RustString> aString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
CORSMode aCORSMode)
|
||||
: mExtraData(std::move(aExtraData))
|
||||
, mURIResolved(false)
|
||||
, mString(aString)
|
||||
, mCORSMode(aCORSMode)
|
||||
{
|
||||
MOZ_ASSERT(mExtraData);
|
||||
MOZ_ASSERT(mExtraData->GetPrincipal());
|
||||
}
|
||||
|
||||
css::URLValueData::~URLValueData()
|
||||
{
|
||||
Servo_ReleaseArcStringData(&mString);
|
||||
}
|
||||
|
||||
bool
|
||||
css::URLValueData::Equals(const URLValueData& aOther) const
|
||||
css::URLValue::Equals(const URLValue& aOther) const
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -932,13 +910,12 @@ css::URLValueData::Equals(const URLValueData& aOther) const
|
||||
(self->BaseURI() == other->BaseURI() ||
|
||||
(NS_SUCCEEDED(self->BaseURI()->Equals(other->BaseURI(), &eq)) &&
|
||||
eq)) &&
|
||||
(self->GetPrincipal() == other->GetPrincipal() ||
|
||||
self->GetPrincipal()->Equals(other->GetPrincipal())) &&
|
||||
self->Principal()->Equals(other->Principal()) &&
|
||||
IsLocalRef() == aOther.IsLocalRef();
|
||||
}
|
||||
|
||||
bool
|
||||
css::URLValueData::DefinitelyEqualURIs(const URLValueData& aOther) const
|
||||
css::URLValue::DefinitelyEqualURIs(const URLValue& aOther) const
|
||||
{
|
||||
if (mExtraData->BaseURI() != aOther.mExtraData->BaseURI()) {
|
||||
return false;
|
||||
@ -947,15 +924,15 @@ css::URLValueData::DefinitelyEqualURIs(const URLValueData& aOther) const
|
||||
}
|
||||
|
||||
bool
|
||||
css::URLValueData::DefinitelyEqualURIsAndPrincipal(
|
||||
const URLValueData& aOther) const
|
||||
css::URLValue::DefinitelyEqualURIsAndPrincipal(
|
||||
const URLValue& aOther) const
|
||||
{
|
||||
return mExtraData->GetPrincipal() == aOther.mExtraData->GetPrincipal() &&
|
||||
return mExtraData->Principal() == aOther.mExtraData->Principal() &&
|
||||
DefinitelyEqualURIs(aOther);
|
||||
}
|
||||
|
||||
nsDependentCSubstring
|
||||
css::URLValueData::GetString() const
|
||||
css::URLValue::GetString() const
|
||||
{
|
||||
const uint8_t* chars;
|
||||
uint32_t len;
|
||||
@ -964,7 +941,7 @@ css::URLValueData::GetString() const
|
||||
}
|
||||
|
||||
nsIURI*
|
||||
css::URLValueData::GetURI() const
|
||||
css::URLValue::GetURI() const
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -982,7 +959,7 @@ css::URLValueData::GetURI() const
|
||||
}
|
||||
|
||||
bool
|
||||
css::URLValueData::IsLocalRef() const
|
||||
css::URLValue::IsLocalRef() const
|
||||
{
|
||||
if (mIsLocalRef.isNothing()) {
|
||||
// IsLocalRefURL is O(N), use it only when IsLocalRef is called.
|
||||
@ -992,7 +969,7 @@ css::URLValueData::IsLocalRef() const
|
||||
}
|
||||
|
||||
bool
|
||||
css::URLValueData::HasRef() const
|
||||
css::URLValue::HasRef() const
|
||||
{
|
||||
if (IsLocalRef()) {
|
||||
return true;
|
||||
@ -1008,7 +985,7 @@ css::URLValueData::HasRef() const
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
css::URLValueData::ResolveLocalRef(nsIURI* aURI) const
|
||||
css::URLValue::ResolveLocalRef(nsIURI* aURI) const
|
||||
{
|
||||
nsCOMPtr<nsIURI> result = GetURI();
|
||||
|
||||
@ -1030,14 +1007,14 @@ css::URLValueData::ResolveLocalRef(nsIURI* aURI) const
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
css::URLValueData::ResolveLocalRef(nsIContent* aContent) const
|
||||
css::URLValue::ResolveLocalRef(nsIContent* aContent) const
|
||||
{
|
||||
nsCOMPtr<nsIURI> url = aContent->GetBaseURI();
|
||||
return ResolveLocalRef(url);
|
||||
}
|
||||
|
||||
void
|
||||
css::URLValueData::GetSourceString(nsString& aRef) const
|
||||
css::URLValue::GetSourceString(nsString& aRef) const
|
||||
{
|
||||
nsIURI* uri = GetURI();
|
||||
if (!uri) {
|
||||
@ -1048,7 +1025,7 @@ css::URLValueData::GetSourceString(nsString& aRef) const
|
||||
nsCString cref;
|
||||
if (IsLocalRef()) {
|
||||
// XXXheycam It's possible we can just return mString in this case, since
|
||||
// it should be the "#fragment" string the URLValueData was created with.
|
||||
// it should be the "#fragment" string the URLValue was created with.
|
||||
uri->GetRef(cref);
|
||||
cref.Insert('#', 0);
|
||||
} else {
|
||||
@ -1063,61 +1040,25 @@ css::URLValueData::GetSourceString(nsString& aRef) const
|
||||
aRef = NS_ConvertUTF8toUTF16(cref);
|
||||
}
|
||||
|
||||
bool
|
||||
css::URLValueData::EqualsExceptRef(nsIURI* aURI) const
|
||||
{
|
||||
nsIURI* uri = GetURI();
|
||||
if (!uri) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ret = false;
|
||||
uri->EqualsExceptRef(aURI, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t
|
||||
css::URLValueData::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
css::URLValue::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
// Measurement of the following members may be added later if DMD finds it
|
||||
// is worthwhile:
|
||||
// - mURI
|
||||
// - mString
|
||||
// - mExtraData
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
css::URLValue::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
// Only measure it if it's unshared, to avoid double-counting.
|
||||
size_t n = 0;
|
||||
if (mRefCnt <= 1) {
|
||||
n += aMallocSizeOf(this);
|
||||
n += URLValueData::SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
css::ImageValue::ImageValue(nsIURI* aURI,
|
||||
ServoRawOffsetArc<RustString> aString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
nsIDocument* aDocument,
|
||||
CORSMode aCORSMode)
|
||||
: URLValueData(do_AddRef(aURI), aString, std::move(aExtraData), aCORSMode)
|
||||
{
|
||||
LoadImage(aDocument);
|
||||
}
|
||||
|
||||
css::ImageValue::ImageValue(ServoRawOffsetArc<RustString> aString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
CORSMode aCORSMode)
|
||||
: URLValueData(aString, std::move(aExtraData), aCORSMode)
|
||||
{
|
||||
}
|
||||
|
||||
imgRequestProxy*
|
||||
css::ImageValue::LoadImage(nsIDocument* aDocument)
|
||||
css::URLValue::LoadImage(nsIDocument* aDocument)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -1137,7 +1078,7 @@ css::ImageValue::LoadImage(nsIDocument* aDocument)
|
||||
|
||||
// Kick off the load in the loading document.
|
||||
ImageLoader::LoadImage(GetURI(),
|
||||
mExtraData->GetPrincipal(),
|
||||
mExtraData->Principal(),
|
||||
mExtraData->GetReferrer(),
|
||||
mExtraData->GetReferrerPolicy(),
|
||||
loadingDoc,
|
||||
@ -1148,21 +1089,6 @@ css::ImageValue::LoadImage(nsIDocument* aDocument)
|
||||
return aDocument->StyleImageLoader()->RegisterCSSImage(this);
|
||||
}
|
||||
|
||||
css::ImageValue::~ImageValue()
|
||||
{
|
||||
if (mLoadID != 0) {
|
||||
ImageLoader::DeregisterCSSImageFromAllLoaders(this);
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
css::ImageValue::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += css::URLValueData::SizeOfExcludingThis(aMallocSizeOf);
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t
|
||||
mozilla::css::GridTemplateAreasValue::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
|
@ -93,45 +93,42 @@ class CSSStyleSheet;
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
|
||||
struct URLValueData
|
||||
struct URLValue final
|
||||
{
|
||||
protected:
|
||||
// Methods are not inline because using an nsIPrincipal means requiring
|
||||
// caps, which leads to REQUIRES hell, since this header is included all
|
||||
// over.
|
||||
|
||||
// aString must not be null.
|
||||
// principal of aExtraData must not be null.
|
||||
public:
|
||||
// aString and aExtraData must not be null.
|
||||
//
|
||||
// Construct with a base URI; this will create the actual URI lazily from
|
||||
// aString and aExtraData.
|
||||
URLValueData(ServoRawOffsetArc<RustString> aString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
CORSMode aCORSMode);
|
||||
// Construct with the actual URI.
|
||||
URLValueData(already_AddRefed<nsIURI> aURI,
|
||||
ServoRawOffsetArc<RustString> aString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
CORSMode aCORSMode);
|
||||
URLValue(ServoRawOffsetArc<RustString> aString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
CORSMode aCORSMode)
|
||||
: mExtraData(std::move(aExtraData))
|
||||
, mURIResolved(false)
|
||||
, mString(aString)
|
||||
, mCORSMode(aCORSMode)
|
||||
{
|
||||
MOZ_ASSERT(mExtraData);
|
||||
}
|
||||
|
||||
public:
|
||||
// Returns true iff all fields of the two URLValueData objects are equal.
|
||||
// Returns true iff all fields of the two URLValue objects are equal.
|
||||
//
|
||||
// Only safe to call on the main thread, since this will call Equals on the
|
||||
// nsIURI and nsIPrincipal objects stored on the URLValueData objects.
|
||||
bool Equals(const URLValueData& aOther) const;
|
||||
// nsIURI and nsIPrincipal objects stored on the URLValue objects.
|
||||
bool Equals(const URLValue& aOther) const;
|
||||
|
||||
// Returns true iff we know for sure, by comparing the mBaseURI pointer,
|
||||
// the specified url() value mString, and the mIsLocalRef, that these
|
||||
// two URLValueData objects represent the same computed url() value.
|
||||
// two URLValue objects represent the same computed url() value.
|
||||
//
|
||||
// Doesn't look at mReferrer or mOriginPrincipal.
|
||||
//
|
||||
// Safe to call from any thread.
|
||||
bool DefinitelyEqualURIs(const URLValueData& aOther) const;
|
||||
bool DefinitelyEqualURIs(const URLValue& aOther) const;
|
||||
|
||||
// Smae as DefinitelyEqualURIs but additionally compares the nsIPrincipal
|
||||
// pointers of the two URLValueData objects.
|
||||
bool DefinitelyEqualURIsAndPrincipal(const URLValueData& aOther) const;
|
||||
// pointers of the two URLValue objects.
|
||||
bool DefinitelyEqualURIsAndPrincipal(const URLValue& aOther) const;
|
||||
|
||||
nsIURI* GetURI() const;
|
||||
|
||||
@ -139,7 +136,7 @@ public:
|
||||
|
||||
bool HasRef() const;
|
||||
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(URLValueData)
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(URLValue)
|
||||
|
||||
// When matching a url with mIsLocalRef set, resolve it against aURI;
|
||||
// Otherwise, ignore aURL and return mURL directly.
|
||||
@ -150,15 +147,14 @@ public:
|
||||
// and serializing just the fragment if true.
|
||||
void GetSourceString(nsString& aRef) const;
|
||||
|
||||
bool EqualsExceptRef(nsIURI* aURI) const;
|
||||
|
||||
bool IsStringEmpty() const
|
||||
{
|
||||
return GetString().IsEmpty();
|
||||
}
|
||||
|
||||
nsDependentCSubstring GetString() const;
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
imgRequestProxy* LoadImage(nsIDocument* aDocument);
|
||||
|
||||
uint64_t LoadID() const { return mLoadID; }
|
||||
|
||||
private:
|
||||
// mURI stores the lazily resolved URI. This may be null if the URI is
|
||||
// invalid, even once resolved.
|
||||
@ -175,77 +171,9 @@ private:
|
||||
|
||||
mozilla::ServoRawOffsetArc<RustString> mString;
|
||||
|
||||
protected:
|
||||
const CORSMode mCORSMode;
|
||||
|
||||
virtual ~URLValueData();
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
URLValueData(const URLValueData& aOther) = delete;
|
||||
URLValueData& operator=(const URLValueData& aOther) = delete;
|
||||
|
||||
friend struct ImageValue;
|
||||
};
|
||||
|
||||
struct URLValue final : public URLValueData
|
||||
{
|
||||
URLValue(ServoRawOffsetArc<RustString> aString,
|
||||
already_AddRefed<URLExtraData> aExtraData)
|
||||
: URLValueData(aString, std::move(aExtraData), CORSMode::CORS_NONE)
|
||||
{ }
|
||||
|
||||
URLValue(const URLValue&) = delete;
|
||||
URLValue& operator=(const URLValue&) = delete;
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
};
|
||||
|
||||
struct ImageValue final : public URLValueData
|
||||
{
|
||||
// Not making the constructor and destructor inline because that would
|
||||
// force us to include imgIRequest.h, which leads to REQUIRES hell, since
|
||||
// this header is included all over.
|
||||
//
|
||||
// This constructor is only safe to call from the main thread.
|
||||
ImageValue(nsIURI* aURI, const nsAString& aString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
nsIDocument* aDocument,
|
||||
CORSMode aCORSMode);
|
||||
|
||||
// This constructor is only safe to call from the main thread.
|
||||
ImageValue(nsIURI* aURI, ServoRawOffsetArc<RustString> aString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
nsIDocument* aDocument,
|
||||
CORSMode aCORSMode);
|
||||
|
||||
// This constructor is safe to call from any thread, but Initialize
|
||||
// must be called later for the object to be useful.
|
||||
ImageValue(const nsAString& aString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
CORSMode aCORSMode);
|
||||
|
||||
// This constructor is safe to call from any thread, but Initialize
|
||||
// must be called later for the object to be useful.
|
||||
ImageValue(ServoRawOffsetArc<RustString> aURIString,
|
||||
already_AddRefed<URLExtraData> aExtraData,
|
||||
CORSMode aCORSMode);
|
||||
|
||||
ImageValue(const ImageValue&) = delete;
|
||||
ImageValue& operator=(const ImageValue&) = delete;
|
||||
|
||||
imgRequestProxy* LoadImage(nsIDocument* aDocument);
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
uint64_t LoadID() const { return mLoadID; }
|
||||
|
||||
protected:
|
||||
~ImageValue();
|
||||
|
||||
private:
|
||||
// A unique, non-reused ID value for this ImageValue over the life of the
|
||||
// A unique, non-reused ID value for this URLValue over the life of the
|
||||
// process. This value is only valid after LoadImage has been called.
|
||||
//
|
||||
// We use this as a key in some tables in ImageLoader. This is better than
|
||||
@ -255,6 +183,12 @@ private:
|
||||
// get re-used by the time we want to update the ImageLoader tables, we use
|
||||
// these IDs.
|
||||
uint64_t mLoadID = 0;
|
||||
|
||||
~URLValue();
|
||||
|
||||
private:
|
||||
URLValue(const URLValue& aOther) = delete;
|
||||
URLValue& operator=(const URLValue& aOther) = delete;
|
||||
};
|
||||
|
||||
struct GridNamedArea {
|
||||
@ -440,8 +374,6 @@ public:
|
||||
struct Array;
|
||||
friend struct Array;
|
||||
|
||||
friend struct mozilla::css::ImageValue;
|
||||
|
||||
// for valueless units only (null, auto, inherit, none, all, normal)
|
||||
explicit nsCSSValue(nsCSSUnit aUnit = eCSSUnit_Null)
|
||||
: mUnit(aUnit)
|
||||
|
@ -662,7 +662,7 @@ AddImageURL(nsIURI& aURI, nsTArray<nsString>& aURLs)
|
||||
|
||||
|
||||
static void
|
||||
AddImageURL(const css::URLValueData& aURL, nsTArray<nsString>& aURLs)
|
||||
AddImageURL(const css::URLValue& aURL, nsTArray<nsString>& aURLs)
|
||||
{
|
||||
if (aURL.IsLocalRef()) {
|
||||
return;
|
||||
@ -1696,7 +1696,7 @@ nsComputedDOMStyle::SetValueToPosition(
|
||||
|
||||
|
||||
void
|
||||
nsComputedDOMStyle::SetValueToURLValue(const css::URLValueData* aURL,
|
||||
nsComputedDOMStyle::SetValueToURLValue(const css::URLValue* aURL,
|
||||
nsROCSSPrimitiveValue* aValue)
|
||||
{
|
||||
if (!aURL) {
|
||||
@ -1704,7 +1704,7 @@ nsComputedDOMStyle::SetValueToURLValue(const css::URLValueData* aURL,
|
||||
return;
|
||||
}
|
||||
|
||||
// If we have a usable nsIURI in the URLValueData, and the url() wasn't
|
||||
// If we have a usable nsIURI in the URLValue, and the url() wasn't
|
||||
// a fragment-only URL, serialize the nsIURI.
|
||||
if (!aURL->IsLocalRef()) {
|
||||
if (nsIURI* uri = aURL->GetURI()) {
|
||||
|
@ -470,7 +470,7 @@ private:
|
||||
nsROCSSPrimitiveValue* aValue);
|
||||
void SetValueToPosition(const mozilla::Position& aPosition,
|
||||
nsDOMCSSValueList* aValueList);
|
||||
void SetValueToURLValue(const mozilla::css::URLValueData* aURL,
|
||||
void SetValueToURLValue(const mozilla::css::URLValue* aURL,
|
||||
nsROCSSPrimitiveValue* aValue);
|
||||
|
||||
/**
|
||||
|
@ -59,16 +59,16 @@ static constexpr size_t kStyleStructSizeLimit = 504;
|
||||
#undef STYLE_STRUCT
|
||||
|
||||
static bool
|
||||
DefinitelyEqualURIs(css::URLValueData* aURI1,
|
||||
css::URLValueData* aURI2)
|
||||
DefinitelyEqualURIs(css::URLValue* aURI1,
|
||||
css::URLValue* aURI2)
|
||||
{
|
||||
return aURI1 == aURI2 ||
|
||||
(aURI1 && aURI2 && aURI1->DefinitelyEqualURIs(*aURI2));
|
||||
}
|
||||
|
||||
static bool
|
||||
DefinitelyEqualURIsAndPrincipal(css::URLValueData* aURI1,
|
||||
css::URLValueData* aURI2)
|
||||
DefinitelyEqualURIsAndPrincipal(css::URLValue* aURI1,
|
||||
css::URLValue* aURI2)
|
||||
{
|
||||
return aURI1 == aURI2 ||
|
||||
(aURI1 && aURI2 && aURI1->DefinitelyEqualURIsAndPrincipal(*aURI2));
|
||||
@ -1251,7 +1251,7 @@ nsStyleSVGReset::FinishStyle(nsPresContext* aPresContext, const nsStyleSVGReset*
|
||||
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, mMask) {
|
||||
nsStyleImage& image = mMask.mLayers[i].mImage;
|
||||
if (image.GetType() == eStyleImageType_Image) {
|
||||
css::URLValueData* url = image.GetURLValue();
|
||||
css::URLValue* url = image.GetURLValue();
|
||||
// If the url is a local ref, it must be a <mask-resource>, so we don't
|
||||
// need to resolve the style image.
|
||||
if (url->IsLocalRef()) {
|
||||
@ -2083,7 +2083,7 @@ private:
|
||||
};
|
||||
|
||||
nsStyleImageRequest::nsStyleImageRequest(Mode aModeFlags,
|
||||
css::ImageValue* aImageValue)
|
||||
css::URLValue* aImageValue)
|
||||
: mImageValue(aImageValue)
|
||||
, mModeFlags(aModeFlags)
|
||||
, mResolved(false)
|
||||
@ -2665,7 +2665,7 @@ nsStyleImage::GetImageURI() const
|
||||
return uri.forget();
|
||||
}
|
||||
|
||||
css::URLValueData*
|
||||
css::URLValue*
|
||||
nsStyleImage::GetURLValue() const
|
||||
{
|
||||
if (mType == eStyleImageType_Image) {
|
||||
|
@ -219,15 +219,13 @@ private:
|
||||
* RequestDiscard() are made to the imgRequestProxy and ImageTracker as
|
||||
* appropriate, according to the mode flags passed in to the constructor.
|
||||
*
|
||||
* The constructor receives a css::ImageValue to represent the url()
|
||||
* The constructor receives a css::URLValue to represent the url()
|
||||
* information, which is held on to for the comparisons done in
|
||||
* DefinitelyEquals().
|
||||
*/
|
||||
class nsStyleImageRequest
|
||||
{
|
||||
public:
|
||||
typedef mozilla::css::URLValueData URLValueData;
|
||||
|
||||
// Flags describing whether the imgRequestProxy must be tracked in the
|
||||
// ImageTracker, whether LockImage/UnlockImage calls will be made
|
||||
// when obtaining and releasing the imgRequestProxy, and whether
|
||||
@ -251,7 +249,7 @@ public:
|
||||
|
||||
// Can be called from any thread, but Resolve() must be called later
|
||||
// on the main thread before get() can be used.
|
||||
nsStyleImageRequest(Mode aModeFlags, mozilla::css::ImageValue* aImageValue);
|
||||
nsStyleImageRequest(Mode aModeFlags, mozilla::css::URLValue* aImageValue);
|
||||
|
||||
bool Resolve(nsPresContext*, const nsStyleImageRequest* aOldImageRequest);
|
||||
bool IsResolved() const { return mResolved; }
|
||||
@ -265,11 +263,11 @@ public:
|
||||
return const_cast<nsStyleImageRequest*>(this)->get();
|
||||
}
|
||||
|
||||
// Returns whether the ImageValue objects in the two nsStyleImageRequests
|
||||
// return true from URLValueData::DefinitelyEqualURIs.
|
||||
// Returns whether the URLValue objects in the two nsStyleImageRequests
|
||||
// return true from URLValue::DefinitelyEqualURIs.
|
||||
bool DefinitelyEquals(const nsStyleImageRequest& aOther) const;
|
||||
|
||||
mozilla::css::ImageValue* GetImageValue() const { return mImageValue; }
|
||||
mozilla::css::URLValue* GetImageValue() const { return mImageValue; }
|
||||
|
||||
already_AddRefed<nsIURI> GetImageURI() const;
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsStyleImageRequest);
|
||||
@ -281,7 +279,7 @@ private:
|
||||
void MaybeTrackAndLock();
|
||||
|
||||
RefPtr<imgRequestProxy> mRequestProxy;
|
||||
RefPtr<mozilla::css::ImageValue> mImageValue;
|
||||
RefPtr<mozilla::css::URLValue> mImageValue;
|
||||
RefPtr<mozilla::dom::ImageTracker> mImageTracker;
|
||||
|
||||
// Cache DocGroup for dispatching events in the destructor.
|
||||
@ -335,8 +333,7 @@ private:
|
||||
*/
|
||||
struct nsStyleImage
|
||||
{
|
||||
typedef mozilla::css::URLValue URLValue;
|
||||
typedef mozilla::css::URLValueData URLValueData;
|
||||
typedef mozilla::css::URLValue URLValue;
|
||||
|
||||
nsStyleImage();
|
||||
~nsStyleImage();
|
||||
@ -390,7 +387,7 @@ struct nsStyleImage
|
||||
|
||||
already_AddRefed<nsIURI> GetImageURI() const;
|
||||
|
||||
URLValueData* GetURLValue() const;
|
||||
URLValue* GetURLValue() const;
|
||||
|
||||
/**
|
||||
* Compute the actual crop rect in pixels, using the source image bounds.
|
||||
|
@ -27,7 +27,7 @@
|
||||
using namespace mozilla::dom;
|
||||
|
||||
static already_AddRefed<URLAndReferrerInfo>
|
||||
ResolveURLUsingLocalRef(nsIFrame* aFrame, const css::URLValueData* aURL)
|
||||
ResolveURLUsingLocalRef(nsIFrame* aFrame, const css::URLValue* aURL)
|
||||
{
|
||||
MOZ_ASSERT(aFrame);
|
||||
|
||||
@ -800,7 +800,7 @@ SVGMaskObserverList::SVGMaskObserverList(nsIFrame* aFrame)
|
||||
const nsStyleSVGReset *svgReset = aFrame->StyleSVGReset();
|
||||
|
||||
for (uint32_t i = 0; i < svgReset->mMask.mImageCount; i++) {
|
||||
css::URLValueData* data = svgReset->mMask.mLayers[i].mImage.GetURLValue();
|
||||
css::URLValue* data = svgReset->mMask.mLayers[i].mImage.GetURLValue();
|
||||
RefPtr<URLAndReferrerInfo> maskUri = ResolveURLUsingLocalRef(aFrame, data);
|
||||
|
||||
bool hasRef = false;
|
||||
|
@ -3284,11 +3284,7 @@ pref("dom.ipc.plugins.asyncdrawing.enabled", true);
|
||||
pref("dom.ipc.plugins.forcedirect.enabled", true);
|
||||
|
||||
// Enable multi by default.
|
||||
#if defined(NIGHTLY_BUILD)
|
||||
pref("dom.ipc.processCount", 8);
|
||||
#else
|
||||
pref("dom.ipc.processCount", 4);
|
||||
#endif
|
||||
|
||||
// Default to allow only one file:// URL content process.
|
||||
pref("dom.ipc.processCount.file", 1);
|
||||
|
@ -225,13 +225,13 @@ impl nsStyleImage {
|
||||
match image {
|
||||
GenericImage::Gradient(boxed_gradient) => self.set_gradient(*boxed_gradient),
|
||||
GenericImage::Url(ref url) => unsafe {
|
||||
bindings::Gecko_SetLayerImageImageValue(self, url.0.image_value.get());
|
||||
bindings::Gecko_SetLayerImageImageValue(self, (url.0).0.url_value.get());
|
||||
},
|
||||
GenericImage::Rect(ref image_rect) => {
|
||||
unsafe {
|
||||
bindings::Gecko_SetLayerImageImageValue(
|
||||
self,
|
||||
image_rect.url.0.image_value.get(),
|
||||
(image_rect.url.0).0.url_value.get(),
|
||||
);
|
||||
bindings::Gecko_InitializeImageCropRect(self);
|
||||
|
||||
|
@ -7,10 +7,9 @@
|
||||
use cssparser::Parser;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs::ServoBundledURI;
|
||||
use gecko_bindings::structs::mozilla::css::URLValueData;
|
||||
use gecko_bindings::structs::root::{RustString, nsStyleImageRequest};
|
||||
use gecko_bindings::structs::root::mozilla::CORSMode;
|
||||
use gecko_bindings::structs::root::mozilla::css::{ImageValue, URLValue};
|
||||
use gecko_bindings::structs::root::mozilla::css::URLValue;
|
||||
use gecko_bindings::sugar::refptr::RefPtr;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use nsstring::nsCString;
|
||||
@ -38,8 +37,7 @@ pub struct CssUrl {
|
||||
}
|
||||
|
||||
impl CssUrl {
|
||||
/// Try to parse a URL from a string value that is a valid CSS token for a
|
||||
/// URL.
|
||||
/// Parse a URL from a string value that is a valid CSS token for a URL.
|
||||
pub fn parse_from_string(url: String, context: &ParserContext) -> Self {
|
||||
CssUrl {
|
||||
serialization: Arc::new(url),
|
||||
@ -54,8 +52,8 @@ impl CssUrl {
|
||||
false
|
||||
}
|
||||
|
||||
/// Convert from URLValueData to SpecifiedUrl.
|
||||
unsafe fn from_url_value_data(url: &URLValueData) -> Self {
|
||||
/// Convert from URLValue to CssUrl.
|
||||
unsafe fn from_url_value(url: &URLValue) -> Self {
|
||||
let arc_type = &url.mString as *const _ as *const RawOffsetArc<String>;
|
||||
CssUrl {
|
||||
serialization: Arc::from_raw_offset((*arc_type).clone()),
|
||||
@ -117,7 +115,7 @@ impl MallocSizeOf for CssUrl {
|
||||
}
|
||||
}
|
||||
|
||||
/// A specified url() value for general usage.
|
||||
/// A specified non-image `url()` value.
|
||||
#[derive(Clone, Debug, SpecifiedValueInfo, ToCss)]
|
||||
pub struct SpecifiedUrl {
|
||||
/// The specified url value.
|
||||
@ -129,72 +127,19 @@ pub struct SpecifiedUrl {
|
||||
}
|
||||
|
||||
impl SpecifiedUrl {
|
||||
fn from_css_url(url: CssUrl) -> Self {
|
||||
let url_value = unsafe {
|
||||
let ptr = bindings::Gecko_NewURLValue(url.for_ffi());
|
||||
// We do not expect Gecko_NewURLValue returns null.
|
||||
debug_assert!(!ptr.is_null());
|
||||
RefPtr::from_addrefed(ptr)
|
||||
};
|
||||
Self { url, url_value }
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for SpecifiedUrl {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.url.eq(&other.url)
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for SpecifiedUrl {}
|
||||
|
||||
impl Parse for SpecifiedUrl {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
CssUrl::parse(context, input).map(Self::from_css_url)
|
||||
}
|
||||
}
|
||||
|
||||
impl MallocSizeOf for SpecifiedUrl {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
let mut n = self.url.size_of(ops);
|
||||
// Although this is a RefPtr, this is the primary reference because
|
||||
// SpecifiedUrl is responsible for creating the url_value. So we
|
||||
// measure unconditionally here.
|
||||
n += unsafe { bindings::Gecko_URLValue_SizeOfIncludingThis(self.url_value.get()) };
|
||||
n
|
||||
}
|
||||
}
|
||||
|
||||
/// A specified url() value for image.
|
||||
///
|
||||
/// This exists so that we can construct `ImageValue` and reuse it.
|
||||
#[derive(Clone, Debug, SpecifiedValueInfo, ToCss)]
|
||||
pub struct SpecifiedImageUrl {
|
||||
/// The specified url value.
|
||||
pub url: CssUrl,
|
||||
/// Gecko's ImageValue so that we can reuse it while rematching a
|
||||
/// property with this specified value.
|
||||
#[css(skip)]
|
||||
pub image_value: RefPtr<ImageValue>,
|
||||
}
|
||||
|
||||
impl SpecifiedImageUrl {
|
||||
/// Parse a URL from a string value. See SpecifiedUrl::parse_from_string.
|
||||
/// Parse a URL from a string value.
|
||||
pub fn parse_from_string(url: String, context: &ParserContext) -> Self {
|
||||
Self::from_css_url(CssUrl::parse_from_string(url, context))
|
||||
}
|
||||
|
||||
fn from_css_url_with_cors(url: CssUrl, cors: CORSMode) -> Self {
|
||||
let image_value = unsafe {
|
||||
let ptr = bindings::Gecko_ImageValue_Create(url.for_ffi(), cors);
|
||||
// We do not expect Gecko_ImageValue_Create returns null.
|
||||
let url_value = unsafe {
|
||||
let ptr = bindings::Gecko_URLValue_Create(url.for_ffi(), cors);
|
||||
// We do not expect Gecko_URLValue_Create returns null.
|
||||
debug_assert!(!ptr.is_null());
|
||||
RefPtr::from_addrefed(ptr)
|
||||
};
|
||||
Self { url, image_value }
|
||||
Self { url, url_value }
|
||||
}
|
||||
|
||||
fn from_css_url(url: CssUrl) -> Self {
|
||||
@ -206,18 +151,9 @@ impl SpecifiedImageUrl {
|
||||
use gecko_bindings::structs::root::mozilla::CORSMode_CORS_ANONYMOUS;
|
||||
Self::from_css_url_with_cors(url, CORSMode_CORS_ANONYMOUS)
|
||||
}
|
||||
|
||||
/// Provides an alternate method for parsing that associates the URL
|
||||
/// with anonymous CORS headers.
|
||||
pub fn parse_with_cors_anonymous<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
CssUrl::parse(context, input).map(Self::from_css_url_with_cors_anonymous)
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for SpecifiedImageUrl {
|
||||
impl Parse for SpecifiedUrl {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
@ -226,21 +162,21 @@ impl Parse for SpecifiedImageUrl {
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for SpecifiedImageUrl {
|
||||
impl PartialEq for SpecifiedUrl {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.url.eq(&other.url)
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for SpecifiedImageUrl {}
|
||||
impl Eq for SpecifiedUrl {}
|
||||
|
||||
impl MallocSizeOf for SpecifiedImageUrl {
|
||||
impl MallocSizeOf for SpecifiedUrl {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
let mut n = self.url.size_of(ops);
|
||||
// Although this is a RefPtr, this is the primary reference because
|
||||
// SpecifiedUrl is responsible for creating the image_value. So we
|
||||
// SpecifiedUrl is responsible for creating the url_value. So we
|
||||
// measure unconditionally here.
|
||||
n += unsafe { bindings::Gecko_ImageValue_SizeOfIncludingThis(self.image_value.get()) };
|
||||
n += unsafe { bindings::Gecko_URLValue_SizeOfIncludingThis(self.url_value.get()) };
|
||||
n
|
||||
}
|
||||
}
|
||||
@ -259,6 +195,37 @@ impl ToComputedValue for SpecifiedUrl {
|
||||
}
|
||||
}
|
||||
|
||||
/// A specified image `url()` value.
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub struct SpecifiedImageUrl(pub SpecifiedUrl);
|
||||
|
||||
impl SpecifiedImageUrl {
|
||||
/// Parse a URL from a string value that is a valid CSS token for a URL.
|
||||
pub fn parse_from_string(url: String, context: &ParserContext) -> Self {
|
||||
SpecifiedImageUrl(SpecifiedUrl::parse_from_string(url, context))
|
||||
}
|
||||
|
||||
/// Provides an alternate method for parsing that associates the URL
|
||||
/// with anonymous CORS headers.
|
||||
pub fn parse_with_cors_anonymous<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
CssUrl::parse(context, input)
|
||||
.map(SpecifiedUrl::from_css_url_with_cors_anonymous)
|
||||
.map(SpecifiedImageUrl)
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for SpecifiedImageUrl {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
SpecifiedUrl::parse(context, input).map(SpecifiedImageUrl)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToComputedValue for SpecifiedImageUrl {
|
||||
type ComputedValue = ComputedImageUrl;
|
||||
|
||||
@ -274,9 +241,9 @@ impl ToComputedValue for SpecifiedImageUrl {
|
||||
}
|
||||
|
||||
fn serialize_computed_url<W>(
|
||||
url_value_data: &URLValueData,
|
||||
url_value: &URLValue,
|
||||
dest: &mut CssWriter<W>,
|
||||
get_url: unsafe extern "C" fn(*const URLValueData, *mut nsCString),
|
||||
get_url: unsafe extern "C" fn(*const URLValue, *mut nsCString) -> (),
|
||||
) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
@ -284,13 +251,13 @@ where
|
||||
dest.write_str("url(")?;
|
||||
unsafe {
|
||||
let mut string = nsCString::new();
|
||||
get_url(url_value_data, &mut string);
|
||||
get_url(url_value, &mut string);
|
||||
string.as_str_unchecked().to_css(dest)?;
|
||||
}
|
||||
dest.write_char(')')
|
||||
}
|
||||
|
||||
/// The computed value of a CSS `url()`.
|
||||
/// The computed value of a CSS non-image `url()`.
|
||||
///
|
||||
/// The only difference between specified and computed URLs is the
|
||||
/// serialization.
|
||||
@ -303,7 +270,7 @@ impl ToCss for ComputedUrl {
|
||||
W: Write,
|
||||
{
|
||||
serialize_computed_url(
|
||||
&self.0.url_value._base,
|
||||
&self.0.url_value,
|
||||
dest,
|
||||
bindings::Gecko_GetComputedURLSpec,
|
||||
)
|
||||
@ -313,12 +280,17 @@ impl ToCss for ComputedUrl {
|
||||
impl ComputedUrl {
|
||||
/// Convert from RefPtr<URLValue> to ComputedUrl.
|
||||
pub unsafe fn from_url_value(url_value: RefPtr<URLValue>) -> Self {
|
||||
let url = CssUrl::from_url_value_data(&url_value._base);
|
||||
let url = CssUrl::from_url_value(&*url_value);
|
||||
ComputedUrl(SpecifiedUrl { url, url_value })
|
||||
}
|
||||
|
||||
/// Get a raw pointer to the URLValue held by this ComputedUrl, for FFI.
|
||||
pub fn url_value_ptr(&self) -> *mut URLValue {
|
||||
self.0.url_value.get()
|
||||
}
|
||||
}
|
||||
|
||||
/// The computed value of a CSS `url()` for image.
|
||||
/// The computed value of a CSS image `url()`.
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
pub struct ComputedImageUrl(pub SpecifiedImageUrl);
|
||||
|
||||
@ -328,7 +300,7 @@ impl ToCss for ComputedImageUrl {
|
||||
W: Write,
|
||||
{
|
||||
serialize_computed_url(
|
||||
&self.0.image_value._base,
|
||||
&(self.0).0.url_value,
|
||||
dest,
|
||||
bindings::Gecko_GetComputedImageURLSpec,
|
||||
)
|
||||
@ -338,8 +310,13 @@ impl ToCss for ComputedImageUrl {
|
||||
impl ComputedImageUrl {
|
||||
/// Convert from nsStyleImageReques to ComputedImageUrl.
|
||||
pub unsafe fn from_image_request(image_request: &nsStyleImageRequest) -> Self {
|
||||
let image_value = image_request.mImageValue.to_safe();
|
||||
let url = CssUrl::from_url_value_data(&image_value._base);
|
||||
ComputedImageUrl(SpecifiedImageUrl { url, image_value })
|
||||
let url_value = image_request.mImageValue.to_safe();
|
||||
let url = CssUrl::from_url_value(&*url_value);
|
||||
ComputedImageUrl(SpecifiedImageUrl(SpecifiedUrl { url, url_value }))
|
||||
}
|
||||
|
||||
/// Get a raw pointer to the URLValue held by this ComputedImageUrl, for FFI.
|
||||
pub fn url_value_ptr(&self) -> *mut URLValue {
|
||||
(self.0).0.url_value.get()
|
||||
}
|
||||
}
|
||||
|
@ -297,11 +297,6 @@ impl_threadsafe_refcount!(
|
||||
bindings::Gecko_AddRefGridTemplateAreasValueArbitraryThread,
|
||||
bindings::Gecko_ReleaseGridTemplateAreasValueArbitraryThread
|
||||
);
|
||||
impl_threadsafe_refcount!(
|
||||
structs::ImageValue,
|
||||
bindings::Gecko_AddRefImageValueArbitraryThread,
|
||||
bindings::Gecko_ReleaseImageValueArbitraryThread
|
||||
);
|
||||
impl_threadsafe_refcount!(
|
||||
structs::SharedFontList,
|
||||
bindings::Gecko_AddRefSharedFontListArbitraryThread,
|
||||
|
@ -689,7 +689,10 @@ def set_gecko_property(ffi_name, expr):
|
||||
}
|
||||
SVGPaintKind::PaintServer(url) => {
|
||||
unsafe {
|
||||
bindings::Gecko_nsStyleSVGPaint_SetURLValue(paint, url.0.url_value.get());
|
||||
bindings::Gecko_nsStyleSVGPaint_SetURLValue(
|
||||
paint,
|
||||
url.url_value_ptr(),
|
||||
)
|
||||
}
|
||||
}
|
||||
SVGPaintKind::Color(color) => {
|
||||
@ -4153,7 +4156,10 @@ fn static_assert() {
|
||||
}
|
||||
UrlOrNone::Url(ref url) => {
|
||||
unsafe {
|
||||
Gecko_SetListStyleImageImageValue(&mut self.gecko, url.0.image_value.get());
|
||||
Gecko_SetListStyleImageImageValue(
|
||||
&mut self.gecko,
|
||||
url.url_value_ptr(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5358,7 +5364,7 @@ clip-path
|
||||
unsafe {
|
||||
Gecko_SetCursorImageValue(
|
||||
&mut self.gecko.mCursorImages[i],
|
||||
v.images[i].url.0.image_value.get(),
|
||||
v.images[i].url.url_value_ptr(),
|
||||
);
|
||||
}
|
||||
|
||||
@ -5659,7 +5665,7 @@ clip-path
|
||||
unsafe {
|
||||
bindings::Gecko_SetContentDataImageValue(
|
||||
&mut self.gecko.mContents[i],
|
||||
url.0.image_value.get(),
|
||||
url.url_value_ptr(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,9 @@
|
||||
* 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/. */
|
||||
|
||||
#include <algorithm>
|
||||
#include "Telemetry.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <prio.h>
|
||||
#include <prproces.h>
|
||||
#if defined(XP_UNIX) && !defined(XP_DARWIN)
|
||||
@ -13,90 +14,84 @@
|
||||
#else
|
||||
#include <chrono>
|
||||
#endif
|
||||
|
||||
#include "base/pickle.h"
|
||||
#if defined(MOZ_TELEMETRY_GECKOVIEW)
|
||||
#include "geckoview/TelemetryGeckoViewPersistence.h"
|
||||
#endif
|
||||
#include "ipc/TelemetryIPCAccumulator.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "js/GCAPI.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/BackgroundHangMonitor.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/FStream.h"
|
||||
#include "mozilla/IOInterposer.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
#include "base/pickle.h"
|
||||
#include "other/CombinedStacks.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsThreadManager.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#include "nsIXULAppInfo.h"
|
||||
#include "nsVersionComparator.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/PoisonIOInterposer.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ProcessedStack.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "js/GCAPI.h"
|
||||
#include "nsString.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsIDirectoryEnumerator.h"
|
||||
#include "nsIFileStreams.h"
|
||||
#include "nsLocalFile.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "Telemetry.h"
|
||||
#include "TelemetryCommon.h"
|
||||
#include "TelemetryHistogram.h"
|
||||
#include "other/TelemetryIOInterposeObserver.h"
|
||||
#include "ipc/TelemetryIPCAccumulator.h"
|
||||
#include "TelemetryScalar.h"
|
||||
#include "TelemetryEvent.h"
|
||||
#include "other/WebrtcTelemetry.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#if defined(XP_WIN)
|
||||
#include "mozilla/WinDllServices.h"
|
||||
#endif
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDirectoryEnumerator.h"
|
||||
#include "nsIFileStreams.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIXULAppInfo.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsLocalFile.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsThreadManager.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#if defined(XP_WIN)
|
||||
#include "nsUnicharUtils.h"
|
||||
#endif
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsVersionComparator.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "other/CombinedStacks.h"
|
||||
#include "other/TelemetryIOInterposeObserver.h"
|
||||
#include "other/WebrtcTelemetry.h"
|
||||
#include "plstr.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "mozilla/BackgroundHangMonitor.h"
|
||||
#include "mozilla/FStream.h"
|
||||
#include "mozilla/ProcessedStack.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/IOInterposer.h"
|
||||
#include "mozilla/PoisonIOInterposer.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#if defined(XP_WIN)
|
||||
#include "mozilla/WinDllServices.h"
|
||||
#endif
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsProxyRelease.h"
|
||||
|
||||
#if defined(MOZ_GECKO_PROFILER)
|
||||
#include "shared-libraries.h"
|
||||
#include "other/KeyedStackCapturer.h"
|
||||
#endif // MOZ_GECKO_PROFILER
|
||||
|
||||
#if defined(MOZ_TELEMETRY_GECKOVIEW)
|
||||
#include "geckoview/TelemetryGeckoViewPersistence.h"
|
||||
#endif
|
||||
#include "TelemetryCommon.h"
|
||||
#include "TelemetryEvent.h"
|
||||
#include "TelemetryHistogram.h"
|
||||
#include "TelemetryScalar.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -7,14 +7,13 @@
|
||||
#define Telemetry_h__
|
||||
|
||||
#include "mozilla/GuardObjects.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include "mozilla/TelemetryHistogramEnums.h"
|
||||
#include "mozilla/TelemetryScalarEnums.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
/******************************************************************************
|
||||
* This implements the Telemetry system.
|
||||
|
@ -4,18 +4,17 @@
|
||||
* 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/. */
|
||||
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsVersionComparator.h"
|
||||
#include "TelemetryCommon.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#include "TelemetryCommon.h"
|
||||
#include "nsVersionComparator.h"
|
||||
#include "TelemetryProcessData.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace mozilla {
|
||||
namespace Telemetry {
|
||||
namespace Common {
|
||||
|
@ -6,12 +6,12 @@
|
||||
#ifndef TelemetryCommon_h__
|
||||
#define TelemetryCommon_h__
|
||||
|
||||
#include "nsTHashtable.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
#include "mozilla/TelemetryProcessEnums.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace Telemetry {
|
||||
|
@ -4,33 +4,32 @@
|
||||
* 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/. */
|
||||
|
||||
#include "Telemetry.h"
|
||||
#include "TelemetryEvent.h"
|
||||
#include <prtime.h>
|
||||
#include <limits>
|
||||
#include "ipc/TelemetryIPCAccumulator.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/Pair.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/Pair.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsUTF8Utils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
#include "Telemetry.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsUTF8Utils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "TelemetryCommon.h"
|
||||
#include "TelemetryEvent.h"
|
||||
#include "TelemetryEventData.h"
|
||||
#include "TelemetryScalar.h"
|
||||
#include "ipc/TelemetryIPCAccumulator.h"
|
||||
|
||||
using mozilla::StaticMutex;
|
||||
using mozilla::StaticMutexAutoLock;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#ifndef TelemetryEvent_h__
|
||||
#define TelemetryEvent_h__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/TelemetryEventEnums.h"
|
||||
#include "mozilla/TelemetryProcessEnums.h"
|
||||
|
||||
|
@ -4,17 +4,14 @@
|
||||
* 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/. */
|
||||
|
||||
#include "TelemetryHistogram.h"
|
||||
|
||||
#include <limits>
|
||||
#include "base/histogram.h"
|
||||
#include "ipc/TelemetryIPCAccumulator.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "js/GCAPI.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/gfx/GPUProcessManager.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
@ -22,16 +19,16 @@
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "TelemetryCommon.h"
|
||||
#include "TelemetryHistogram.h"
|
||||
#include "TelemetryHistogramNameMap.h"
|
||||
#include "TelemetryScalar.h"
|
||||
#include "ipc/TelemetryIPCAccumulator.h"
|
||||
|
||||
#include "base/histogram.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
using base::Histogram;
|
||||
using base::BooleanHistogram;
|
||||
|
@ -6,10 +6,9 @@
|
||||
#ifndef TelemetryHistogram_h__
|
||||
#define TelemetryHistogram_h__
|
||||
|
||||
#include "mozilla/TelemetryComms.h"
|
||||
#include "mozilla/TelemetryHistogramEnums.h"
|
||||
#include "mozilla/TelemetryProcessEnums.h"
|
||||
|
||||
#include "mozilla/TelemetryComms.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
namespace mozilla{
|
||||
|
@ -4,18 +4,10 @@
|
||||
* 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/. */
|
||||
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsVariant.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "TelemetryScalar.h"
|
||||
|
||||
#include "ipc/TelemetryComms.h"
|
||||
#include "ipc/TelemetryIPCAccumulator.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/PContent.h"
|
||||
#include "mozilla/JSONWriter.h"
|
||||
@ -23,12 +15,20 @@
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsVariant.h"
|
||||
#include "TelemetryCommon.h"
|
||||
#include "TelemetryScalar.h"
|
||||
#include "TelemetryScalarData.h"
|
||||
#include "ipc/TelemetryComms.h"
|
||||
#include "ipc/TelemetryIPCAccumulator.h"
|
||||
|
||||
using mozilla::Preferences;
|
||||
using mozilla::StaticAutoPtr;
|
||||
|
@ -6,9 +6,10 @@
|
||||
#ifndef TelemetryScalar_h__
|
||||
#define TelemetryScalar_h__
|
||||
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/TelemetryScalarEnums.h"
|
||||
#include <stdint.h>
|
||||
#include "mozilla/TelemetryProcessEnums.h"
|
||||
#include "mozilla/TelemetryScalarEnums.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
// This module is internal to Telemetry. It encapsulates Telemetry's
|
||||
// scalar accumulation and storage logic. It should only be used by
|
||||
|
@ -7,10 +7,10 @@
|
||||
#define Telemetry_Comms_h__
|
||||
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "mozilla/TelemetryProcessEnums.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsVariant.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/TelemetryProcessEnums.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace Telemetry {
|
||||
|
@ -6,9 +6,10 @@
|
||||
#ifndef TelemetryIPC_h__
|
||||
#define TelemetryIPC_h__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/TelemetryProcessEnums.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "mozilla/TelemetryProcessEnums.h"
|
||||
|
||||
// This module provides the interface to accumulate Telemetry from child processes.
|
||||
// Top-level actors for different child processes types (ContentParent, GPUChild)
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include "TelemetryIPCAccumulator.h"
|
||||
|
||||
#include "core/TelemetryHistogram.h"
|
||||
#include "core/TelemetryScalar.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/gfx/GPUParent.h"
|
||||
#include "mozilla/gfx/GPUProcessManager.h"
|
||||
@ -16,8 +18,6 @@
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "core/TelemetryHistogram.h"
|
||||
#include "core/TelemetryScalar.h"
|
||||
|
||||
using mozilla::StaticMutex;
|
||||
using mozilla::StaticMutexAutoLock;
|
||||
|
@ -6,8 +6,12 @@
|
||||
|
||||
#include "TelemetryGeckoViewPersistence.h"
|
||||
|
||||
#include "core/TelemetryHistogram.h"
|
||||
#include "core/TelemetryScalar.h"
|
||||
#include "jsapi.h"
|
||||
#include "js/JSON.h"
|
||||
#include "mozilla/dom/ScriptSettings.h" // for AutoJSAPI
|
||||
#include "mozilla/dom/SimpleGlobalObject.h"
|
||||
#include "mozilla/ErrorNames.h"
|
||||
#include "mozilla/JSONWriter.h"
|
||||
#include "mozilla/Path.h"
|
||||
@ -15,8 +19,6 @@
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/SystemGroup.h"
|
||||
#include "mozilla/dom/ScriptSettings.h" // for AutoJSAPI
|
||||
#include "mozilla/dom/SimpleGlobalObject.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
@ -29,8 +31,6 @@
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "prenv.h"
|
||||
#include "prio.h"
|
||||
#include "core/TelemetryScalar.h"
|
||||
#include "core/TelemetryHistogram.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
using mozilla::GetErrorName;
|
||||
|
@ -12,8 +12,8 @@
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "prenv.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "TelemetryFixture.h"
|
||||
|
@ -5,8 +5,9 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "CombinedStacks.h"
|
||||
#include "mozilla/HangAnnotations.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/HangAnnotations.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace Telemetry {
|
||||
|
@ -5,10 +5,11 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "KeyedStackCapturer.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/StackWalk.h"
|
||||
#include "ProcessedStack.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/StackWalk.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "ProcessedStack.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -6,11 +6,11 @@
|
||||
#ifndef KeyedStackCapturer_h__
|
||||
#define KeyedStackCapturer_h__
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsString.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "CombinedStacks.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsString.h"
|
||||
|
||||
struct JSContext;
|
||||
|
||||
|
@ -13,15 +13,14 @@
|
||||
#ifndef TelemetryIOInterposeObserver_h__
|
||||
#define TelemetryIOInterposeObserver_h__
|
||||
|
||||
#include "core/TelemetryCommon.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "mozilla/IOInterposer.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsClassHashtable.h"
|
||||
|
||||
#include "core/TelemetryCommon.h"
|
||||
#include "mozilla/IOInterposer.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTHashtable.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace Telemetry {
|
||||
|
@ -4,13 +4,12 @@
|
||||
* 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/. */
|
||||
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "WebrtcTelemetry.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsTHashtable.h"
|
||||
|
||||
void
|
||||
WebrtcTelemetry::RecordIceCandidateMask(const uint32_t iceCandidateBitmask,
|
||||
const bool success)
|
||||
|
@ -5,14 +5,11 @@
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "third_party/curl/curl.h"
|
||||
|
||||
#include "mozilla/Unused.h"
|
||||
#include "third_party/curl/curl.h"
|
||||
|
||||
namespace PingSender {
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
#define TelemetryFixture_h_
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "mozilla/CycleCollectedJSContext.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "nsITelemetry.h"
|
||||
|
||||
class TelemetryTestFixture: public ::testing::Test {
|
||||
protected:
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
#include "TelemetryTestHelpers.h"
|
||||
|
||||
#include "core/TelemetryCommon.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "mozilla/CycleCollectedJSContext.h"
|
||||
#include "core/TelemetryCommon.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "js/Conversions.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "TelemetryFixture.h"
|
||||
#include "TelemetryTestHelpers.h"
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "js/Conversions.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "TelemetryFixture.h"
|
||||
#include "TelemetryTestHelpers.h"
|
||||
|
||||
|
@ -3,17 +3,16 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#include "core/TelemetryScalar.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "js/Conversions.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TelemetryProcessEnums.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsJSUtils.h" // nsAutoJSString
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TelemetryProcessEnums.h"
|
||||
#include "TelemetryFixture.h"
|
||||
#include "core/TelemetryScalar.h"
|
||||
#include "TelemetryTestHelpers.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
Loading…
Reference in New Issue
Block a user