зеркало из https://github.com/mozilla/gecko-dev.git
Merge autoland to mozilla-central. a=merge
This commit is contained in:
Коммит
6895bcddff
|
@ -117,6 +117,7 @@ jobs:
|
|||
- mozilla-central
|
||||
- mozilla-beta
|
||||
- mozilla-release
|
||||
- mozilla-esr68
|
||||
when:
|
||||
- {hour: 10, minute: 0}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
obj*/**
|
||||
|
||||
# dom/ exclusions which should be removed (aka ESLint enabled)
|
||||
dom/base/*.*
|
||||
dom/media/test/**
|
||||
!dom/media/test/marionette/yttest/*.js
|
||||
dom/xhr/**
|
||||
|
|
|
@ -152,10 +152,10 @@ already_AddRefed<nsIURI> ImageAccessible::GetLongDescURI() const {
|
|||
longdesc.FindChar('\r') != -1 || longdesc.FindChar('\n') != -1) {
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), longdesc,
|
||||
mContent->OwnerDoc(), baseURI);
|
||||
mContent->OwnerDoc(),
|
||||
mContent->GetBaseURI());
|
||||
return uri.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -205,12 +205,11 @@ already_AddRefed<nsIURI> XULLinkAccessible::AnchorURIAt(
|
|||
nsAutoString href;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
|
||||
dom::Document* document = mContent->OwnerDoc();
|
||||
|
||||
nsCOMPtr<nsIURI> anchorURI;
|
||||
NS_NewURI(getter_AddRefs(anchorURI), href,
|
||||
document->GetDocumentCharacterSet(), baseURI);
|
||||
document->GetDocumentCharacterSet(), mContent->GetBaseURI());
|
||||
|
||||
return anchorURI.forget();
|
||||
}
|
||||
|
|
|
@ -1614,6 +1614,9 @@ pref("browser.contentblocking.rejecttrackers.reportBreakage.enabled", true);
|
|||
|
||||
pref("browser.contentblocking.reportBreakage.url", "https://tracking-protection-issues.herokuapp.com/new");
|
||||
|
||||
// Enable Protections report's Lockwise card by default.
|
||||
pref("browser.contentblocking.report.lockwise.enabled", true);
|
||||
|
||||
// Enables the new Protections Panel.
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("browser.protections_panel.enabled", true);
|
||||
|
@ -1641,6 +1644,23 @@ pref("privacy.userContext.extension", "");
|
|||
pref("browser.tabs.remote.autostart", true);
|
||||
pref("browser.tabs.remote.desktopbehavior", true);
|
||||
|
||||
// Run media transport in a separate process?
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("media.peerconnection.mtransport_process", true);
|
||||
#else
|
||||
pref("media.peerconnection.mtransport_process", false);
|
||||
#endif
|
||||
|
||||
// Start a separate socket process. Performing networking on the socket process
|
||||
// is control by a sepparate pref
|
||||
// ("network.http.network_access_on_socket_process.enabled").
|
||||
// Changing these prefs requires a restart.
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("network.process.enabled", true);
|
||||
#else
|
||||
pref("network.process.enabled", false);
|
||||
#endif
|
||||
|
||||
// For speculatively warming up tabs to improve perceived
|
||||
// performance while using the async tab switcher.
|
||||
pref("browser.tabs.remote.warmup.enabled", true);
|
||||
|
|
|
@ -12,6 +12,11 @@ const { RemotePages } = ChromeUtils.import(
|
|||
"resource://gre/modules/remotepagemanager/RemotePageManagerParent.jsm"
|
||||
);
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"fxAccounts",
|
||||
"resource://gre/modules/FxAccounts.jsm"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
|
@ -30,13 +35,19 @@ let idToTextMap = new Map([
|
|||
var AboutProtectionsHandler = {
|
||||
_inited: false,
|
||||
_topics: [
|
||||
// Opening about:* pages
|
||||
"OpenAboutLogins",
|
||||
"OpenContentBlockingPreferences",
|
||||
"OpenSyncPreferences",
|
||||
// Fetching data
|
||||
"FetchContentBlockingEvents",
|
||||
"FetchUserLoginsData",
|
||||
// Getting prefs
|
||||
"GetEnabledLockwiseCard",
|
||||
],
|
||||
|
||||
PREF_LOCKWISE_CARD_ENABLED: "browser.contentblocking.report.lockwise.enabled",
|
||||
|
||||
init() {
|
||||
this.receiveMessage = this.receiveMessage.bind(this);
|
||||
this.pageListener = new RemotePages("about:protections");
|
||||
|
@ -64,18 +75,40 @@ var AboutProtectionsHandler = {
|
|||
* numberOfSyncedDevices: Number }}
|
||||
* The login data.
|
||||
*/
|
||||
getLoginData() {
|
||||
const logins = Services.logins.countLogins("", "", "");
|
||||
async getLoginData() {
|
||||
const loginCount = Services.logins.countLogins("", "", "");
|
||||
let syncedDevices = [];
|
||||
const isLoggedWithFxa = await fxAccounts.accountStatus();
|
||||
|
||||
if (isLoggedWithFxa) {
|
||||
syncedDevices = await fxAccounts.getDeviceList();
|
||||
}
|
||||
|
||||
const isLoggedIn = logins > 0;
|
||||
return {
|
||||
isLoggedIn,
|
||||
numberOfLogins: logins,
|
||||
numberOfSyncedDevices: 0,
|
||||
isLoggedIn: loginCount > 0 || syncedDevices.length > 0,
|
||||
numberOfLogins: loginCount,
|
||||
numberOfSyncedDevices: syncedDevices.length,
|
||||
};
|
||||
},
|
||||
|
||||
receiveMessage(aMessage) {
|
||||
/**
|
||||
* Sends a response from message target.
|
||||
*
|
||||
* @param {Object} target
|
||||
* The message target.
|
||||
* @param {String} message
|
||||
* The topic of the message to send.
|
||||
* @param {Object} payload
|
||||
* The payload of the message to send.
|
||||
*/
|
||||
sendMessage(target, message, payload) {
|
||||
// Make sure the target's browser is available before sending.
|
||||
if (target.browser) {
|
||||
target.sendAsyncMessage(message, payload);
|
||||
}
|
||||
},
|
||||
|
||||
async receiveMessage(aMessage) {
|
||||
let win = aMessage.target.browser.ownerGlobal;
|
||||
switch (aMessage.name) {
|
||||
case "OpenAboutLogins":
|
||||
|
@ -110,20 +143,28 @@ var AboutProtectionsHandler = {
|
|||
}
|
||||
}
|
||||
dataToSend.largest = largest;
|
||||
if (aMessage.target.browser) {
|
||||
aMessage.target.sendAsyncMessage(
|
||||
"SendContentBlockingRecords",
|
||||
dataToSend
|
||||
);
|
||||
}
|
||||
this.sendMessage(
|
||||
aMessage.target,
|
||||
"SendContentBlockingRecords",
|
||||
dataToSend
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "FetchUserLoginsData":
|
||||
aMessage.target.sendAsyncMessage(
|
||||
this.sendMessage(
|
||||
aMessage.target,
|
||||
"SendUserLoginsData",
|
||||
this.getLoginData()
|
||||
await this.getLoginData()
|
||||
);
|
||||
break;
|
||||
case "GetEnabledLockwiseCard":
|
||||
const enabled = Services.prefs.getBoolPref(
|
||||
this.PREF_LOCKWISE_CARD_ENABLED
|
||||
);
|
||||
this.sendMessage(aMessage.target, "SendEnabledLockWiseCardPref", {
|
||||
isEnabled: enabled,
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -62,6 +62,7 @@ login-item-password-reveal-checkbox-hide =
|
|||
login-item-copied-password-button-text = ✔ Copied!
|
||||
login-item-copy-password-button-text = Copy
|
||||
login-item-save-changes-button = Save Changes
|
||||
login-item-save-new-button = Save
|
||||
login-item-cancel-button = Cancel
|
||||
login-item-time-changed = Last modified: { DATETIME($timeChanged, day: "numeric", month: "long", year: "numeric") }
|
||||
login-item-time-created = Created: { DATETIME($timeCreated, day: "numeric", month: "long", year: "numeric") }
|
||||
|
|
|
@ -97,14 +97,14 @@
|
|||
<span class="origin-label field-label" data-l10n-id="login-item-origin-label"></span>
|
||||
<input type="url" name="origin" class="origin-input" required data-l10n-id="login-item-origin"/>
|
||||
</label>
|
||||
<button class="open-site-button" data-l10n-id="login-item-open-site-button"></button>
|
||||
<button class="open-site-button" data-l10n-id="login-item-open-site-button" type="button"></button>
|
||||
</div>
|
||||
<div class="detail-row">
|
||||
<label class="detail-cell">
|
||||
<span class="username-label field-label" data-l10n-id="login-item-username-label"></span>
|
||||
<input type="text" name="username" data-l10n-id="login-item-username"/>
|
||||
</label>
|
||||
<button class="copy-button copy-username-button" data-copy-login-property="username" data-telemetry-object="username">
|
||||
<button class="copy-button copy-username-button" data-copy-login-property="username" data-telemetry-object="username" type="button">
|
||||
<span class="copied-button-text" data-l10n-id="login-item-copied-username-button-text"></span>
|
||||
<span class="copy-button-text" data-l10n-id="login-item-copy-username-button-text"></span>
|
||||
</button>
|
||||
|
@ -119,7 +119,7 @@
|
|||
data-l10n-id="login-item-password-reveal-checkbox"/>
|
||||
</div>
|
||||
</label>
|
||||
<button class="copy-button copy-password-button" data-copy-login-property="password" data-telemetry-object="password">
|
||||
<button class="copy-button copy-password-button" data-copy-login-property="password" data-telemetry-object="password" type="button">
|
||||
<span class="copied-button-text" data-l10n-id="login-item-copied-password-button-text"></span>
|
||||
<span class="copy-button-text" data-l10n-id="login-item-copy-password-button-text"></span>
|
||||
</button>
|
||||
|
@ -127,8 +127,8 @@
|
|||
<p class="time-created meta-info" data-l10n-id="login-item-time-created" data-l10n-args='{"timeCreated": 0}'></p>
|
||||
<p class="time-changed meta-info" data-l10n-id="login-item-time-changed" data-l10n-args='{"timeChanged": 0}'></p>
|
||||
<p class="time-used meta-info" data-l10n-id="login-item-time-used" data-l10n-args='{"timeUsed": 0}'></p>
|
||||
<button class="save-changes-button" data-l10n-id="login-item-save-changes-button"></button>
|
||||
<button class="cancel-button" data-l10n-id="login-item-cancel-button"></button>
|
||||
<button class="save-changes-button" type="submit"></button>
|
||||
<button class="cancel-button" data-l10n-id="login-item-cancel-button" type="button"></button>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
}
|
||||
|
||||
:host([data-editing]) .edit-button,
|
||||
:host([data-is-new-login]) .copy-button,
|
||||
:host([data-is-new-login]) .delete-button,
|
||||
:host([data-is-new-login]) .origin-saved-value,
|
||||
:host([data-is-new-login]) copy-to-clipboard-button,
|
||||
:host([data-is-new-login]) .open-site-button,
|
||||
:host([data-is-new-login]) .meta-info,
|
||||
:host([data-is-new-login]) .login-item-title,
|
||||
|
|
|
@ -67,10 +67,10 @@ export default class LoginItem extends HTMLElement {
|
|||
this._copyUsernameButton.addEventListener("click", this);
|
||||
this._deleteButton.addEventListener("click", this);
|
||||
this._editButton.addEventListener("click", this);
|
||||
this._form.addEventListener("submit", this);
|
||||
this._openSiteButton.addEventListener("click", this);
|
||||
this._originInput.addEventListener("click", this);
|
||||
this._revealCheckbox.addEventListener("click", this);
|
||||
this._saveChangesButton.addEventListener("click", this);
|
||||
window.addEventListener("AboutLoginsCreateLogin", this);
|
||||
window.addEventListener("AboutLoginsInitialLoginSelected", this);
|
||||
window.addEventListener("AboutLoginsLoginSelected", this);
|
||||
|
@ -91,6 +91,12 @@ export default class LoginItem extends HTMLElement {
|
|||
this._originInput.defaultValue = this._login.origin || "";
|
||||
this._usernameInput.defaultValue = this._login.username || "";
|
||||
this._passwordInput.defaultValue = this._login.password || "";
|
||||
document.l10n.setAttributes(
|
||||
this._saveChangesButton,
|
||||
this.dataset.isNewLogin
|
||||
? "login-item-save-new-button"
|
||||
: "login-item-save-changes-button"
|
||||
);
|
||||
this._updatePasswordRevealState();
|
||||
}
|
||||
|
||||
|
@ -129,8 +135,6 @@ export default class LoginItem extends HTMLElement {
|
|||
return;
|
||||
}
|
||||
|
||||
// Prevent form submit behavior on the following buttons.
|
||||
event.preventDefault();
|
||||
if (classList.contains("cancel-button")) {
|
||||
let wasExistingLogin = !!this._login.guid;
|
||||
if (wasExistingLogin) {
|
||||
|
@ -194,36 +198,37 @@ export default class LoginItem extends HTMLElement {
|
|||
object: "existing_login",
|
||||
method: "open_site",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (classList.contains("save-changes-button")) {
|
||||
if (!this._isFormValid({ reportErrors: true })) {
|
||||
return;
|
||||
}
|
||||
let loginUpdates = this._loginFromForm();
|
||||
if (this._login.guid) {
|
||||
loginUpdates.guid = this._login.guid;
|
||||
document.dispatchEvent(
|
||||
new CustomEvent("AboutLoginsUpdateLogin", {
|
||||
bubbles: true,
|
||||
detail: loginUpdates,
|
||||
})
|
||||
);
|
||||
|
||||
recordTelemetryEvent({ object: "existing_login", method: "save" });
|
||||
} else {
|
||||
document.dispatchEvent(
|
||||
new CustomEvent("AboutLoginsCreateLogin", {
|
||||
bubbles: true,
|
||||
detail: loginUpdates,
|
||||
})
|
||||
);
|
||||
|
||||
recordTelemetryEvent({ object: "new_login", method: "save" });
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "submit": {
|
||||
// Prevent page navigation form submit behavior.
|
||||
event.preventDefault();
|
||||
if (!this._isFormValid({ reportErrors: true })) {
|
||||
return;
|
||||
}
|
||||
let loginUpdates = this._loginFromForm();
|
||||
if (this._login.guid) {
|
||||
loginUpdates.guid = this._login.guid;
|
||||
document.dispatchEvent(
|
||||
new CustomEvent("AboutLoginsUpdateLogin", {
|
||||
bubbles: true,
|
||||
detail: loginUpdates,
|
||||
})
|
||||
);
|
||||
|
||||
recordTelemetryEvent({ object: "existing_login", method: "save" });
|
||||
} else {
|
||||
document.dispatchEvent(
|
||||
new CustomEvent("AboutLoginsCreateLogin", {
|
||||
bubbles: true,
|
||||
detail: loginUpdates,
|
||||
})
|
||||
);
|
||||
|
||||
recordTelemetryEvent({ object: "new_login", method: "save" });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,8 @@ add_task(async function test_set_login() {
|
|||
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-created")).args.timeCreated, TEST_LOGIN_1.timeCreated, "time-created should be populated");
|
||||
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-changed")).args.timeChanged, TEST_LOGIN_1.timePasswordChanged, "time-changed should be populated");
|
||||
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-used")).args.timeUsed, TEST_LOGIN_1.timeLastUsed, "time-used should be populated");
|
||||
let copyButtons = [...gLoginItem.shadowRoot.querySelectorAll(".copy-button")];
|
||||
ok(copyButtons.every(button => !isHidden(button)), "The copy buttons should be visible when viewing a login");
|
||||
});
|
||||
|
||||
add_task(async function test_edit_login() {
|
||||
|
@ -95,6 +97,8 @@ add_task(async function test_edit_login() {
|
|||
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-created")).args.timeCreated, TEST_LOGIN_1.timeCreated, "time-created should be populated");
|
||||
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-changed")).args.timeChanged, TEST_LOGIN_1.timePasswordChanged, "time-changed should be populated");
|
||||
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-used")).args.timeUsed, TEST_LOGIN_1.timeLastUsed, "time-used should be populated");
|
||||
let copyButtons = [...gLoginItem.shadowRoot.querySelectorAll(".copy-button")];
|
||||
ok(copyButtons.every(button => !isHidden(button)), "The copy buttons should be visible when editing a login");
|
||||
|
||||
gLoginItem.shadowRoot.querySelector("input[name='username']").value = "newUsername";
|
||||
gLoginItem.shadowRoot.querySelector("input[name='password']").value = "newPassword";
|
||||
|
@ -155,6 +159,8 @@ add_task(async function test_set_login_empty() {
|
|||
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-created")).args.timeCreated, "", "time-created should be blank when undefined");
|
||||
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-changed")).args.timeChanged, "", "time-changed should be blank when undefined");
|
||||
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-used")).args.timeUsed, "", "time-used should be blank when undefined");
|
||||
let copyButtons = [...gLoginItem.shadowRoot.querySelectorAll(".copy-button")];
|
||||
ok(copyButtons.every(button => isHidden(button)), "The copy buttons should be hidden when creating a login");
|
||||
|
||||
let createEventDispatched = false;
|
||||
document.addEventListener("AboutLoginsCreateLogin", event => {
|
||||
|
|
|
@ -638,7 +638,12 @@ add_task(async function browseraction_contextmenu_report_extension() {
|
|||
// loaded in the existing blank tab.
|
||||
if (customizing) {
|
||||
info("Closing the about:addons tab");
|
||||
BrowserTestUtils.removeTab(win.gBrowser.selectedTab);
|
||||
let customizationReady = BrowserTestUtils.waitForEvent(
|
||||
win.gNavToolbox,
|
||||
"customizationready"
|
||||
);
|
||||
win.gBrowser.removeTab(win.gBrowser.selectedTab);
|
||||
await customizationReady;
|
||||
} else {
|
||||
info("Navigate the about:addons tab to about:blank");
|
||||
await BrowserTestUtils.loadURI(browser, "about:blank");
|
||||
|
|
|
@ -27,9 +27,14 @@ export default class LockwiseCard {
|
|||
});
|
||||
|
||||
RPMAddMessageListener("SendUserLoginsData", ({ data }) => {
|
||||
// Once browser data for the user is retrieved, display it on the card's body
|
||||
// section.
|
||||
// Once data for the user is retrieved, display the lockwise card.
|
||||
this.buildContent(data);
|
||||
|
||||
// Show the Lockwise card.
|
||||
const lockwiseCard = this.doc.querySelector(
|
||||
".report-card.lockwise-card.hidden"
|
||||
);
|
||||
lockwiseCard.classList.remove("hidden");
|
||||
});
|
||||
|
||||
// Dispatch messages to retrieve data for the Lockwise card.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
--cookie-color-darker: #0073C3;
|
||||
--tracker-color: #2AC3A2;
|
||||
--tracker-color-darker: #229C82;
|
||||
--orange: #FFBD4F;
|
||||
--orange: #FFA436;
|
||||
--dark-orange: #ffA40C;
|
||||
--grey: #AFAFBB;
|
||||
--dark-grey: #88889A;
|
||||
|
@ -390,6 +390,7 @@ label:hover {
|
|||
}
|
||||
|
||||
a.hidden,
|
||||
.lockwise-card.hidden,
|
||||
#lockwise-body-content .has-logins.hidden,
|
||||
#lockwise-body-content .no-logins.hidden {
|
||||
display: none;
|
||||
|
@ -439,6 +440,6 @@ a.hidden,
|
|||
line-height: 18px;
|
||||
}
|
||||
|
||||
.has-logins a {
|
||||
#lockwise-body-content .has-logins a {
|
||||
margin-inline-start: 10px;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- Markup for Lockwise card. -->
|
||||
<section class="report-card lockwise-card">
|
||||
<section class="report-card lockwise-card hidden">
|
||||
<div class="card-header">
|
||||
<div class="icon"></div>
|
||||
<div class="wrapper">
|
||||
|
|
|
@ -28,6 +28,9 @@ document.addEventListener("DOMContentLoaded", e => {
|
|||
RPMSendAsyncMessage("OpenContentBlockingPreferences");
|
||||
});
|
||||
|
||||
// Check to see if displaying the Lockwise card pref is enabled.
|
||||
RPMSendAsyncMessage("GetEnabledLockwiseCard");
|
||||
|
||||
let createGraph = data => {
|
||||
// Set a default top size for the height of the graph bars so that small
|
||||
// numbers don't fill the whole graph.
|
||||
|
@ -114,7 +117,15 @@ document.addEventListener("DOMContentLoaded", e => {
|
|||
createGraph(message.data);
|
||||
});
|
||||
|
||||
// Create the Lockwise card.
|
||||
const lockwiseCard = new LockwiseCard(document);
|
||||
lockwiseCard.init();
|
||||
// Display Lockwise card
|
||||
RPMAddMessageListener("SendEnabledLockWiseCardPref", message => {
|
||||
if (message.data.isEnabled) {
|
||||
const lockwiseCard = new LockwiseCard(document);
|
||||
lockwiseCard.init();
|
||||
}
|
||||
|
||||
// For tests
|
||||
const lockwiseUI = document.querySelector(".lockwise-card");
|
||||
lockwiseUI.dataset.enabled = message.data.isEnabled;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { AboutProtectionsHandler } = ChromeUtils.import(
|
||||
"resource:///modules/aboutpages/AboutProtectionsHandler.jsm"
|
||||
);
|
||||
|
||||
const nsLoginInfo = new Components.Constructor(
|
||||
"@mozilla.org/login-manager/loginInfo;1",
|
||||
Ci.nsILoginInfo,
|
||||
|
@ -30,6 +34,18 @@ const TEST_LOGIN2 = new nsLoginInfo(
|
|||
"password"
|
||||
);
|
||||
|
||||
// Modify AboutProtectionsHandler's getLoginData method to fake returning a specified
|
||||
// number of devices.
|
||||
const mockGetLoginDataWithSyncedDevices = deviceCount => async () => {
|
||||
const loginCount = Services.logins.countLogins("", "", "");
|
||||
|
||||
return {
|
||||
isLoggedIn: loginCount > 0 || deviceCount > 0,
|
||||
numberOfLogins: loginCount,
|
||||
numberOfSyncedDevices: deviceCount,
|
||||
};
|
||||
};
|
||||
|
||||
add_task(async function() {
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||
url: "about:protections",
|
||||
|
@ -37,7 +53,12 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
info("Check that the correct content is displayed for non-logged in users.");
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
const noLogins = content.document.querySelector(".no-logins");
|
||||
return ContentTaskUtils.is_visible(noLogins);
|
||||
}, "Lockwise card for user with no logins is shown.");
|
||||
|
||||
const noLoginsContent = content.document.querySelector(
|
||||
"#lockwise-body-content .no-logins"
|
||||
);
|
||||
|
@ -59,7 +80,12 @@ add_task(async function() {
|
|||
Services.logins.addLogin(TEST_LOGIN1);
|
||||
await reloadTab(tab);
|
||||
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
const hasLogins = content.document.querySelector(".has-logins");
|
||||
return ContentTaskUtils.is_visible(hasLogins);
|
||||
}, "Lockwise card for user with logins is shown.");
|
||||
|
||||
const noLoginsContent = content.document.querySelector(
|
||||
"#lockwise-body-content .no-logins"
|
||||
);
|
||||
|
@ -69,6 +95,12 @@ add_task(async function() {
|
|||
const numberOfLogins = hasLoginsContent.querySelector(
|
||||
".number-of-logins.block"
|
||||
);
|
||||
const numberOfSyncedDevices = hasLoginsContent.querySelector(
|
||||
".number-of-synced-devices.block"
|
||||
);
|
||||
const syncedDevicesStatusText = content.document.querySelector(
|
||||
".synced-devices-text span"
|
||||
);
|
||||
|
||||
ok(
|
||||
ContentTaskUtils.is_hidden(noLoginsContent),
|
||||
|
@ -79,6 +111,14 @@ add_task(async function() {
|
|||
"Content for user with logins is shown."
|
||||
);
|
||||
is(numberOfLogins.textContent, 1, "One stored login should be displayed");
|
||||
|
||||
info("Also check that content for no synced devices is correct.");
|
||||
is(
|
||||
numberOfSyncedDevices.textContent,
|
||||
0,
|
||||
"Zero synced devices are displayed."
|
||||
);
|
||||
is(syncedDevicesStatusText.textContent, "Not syncing to other devices.");
|
||||
});
|
||||
|
||||
info(
|
||||
|
@ -87,7 +127,12 @@ add_task(async function() {
|
|||
Services.logins.addLogin(TEST_LOGIN2);
|
||||
await reloadTab(tab);
|
||||
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
const hasLogins = content.document.querySelector(".has-logins");
|
||||
return ContentTaskUtils.is_visible(hasLogins);
|
||||
}, "Lockwise card for user with logins is shown.");
|
||||
|
||||
const numberOfLogins = content.document.querySelector(
|
||||
"#lockwise-body-content .has-logins .number-of-logins.block"
|
||||
);
|
||||
|
@ -95,6 +140,55 @@ add_task(async function() {
|
|||
is(numberOfLogins.textContent, 2, "Two stored logins should be displayed");
|
||||
});
|
||||
|
||||
info(
|
||||
"Mock login data with synced devices and check that the correct number and content is displayed."
|
||||
);
|
||||
AboutProtectionsHandler.getLoginData = mockGetLoginDataWithSyncedDevices(5);
|
||||
await reloadTab(tab);
|
||||
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
const hasLogins = content.document.querySelector(".has-logins");
|
||||
return ContentTaskUtils.is_visible(hasLogins);
|
||||
}, "Lockwise card for user with logins is shown.");
|
||||
|
||||
const numberOfSyncedDevices = content.document.querySelector(
|
||||
".number-of-synced-devices.block"
|
||||
);
|
||||
const syncedDevicesStatusText = content.document.querySelector(
|
||||
".synced-devices-text span"
|
||||
);
|
||||
|
||||
is(
|
||||
numberOfSyncedDevices.textContent,
|
||||
5,
|
||||
"Five synced devices should be displayed"
|
||||
);
|
||||
is(syncedDevicesStatusText.textContent, "Syncing to 5 other devices.");
|
||||
});
|
||||
|
||||
info("Disable showing the Lockwise card.");
|
||||
Services.prefs.setBoolPref(
|
||||
"browser.contentblocking.report.lockwise.enabled",
|
||||
false
|
||||
);
|
||||
await reloadTab(tab);
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
const lockwiseCard = content.document.querySelector(".lockwise-card");
|
||||
return !lockwiseCard["data-enabled"];
|
||||
}, "Lockwise card is not enabled.");
|
||||
|
||||
const lockwiseCard = content.document.querySelector(".lockwise-card");
|
||||
ok(ContentTaskUtils.is_hidden(lockwiseCard), "Lockwise card is hidden.");
|
||||
});
|
||||
|
||||
// set the pref back to displaying the card.
|
||||
Services.prefs.setBoolPref(
|
||||
"browser.contentblocking.report.lockwise.enabled",
|
||||
true
|
||||
);
|
||||
|
||||
// remove logins
|
||||
Services.logins.removeLogin(TEST_LOGIN1);
|
||||
Services.logins.removeLogin(TEST_LOGIN2);
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
%include build/sparse-profiles/mach
|
||||
|
||||
[include]
|
||||
path:build/
|
||||
path:testing/profiles/
|
||||
path:third_party/webkit/
|
||||
path:tools/quitter/
|
||||
path:taskcluster/scripts/misc
|
|
@ -10,9 +10,8 @@ import Services from "devtools-services";
|
|||
import { asyncStoreHelper } from "./asyncStoreHelper";
|
||||
|
||||
// Schema version to bump when the async store format has changed incompatibly
|
||||
// and old stores should be cleared. This needs to match the prefs schema
|
||||
// version in devtools/client/preferences/debugger.js.
|
||||
const prefsSchemaVersion = "1.0.11";
|
||||
// and old stores should be cleared.
|
||||
const prefsSchemaVersion = 11;
|
||||
const pref = Services.pref;
|
||||
|
||||
if (isDevelopment()) {
|
||||
|
@ -100,7 +99,7 @@ export const prefs = new PrefsHelper("devtools", {
|
|||
fileSearchCaseSensitive: ["Bool", "debugger.file-search-case-sensitive"],
|
||||
fileSearchWholeWord: ["Bool", "debugger.file-search-whole-word"],
|
||||
fileSearchRegexMatch: ["Bool", "debugger.file-search-regex-match"],
|
||||
debuggerPrefsSchemaVersion: ["Char", "debugger.prefs-schema-version"],
|
||||
debuggerPrefsSchemaVersion: ["Int", "debugger.prefs-schema-version"],
|
||||
projectDirectoryRoot: ["Char", "debugger.project-directory-root", ""],
|
||||
skipPausing: ["Bool", "debugger.skip-pausing"],
|
||||
mapScopes: ["Bool", "debugger.map-scopes-enabled"],
|
||||
|
@ -137,9 +136,12 @@ export const asyncStore = asyncStoreHelper("debugger", {
|
|||
eventListenerBreakpoints: ["event-listener-breakpoints", undefined],
|
||||
});
|
||||
|
||||
export function resetSchemaVersion() {
|
||||
prefs.debuggerPrefsSchemaVersion = prefsSchemaVersion;
|
||||
}
|
||||
|
||||
export function verifyPrefSchema() {
|
||||
if (prefs.debuggerPrefsSchemaVersion !== prefsSchemaVersion) {
|
||||
// clear pending Breakpoints
|
||||
if (prefs.debuggerPrefsSchemaVersion < prefsSchemaVersion) {
|
||||
asyncStore.pendingBreakpoints = {};
|
||||
asyncStore.tabs = [];
|
||||
asyncStore.xhrBreakpoints = [];
|
||||
|
|
|
@ -22,6 +22,10 @@ const {
|
|||
getSelectedLocation
|
||||
} = require("devtools/client/debugger/src/utils/selected-location");
|
||||
|
||||
const {
|
||||
resetSchemaVersion
|
||||
} = require("devtools/client/debugger/src/utils/prefs");
|
||||
|
||||
function log(msg, data) {
|
||||
info(`${msg} ${!data ? "" : JSON.stringify(data)}`);
|
||||
}
|
||||
|
@ -505,6 +509,7 @@ function isSelectedFrameSelected(dbg, state) {
|
|||
* Clear all the debugger related preferences.
|
||||
*/
|
||||
async function clearDebuggerPreferences() {
|
||||
resetSchemaVersion();
|
||||
asyncStorage.clear();
|
||||
Services.prefs.clearUserPref("devtools.recordreplay.enabled");
|
||||
Services.prefs.clearUserPref("devtools.debugger.pause-on-exceptions");
|
||||
|
|
|
@ -18,9 +18,9 @@ pref("devtools.debugger.auto-pretty-print", false);
|
|||
pref("devtools.debugger.auto-black-box", true);
|
||||
pref("devtools.debugger.workers", false);
|
||||
|
||||
// The default Debugger UI settings
|
||||
// This schema version needs to match that in devtools/client/debugger/src/utils/prefs.js.
|
||||
pref("devtools.debugger.prefs-schema-version", "1.0.11");
|
||||
// The debugger pref's schema defaults to 0 so that it can be managed
|
||||
// by utils/prefs.js in verifySchema. Bug 1565485
|
||||
pref("devtools.debugger.prefs-schema-version", 0);
|
||||
pref("devtools.debugger.ui.panes-workers-and-sources-width", 200);
|
||||
pref("devtools.debugger.ui.panes-instruments-width", 300);
|
||||
pref("devtools.debugger.ui.panes-visible-on-startup", false);
|
||||
|
|
|
@ -147,16 +147,19 @@ HUDService.prototype = {
|
|||
}
|
||||
|
||||
async function connect() {
|
||||
// The Browser console ends up using the debugger in autocomplete.
|
||||
// Because the debugger can't be running in the same compartment than its debuggee,
|
||||
// we have to load the server in a dedicated Loader, flagged with
|
||||
// invisibleToDebugger, which will force it to be loaded in another compartment.
|
||||
// The console ends up using the debugger in autocomplete.
|
||||
// `freshCompartment`, which will force it to be loaded in another compartment.
|
||||
// We aren't using `invisibleToDebugger` in order to allow the Browser toolbox to
|
||||
// debug the Browser console. This is fine as they will spawn distinct Loaders and
|
||||
// so distinct `DebuggerServer` and actor modules.
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
const { DevToolsLoader } = ChromeUtils.import(
|
||||
"resource://devtools/shared/Loader.jsm"
|
||||
);
|
||||
const loader = new DevToolsLoader();
|
||||
loader.invisibleToDebugger = true;
|
||||
loader.freshCompartment = true;
|
||||
const { DebuggerServer } = loader.require("devtools/server/main");
|
||||
|
||||
DebuggerServer.init();
|
||||
|
|
|
@ -165,6 +165,10 @@ const NAME_FROM_SUBTREE_RULE_ROLES = new Set([
|
|||
|
||||
const IS_OSX = Services.appinfo.OS === "Darwin";
|
||||
|
||||
const {
|
||||
SCORES: { BEST_PRACTICES, FAIL, WARNING },
|
||||
} = accessibility;
|
||||
|
||||
/**
|
||||
* Helper function that determines if nsIAccessible object is in stale state. When an
|
||||
* object is stale it means its subtree is not up to date.
|
||||
|
@ -549,7 +553,7 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
|
|||
check =>
|
||||
check != null &&
|
||||
!check.error &&
|
||||
check.score === accessibility.SCORES.FAIL
|
||||
[BEST_PRACTICES, FAIL, WARNING].includes(check.score)
|
||||
)
|
||||
) {
|
||||
ancestries.push(this.getAncestry(acc));
|
||||
|
|
|
@ -300,7 +300,7 @@ void BrowsingContext::Detach(bool aFromIPC) {
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<BrowsingContext> kungFuDeathGrip(this);
|
||||
RefPtr<BrowsingContext> self(this);
|
||||
|
||||
if (!mGroup->EvictCachedContext(this)) {
|
||||
Children* children = nullptr;
|
||||
|
@ -313,15 +313,17 @@ void BrowsingContext::Detach(bool aFromIPC) {
|
|||
children->RemoveElement(this);
|
||||
}
|
||||
|
||||
// As our nsDocShell is going away, this should implicitly mark us as closed.
|
||||
// We directly set our member, rather than using a transaction as we're going
|
||||
// to send a `Detach` message to other processes either way.
|
||||
Unregister();
|
||||
|
||||
if (!aFromIPC && XRE_IsContentProcess()) {
|
||||
auto cc = ContentChild::GetSingleton();
|
||||
MOZ_DIAGNOSTIC_ASSERT(cc);
|
||||
cc->SendDetachBrowsingContext(this);
|
||||
// Tell our parent that the BrowsingContext has been detached. A strong
|
||||
// reference to this is held until the promise is resolved to ensure it
|
||||
// doesn't die before the parent receives the message.
|
||||
auto resolve = [self](bool) {};
|
||||
auto reject = [self](mozilla::ipc::ResponseRejectReason) {};
|
||||
cc->SendDetachBrowsingContext(Id(), resolve, reject);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -955,12 +957,24 @@ void IPDLParamTraits<dom::BrowsingContext*>::Write(
|
|||
IPC::Message* aMsg, IProtocol* aActor, dom::BrowsingContext* aParam) {
|
||||
uint64_t id = aParam ? aParam->Id() : 0;
|
||||
WriteIPDLParam(aMsg, aActor, id);
|
||||
if (!aParam) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If his is an in-process send. We want to make sure that our BrowsingContext
|
||||
// object lives long enough to make it to the other side, so we take an extra
|
||||
// reference. This reference is freed in ::Read().
|
||||
if (!aActor->GetIPCChannel()->IsCrossProcess()) {
|
||||
NS_IF_ADDREF(aParam);
|
||||
// Make sure that the other side will still have our BrowsingContext around
|
||||
// when it tries to perform deserialization.
|
||||
if (aActor->GetIPCChannel()->IsCrossProcess()) {
|
||||
// If we're sending the message between processes, we only know the other
|
||||
// side will still have a copy if we've not been discarded yet. As
|
||||
// serialization cannot fail softly, fail loudly by crashing.
|
||||
MOZ_RELEASE_ASSERT(
|
||||
!aParam->IsDiscarded(),
|
||||
"Cannot send discarded BrowsingContext between processes!");
|
||||
} else {
|
||||
// If we're in-process, we can take an extra reference to ensure it lives
|
||||
// long enough to make it to the other side. This reference is freed in
|
||||
// `::Read()`.
|
||||
aParam->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -977,16 +991,26 @@ bool IPDLParamTraits<dom::BrowsingContext*>::Read(
|
|||
return true;
|
||||
}
|
||||
|
||||
*aResult = dom::BrowsingContext::Get(id);
|
||||
MOZ_ASSERT(*aResult, "Deserialized absent BrowsingContext!");
|
||||
|
||||
// If this is an in-process actor, free the reference taken in ::Write().
|
||||
if (!aActor->GetIPCChannel()->IsCrossProcess()) {
|
||||
dom::BrowsingContext* bc = *aResult;
|
||||
NS_IF_RELEASE(bc);
|
||||
RefPtr<dom::BrowsingContext> browsingContext = dom::BrowsingContext::Get(id);
|
||||
if (!browsingContext) {
|
||||
// NOTE: We could fail softly by returning `false` if the `BrowsingContext`
|
||||
// isn't present, but doing so will cause a crash anyway. Let's improve
|
||||
// diagnostics by reliably crashing here.
|
||||
//
|
||||
// If we can recover from failures to deserialize in the future, this crash
|
||||
// should be removed or modified.
|
||||
MOZ_CRASH("Attempt to deserialize absent BrowsingContext");
|
||||
*aResult = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return *aResult != nullptr;
|
||||
if (!aActor->GetIPCChannel()->IsCrossProcess()) {
|
||||
// Release the reference taken in `::Write()` for in-process actors.
|
||||
browsingContext.get()->Release();
|
||||
}
|
||||
|
||||
*aResult = browsingContext.forget();
|
||||
return true;
|
||||
}
|
||||
|
||||
void IPDLParamTraits<dom::BrowsingContext::Transaction>::Write(
|
||||
|
|
|
@ -4663,7 +4663,7 @@ nsDocShell::Reload(uint32_t aReloadFlags) {
|
|||
// Do not inherit owner from document
|
||||
uint32_t flags = INTERNAL_LOAD_FLAGS_NONE;
|
||||
nsAutoString srcdoc;
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsIURI* baseURI = nullptr;
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
nsCOMPtr<nsIURI> resultPrincipalURI;
|
||||
bool loadReplace = false;
|
||||
|
|
|
@ -273,9 +273,9 @@ static void ForEachPing(nsIContent* aContent, ForEachPingCallback aCallback,
|
|||
nsWhitespaceTokenizer tokenizer(value);
|
||||
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
nsCOMPtr<nsIURI> uri, baseURI = aContent->GetBaseURI();
|
||||
ios->NewURI(NS_ConvertUTF16toUTF8(tokenizer.nextToken()), charset.get(),
|
||||
baseURI, getter_AddRefs(uri));
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), tokenizer.nextToken(), charset.get(),
|
||||
aContent->GetBaseURI());
|
||||
// if we can't generate a valid URI, then there is nothing to do
|
||||
if (!uri) {
|
||||
continue;
|
||||
|
|
|
@ -182,7 +182,7 @@ nsresult Attr::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> Attr::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
|
||||
nsIURI* Attr::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
|
||||
Element* parent = GetElement();
|
||||
|
||||
return parent ? parent->GetBaseURI(aTryUseXHRDocBaseURI) : nullptr;
|
||||
|
|
|
@ -67,8 +67,7 @@ class Attr final : public nsINode {
|
|||
// nsINode interface
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI(
|
||||
bool aTryUseXHRDocBaseURI = false) const override;
|
||||
nsIURI* GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
||||
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
|
||||
// This component is used for handling dragover and drop of urls.
|
||||
//
|
||||
|
@ -12,20 +12,17 @@ const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
|||
// access the uri. This prevents, for example, a source document from tricking
|
||||
// the user into dragging a chrome url.
|
||||
|
||||
function ContentAreaDropListener() { };
|
||||
function ContentAreaDropListener() {}
|
||||
|
||||
ContentAreaDropListener.prototype =
|
||||
{
|
||||
classID: Components.ID("{1f34bc80-1bc7-11d6-a384-d705dd0746fc}"),
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIDroppedLinkHandler]),
|
||||
ContentAreaDropListener.prototype = {
|
||||
classID: Components.ID("{1f34bc80-1bc7-11d6-a384-d705dd0746fc}"),
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIDroppedLinkHandler]),
|
||||
|
||||
_addLink : function(links, url, name, type)
|
||||
{
|
||||
_addLink: function(links, url, name, type) {
|
||||
links.push({ url, name, type });
|
||||
},
|
||||
|
||||
_addLinksFromItem: function(links, dt, i)
|
||||
{
|
||||
_addLinksFromItem: function(links, dt, i) {
|
||||
let types = dt.mozTypesAt(i);
|
||||
let type, data;
|
||||
|
||||
|
@ -36,8 +33,9 @@ ContentAreaDropListener.prototype =
|
|||
let urls = data.split("\n");
|
||||
for (let url of urls) {
|
||||
// lines beginning with # are comments
|
||||
if (url.startsWith("#"))
|
||||
if (url.startsWith("#")) {
|
||||
continue;
|
||||
}
|
||||
url = url.replace(/^\s+|\s+$/g, "");
|
||||
this._addLink(links, url, url, type);
|
||||
}
|
||||
|
@ -61,7 +59,7 @@ ContentAreaDropListener.prototype =
|
|||
if (types.contains(type)) {
|
||||
data = dt.mozGetDataAt(type, i);
|
||||
if (data) {
|
||||
let lines = data.replace(/^\s+|\s+$/mg, "").split("\n");
|
||||
let lines = data.replace(/^\s+|\s+$/gm, "").split("\n");
|
||||
if (!lines.length) {
|
||||
return;
|
||||
}
|
||||
|
@ -74,8 +72,9 @@ ContentAreaDropListener.prototype =
|
|||
// Add the entire text as a single entry, so that the entire
|
||||
// text is searched.
|
||||
let hasURI = false;
|
||||
let flags = Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS |
|
||||
Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
|
||||
let flags =
|
||||
Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS |
|
||||
Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
|
||||
for (let line of lines) {
|
||||
let info = Services.uriFixup.getFixupURIInfo(line, flags);
|
||||
if (info.fixedURI) {
|
||||
|
@ -99,13 +98,16 @@ ContentAreaDropListener.prototype =
|
|||
// type, which points to the actual file.
|
||||
let files = dt.files;
|
||||
if (files && i < files.length) {
|
||||
this._addLink(links, OS.Path.toFileURI(files[i].mozFullPath),
|
||||
files[i].name, "application/x-moz-file");
|
||||
this._addLink(
|
||||
links,
|
||||
OS.Path.toFileURI(files[i].mozFullPath),
|
||||
files[i].name,
|
||||
"application/x-moz-file"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
_getDropLinks : function (dt)
|
||||
{
|
||||
_getDropLinks: function(dt) {
|
||||
let links = [];
|
||||
for (let i = 0; i < dt.mozItemCount; i++) {
|
||||
this._addLinksFromItem(links, dt, i);
|
||||
|
@ -113,23 +115,28 @@ ContentAreaDropListener.prototype =
|
|||
return links;
|
||||
},
|
||||
|
||||
_validateURI: function(dataTransfer, uriString, disallowInherit,
|
||||
triggeringPrincipal)
|
||||
{
|
||||
if (!uriString)
|
||||
_validateURI: function(
|
||||
dataTransfer,
|
||||
uriString,
|
||||
disallowInherit,
|
||||
triggeringPrincipal
|
||||
) {
|
||||
if (!uriString) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// Strip leading and trailing whitespace, then try to create a
|
||||
// URI from the dropped string. If that succeeds, we're
|
||||
// dropping a URI and we need to do a security check to make
|
||||
// sure the source document can load the dropped URI.
|
||||
uriString = uriString.replace(/^\s*|\s*$/g, '');
|
||||
uriString = uriString.replace(/^\s*|\s*$/g, "");
|
||||
|
||||
// Apply URI fixup so that this validation prevents bad URIs even if the
|
||||
// similar fixup is applied later, especialy fixing typos up will convert
|
||||
// non-URI to URI.
|
||||
let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS |
|
||||
Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
|
||||
let fixupFlags =
|
||||
Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS |
|
||||
Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
|
||||
let info = Services.uriFixup.getFixupURIInfo(uriString, fixupFlags);
|
||||
if (!info.fixedURI || info.keywordProviderName) {
|
||||
// Loading a keyword search should always be fine for all cases.
|
||||
|
@ -137,11 +144,13 @@ ContentAreaDropListener.prototype =
|
|||
}
|
||||
let uri = info.fixedURI;
|
||||
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
||||
getService(Ci.nsIScriptSecurityManager);
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
|
||||
Ci.nsIScriptSecurityManager
|
||||
);
|
||||
let flags = secMan.STANDARD;
|
||||
if (disallowInherit)
|
||||
if (disallowInherit) {
|
||||
flags |= secMan.DISALLOW_INHERIT_PRINCIPAL;
|
||||
}
|
||||
|
||||
secMan.checkLoadURIWithPrincipal(triggeringPrincipal, uri, flags);
|
||||
|
||||
|
@ -150,13 +159,17 @@ ContentAreaDropListener.prototype =
|
|||
return uri.spec;
|
||||
},
|
||||
|
||||
_getTriggeringPrincipalFromDataTransfer: function(aDataTransfer,
|
||||
fallbackToSystemPrincipal)
|
||||
{
|
||||
_getTriggeringPrincipalFromDataTransfer: function(
|
||||
aDataTransfer,
|
||||
fallbackToSystemPrincipal
|
||||
) {
|
||||
let sourceNode = aDataTransfer.mozSourceNode;
|
||||
if (sourceNode &&
|
||||
(sourceNode.localName !== "browser" ||
|
||||
sourceNode.namespaceURI !== "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")) {
|
||||
if (
|
||||
sourceNode &&
|
||||
(sourceNode.localName !== "browser" ||
|
||||
sourceNode.namespaceURI !==
|
||||
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")
|
||||
) {
|
||||
// Use sourceNode's principal only if the sourceNode is not browser.
|
||||
//
|
||||
// If sourceNode is browser, the actual triggering principal may be
|
||||
|
@ -179,33 +192,39 @@ ContentAreaDropListener.prototype =
|
|||
// TODO: Investigate and describe the difference between them,
|
||||
// or use only one principal. (Bug 1367038)
|
||||
if (fallbackToSystemPrincipal) {
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
||||
getService(Ci.nsIScriptSecurityManager);
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
|
||||
Ci.nsIScriptSecurityManager
|
||||
);
|
||||
return secMan.getSystemPrincipal();
|
||||
} else {
|
||||
principalURISpec = "file:///";
|
||||
}
|
||||
}
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
||||
getService(Ci.nsIScriptSecurityManager);
|
||||
return secMan.createContentPrincipal(ioService.newURI(principalURISpec), {});
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"].getService(
|
||||
Ci.nsIIOService
|
||||
);
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
|
||||
Ci.nsIScriptSecurityManager
|
||||
);
|
||||
return secMan.createContentPrincipal(
|
||||
ioService.newURI(principalURISpec),
|
||||
{}
|
||||
);
|
||||
},
|
||||
|
||||
getTriggeringPrincipal: function(aEvent)
|
||||
{
|
||||
getTriggeringPrincipal: function(aEvent) {
|
||||
let dataTransfer = aEvent.dataTransfer;
|
||||
return this._getTriggeringPrincipalFromDataTransfer(dataTransfer, true);
|
||||
|
||||
},
|
||||
|
||||
getCSP: function(aEvent)
|
||||
{
|
||||
getCSP: function(aEvent) {
|
||||
let sourceNode = aEvent.dataTransfer.mozSourceNode;
|
||||
if (sourceNode &&
|
||||
(sourceNode.localName !== "browser" ||
|
||||
sourceNode.namespaceURI !== "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")) {
|
||||
if (
|
||||
sourceNode &&
|
||||
(sourceNode.localName !== "browser" ||
|
||||
sourceNode.namespaceURI !==
|
||||
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")
|
||||
) {
|
||||
// Use sourceNode's csp only if the sourceNode is not browser.
|
||||
//
|
||||
// If sourceNode is browser, the actual triggering csp may be differ than sourceNode's csp,
|
||||
|
@ -216,74 +235,89 @@ ContentAreaDropListener.prototype =
|
|||
return null;
|
||||
},
|
||||
|
||||
canDropLink: function(aEvent, aAllowSameDocument)
|
||||
{
|
||||
if (this._eventTargetIsDisabled(aEvent))
|
||||
canDropLink: function(aEvent, aAllowSameDocument) {
|
||||
if (this._eventTargetIsDisabled(aEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let dataTransfer = aEvent.dataTransfer;
|
||||
let types = dataTransfer.types;
|
||||
if (!types.includes("application/x-moz-file") &&
|
||||
!types.includes("text/x-moz-url") &&
|
||||
!types.includes("text/uri-list") &&
|
||||
!types.includes("text/x-moz-text-internal") &&
|
||||
!types.includes("text/plain"))
|
||||
if (
|
||||
!types.includes("application/x-moz-file") &&
|
||||
!types.includes("text/x-moz-url") &&
|
||||
!types.includes("text/uri-list") &&
|
||||
!types.includes("text/x-moz-text-internal") &&
|
||||
!types.includes("text/plain")
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aAllowSameDocument)
|
||||
if (aAllowSameDocument) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let sourceNode = dataTransfer.mozSourceNode;
|
||||
if (!sourceNode)
|
||||
if (!sourceNode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// don't allow a drop of a node from the same document onto this one
|
||||
let sourceDocument = sourceNode.ownerDocument;
|
||||
let eventDocument = aEvent.originalTarget.ownerDocument;
|
||||
if (sourceDocument == eventDocument)
|
||||
if (sourceDocument == eventDocument) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// also check for nodes in other child or sibling frames by checking
|
||||
// if both have the same top window.
|
||||
if (sourceDocument && eventDocument) {
|
||||
if (sourceDocument.defaultView == null)
|
||||
if (sourceDocument.defaultView == null) {
|
||||
return true;
|
||||
}
|
||||
let sourceRoot = sourceDocument.defaultView.top;
|
||||
if (sourceRoot && sourceRoot == eventDocument.defaultView.top)
|
||||
if (sourceRoot && sourceRoot == eventDocument.defaultView.top) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
dropLink: function(aEvent, aName, aDisallowInherit)
|
||||
{
|
||||
dropLink: function(aEvent, aName, aDisallowInherit) {
|
||||
aName.value = "";
|
||||
let links = this.dropLinks(aEvent, aDisallowInherit);
|
||||
let url = "";
|
||||
if (links.length > 0) {
|
||||
url = links[0].url;
|
||||
let name = links[0].name;
|
||||
if (name)
|
||||
if (name) {
|
||||
aName.value = name;
|
||||
}
|
||||
}
|
||||
|
||||
return url;
|
||||
},
|
||||
|
||||
dropLinks: function(aEvent, aDisallowInherit)
|
||||
{
|
||||
if (aEvent && this._eventTargetIsDisabled(aEvent))
|
||||
dropLinks: function(aEvent, aDisallowInherit) {
|
||||
if (aEvent && this._eventTargetIsDisabled(aEvent)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
let dataTransfer = aEvent.dataTransfer;
|
||||
let links = this._getDropLinks(dataTransfer);
|
||||
let triggeringPrincipal = this._getTriggeringPrincipalFromDataTransfer(dataTransfer, false);
|
||||
let triggeringPrincipal = this._getTriggeringPrincipalFromDataTransfer(
|
||||
dataTransfer,
|
||||
false
|
||||
);
|
||||
|
||||
for (let link of links) {
|
||||
try {
|
||||
link.url = this._validateURI(dataTransfer, link.url, aDisallowInherit,
|
||||
triggeringPrincipal);
|
||||
link.url = this._validateURI(
|
||||
dataTransfer,
|
||||
link.url,
|
||||
aDisallowInherit,
|
||||
triggeringPrincipal
|
||||
);
|
||||
} catch (ex) {
|
||||
// Prevent the drop entirely if any of the links are invalid even if
|
||||
// one of them is valid.
|
||||
|
@ -296,32 +330,37 @@ ContentAreaDropListener.prototype =
|
|||
return links;
|
||||
},
|
||||
|
||||
validateURIsForDrop: function(aEvent, aURIs, aDisallowInherit)
|
||||
{
|
||||
validateURIsForDrop: function(aEvent, aURIs, aDisallowInherit) {
|
||||
let dataTransfer = aEvent.dataTransfer;
|
||||
let triggeringPrincipal = this._getTriggeringPrincipalFromDataTransfer(dataTransfer, false);
|
||||
let triggeringPrincipal = this._getTriggeringPrincipalFromDataTransfer(
|
||||
dataTransfer,
|
||||
false
|
||||
);
|
||||
|
||||
for (let uri of aURIs) {
|
||||
this._validateURI(dataTransfer, uri, aDisallowInherit,
|
||||
triggeringPrincipal);
|
||||
this._validateURI(
|
||||
dataTransfer,
|
||||
uri,
|
||||
aDisallowInherit,
|
||||
triggeringPrincipal
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
queryLinks: function(aDataTransfer)
|
||||
{
|
||||
queryLinks: function(aDataTransfer) {
|
||||
return this._getDropLinks(aDataTransfer);
|
||||
},
|
||||
|
||||
_eventTargetIsDisabled: function(aEvent)
|
||||
{
|
||||
_eventTargetIsDisabled: function(aEvent) {
|
||||
let ownerDoc = aEvent.originalTarget.ownerDocument;
|
||||
if (!ownerDoc || !ownerDoc.defaultView)
|
||||
if (!ownerDoc || !ownerDoc.defaultView) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ownerDoc.defaultView
|
||||
.windowUtils
|
||||
.isNodeDisabledForEvents(aEvent.originalTarget);
|
||||
}
|
||||
return ownerDoc.defaultView.windowUtils.isNodeDisabledForEvents(
|
||||
aEvent.originalTarget
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ContentAreaDropListener"];
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
var EXPORTED_SYMBOLS = ["DOMRequestIpcHelper"];
|
||||
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function DOMRequestIpcHelper() {
|
||||
// _listeners keeps a list of messages for which we added a listener and the
|
||||
|
@ -41,10 +41,12 @@ DOMRequestIpcHelper.prototype = {
|
|||
* An object which "inherits" from DOMRequestIpcHelper and declares its own
|
||||
* queryInterface method MUST implement Ci.nsISupportsWeakReference.
|
||||
*/
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference,
|
||||
Ci.nsIObserver]),
|
||||
QueryInterface: ChromeUtils.generateQI([
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIObserver,
|
||||
]),
|
||||
|
||||
/**
|
||||
/**
|
||||
* 'aMessages' is expected to be an array of either:
|
||||
* - objects of this form:
|
||||
* {
|
||||
|
@ -70,7 +72,7 @@ DOMRequestIpcHelper.prototype = {
|
|||
aMessages = [aMessages];
|
||||
}
|
||||
|
||||
aMessages.forEach((aMsg) => {
|
||||
aMessages.forEach(aMsg => {
|
||||
let name = aMsg.name || aMsg;
|
||||
// If the listener is already set and it is of the same type we just
|
||||
// increase the count and bail out. If it is not of the same type,
|
||||
|
@ -84,11 +86,12 @@ DOMRequestIpcHelper.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
aMsg.weakRef ? Services.cpmm.addWeakMessageListener(name, this)
|
||||
: Services.cpmm.addMessageListener(name, this);
|
||||
aMsg.weakRef
|
||||
? Services.cpmm.addWeakMessageListener(name, this)
|
||||
: Services.cpmm.addMessageListener(name, this);
|
||||
this._listeners[name] = {
|
||||
weakRef: !!aMsg.weakRef,
|
||||
count: 1
|
||||
count: 1,
|
||||
};
|
||||
});
|
||||
},
|
||||
|
@ -106,7 +109,7 @@ DOMRequestIpcHelper.prototype = {
|
|||
aMessages = [aMessages];
|
||||
}
|
||||
|
||||
aMessages.forEach((aName) => {
|
||||
aMessages.forEach(aName => {
|
||||
if (this._listeners[aName] == undefined) {
|
||||
return;
|
||||
}
|
||||
|
@ -114,8 +117,8 @@ DOMRequestIpcHelper.prototype = {
|
|||
// Only remove the listener really when we don't have anybody that could
|
||||
// be waiting on a message.
|
||||
if (!--this._listeners[aName].count) {
|
||||
this._listeners[aName].weakRef ?
|
||||
Services.cpmm.removeWeakMessageListener(aName, this)
|
||||
this._listeners[aName].weakRef
|
||||
? Services.cpmm.removeWeakMessageListener(aName, this)
|
||||
: Services.cpmm.removeMessageListener(aName, this);
|
||||
delete this._listeners[aName];
|
||||
}
|
||||
|
@ -160,8 +163,11 @@ DOMRequestIpcHelper.prototype = {
|
|||
|
||||
this._destroyed = false;
|
||||
|
||||
Services.obs.addObserver(this, "inner-window-destroyed",
|
||||
/* weak-ref */ true);
|
||||
Services.obs.addObserver(
|
||||
this,
|
||||
"inner-window-destroyed",
|
||||
/* weak-ref */ true
|
||||
);
|
||||
},
|
||||
|
||||
destroyDOMRequestHelper: function() {
|
||||
|
@ -174,9 +180,9 @@ DOMRequestIpcHelper.prototype = {
|
|||
Services.obs.removeObserver(this, "inner-window-destroyed");
|
||||
|
||||
if (this._listeners) {
|
||||
Object.keys(this._listeners).forEach((aName) => {
|
||||
this._listeners[aName].weakRef ?
|
||||
Services.cpmm.removeWeakMessageListener(aName, this)
|
||||
Object.keys(this._listeners).forEach(aName => {
|
||||
this._listeners[aName].weakRef
|
||||
? Services.cpmm.removeWeakMessageListener(aName, this)
|
||||
: Services.cpmm.removeMessageListener(aName, this);
|
||||
});
|
||||
}
|
||||
|
@ -262,13 +268,17 @@ DOMRequestIpcHelper.prototype = {
|
|||
|
||||
_getRandomId: function() {
|
||||
return Cc["@mozilla.org/uuid-generator;1"]
|
||||
.getService(Ci.nsIUUIDGenerator).generateUUID().toString();
|
||||
.getService(Ci.nsIUUIDGenerator)
|
||||
.generateUUID()
|
||||
.toString();
|
||||
},
|
||||
|
||||
createRequest: function() {
|
||||
// If we don't have a valid window object, throw.
|
||||
if (!this._window) {
|
||||
Cu.reportError("DOMRequestHelper trying to create a DOMRequest without a valid window, failing.");
|
||||
Cu.reportError(
|
||||
"DOMRequestHelper trying to create a DOMRequest without a valid window, failing."
|
||||
);
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
return Services.DOMRequest.createRequest(this._window);
|
||||
|
@ -282,7 +292,9 @@ DOMRequestIpcHelper.prototype = {
|
|||
createPromise: function(aPromiseInit) {
|
||||
// If we don't have a valid window object, throw.
|
||||
if (!this._window) {
|
||||
Cu.reportError("DOMRequestHelper trying to create a Promise without a valid window, failing.");
|
||||
Cu.reportError(
|
||||
"DOMRequestHelper trying to create a Promise without a valid window, failing."
|
||||
);
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
return new this._window.Promise(aPromiseInit);
|
||||
|
@ -294,7 +306,10 @@ DOMRequestIpcHelper.prototype = {
|
|||
*/
|
||||
createPromiseWithId: function(aCallback) {
|
||||
return this.createPromise((aResolve, aReject) => {
|
||||
let resolverId = this.getPromiseResolverId({ resolve: aResolve, reject: aReject });
|
||||
let resolverId = this.getPromiseResolverId({
|
||||
resolve: aResolve,
|
||||
reject: aReject,
|
||||
});
|
||||
aCallback(resolverId);
|
||||
});
|
||||
},
|
||||
|
@ -304,7 +319,7 @@ DOMRequestIpcHelper.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
Object.keys(this._requests).forEach((aKey) => {
|
||||
Object.keys(this._requests).forEach(aKey => {
|
||||
if (this.getRequest(aKey) instanceof this._window.DOMRequest) {
|
||||
aCallback(aKey);
|
||||
}
|
||||
|
@ -316,11 +331,13 @@ DOMRequestIpcHelper.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
Object.keys(this._requests).forEach((aKey) => {
|
||||
if ("resolve" in this.getPromiseResolver(aKey) &&
|
||||
"reject" in this.getPromiseResolver(aKey)) {
|
||||
Object.keys(this._requests).forEach(aKey => {
|
||||
if (
|
||||
"resolve" in this.getPromiseResolver(aKey) &&
|
||||
"reject" in this.getPromiseResolver(aKey)
|
||||
) {
|
||||
aCallback(aKey);
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5705,15 +5705,12 @@ void Document::ReleaseCapture() const {
|
|||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> Document::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsIURI* Document::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
|
||||
if (aTryUseXHRDocBaseURI && mChromeXHRDocBaseURI) {
|
||||
uri = mChromeXHRDocBaseURI;
|
||||
} else {
|
||||
uri = GetDocBaseURI();
|
||||
return mChromeXHRDocBaseURI;
|
||||
}
|
||||
|
||||
return uri.forget();
|
||||
return GetDocBaseURI();
|
||||
}
|
||||
|
||||
void Document::SetBaseURI(nsIURI* aURI) {
|
||||
|
|
|
@ -666,7 +666,9 @@ class Document : public nsINode,
|
|||
virtual void NotifyPossibleTitleChange(bool aBoundTitleElement);
|
||||
|
||||
/**
|
||||
* Return the URI for the document. May return null.
|
||||
* Return the URI for the document. May return null. If it ever stops being
|
||||
* able to return null, we can make sure nsINode::GetBaseURI/GetBaseURIObject
|
||||
* also never return null.
|
||||
*
|
||||
* The value returned corresponds to the "document's address" in
|
||||
* HTML5. As such, it may change over the lifetime of the document, for
|
||||
|
@ -901,8 +903,7 @@ class Document : public nsINode,
|
|||
return GetFallbackBaseURI();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> GetBaseURI(
|
||||
bool aTryUseXHRDocBaseURI = false) const final;
|
||||
nsIURI* GetBaseURI(bool aTryUseXHRDocBaseURI = false) const final;
|
||||
|
||||
void SetBaseURI(nsIURI* aURI);
|
||||
|
||||
|
|
|
@ -327,19 +327,14 @@ nsAtom* nsIContent::GetLang() const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> nsIContent::GetBaseURI(
|
||||
bool aTryUseXHRDocBaseURI) const {
|
||||
nsIURI* nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
|
||||
if (SVGUseElement* use = GetContainingSVGUseShadowHost()) {
|
||||
if (URLExtraData* data = use->GetContentURLData()) {
|
||||
return do_AddRef(data->BaseURI());
|
||||
return data->BaseURI();
|
||||
}
|
||||
}
|
||||
|
||||
Document* doc = OwnerDoc();
|
||||
// Start with document base
|
||||
nsCOMPtr<nsIURI> base = doc->GetBaseURI(aTryUseXHRDocBaseURI);
|
||||
|
||||
return base.forget();
|
||||
return OwnerDoc()->GetBaseURI(aTryUseXHRDocBaseURI);
|
||||
}
|
||||
|
||||
nsIURI* nsIContent::GetBaseURIForStyleAttr() const {
|
||||
|
|
|
@ -7,24 +7,28 @@
|
|||
var DEBUG = 0;
|
||||
var debug;
|
||||
if (DEBUG) {
|
||||
debug = function (s) { dump("-*- IndexedDBHelper: " + s + "\n"); }
|
||||
debug = function(s) {
|
||||
dump("-*- IndexedDBHelper: " + s + "\n");
|
||||
};
|
||||
} else {
|
||||
debug = function (s) {}
|
||||
debug = function(s) {};
|
||||
}
|
||||
|
||||
var EXPORTED_SYMBOLS = ["IndexedDBHelper"];
|
||||
|
||||
Cu.importGlobalProperties(["indexedDB"]);
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, 'Services',
|
||||
'resource://gre/modules/Services.jsm');
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"Services",
|
||||
"resource://gre/modules/Services.jsm"
|
||||
);
|
||||
|
||||
function getErrorName(err) {
|
||||
return err && err.name || "UnknownError";
|
||||
return (err && err.name) || "UnknownError";
|
||||
}
|
||||
|
||||
function IndexedDBHelper() {
|
||||
}
|
||||
function IndexedDBHelper() {}
|
||||
|
||||
IndexedDBHelper.prototype = {
|
||||
// Close the database
|
||||
|
@ -60,39 +64,64 @@ IndexedDBHelper.prototype = {
|
|||
self._waitForOpenCallbacks.clear();
|
||||
};
|
||||
|
||||
if (DEBUG) debug("Try to open database:" + self.dbName + " " + self.dbVersion);
|
||||
if (DEBUG) {
|
||||
debug("Try to open database:" + self.dbName + " " + self.dbVersion);
|
||||
}
|
||||
let req;
|
||||
try {
|
||||
req = indexedDB.open(this.dbName, this.dbVersion);
|
||||
} catch (e) {
|
||||
if (DEBUG) debug("Error opening database: " + self.dbName);
|
||||
if (DEBUG) {
|
||||
debug("Error opening database: " + self.dbName);
|
||||
}
|
||||
Services.tm.dispatchToMainThread(() => invokeCallbacks(getErrorName(e)));
|
||||
return;
|
||||
}
|
||||
req.onsuccess = function (event) {
|
||||
if (DEBUG) debug("Opened database:" + self.dbName + " " + self.dbVersion);
|
||||
req.onsuccess = function(event) {
|
||||
if (DEBUG) {
|
||||
debug("Opened database:" + self.dbName + " " + self.dbVersion);
|
||||
}
|
||||
self._db = event.target.result;
|
||||
self._db.onversionchange = function(event) {
|
||||
if (DEBUG) debug("WARNING: DB modified from a different window.");
|
||||
}
|
||||
if (DEBUG) {
|
||||
debug("WARNING: DB modified from a different window.");
|
||||
}
|
||||
};
|
||||
invokeCallbacks();
|
||||
};
|
||||
|
||||
req.onupgradeneeded = function (aEvent) {
|
||||
req.onupgradeneeded = function(aEvent) {
|
||||
if (DEBUG) {
|
||||
debug("Database needs upgrade:" + self.dbName + aEvent.oldVersion + aEvent.newVersion);
|
||||
debug("Correct new database version:" + (aEvent.newVersion == this.dbVersion));
|
||||
debug(
|
||||
"Database needs upgrade:" +
|
||||
self.dbName +
|
||||
aEvent.oldVersion +
|
||||
aEvent.newVersion
|
||||
);
|
||||
debug(
|
||||
"Correct new database version:" +
|
||||
(aEvent.newVersion == this.dbVersion)
|
||||
);
|
||||
}
|
||||
|
||||
let _db = aEvent.target.result;
|
||||
self.upgradeSchema(req.transaction, _db, aEvent.oldVersion, aEvent.newVersion);
|
||||
self.upgradeSchema(
|
||||
req.transaction,
|
||||
_db,
|
||||
aEvent.oldVersion,
|
||||
aEvent.newVersion
|
||||
);
|
||||
};
|
||||
req.onerror = function (aEvent) {
|
||||
if (DEBUG) debug("Failed to open database: " + self.dbName);
|
||||
req.onerror = function(aEvent) {
|
||||
if (DEBUG) {
|
||||
debug("Failed to open database: " + self.dbName);
|
||||
}
|
||||
invokeCallbacks(getErrorName(aEvent.target.error));
|
||||
};
|
||||
req.onblocked = function (aEvent) {
|
||||
if (DEBUG) debug("Opening database request is blocked.");
|
||||
req.onblocked = function(aEvent) {
|
||||
if (DEBUG) {
|
||||
debug("Opening database request is blocked.");
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -106,7 +135,9 @@ IndexedDBHelper.prototype = {
|
|||
*/
|
||||
ensureDB: function ensureDB(aSuccessCb, aFailureCb) {
|
||||
if (this._db) {
|
||||
if (DEBUG) debug("ensureDB: already have a database, returning early.");
|
||||
if (DEBUG) {
|
||||
debug("ensureDB: already have a database, returning early.");
|
||||
}
|
||||
if (aSuccessCb) {
|
||||
Services.tm.dispatchToMainThread(aSuccessCb);
|
||||
}
|
||||
|
@ -137,18 +168,33 @@ IndexedDBHelper.prototype = {
|
|||
* @param failureCb
|
||||
* Error callback to call when an error is encountered.
|
||||
*/
|
||||
newTxn: function newTxn(txn_type, store_name, callback, successCb, failureCb) {
|
||||
newTxn: function newTxn(
|
||||
txn_type,
|
||||
store_name,
|
||||
callback,
|
||||
successCb,
|
||||
failureCb
|
||||
) {
|
||||
this.ensureDB(() => {
|
||||
if (DEBUG) debug("Starting new transaction" + txn_type);
|
||||
if (DEBUG) {
|
||||
debug("Starting new transaction" + txn_type);
|
||||
}
|
||||
let txn;
|
||||
try {
|
||||
txn = this._db.transaction(Array.isArray(store_name) ? store_name : this.dbStoreNames, txn_type);
|
||||
txn = this._db.transaction(
|
||||
Array.isArray(store_name) ? store_name : this.dbStoreNames,
|
||||
txn_type
|
||||
);
|
||||
} catch (e) {
|
||||
if (DEBUG) debug("Error starting transaction: " + this.dbName);
|
||||
if (DEBUG) {
|
||||
debug("Error starting transaction: " + this.dbName);
|
||||
}
|
||||
failureCb(getErrorName(e));
|
||||
return;
|
||||
}
|
||||
if (DEBUG) debug("Retrieving object store: " + this.dbName);
|
||||
if (DEBUG) {
|
||||
debug("Retrieving object store: " + this.dbName);
|
||||
}
|
||||
let stores;
|
||||
if (Array.isArray(store_name)) {
|
||||
stores = [];
|
||||
|
@ -159,8 +205,10 @@ IndexedDBHelper.prototype = {
|
|||
stores = txn.objectStore(store_name);
|
||||
}
|
||||
|
||||
txn.oncomplete = function () {
|
||||
if (DEBUG) debug("Transaction complete. Returning to callback.");
|
||||
txn.oncomplete = function() {
|
||||
if (DEBUG) {
|
||||
debug("Transaction complete. Returning to callback.");
|
||||
}
|
||||
/*
|
||||
* txn.result property is not part of the transaction object returned
|
||||
* by this._db.transaction method called above.
|
||||
|
@ -178,8 +226,10 @@ IndexedDBHelper.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
txn.onabort = function () {
|
||||
if (DEBUG) debug("Caught error on transaction");
|
||||
txn.onabort = function() {
|
||||
if (DEBUG) {
|
||||
debug("Caught error on transaction");
|
||||
}
|
||||
/*
|
||||
* txn.error property is part of the transaction object returned by
|
||||
* this._db.transaction method called above.
|
||||
|
@ -211,5 +261,5 @@ IndexedDBHelper.prototype = {
|
|||
// Cache the database.
|
||||
this._db = null;
|
||||
this._waitForOpenCallbacks = new Set();
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -810,7 +810,7 @@ void Location::Assign(const nsAString& aUrl, nsIPrincipal& aSubjectPrincipal,
|
|||
DoSetHref(aUrl, aSubjectPrincipal, false, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> Location::GetSourceBaseURL() {
|
||||
nsIURI* Location::GetSourceBaseURL() {
|
||||
Document* doc = GetEntryDocument();
|
||||
// If there's no entry document, we either have no Script Entry Point or one
|
||||
// that isn't a DOM Window. This doesn't generally happen with the DOM, but
|
||||
|
|
|
@ -152,7 +152,7 @@ class Location final : public nsISupports, public nsWrapperCache {
|
|||
|
||||
// Get the base URL we should be using for our relative URL
|
||||
// resolution for SetHref/Assign/Replace.
|
||||
already_AddRefed<nsIURI> GetSourceBaseURL();
|
||||
nsIURI* GetSourceBaseURL();
|
||||
|
||||
// Check whether it's OK to load the given url with the given subject
|
||||
// principal, and if so construct the right nsDocShellLoadInfo for the load
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
|
||||
// Fills up aProcesses until max and then selects randomly from the available
|
||||
// ones.
|
||||
function RandomSelector() {
|
||||
}
|
||||
function RandomSelector() {}
|
||||
|
||||
RandomSelector.prototype = {
|
||||
classID: Components.ID("{c616fcfd-9737-41f1-aa74-cee72a38f91b}"),
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
|
||||
classID: Components.ID("{c616fcfd-9737-41f1-aa74-cee72a38f91b}"),
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
|
||||
|
||||
provideProcess(aType, aOpener, aProcesses, aMaxCount) {
|
||||
if (aProcesses.length < aMaxCount) {
|
||||
|
@ -33,12 +32,11 @@ RandomSelector.prototype = {
|
|||
|
||||
// Fills up aProcesses until max and then selects one from the available
|
||||
// ones that host the least number of tabs.
|
||||
function MinTabSelector() {
|
||||
}
|
||||
function MinTabSelector() {}
|
||||
|
||||
MinTabSelector.prototype = {
|
||||
classID: Components.ID("{2dc08eaf-6eef-4394-b1df-a3a927c1290b}"),
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
|
||||
classID: Components.ID("{2dc08eaf-6eef-4394-b1df-a3a927c1290b}"),
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
|
||||
|
||||
provideProcess(aType, aOpener, aProcesses, aMaxCount) {
|
||||
if (aProcesses.length < aMaxCount) {
|
||||
|
@ -66,4 +64,4 @@ MinTabSelector.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
var EXPORTED_SYMBOLS = ["RandomSelector", "MinTabSelector"]
|
||||
var EXPORTED_SYMBOLS = ["RandomSelector", "MinTabSelector"];
|
||||
|
|
|
@ -111,9 +111,7 @@ bool ResponsiveImageSelector::SetCandidatesFromSourceSet(
|
|||
const nsAString& aSrcSet, nsIPrincipal* aTriggeringPrincipal) {
|
||||
ClearSelectedCandidate();
|
||||
|
||||
nsCOMPtr<nsIURI> docBaseURI = mOwnerNode ? mOwnerNode->GetBaseURI() : nullptr;
|
||||
|
||||
if (!docBaseURI) {
|
||||
if (!mOwnerNode || !mOwnerNode->GetBaseURI()) {
|
||||
MOZ_ASSERT(false, "Should not be parsing SourceSet without a document");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4,17 +4,25 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
function SlowScriptDebug() { }
|
||||
function SlowScriptDebug() {}
|
||||
|
||||
SlowScriptDebug.prototype = {
|
||||
classDescription: "Slow script debug handler",
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsISlowScriptDebug]),
|
||||
|
||||
get activationHandler() { return this._activationHandler; },
|
||||
set activationHandler(cb) { return this._activationHandler = cb; },
|
||||
get activationHandler() {
|
||||
return this._activationHandler;
|
||||
},
|
||||
set activationHandler(cb) {
|
||||
return (this._activationHandler = cb);
|
||||
},
|
||||
|
||||
get remoteActivationHandler() { return this._remoteActivationHandler; },
|
||||
set remoteActivationHandler(cb) { return this._remoteActivationHandler = cb; },
|
||||
get remoteActivationHandler() {
|
||||
return this._remoteActivationHandler;
|
||||
},
|
||||
set remoteActivationHandler(cb) {
|
||||
return (this._remoteActivationHandler = cb);
|
||||
},
|
||||
};
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SlowScriptDebug"];
|
||||
|
|
|
@ -445,7 +445,7 @@ void nsFrameLoader::LoadFrame(bool aOriginalSrc) {
|
|||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> base_uri = mOwnerContent->GetBaseURI();
|
||||
nsIURI* base_uri = mOwnerContent->GetBaseURI();
|
||||
auto encoding = doc->GetDocumentCharacterSet();
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
@ -635,8 +635,7 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() {
|
|||
|
||||
if (isSrcdoc) {
|
||||
loadState->SetSrcdocData(srcdoc);
|
||||
nsCOMPtr<nsIURI> baseURI = mOwnerContent->GetBaseURI();
|
||||
loadState->SetBaseURI(baseURI);
|
||||
loadState->SetBaseURI(mOwnerContent->GetBaseURI());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo = new ReferrerInfo();
|
||||
|
|
|
@ -104,7 +104,7 @@ bool nsHTMLContentSerializer::SerializeHTMLAttributes(
|
|||
// Would be nice to handle OBJECT tags, but that gets more complicated
|
||||
// since we have to search the tag list for CODEBASE as well. For now,
|
||||
// just leave them relative.
|
||||
nsCOMPtr<nsIURI> uri = aElement->GetBaseURI();
|
||||
nsIURI* uri = aElement->GetBaseURI();
|
||||
if (uri) {
|
||||
nsAutoString absURI;
|
||||
rv = NS_MakeAbsoluteURI(absURI, valueStr, uri);
|
||||
|
|
|
@ -675,8 +675,7 @@ class nsIContent : public nsINode {
|
|||
}
|
||||
|
||||
// Overloaded from nsINode
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI(
|
||||
bool aTryUseXHRDocBaseURI = false) const override;
|
||||
nsIURI* GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
||||
|
||||
// Returns base URI for style attribute.
|
||||
nsIURI* GetBaseURIForStyleAttr() const;
|
||||
|
|
|
@ -611,7 +611,7 @@ void nsINode::Normalize() {
|
|||
}
|
||||
|
||||
nsresult nsINode::GetBaseURI(nsAString& aURI) const {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
nsIURI* baseURI = GetBaseURI();
|
||||
|
||||
nsAutoCString spec;
|
||||
if (baseURI) {
|
||||
|
@ -625,7 +625,7 @@ nsresult nsINode::GetBaseURI(nsAString& aURI) const {
|
|||
|
||||
void nsINode::GetBaseURIFromJS(nsAString& aURI, CallerType aCallerType,
|
||||
ErrorResult& aRv) const {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI(aCallerType == CallerType::System);
|
||||
nsIURI* baseURI = GetBaseURI(aCallerType == CallerType::System);
|
||||
nsAutoCString spec;
|
||||
if (baseURI) {
|
||||
nsresult res = baseURI->GetSpec(spec);
|
||||
|
@ -637,9 +637,7 @@ void nsINode::GetBaseURIFromJS(nsAString& aURI, CallerType aCallerType,
|
|||
CopyUTF8toUTF16(spec, aURI);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> nsINode::GetBaseURIObject() const {
|
||||
return GetBaseURI(true);
|
||||
}
|
||||
nsIURI* nsINode::GetBaseURIObject() const { return GetBaseURI(true); }
|
||||
|
||||
void nsINode::LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix) {
|
||||
Element* element = GetNameSpaceElement();
|
||||
|
|
|
@ -1218,14 +1218,12 @@ class nsINode : public mozilla::dom::EventTarget {
|
|||
/**
|
||||
* Get the base URI for any relative URIs within this piece of
|
||||
* content. Generally, this is the document's base URI, but certain
|
||||
* content carries a local base for backward compatibility, and XML
|
||||
* supports setting a per-node base URI.
|
||||
* content carries a local base for backward compatibility.
|
||||
*
|
||||
* @return the base URI
|
||||
* @return the base URI. May return null.
|
||||
*/
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI(
|
||||
bool aTryUseXHRDocBaseURI = false) const = 0;
|
||||
already_AddRefed<nsIURI> GetBaseURIObject() const;
|
||||
virtual nsIURI* GetBaseURI(bool aTryUseXHRDocBaseURI = false) const = 0;
|
||||
nsIURI* GetBaseURIObject() const;
|
||||
|
||||
/**
|
||||
* Return true if the node may be apz aware. There are two cases. One is that
|
||||
|
|
|
@ -1353,7 +1353,7 @@ nsresult nsImageLoadingContent::StringToURI(const nsAString& aSpec,
|
|||
|
||||
// (1) Get the base URI
|
||||
nsIContent* thisContent = AsContent();
|
||||
nsCOMPtr<nsIURI> baseURL = thisContent->GetBaseURI();
|
||||
nsIURI* baseURL = thisContent->GetBaseURI();
|
||||
|
||||
// (2) Get the charset
|
||||
auto encoding = aDocument->GetDocumentCharacterSet();
|
||||
|
|
|
@ -1492,7 +1492,7 @@ nsObjectLoadingContent::UpdateObjectParameters() {
|
|||
///
|
||||
|
||||
nsAutoString codebaseStr;
|
||||
nsCOMPtr<nsIURI> docBaseURI = thisElement->GetBaseURI();
|
||||
nsIURI* docBaseURI = thisElement->GetBaseURI();
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::codebase, codebaseStr);
|
||||
|
||||
if (!codebaseStr.IsEmpty()) {
|
||||
|
@ -1508,6 +1508,11 @@ nsObjectLoadingContent::UpdateObjectParameters() {
|
|||
}
|
||||
}
|
||||
|
||||
// If we failed to build a valid URI, use the document's base URI
|
||||
if (!newBaseURI) {
|
||||
newBaseURI = docBaseURI;
|
||||
}
|
||||
|
||||
nsAutoString rawTypeAttr;
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::type, rawTypeAttr);
|
||||
if (!rawTypeAttr.IsEmpty()) {
|
||||
|
@ -1518,11 +1523,6 @@ nsObjectLoadingContent::UpdateObjectParameters() {
|
|||
CopyUTF16toUTF8(mime, newMime);
|
||||
}
|
||||
|
||||
// If we failed to build a valid URI, use the document's base URI
|
||||
if (!newBaseURI) {
|
||||
newBaseURI = docBaseURI;
|
||||
}
|
||||
|
||||
///
|
||||
/// URI
|
||||
///
|
||||
|
|
|
@ -1286,9 +1286,9 @@ bool nsTreeSanitizer::SanitizeURL(mozilla::dom::Element* aElement,
|
|||
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
|
||||
uint32_t flags = nsIScriptSecurityManager::DISALLOW_INHERIT_PRINCIPAL;
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = aElement->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> attrURI;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(attrURI), v, nullptr, baseURI);
|
||||
nsresult rv =
|
||||
NS_NewURI(getter_AddRefs(attrURI), v, nullptr, aElement->GetBaseURI());
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (mCidEmbedsOnly && kNameSpaceID_None == aNamespace) {
|
||||
if (nsGkAtoms::src == aLocalName || nsGkAtoms::background == aLocalName) {
|
||||
|
@ -1383,9 +1383,8 @@ void nsTreeSanitizer::SanitizeChildren(nsINode* aRoot) {
|
|||
nsContentUtils::GetNodeTextContent(node, false, styleText);
|
||||
|
||||
nsAutoString sanitizedStyle;
|
||||
nsCOMPtr<nsIURI> baseURI = node->GetBaseURI();
|
||||
if (SanitizeStyleSheet(styleText, sanitizedStyle, aRoot->OwnerDoc(),
|
||||
baseURI)) {
|
||||
node->GetBaseURI())) {
|
||||
nsContentUtils::SetNodeTextContent(node, sanitizedStyle, true);
|
||||
} else {
|
||||
// If the node had non-text child nodes, this operation zaps those.
|
||||
|
|
|
@ -277,7 +277,7 @@ bool nsXHTMLContentSerializer::SerializeAttributes(
|
|||
// but that gets more complicated since we have to
|
||||
// search the tag list for CODEBASE as well.
|
||||
// For now, just leave them relative.
|
||||
nsCOMPtr<nsIURI> uri = aElement->GetBaseURI();
|
||||
nsIURI* uri = aElement->GetBaseURI();
|
||||
if (uri) {
|
||||
nsAutoString absURI;
|
||||
rv = NS_MakeAbsoluteURI(absURI, valueStr, uri);
|
||||
|
|
|
@ -84,9 +84,9 @@ already_AddRefed<nsIURI> ParseURLFromDocument(Document* aDocument,
|
|||
MOZ_ASSERT(aDocument);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = aDocument->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> resolvedURI;
|
||||
aRv = NS_NewURI(getter_AddRefs(resolvedURI), aInput, nullptr, baseURI);
|
||||
aRv = NS_NewURI(getter_AddRefs(resolvedURI), aInput, nullptr,
|
||||
aDocument->GetBaseURI());
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(aInput);
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ already_AddRefed<Response> Response::Redirect(const GlobalObject& aGlobal,
|
|||
nsAutoString parsedURL;
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsIURI* baseURI = nullptr;
|
||||
nsCOMPtr<nsPIDOMWindowInner> inner(
|
||||
do_QueryInterface(aGlobal.GetAsSupports()));
|
||||
Document* doc = inner ? inner->GetExtantDoc() : nullptr;
|
||||
|
|
|
@ -1485,7 +1485,7 @@ nsresult HTMLFormElement::GetActionURL(nsIURI** aActionURL,
|
|||
|
||||
actionURL = docURI;
|
||||
} else {
|
||||
nsCOMPtr<nsIURI> baseURL = GetBaseURI();
|
||||
nsIURI* baseURL = GetBaseURI();
|
||||
NS_ASSERTION(baseURL, "No Base URL found in Form Submit!\n");
|
||||
if (!baseURL) {
|
||||
return NS_OK; // No base URL -> exit early, see Bug 30721
|
||||
|
|
|
@ -135,10 +135,9 @@ bool HTMLMenuElement::CanLoadIcon(nsIContent* aContent,
|
|||
|
||||
Document* doc = aContent->OwnerDoc();
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = aContent->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), aIcon, doc,
|
||||
baseURI);
|
||||
aContent->GetBaseURI());
|
||||
|
||||
if (!uri) {
|
||||
return false;
|
||||
|
|
|
@ -186,9 +186,8 @@ void HTMLScriptElement::FreezeExecutionAttrs(Document* aOwnerDoc) {
|
|||
if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) {
|
||||
// Empty src should be treated as invalid URL.
|
||||
if (!src.IsEmpty()) {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(mUri), src,
|
||||
OwnerDoc(), baseURI);
|
||||
OwnerDoc(), GetBaseURI());
|
||||
|
||||
if (!mUri) {
|
||||
AutoTArray<nsString, 2> params = {NS_LITERAL_STRING("src"), src};
|
||||
|
|
|
@ -863,10 +863,9 @@ bool nsGenericHTMLElement::ParseBackgroundAttribute(int32_t aNamespaceID,
|
|||
aAttribute == nsGkAtoms::background && !aValue.IsEmpty()) {
|
||||
// Resolve url to an absolute url
|
||||
Document* doc = OwnerDoc();
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = nsContentUtils::NewURIWithDocumentCharset(
|
||||
getter_AddRefs(uri), aValue, doc, baseURI);
|
||||
getter_AddRefs(uri), aValue, doc, GetBaseURI());
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2685,9 +2684,9 @@ nsresult nsGenericHTMLElement::NewURIFromString(const nsAString& aURISpec,
|
|||
|
||||
nsCOMPtr<Document> doc = OwnerDoc();
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
nsresult rv =
|
||||
nsContentUtils::NewURIWithDocumentCharset(aURI, aURISpec, doc, baseURI);
|
||||
nsContentUtils::NewURIWithDocumentCharset(aURI, aURISpec, doc,
|
||||
GetBaseURI());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool equal;
|
||||
|
|
|
@ -3878,10 +3878,17 @@ mozilla::ipc::IPCResult ContentChild::RecvAttachBrowsingContext(
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvDetachBrowsingContext(
|
||||
BrowsingContext* aContext) {
|
||||
MOZ_RELEASE_ASSERT(aContext);
|
||||
uint64_t aContextId, DetachBrowsingContextResolver&& aResolve) {
|
||||
// NOTE: Immediately resolve the promise, as we've received the message. This
|
||||
// will allow the parent process to discard references to this BC.
|
||||
aResolve(true);
|
||||
|
||||
aContext->Detach(/* aFromIPC */ true);
|
||||
// If we can't find a BrowsingContext with the given ID, it's already been
|
||||
// collected and we can ignore the request.
|
||||
RefPtr<BrowsingContext> context = BrowsingContext::Get(aContextId);
|
||||
if (context) {
|
||||
context->Detach(/* aFromIPC */ true);
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
|
|
@ -717,7 +717,8 @@ class ContentChild final : public PContentChild,
|
|||
mozilla::ipc::IPCResult RecvAttachBrowsingContext(
|
||||
BrowsingContext::IPCInitializer&& aInit);
|
||||
|
||||
mozilla::ipc::IPCResult RecvDetachBrowsingContext(BrowsingContext* aContext);
|
||||
mozilla::ipc::IPCResult RecvDetachBrowsingContext(
|
||||
uint64_t aContextId, DetachBrowsingContextResolver&& aResolve);
|
||||
|
||||
mozilla::ipc::IPCResult RecvCacheBrowsingContextChildren(
|
||||
BrowsingContext* aContext);
|
||||
|
|
|
@ -5817,14 +5817,21 @@ mozilla::ipc::IPCResult ContentParent::RecvAttachBrowsingContext(
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvDetachBrowsingContext(
|
||||
BrowsingContext* aContext) {
|
||||
if (!aContext) {
|
||||
uint64_t aContextId, DetachBrowsingContextResolver&& aResolve) {
|
||||
// NOTE: Immediately resolve the promise, as we've received the message. This
|
||||
// will allow the content process to discard references to this BC.
|
||||
aResolve(true);
|
||||
|
||||
// NOTE: It's OK if we don't have this context anymore. It was just already
|
||||
// detached, return.
|
||||
RefPtr<BrowsingContext> context = BrowsingContext::Get(aContextId);
|
||||
if (!context) {
|
||||
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
|
||||
("ParentIPC: Trying to detach already detached"));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
if (!aContext->Canonical()->IsOwnedByProcess(ChildID())) {
|
||||
if (!context->Canonical()->IsOwnedByProcess(ChildID())) {
|
||||
// We're trying to detach a child BrowsingContext in another child
|
||||
// process. This is illegal since the owner of the BrowsingContext
|
||||
// is the proccess with the in-process docshell, which is tracked
|
||||
|
@ -5833,14 +5840,18 @@ mozilla::ipc::IPCResult ContentParent::RecvDetachBrowsingContext(
|
|||
|
||||
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Warning,
|
||||
("ParentIPC: Trying to detach out of process context 0x%08" PRIx64,
|
||||
aContext->Id()));
|
||||
context->Id()));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
aContext->Detach(/* aFromIPC */ true);
|
||||
context->Detach(/* aFromIPC */ true);
|
||||
|
||||
aContext->Group()->EachOtherParent(this, [&](ContentParent* aParent) {
|
||||
Unused << aParent->SendDetachBrowsingContext(aContext);
|
||||
context->Group()->EachOtherParent(this, [&](ContentParent* aParent) {
|
||||
// Hold a reference to `context` until the response comes back to ensure it
|
||||
// doesn't die while messages relating to this context are in-flight.
|
||||
auto resolve = [context](bool) {};
|
||||
auto reject = [context](ResponseRejectReason) {};
|
||||
aParent->SendDetachBrowsingContext(context->Id(), resolve, reject);
|
||||
});
|
||||
|
||||
return IPC_OK();
|
||||
|
|
|
@ -626,7 +626,8 @@ class ContentParent final : public PContentParent,
|
|||
mozilla::ipc::IPCResult RecvAttachBrowsingContext(
|
||||
BrowsingContext::IPCInitializer&& aInit);
|
||||
|
||||
mozilla::ipc::IPCResult RecvDetachBrowsingContext(BrowsingContext* aContext);
|
||||
mozilla::ipc::IPCResult RecvDetachBrowsingContext(
|
||||
uint64_t aContextId, DetachBrowsingContextResolver&& aResolve);
|
||||
|
||||
mozilla::ipc::IPCResult RecvCacheBrowsingContextChildren(
|
||||
BrowsingContext* aContext);
|
||||
|
|
|
@ -1414,18 +1414,22 @@ both:
|
|||
async AttachBrowsingContext(BrowsingContextInitializer aInit);
|
||||
|
||||
/**
|
||||
* Remove the synced BrowsingContext 'aContext' from the parent.
|
||||
* Remove the synced BrowsingContext with id 'aContextId' from the parent.
|
||||
* DetachBrowsingContext is only needed to be called once for any
|
||||
* BrowsingContext, since detaching a node in the BrowsingContext detaches
|
||||
* the entire sub-tree rooted at that node. Calling DetachBrowsingContext
|
||||
* with an already detached BrowsingContext effectively does nothing. Note
|
||||
* that it is not an error to call DetachBrowsingContext on a
|
||||
* BrowsingContext belonging to an already detached subtree. The
|
||||
* 'aMoveToBFCache' paramater controls if detaching a BrowsingContext
|
||||
* should move it to the bfcache allowing it to be re-attached if navigated
|
||||
* to.
|
||||
* BrowsingContext belonging to an already detached subtree.
|
||||
*
|
||||
* As the passed-in context is allowed to already be detached, it is passed
|
||||
* by id, rather than using BrowsingContext's serializer.
|
||||
*
|
||||
* Callers should keep the BrowsingContext alive until this async request is
|
||||
* resolved or rejected, in order to ensure that in-flight messages still
|
||||
* have valid targets.
|
||||
*/
|
||||
async DetachBrowsingContext(BrowsingContext aContext);
|
||||
async DetachBrowsingContext(uint64_t aContextId) returns (bool unused);
|
||||
|
||||
/**
|
||||
* Removes all of 'aContext'\'s children, and caches them in the
|
||||
|
|
|
@ -930,12 +930,11 @@ bool nsMathMLElement::IsLink(nsIURI** aURI) const {
|
|||
}
|
||||
|
||||
if (hasHref) {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
// Get absolute URI
|
||||
nsAutoString hrefStr;
|
||||
href->ToString(hrefStr);
|
||||
nsContentUtils::NewURIWithDocumentCharset(aURI, hrefStr, OwnerDoc(),
|
||||
baseURI);
|
||||
GetBaseURI());
|
||||
// must promise out param is non-null if we return true
|
||||
return !!*aURI;
|
||||
}
|
||||
|
|
|
@ -1675,7 +1675,7 @@ nsresult Notification::ResolveIconAndSoundURL(nsString& iconUrl,
|
|||
AssertIsOnMainThread();
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIURI> baseUri;
|
||||
nsIURI* baseUri = nullptr;
|
||||
|
||||
// XXXnsm If I understand correctly, the character encoding for resolving
|
||||
// URIs in new specs is dictated by the URL spec, which states that unless
|
||||
|
|
|
@ -3048,7 +3048,6 @@ nsresult nsPluginHost::NewPluginURLStream(
|
|||
const char* aHeadersData, uint32_t aHeadersDataLen) {
|
||||
nsCOMPtr<nsIURI> url;
|
||||
nsAutoString absUrl;
|
||||
nsresult rv;
|
||||
|
||||
if (aURL.Length() <= 0) return NS_OK;
|
||||
|
||||
|
@ -3056,13 +3055,12 @@ nsresult nsPluginHost::NewPluginURLStream(
|
|||
// in case aURL is relative
|
||||
RefPtr<nsPluginInstanceOwner> owner = aInstance->GetOwner();
|
||||
if (owner) {
|
||||
nsCOMPtr<nsIURI> baseURI = owner->GetBaseURI();
|
||||
rv = NS_MakeAbsoluteURI(absUrl, aURL, baseURI);
|
||||
NS_MakeAbsoluteURI(absUrl, aURL, owner->GetBaseURI());
|
||||
}
|
||||
|
||||
if (absUrl.IsEmpty()) absUrl.Assign(aURL);
|
||||
|
||||
rv = NS_NewURI(getter_AddRefs(url), absUrl);
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(url), absUrl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
RefPtr<nsPluginStreamListenerPeer> listenerPeer =
|
||||
|
|
|
@ -401,11 +401,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(
|
|||
unitarget.AssignASCII(aTarget); // XXX could this be nonascii?
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
|
||||
// Create an absolute URL
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, baseURI);
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, GetBaseURI());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIInputStream> headersDataStream;
|
||||
|
@ -3225,7 +3223,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::PrivateModeChanged(bool aEnabled) {
|
|||
return mInstance ? mInstance->PrivateModeStateChanged(aEnabled) : NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> nsPluginInstanceOwner::GetBaseURI() const {
|
||||
nsIURI* nsPluginInstanceOwner::GetBaseURI() const {
|
||||
nsCOMPtr<nsIContent> content = do_QueryReferent(mContent);
|
||||
if (!content) {
|
||||
return nullptr;
|
||||
|
|
|
@ -251,7 +251,7 @@ class nsPluginInstanceOwner final : public nsIPluginInstanceOwner,
|
|||
|
||||
bool UseAsyncRendering();
|
||||
|
||||
already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
nsIURI* GetBaseURI() const;
|
||||
|
||||
bool GetCompositionString(uint32_t aIndex, nsTArray<uint8_t>* aString,
|
||||
int32_t* aLength);
|
||||
|
|
|
@ -163,9 +163,8 @@ bool PluginInstanceParent::InitMetadata(const nsACString& aMimeType,
|
|||
if (!owner) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsIURI> baseUri(owner->GetBaseURI());
|
||||
return NS_SUCCEEDED(
|
||||
NS_MakeAbsoluteURI(mSrcAttribute, aSrcAttribute, baseUri));
|
||||
NS_MakeAbsoluteURI(mSrcAttribute, aSrcAttribute, owner->GetBaseURI()));
|
||||
}
|
||||
|
||||
void PluginInstanceParent::ActorDestroy(ActorDestroyReason why) {
|
||||
|
|
|
@ -276,12 +276,12 @@ bool SVGAElement::IsLink(nsIURI** aURI) const {
|
|||
eCaseMatters) != Element::ATTR_VALUE_NO_MATCH &&
|
||||
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::actuate, sActuateVals,
|
||||
eCaseMatters) != Element::ATTR_VALUE_NO_MATCH) {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
// Get absolute URI
|
||||
nsAutoString str;
|
||||
const uint8_t idx = useBareHref ? HREF : XLINK_HREF;
|
||||
mStringAttributes[idx].GetAnimValue(str, this);
|
||||
nsContentUtils::NewURIWithDocumentCharset(aURI, str, OwnerDoc(), baseURI);
|
||||
nsContentUtils::NewURIWithDocumentCharset(aURI, str, OwnerDoc(),
|
||||
GetBaseURI());
|
||||
// must promise out param is non-null if we return true
|
||||
return !!*aURI;
|
||||
}
|
||||
|
|
|
@ -356,9 +356,8 @@ bool SVGAnimationElement::IsEventAttributeNameInternal(nsAtom* aName) {
|
|||
|
||||
void SVGAnimationElement::UpdateHrefTarget(const nsAString& aHrefStr) {
|
||||
nsCOMPtr<nsIURI> targetURI;
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), aHrefStr,
|
||||
OwnerDoc(), baseURI);
|
||||
OwnerDoc(), GetBaseURI());
|
||||
// Bug 1415044 to investigate which referrer we should use
|
||||
mHrefTarget.ResetToURIFragmentID(this, targetURI,
|
||||
OwnerDoc()->GetDocumentURI(),
|
||||
|
|
|
@ -1063,8 +1063,8 @@ namespace {
|
|||
|
||||
class MOZ_STACK_CLASS MappedAttrParser {
|
||||
public:
|
||||
MappedAttrParser(css::Loader* aLoader, nsIURI* aDocURI,
|
||||
already_AddRefed<nsIURI> aBaseURI, SVGElement* aElement);
|
||||
MappedAttrParser(css::Loader* aLoader, nsIURI* aDocURI, nsIURI* aBaseURI,
|
||||
SVGElement* aElement);
|
||||
~MappedAttrParser();
|
||||
|
||||
// Parses a mapped attribute value.
|
||||
|
@ -1096,8 +1096,7 @@ class MOZ_STACK_CLASS MappedAttrParser {
|
|||
};
|
||||
|
||||
MappedAttrParser::MappedAttrParser(css::Loader* aLoader, nsIURI* aDocURI,
|
||||
already_AddRefed<nsIURI> aBaseURI,
|
||||
SVGElement* aElement)
|
||||
nsIURI* aBaseURI, SVGElement* aElement)
|
||||
: mLoader(aLoader),
|
||||
mDocURI(aDocURI),
|
||||
mBaseURI(aBaseURI),
|
||||
|
|
|
@ -59,7 +59,7 @@ SVGFEImageElement::~SVGFEImageElement() { DestroyImageLoadingContent(); }
|
|||
|
||||
nsresult SVGFEImageElement::LoadSVGImage(bool aForce, bool aNotify) {
|
||||
// resolve href attribute
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
nsIURI* baseURI = GetBaseURI();
|
||||
|
||||
nsAutoString href;
|
||||
if (mStringAttributes[HREF].IsExplicitlySet()) {
|
||||
|
|
|
@ -128,7 +128,7 @@ already_AddRefed<Promise> SVGImageElement::Decode(ErrorResult& aRv) {
|
|||
|
||||
nsresult SVGImageElement::LoadSVGImage(bool aForce, bool aNotify) {
|
||||
// resolve href attribute
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
nsIURI* baseURI = GetBaseURI();
|
||||
|
||||
nsAutoString href;
|
||||
if (mStringAttributes[HREF].IsExplicitlySet()) {
|
||||
|
|
|
@ -191,9 +191,8 @@ SVGPathElement* SVGMPathElement::GetReferencedPath() {
|
|||
void SVGMPathElement::UpdateHrefTarget(nsIContent* aParent,
|
||||
const nsAString& aHrefStr) {
|
||||
nsCOMPtr<nsIURI> targetURI;
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), aHrefStr,
|
||||
OwnerDoc(), baseURI);
|
||||
OwnerDoc(), GetBaseURI());
|
||||
|
||||
// Stop observing old target (if any)
|
||||
if (mPathTracker.get()) {
|
||||
|
|
|
@ -129,8 +129,7 @@ void SVGScriptElement::FreezeExecutionAttrs(Document* aOwnerDoc) {
|
|||
|
||||
// Empty src should be treated as invalid URL.
|
||||
if (!src.IsEmpty()) {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
NS_NewURI(getter_AddRefs(mUri), src, nullptr, baseURI);
|
||||
NS_NewURI(getter_AddRefs(mUri), src, nullptr, GetBaseURI());
|
||||
|
||||
if (!mUri) {
|
||||
AutoTArray<nsString, 2> params = {isHref
|
||||
|
|
|
@ -208,7 +208,7 @@ uint32_t WebBrowserPersistLocalDocument::GetPersistFlags() const {
|
|||
return mPersistFlags;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> WebBrowserPersistLocalDocument::GetBaseURI() const {
|
||||
nsIURI* WebBrowserPersistLocalDocument::GetBaseURI() const {
|
||||
return mDocument->GetBaseURI();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class WebBrowserPersistLocalDocument final
|
|||
|
||||
NotNull<const Encoding*> GetCharacterSet() const;
|
||||
uint32_t GetPersistFlags() const;
|
||||
already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
nsIURI* GetBaseURI() const;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_NSIWEBBROWSERPERSISTDOCUMENT
|
||||
|
|
|
@ -94,10 +94,9 @@ class WorkletFetchHandler final : public PromiseNativeHandler,
|
|||
return promise.forget();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = doc->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> resolvedURI;
|
||||
nsresult rv =
|
||||
NS_NewURI(getter_AddRefs(resolvedURI), aModuleURL, nullptr, baseURI);
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(resolvedURI), aModuleURL, nullptr,
|
||||
doc->GetBaseURI());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
promise->MaybeReject(rv);
|
||||
return promise.forget();
|
||||
|
|
|
@ -1372,7 +1372,7 @@ nsresult XMLHttpRequestMainThread::Open(const nsACString& aMethod,
|
|||
}
|
||||
|
||||
// Steps 5-6
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsIURI* baseURI = nullptr;
|
||||
if (mBaseURI) {
|
||||
baseURI = mBaseURI;
|
||||
} else if (responsibleDocument) {
|
||||
|
|
|
@ -592,17 +592,11 @@ nsresult TX_CompileStylesheet(nsINode* aNode,
|
|||
// If we move GetBaseURI to nsINode this can be simplified.
|
||||
nsCOMPtr<Document> doc = aNode->OwnerDoc();
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (aNode->IsContent()) {
|
||||
uri = aNode->AsContent()->GetBaseURI();
|
||||
} else {
|
||||
NS_ASSERTION(aNode->IsDocument(), "not a doc");
|
||||
uri = aNode->AsDocument()->GetBaseURI();
|
||||
}
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
nsIURI* nodeBaseURI = aNode->GetBaseURI();
|
||||
NS_ENSURE_TRUE(nodeBaseURI, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoCString spec;
|
||||
uri->GetSpec(spec);
|
||||
nodeBaseURI->GetSpec(spec);
|
||||
NS_ConvertUTF8toUTF16 baseURI(spec);
|
||||
|
||||
nsIURI* docUri = doc->GetDocumentURI();
|
||||
|
@ -610,6 +604,7 @@ nsresult TX_CompileStylesheet(nsINode* aNode,
|
|||
|
||||
// We need to remove the ref, a URI with a ref would mean that we have an
|
||||
// embedded stylesheet.
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_GetURIWithoutRef(docUri, getter_AddRefs(uri));
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ function* test(testDriver) {
|
|||
// i.e. overscroll-behavior is respected.
|
||||
var waitForScroll = false; // don't wait for a scroll event, it will never come
|
||||
yield moveMouseAndScrollWheelOver(subframe, 50, 50, testDriver, waitForScroll);
|
||||
ok(window.scrollY == 0, "overscroll-behavior was respected");
|
||||
is(window.scrollY, 0, "overscroll-behavior was respected");
|
||||
|
||||
subtestDone();
|
||||
}
|
||||
|
|
|
@ -365,6 +365,11 @@ impl PrimitiveBatch {
|
|||
features: BatchFeatures::empty(),
|
||||
}
|
||||
}
|
||||
|
||||
fn merge(&mut self, other: PrimitiveBatch) {
|
||||
self.instances.extend(other.instances);
|
||||
self.features |= other.features;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
|
@ -407,7 +412,7 @@ impl AlphaBatchContainer {
|
|||
|
||||
match batch_index {
|
||||
Some(batch_index) => {
|
||||
self.opaque_batches[batch_index].instances.extend(other_batch.instances);
|
||||
self.opaque_batches[batch_index].merge(other_batch);
|
||||
}
|
||||
None => {
|
||||
self.opaque_batches.push(other_batch);
|
||||
|
@ -424,8 +429,7 @@ impl AlphaBatchContainer {
|
|||
|
||||
match batch_index {
|
||||
Some(batch_index) => {
|
||||
let batch_index = batch_index + min_batch_index;
|
||||
self.alpha_batches[batch_index].instances.extend(other_batch.instances);
|
||||
self.alpha_batches[batch_index + min_batch_index].merge(other_batch);
|
||||
min_batch_index = batch_index;
|
||||
}
|
||||
None => {
|
||||
|
|
|
@ -40,12 +40,6 @@ class OffThreadToken;
|
|||
using OffThreadCompileCallback = void (*)(OffThreadToken* token,
|
||||
void* callbackData);
|
||||
|
||||
extern JS_PUBLIC_API bool CanCompileOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool CanDecodeOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
/*
|
||||
* Off thread compilation control flow.
|
||||
*
|
||||
|
@ -63,6 +57,9 @@ extern JS_PUBLIC_API bool CanDecodeOffThread(
|
|||
* to FinishOffThreadScript.
|
||||
*/
|
||||
|
||||
extern JS_PUBLIC_API bool CanCompileOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool CompileOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
SourceText<char16_t>& srcBuf, OffThreadCompileCallback callback,
|
||||
|
@ -103,6 +100,9 @@ extern JS_PUBLIC_API JSObject* FinishOffThreadModule(JSContext* cx,
|
|||
extern JS_PUBLIC_API void CancelOffThreadModule(JSContext* cx,
|
||||
OffThreadToken* token);
|
||||
|
||||
extern JS_PUBLIC_API bool CanDecodeOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool DecodeOffThreadScript(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
mozilla::Vector<uint8_t>& buffer /* TranscodeBuffer& */, size_t cursor,
|
||||
|
@ -136,6 +136,13 @@ extern JS_PUBLIC_API void CancelMultiOffThreadScriptsDecoder(
|
|||
extern JS_PUBLIC_API bool CanDecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool DecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, const uint8_t* buf,
|
||||
size_t length, OffThreadCompileCallback callback, void* callbackData);
|
||||
|
||||
extern JS_PUBLIC_API JSScript* FinishOffThreadBinASTDecode(
|
||||
JSContext* cx, OffThreadToken* token);
|
||||
|
||||
#endif // defined(JS_BUILD_BINAST)
|
||||
|
||||
} // namespace JS
|
||||
|
|
|
@ -3626,19 +3626,6 @@ JSScript* JS::DecodeBinAST(JSContext* cx, const ReadOnlyCompileOptions& options,
|
|||
return DecodeBinAST(cx, options, fileContents.begin(), fileContents.length());
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::DecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, const uint8_t* buf,
|
||||
size_t length, OffThreadCompileCallback callback, void* callbackData) {
|
||||
return StartOffThreadDecodeBinAST(cx, options, buf, length, callback,
|
||||
callbackData);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API JSScript* JS::FinishOffThreadBinASTDecode(
|
||||
JSContext* cx, JS::OffThreadToken* token) {
|
||||
MOZ_ASSERT(cx);
|
||||
MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime()));
|
||||
return HelperThreadState().finishBinASTDecodeTask(cx, token);
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_PUBLIC_API JSObject* JS_GetGlobalFromScript(JSScript* script) {
|
||||
|
|
|
@ -1974,16 +1974,6 @@ extern JS_PUBLIC_API JSScript* DecodeBinAST(
|
|||
JSContext* cx, const ReadOnlyCompileOptions& options, const uint8_t* buf,
|
||||
size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool CanDecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool DecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, const uint8_t* buf,
|
||||
size_t length, OffThreadCompileCallback callback, void* callbackData);
|
||||
|
||||
extern JS_PUBLIC_API JSScript* FinishOffThreadBinASTDecode(
|
||||
JSContext* cx, OffThreadToken* token);
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
#endif /* JS_BUILD_BINAST */
|
||||
|
|
|
@ -70,19 +70,6 @@ JS_PUBLIC_API bool JS::CanCompileOffThread(
|
|||
return CanDoOffThread(cx, options, length, OffThread::Compile);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::CanDecodeOffThread(JSContext* cx,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
size_t length) {
|
||||
return CanDoOffThread(cx, options, length, OffThread::Decode);
|
||||
}
|
||||
|
||||
#ifdef JS_BUILD_BINAST
|
||||
JS_PUBLIC_API bool JS::CanDecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length) {
|
||||
return CanDoOffThread(cx, options, length, OffThread::DecodeBinAST);
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_PUBLIC_API bool JS::CompileOffThread(JSContext* cx,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
JS::SourceText<char16_t>& srcBuf,
|
||||
|
@ -147,6 +134,12 @@ JS_PUBLIC_API void JS::CancelOffThreadModule(JSContext* cx,
|
|||
token);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::CanDecodeOffThread(JSContext* cx,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
size_t length) {
|
||||
return CanDoOffThread(cx, options, length, OffThread::Decode);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::DecodeOffThreadScript(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
mozilla::Vector<uint8_t>& buffer /* TranscodeBuffer& */, size_t cursor,
|
||||
|
@ -164,21 +157,6 @@ JS_PUBLIC_API bool JS::DecodeOffThreadScript(
|
|||
return StartOffThreadDecodeScript(cx, options, range, callback, callbackData);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::DecodeMultiOffThreadScripts(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
TranscodeSources& sources, OffThreadCompileCallback callback,
|
||||
void* callbackData) {
|
||||
#ifdef DEBUG
|
||||
size_t length = 0;
|
||||
for (auto& source : sources) {
|
||||
length += source.range.length();
|
||||
}
|
||||
MOZ_ASSERT(CanCompileOffThread(cx, options, length));
|
||||
#endif
|
||||
return StartOffThreadDecodeMultiScripts(cx, options, sources, callback,
|
||||
callbackData);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API JSScript* JS::FinishOffThreadScriptDecoder(
|
||||
JSContext* cx, JS::OffThreadToken* token) {
|
||||
MOZ_ASSERT(cx);
|
||||
|
@ -194,6 +172,21 @@ JS_PUBLIC_API void JS::CancelOffThreadScriptDecoder(JSContext* cx,
|
|||
ParseTaskKind::ScriptDecode, token);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::DecodeMultiOffThreadScripts(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
TranscodeSources& sources, OffThreadCompileCallback callback,
|
||||
void* callbackData) {
|
||||
#ifdef DEBUG
|
||||
size_t length = 0;
|
||||
for (auto& source : sources) {
|
||||
length += source.range.length();
|
||||
}
|
||||
MOZ_ASSERT(CanCompileOffThread(cx, options, length));
|
||||
#endif
|
||||
return StartOffThreadDecodeMultiScripts(cx, options, sources, callback,
|
||||
callbackData);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::FinishMultiOffThreadScriptsDecoder(
|
||||
JSContext* cx, JS::OffThreadToken* token,
|
||||
MutableHandle<ScriptVector> scripts) {
|
||||
|
@ -209,3 +202,26 @@ JS_PUBLIC_API void JS::CancelMultiOffThreadScriptsDecoder(
|
|||
HelperThreadState().cancelParseTask(cx->runtime(),
|
||||
ParseTaskKind::MultiScriptsDecode, token);
|
||||
}
|
||||
|
||||
#ifdef JS_BUILD_BINAST
|
||||
|
||||
JS_PUBLIC_API bool JS::CanDecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length) {
|
||||
return CanDoOffThread(cx, options, length, OffThread::DecodeBinAST);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::DecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, const uint8_t* buf,
|
||||
size_t length, OffThreadCompileCallback callback, void* callbackData) {
|
||||
return StartOffThreadDecodeBinAST(cx, options, buf, length, callback,
|
||||
callbackData);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API JSScript* JS::FinishOffThreadBinASTDecode(
|
||||
JSContext* cx, JS::OffThreadToken* token) {
|
||||
MOZ_ASSERT(cx);
|
||||
MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime()));
|
||||
return HelperThreadState().finishBinASTDecodeTask(cx, token);
|
||||
}
|
||||
|
||||
#endif // JS_BUILD_BINAST
|
||||
|
|
|
@ -2747,11 +2747,24 @@ bool RestyleManager::ProcessPostTraversal(Element* aElement,
|
|||
// XXXbholley: We should teach the frame constructor how to clear the dirty
|
||||
// descendants bit to avoid the traversal here.
|
||||
if (changeHint & nsChangeHint_ReconstructFrame) {
|
||||
if (wasRestyled && styleFrame &&
|
||||
styleFrame->StyleDisplay()->IsAbsolutelyPositionedStyle() !=
|
||||
upToDateStyleIfRestyled->StyleDisplay()
|
||||
->IsAbsolutelyPositionedStyle()) {
|
||||
aRestyleState.AddPendingScrollAnchorSuppression(styleFrame);
|
||||
if (wasRestyled && styleFrame) {
|
||||
auto* oldDisp = styleFrame->StyleDisplay();
|
||||
auto* newDisp = upToDateStyleIfRestyled->StyleDisplay();
|
||||
// https://drafts.csswg.org/css-scroll-anchoring/#suppression-triggers
|
||||
//
|
||||
// We need to do the position check here rather than in
|
||||
// DidSetComputedStyle because changing position reframes.
|
||||
//
|
||||
// Don't suppress adjustments when going back to display: none, regardless
|
||||
// of whether we're abspos changes.
|
||||
//
|
||||
// TODO(emilio): I _think_ chrome won't suppress adjustments whenever
|
||||
// `display` changes. But ICBW.
|
||||
if (newDisp->mDisplay != StyleDisplay::None &&
|
||||
oldDisp->IsAbsolutelyPositionedStyle() !=
|
||||
newDisp->IsAbsolutelyPositionedStyle()) {
|
||||
aRestyleState.AddPendingScrollAnchorSuppression(styleFrame);
|
||||
}
|
||||
}
|
||||
ClearRestyleStateFromSubtree(aElement);
|
||||
return true;
|
||||
|
|
|
@ -2415,7 +2415,7 @@ void nsImageFrame::GetDocumentCharacterSet(nsACString& aCharset) const {
|
|||
}
|
||||
|
||||
void nsImageFrame::SpecToURI(const nsAString& aSpec, nsIURI** aURI) {
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsIURI* baseURI = nullptr;
|
||||
if (mContent) {
|
||||
baseURI = mContent->GetBaseURI();
|
||||
}
|
||||
|
|
|
@ -1007,7 +1007,7 @@ nsresult Loader::CreateSheet(nsIURI* aURI, nsIContent* aLinkingContent,
|
|||
if (!*aSheet) {
|
||||
aSheetState = eSheetNeedsParser;
|
||||
nsIURI* sheetURI;
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsIURI* baseURI;
|
||||
nsIURI* originalURI;
|
||||
if (!aURI) {
|
||||
// Inline style. Use the document's base URL so that @import in
|
||||
|
|
|
@ -119,8 +119,7 @@ already_AddRefed<nsIURI> StyleComputedUrl::ResolveLocalRef(nsIURI* aURI) const {
|
|||
|
||||
already_AddRefed<nsIURI> StyleComputedUrl::ResolveLocalRef(
|
||||
const nsIContent* aContent) const {
|
||||
nsCOMPtr<nsIURI> url = aContent->GetBaseURI();
|
||||
return ResolveLocalRef(url);
|
||||
return ResolveLocalRef(aContent->GetBaseURI());
|
||||
}
|
||||
|
||||
imgRequestProxy* StyleComputedUrl::LoadImage(Document& aDocument) {
|
||||
|
|
|
@ -1372,9 +1372,9 @@ SVGGeometryElement* SVGObserverUtils::GetAndObserveTextPathsPath(
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIURI> targetURI;
|
||||
nsCOMPtr<nsIURI> base = content->GetBaseURI();
|
||||
nsContentUtils::NewURIWithDocumentCharset(
|
||||
getter_AddRefs(targetURI), href, content->GetUncomposedDoc(), base);
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
|
||||
content->GetUncomposedDoc(),
|
||||
content->GetBaseURI());
|
||||
|
||||
// There's no clear refererer policy spec about non-CSS SVG resource
|
||||
// references Bug 1415044 to investigate which referrer we should use
|
||||
|
@ -1422,9 +1422,9 @@ nsIFrame* SVGObserverUtils::GetAndObserveTemplate(
|
|||
// Convert href to an nsIURI
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
nsCOMPtr<nsIURI> targetURI;
|
||||
nsCOMPtr<nsIURI> base = content->GetBaseURI();
|
||||
nsContentUtils::NewURIWithDocumentCharset(
|
||||
getter_AddRefs(targetURI), href, content->GetUncomposedDoc(), base);
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
|
||||
content->GetUncomposedDoc(),
|
||||
content->GetBaseURI());
|
||||
|
||||
// There's no clear refererer policy spec about non-CSS SVG resource
|
||||
// references. Bug 1415044 to investigate which referrer we should use.
|
||||
|
@ -1457,10 +1457,10 @@ Element* SVGObserverUtils::GetAndObserveBackgroundImage(nsIFrame* aFrame,
|
|||
nsAutoString elementId =
|
||||
NS_LITERAL_STRING("#") + nsDependentAtomString(aHref);
|
||||
nsCOMPtr<nsIURI> targetURI;
|
||||
nsCOMPtr<nsIURI> base = aFrame->GetContent()->GetBaseURI();
|
||||
nsContentUtils::NewURIWithDocumentCharset(
|
||||
getter_AddRefs(targetURI), elementId,
|
||||
aFrame->GetContent()->GetUncomposedDoc(), base);
|
||||
aFrame->GetContent()->GetUncomposedDoc(),
|
||||
aFrame->GetContent()->GetBaseURI());
|
||||
RefPtr<URLAndReferrerInfo> url = new URLAndReferrerInfo(
|
||||
targetURI, aFrame->GetContent()->OwnerDoc()->GetDocumentURI(),
|
||||
aFrame->GetContent()->OwnerDoc()->GetReferrerPolicy());
|
||||
|
|
|
@ -238,10 +238,9 @@ void nsImageBoxFrame::UpdateImage() {
|
|||
mContent, getter_AddRefs(triggeringPrincipal), contentPolicyType,
|
||||
&requestContextID);
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), src, doc,
|
||||
baseURI);
|
||||
mContent->GetBaseURI());
|
||||
if (uri) {
|
||||
nsresult rv = nsContentUtils::LoadImage(
|
||||
uri, mContent, doc, triggeringPrincipal, requestContextID,
|
||||
|
|
|
@ -1913,11 +1913,9 @@ nsresult nsTreeBodyFrame::GetImage(int32_t aRowIndex, nsTreeColumn* aCol,
|
|||
styleRequest->SyncClone(imgNotificationObserver, doc,
|
||||
getter_AddRefs(imageRequest));
|
||||
} else {
|
||||
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
|
||||
|
||||
nsCOMPtr<nsIURI> srcURI;
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(srcURI),
|
||||
imageSrc, doc, baseURI);
|
||||
nsContentUtils::NewURIWithDocumentCharset(
|
||||
getter_AddRefs(srcURI), imageSrc, doc, mContent->GetBaseURI());
|
||||
if (!srcURI) return NS_ERROR_FAILURE;
|
||||
|
||||
// XXXbz what's the origin principal for this stuff that comes from our
|
||||
|
|
|
@ -3900,7 +3900,7 @@ TEST_P(NewSdpTest, CheckAddMediaSection) {
|
|||
|
||||
mSdp->AddMediaSection(SdpMediaSection::kAudio,
|
||||
SdpDirectionAttribute::Direction::kSendonly, 14006,
|
||||
SdpMediaSection::kTcpTlsRtpSavpf, sdp::kIPv6,
|
||||
SdpMediaSection::kTcpDtlsRtpSavpf, sdp::kIPv6,
|
||||
"2607:f8b0:4004:801::2013");
|
||||
|
||||
ASSERT_EQ(5U, mSdp->GetMediaSectionCount())
|
||||
|
@ -3912,7 +3912,7 @@ TEST_P(NewSdpTest, CheckAddMediaSection) {
|
|||
ASSERT_EQ(SdpDirectionAttribute::Direction::kSendonly,
|
||||
nextNewMediaSection.GetDirectionAttribute().mValue);
|
||||
ASSERT_EQ(14006U, nextNewMediaSection.GetPort());
|
||||
ASSERT_EQ(SdpMediaSection::kTcpTlsRtpSavpf,
|
||||
ASSERT_EQ(SdpMediaSection::kTcpDtlsRtpSavpf,
|
||||
nextNewMediaSection.GetProtocol());
|
||||
ASSERT_EQ(sdp::kIPv6, nextNewMediaSection.GetConnection().GetAddrType());
|
||||
ASSERT_EQ("2607:f8b0:4004:801::2013",
|
||||
|
@ -3939,7 +3939,7 @@ TEST_P(NewSdpTest, CheckAddMediaSection) {
|
|||
// "NOT:AN.IP.ADDRESS" is expected to cause a failure
|
||||
mSdp->AddMediaSection(SdpMediaSection::kAudio,
|
||||
SdpDirectionAttribute::Direction::kSendonly, 14006,
|
||||
SdpMediaSection::kTcpTlsRtpSavpf, sdp::kIPv6,
|
||||
SdpMediaSection::kTcpDtlsRtpSavpf, sdp::kIPv6,
|
||||
"NOT:AN.IP.ADDRESS");
|
||||
ASSERT_EQ(5U, mSdp->GetMediaSectionCount())
|
||||
<< "Wrong number of media sections after adding media section";
|
||||
|
|
|
@ -55,7 +55,6 @@ enum class RustSdpProtocolValue {
|
|||
kRustUdpTlsRtpSavp,
|
||||
kRustTcpDtlsRtpSavp,
|
||||
kRustUdpTlsRtpSavpf,
|
||||
kRustTcpTlsRtpSavpf,
|
||||
kRustTcpDtlsRtpSavpf,
|
||||
kRustDtlsSctp,
|
||||
kRustUdpDtlsSctp,
|
||||
|
|
|
@ -67,8 +67,6 @@ SdpMediaSection::Protocol RsdparsaSdpMediaSection::GetProtocol() const {
|
|||
return kTcpDtlsRtpSavp;
|
||||
case RustSdpProtocolValue::kRustUdpTlsRtpSavpf:
|
||||
return kUdpTlsRtpSavpf;
|
||||
case RustSdpProtocolValue::kRustTcpTlsRtpSavpf:
|
||||
return kTcpTlsRtpSavpf;
|
||||
case RustSdpProtocolValue::kRustTcpDtlsRtpSavpf:
|
||||
return kTcpDtlsRtpSavpf;
|
||||
case RustSdpProtocolValue::kRustDtlsSctp:
|
||||
|
|
|
@ -544,7 +544,6 @@ bool SdpHelper::HasRtcp(SdpMediaSection::Protocol proto) const {
|
|||
case SdpMediaSection::kDccpRtpSavpf:
|
||||
case SdpMediaSection::kRtpSavpf:
|
||||
case SdpMediaSection::kUdpTlsRtpSavpf:
|
||||
case SdpMediaSection::kTcpTlsRtpSavpf:
|
||||
case SdpMediaSection::kTcpDtlsRtpSavpf:
|
||||
case SdpMediaSection::kDccpTlsRtpSavpf:
|
||||
return true;
|
||||
|
@ -566,7 +565,6 @@ bool SdpHelper::HasRtcp(SdpMediaSection::Protocol proto) const {
|
|||
case SdpMediaSection::kDccpRtpAvp:
|
||||
case SdpMediaSection::kDccpRtpSavp:
|
||||
case SdpMediaSection::kUdpTlsRtpSavp:
|
||||
case SdpMediaSection::kTcpTlsRtpSavp:
|
||||
case SdpMediaSection::kTcpDtlsRtpSavp:
|
||||
case SdpMediaSection::kDccpTlsRtpSavp:
|
||||
case SdpMediaSection::kUdpMbmsFecRtpAvp:
|
||||
|
|
|
@ -49,11 +49,9 @@ class SdpMediaSection {
|
|||
kDccpRtpSavpf, // DCCP/RTP/SAVPF [RFC5762]
|
||||
kRtpSavpf, // RTP/SAVPF [RFC5124]
|
||||
kUdpTlsRtpSavp, // UDP/TLS/RTP/SAVP [RFC5764]
|
||||
kTcpTlsRtpSavp, // TCP/TLS/RTP/SAVP DON'T USE - NO RFC
|
||||
kTcpDtlsRtpSavp, // TCP/DTLS/RTP/SAVP [RFC7850]
|
||||
kDccpTlsRtpSavp, // DCCP/TLS/RTP/SAVP [RFC5764]
|
||||
kUdpTlsRtpSavpf, // UDP/TLS/RTP/SAVPF [RFC5764]
|
||||
kTcpTlsRtpSavpf, // TCP/TLS/RTP/SAVPF DON'T USE - NO RFC
|
||||
kTcpDtlsRtpSavpf, // TCP/DTLS/RTP/SAVPF [RFC7850]
|
||||
kDccpTlsRtpSavpf, // DCCP/TLS/RTP/SAVPF [RFC5764]
|
||||
kUdpMbmsFecRtpAvp, // UDP/MBMS-FEC/RTP/AVP [RFC6064]
|
||||
|
@ -227,16 +225,12 @@ inline std::ostream& operator<<(std::ostream& os, SdpMediaSection::Protocol p) {
|
|||
return os << "RTP/SAVPF";
|
||||
case SdpMediaSection::kUdpTlsRtpSavp:
|
||||
return os << "UDP/TLS/RTP/SAVP";
|
||||
case SdpMediaSection::kTcpTlsRtpSavp:
|
||||
return os << "TCP/TLS/RTP/SAVP";
|
||||
case SdpMediaSection::kTcpDtlsRtpSavp:
|
||||
return os << "TCP/DTLS/RTP/SAVP";
|
||||
case SdpMediaSection::kDccpTlsRtpSavp:
|
||||
return os << "DCCP/TLS/RTP/SAVP";
|
||||
case SdpMediaSection::kUdpTlsRtpSavpf:
|
||||
return os << "UDP/TLS/RTP/SAVPF";
|
||||
case SdpMediaSection::kTcpTlsRtpSavpf:
|
||||
return os << "TCP/TLS/RTP/SAVPF";
|
||||
case SdpMediaSection::kTcpDtlsRtpSavpf:
|
||||
return os << "TCP/DTLS/RTP/SAVPF";
|
||||
case SdpMediaSection::kDccpTlsRtpSavpf:
|
||||
|
|
|
@ -135,15 +135,9 @@ bool SipccSdpMediaSection::LoadProtocol(sdp_t* sdp, uint16_t level,
|
|||
case SDP_TRANSPORT_UDPTLSRTPSAVPF:
|
||||
mProtocol = kUdpTlsRtpSavpf;
|
||||
break;
|
||||
case SDP_TRANSPORT_TCPTLSRTPSAVP:
|
||||
mProtocol = kTcpTlsRtpSavp;
|
||||
break;
|
||||
case SDP_TRANSPORT_TCPDTLSRTPSAVP:
|
||||
mProtocol = kTcpDtlsRtpSavp;
|
||||
break;
|
||||
case SDP_TRANSPORT_TCPTLSRTPSAVPF:
|
||||
mProtocol = kTcpTlsRtpSavpf;
|
||||
break;
|
||||
case SDP_TRANSPORT_TCPDTLSRTPSAVPF:
|
||||
mProtocol = kTcpDtlsRtpSavpf;
|
||||
break;
|
||||
|
|
|
@ -42,8 +42,8 @@ UniquePtr<Sdp> SipccSdpParser::Parse(const std::string& sdpText) {
|
|||
sdp_transport_supported(sipcc_config, SDP_TRANSPORT_RTPSAVPF, true);
|
||||
sdp_transport_supported(sipcc_config, SDP_TRANSPORT_UDPTLSRTPSAVP, true);
|
||||
sdp_transport_supported(sipcc_config, SDP_TRANSPORT_UDPTLSRTPSAVPF, true);
|
||||
sdp_transport_supported(sipcc_config, SDP_TRANSPORT_TCPTLSRTPSAVP, true);
|
||||
sdp_transport_supported(sipcc_config, SDP_TRANSPORT_TCPTLSRTPSAVPF, true);
|
||||
sdp_transport_supported(sipcc_config, SDP_TRANSPORT_TCPDTLSRTPSAVP, true);
|
||||
sdp_transport_supported(sipcc_config, SDP_TRANSPORT_TCPDTLSRTPSAVPF, true);
|
||||
sdp_transport_supported(sipcc_config, SDP_TRANSPORT_DTLSSCTP, true);
|
||||
sdp_transport_supported(sipcc_config, SDP_TRANSPORT_UDPDTLSSCTP, true);
|
||||
sdp_transport_supported(sipcc_config, SDP_TRANSPORT_TCPDTLSSCTP, true);
|
||||
|
|
|
@ -61,7 +61,6 @@ pub enum SdpProtocolValue {
|
|||
DtlsSctp,
|
||||
UdpDtlsSctp,
|
||||
TcpDtlsSctp,
|
||||
TcpTlsRtpSavpf, /* not standardized - to be removed */
|
||||
}
|
||||
|
||||
impl ToString for SdpProtocolValue {
|
||||
|
@ -78,7 +77,6 @@ impl ToString for SdpProtocolValue {
|
|||
SdpProtocolValue::DtlsSctp => "DTLS/SCTP",
|
||||
SdpProtocolValue::UdpDtlsSctp => "UDP/DTLS/SCTP",
|
||||
SdpProtocolValue::TcpDtlsSctp => "TCP/DTLS/SCTP",
|
||||
SdpProtocolValue::TcpTlsRtpSavpf => "TCP/TLS/RTP/SAVPF",
|
||||
}
|
||||
.to_string()
|
||||
}
|
||||
|
@ -322,8 +320,6 @@ fn parse_protocol_token(value: &str) -> Result<SdpProtocolValue, SdpParserIntern
|
|||
"DTLS/SCTP" => SdpProtocolValue::DtlsSctp,
|
||||
"UDP/DTLS/SCTP" => SdpProtocolValue::UdpDtlsSctp,
|
||||
"TCP/DTLS/SCTP" => SdpProtocolValue::TcpDtlsSctp,
|
||||
/* to be removed */
|
||||
"TCP/TLS/RTP/SAVPF" => SdpProtocolValue::TcpTlsRtpSavpf,
|
||||
_ => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"unsupported protocol value: {}",
|
||||
|
|
|
@ -160,13 +160,12 @@ pub unsafe extern "C" fn sdp_add_media_section(session: *mut SdpSession,
|
|||
let protocol = match protocol {
|
||||
20 => SdpProtocolValue::RtpSavpf, // Protocol::kRtpSavpf
|
||||
21 => SdpProtocolValue::UdpTlsRtpSavp, // Protocol::kUdpTlsRtpSavp
|
||||
23 => SdpProtocolValue::TcpDtlsRtpSavp, // Protocol::kTcpDtlsRtpSavp
|
||||
25 => SdpProtocolValue::UdpTlsRtpSavpf, // Protocol::kUdpTlsRtpSavpf
|
||||
26 => SdpProtocolValue::TcpTlsRtpSavpf, // Protocol::kTcpTlsRtpSavpf
|
||||
27 => SdpProtocolValue::TcpDtlsRtpSavpf, // Protocol::kTcpTlsRtpSavpf
|
||||
39 => SdpProtocolValue::DtlsSctp, // Protocol::kDtlsSctp
|
||||
40 => SdpProtocolValue::UdpDtlsSctp, // Protocol::kUdpDtlsSctp
|
||||
41 => SdpProtocolValue::TcpDtlsSctp, // Protocol::kTcpDtlsSctp
|
||||
22 => SdpProtocolValue::TcpDtlsRtpSavp, // Protocol::kTcpDtlsRtpSavp
|
||||
24 => SdpProtocolValue::UdpTlsRtpSavpf, // Protocol::kUdpTlsRtpSavpf
|
||||
25 => SdpProtocolValue::TcpDtlsRtpSavpf, // Protocol::kTcpTlsRtpSavpf
|
||||
37 => SdpProtocolValue::DtlsSctp, // Protocol::kDtlsSctp
|
||||
38 => SdpProtocolValue::UdpDtlsSctp, // Protocol::kUdpDtlsSctp
|
||||
39 => SdpProtocolValue::TcpDtlsSctp, // Protocol::kTcpDtlsSctp
|
||||
_ => {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ pub enum RustSdpProtocolValue {
|
|||
UdpTlsRtpSavp,
|
||||
TcpDtlsRtpSavp,
|
||||
UdpTlsRtpSavpf,
|
||||
TcpTlsRtpSavpf,
|
||||
TcpDtlsRtpSavpf,
|
||||
DtlsSctp,
|
||||
UdpDtlsSctp,
|
||||
|
@ -68,7 +67,6 @@ impl<'a> From<&'a SdpProtocolValue> for RustSdpProtocolValue {
|
|||
SdpProtocolValue::UdpTlsRtpSavp => RustSdpProtocolValue::UdpTlsRtpSavp,
|
||||
SdpProtocolValue::TcpDtlsRtpSavp => RustSdpProtocolValue::TcpDtlsRtpSavp,
|
||||
SdpProtocolValue::UdpTlsRtpSavpf => RustSdpProtocolValue::UdpTlsRtpSavpf,
|
||||
SdpProtocolValue::TcpTlsRtpSavpf => RustSdpProtocolValue::TcpTlsRtpSavpf,
|
||||
SdpProtocolValue::TcpDtlsRtpSavpf => RustSdpProtocolValue::TcpDtlsRtpSavpf,
|
||||
SdpProtocolValue::DtlsSctp => RustSdpProtocolValue::DtlsSctp,
|
||||
SdpProtocolValue::UdpDtlsSctp => RustSdpProtocolValue::UdpDtlsSctp,
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче