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