Merge m-c to b2g-inbound. a=merge

This commit is contained in:
Ryan VanderMeulen 2015-08-07 16:17:19 -04:00
commit e829019413
119 changed files with 1525 additions and 753 deletions

View File

@ -6678,12 +6678,10 @@ var gIdentityHandler = {
IDENTITY_MODE_MIXED_ACTIVE_BLOCKED : "verifiedDomain mixedContent mixedActiveBlocked", // SSL with unauthenticated active content blocked; no unauthenticated display content
IDENTITY_MODE_MIXED_ACTIVE_BLOCKED_IDENTIFIED : "verifiedIdentity mixedContent mixedActiveBlocked", // SSL with unauthenticated active content blocked; no unauthenticated display content
IDENTITY_MODE_CHROMEUI : "chromeUI", // Part of the product's UI
IDENTITY_MODE_FILE_URI : "fileURI", // File path
// Cache the most recent SSLStatus and Location seen in checkIdentity
_lastStatus : null,
_lastUri : null,
_mode : "unknownIdentity",
_isChromeUI: false,
_sslStatus: null,
_uri: null,
// smart getters
get _identityPopup () {
@ -6714,20 +6712,10 @@ var gIdentityHandler = {
return this._identityPopupContentVerif =
document.getElementById("identity-popup-content-verifier");
},
get _identityPopupSecurityContent () {
delete this._identityPopupSecurityContent;
return this._identityPopupSecurityContent =
document.getElementById("identity-popup-security-content");
},
get _identityPopupSecurityView () {
delete this._identityPopupSecurityView;
return this._identityPopupSecurityView =
document.getElementById("identity-popup-securityView");
},
get _identityPopupMainView () {
delete this._identityPopupMainView;
return this._identityPopupMainView =
document.getElementById("identity-popup-mainView");
get _identityPopupMixedContentLearnMore () {
delete this._identityPopupMixedContentLearnMore;
return this._identityPopupMixedContentLearnMore =
document.getElementById("identity-popup-mcb-learn-more");
},
get _identityIconLabel () {
delete this._identityIconLabel;
@ -6806,13 +6794,33 @@ var gIdentityHandler = {
}
},
disableMixedContentProtection() {
// Use telemetry to measure how often unblocking happens
const kMIXED_CONTENT_UNBLOCK_EVENT = 2;
let histogram =
Services.telemetry.getHistogramById(
"MIXED_CONTENT_UNBLOCK_COUNTER");
histogram.add(kMIXED_CONTENT_UNBLOCK_EVENT);
// Reload the page with the content unblocked
BrowserReloadWithFlags(
Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_MIXED_CONTENT);
this._identityPopup.hidePopup();
},
enableMixedContentProtection() {
gBrowser.selectedBrowser.messageManager.sendAsyncMessage(
"MixedContent:ReenableProtection", {});
BrowserReload();
this._identityPopup.hidePopup();
},
/**
* Helper to parse out the important parts of _lastStatus (of the SSL cert in
* Helper to parse out the important parts of _sslStatus (of the SSL cert in
* particular) for use in constructing identity UI strings
*/
getIdentityData : function() {
var result = {};
var status = this._lastStatus.QueryInterface(Components.interfaces.nsISSLStatus);
var status = this._sslStatus.QueryInterface(Ci.nsISSLStatus);
var cert = status.serverCert;
// Human readable name of Subject
@ -6848,16 +6856,11 @@ var gIdentityHandler = {
* @param nsIURI uri The address for which the UI should be updated.
*/
checkIdentity : function(state, uri) {
var currentStatus = gBrowser.securityUI
.QueryInterface(Components.interfaces.nsISSLStatusProvider)
.SSLStatus;
this._lastStatus = currentStatus;
this._lastUri = uri;
let nsIWebProgressListener = Ci.nsIWebProgressListener;
// For some URIs like data: we can't get a host and so can't do
// anything useful here.
// For some URIs like data: we can't get a host. URIs without a host will
// usually be treated as a non-secure connection if they're not on the
// whitelist below and don't resolve to file:// URIs internally.
let unknown = false;
try {
uri.host;
@ -6867,49 +6870,54 @@ var gIdentityHandler = {
// whitelisted to provide a positive security signal to the user.
let whitelist = /^about:(accounts|addons|app-manager|config|crashes|customizing|downloads|healthreport|home|license|newaddon|permissions|preferences|privatebrowsing|rights|sessionrestore|support|welcomeback)/i;
let isChromeUI = uri.schemeIs("about") && whitelist.test(uri.spec);
let mode = this.IDENTITY_MODE_UNKNOWN;
if (isChromeUI) {
this.setMode(this.IDENTITY_MODE_CHROMEUI);
mode = this.IDENTITY_MODE_CHROMEUI;
} else if (unknown) {
this.setMode(this.IDENTITY_MODE_UNKNOWN);
// Use default mode.
} else if (state & nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL) {
if (state & nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT) {
this.setMode(this.IDENTITY_MODE_MIXED_ACTIVE_BLOCKED_IDENTIFIED);
mode = this.IDENTITY_MODE_MIXED_ACTIVE_BLOCKED_IDENTIFIED;
} else {
this.setMode(this.IDENTITY_MODE_IDENTIFIED);
mode = this.IDENTITY_MODE_IDENTIFIED;
}
} else if (state & nsIWebProgressListener.STATE_IS_SECURE) {
if (state & nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT) {
this.setMode(this.IDENTITY_MODE_MIXED_ACTIVE_BLOCKED);
mode = this.IDENTITY_MODE_MIXED_ACTIVE_BLOCKED;
} else {
this.setMode(this.IDENTITY_MODE_DOMAIN_VERIFIED);
mode = this.IDENTITY_MODE_DOMAIN_VERIFIED;
}
} else if (state & nsIWebProgressListener.STATE_IS_BROKEN) {
if (state & nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT) {
this.setMode(this.IDENTITY_MODE_MIXED_ACTIVE_LOADED);
mode = this.IDENTITY_MODE_MIXED_ACTIVE_LOADED;
} else if (state & nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT) {
this.setMode(this.IDENTITY_MODE_MIXED_DISPLAY_LOADED_ACTIVE_BLOCKED);
mode = this.IDENTITY_MODE_MIXED_DISPLAY_LOADED_ACTIVE_BLOCKED;
} else if (state & nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT) {
this.setMode(this.IDENTITY_MODE_MIXED_DISPLAY_LOADED);
mode = this.IDENTITY_MODE_MIXED_DISPLAY_LOADED;
} else {
this.setMode(this.IDENTITY_MODE_USES_WEAK_CIPHER);
}
} else {
// Create a channel for the sole purpose of getting the resolved URI
// of the request to determine if it's loaded from the file system.
let resolvedURI = NetUtil.newChannel({uri,loadUsingSystemPrincipal:true}).URI;
if (resolvedURI.schemeIs("jar")) {
// Given a URI "jar:<jar-file-uri>!/<jar-entry>"
// create a new URI using <jar-file-uri>!/<jar-entry>
resolvedURI = NetUtil.newURI(resolvedURI.path);
}
if (resolvedURI.schemeIs("file")) {
this.setMode(this.IDENTITY_MODE_FILE_URI);
} else {
this.setMode(this.IDENTITY_MODE_UNKNOWN);
mode = this.IDENTITY_MODE_USES_WEAK_CIPHER;
}
}
// We need those values later when populating the control center.
this._uri = uri;
this._state = state;
this._isChromeUI = isChromeUI;
this._sslStatus =
gBrowser.securityUI.QueryInterface(Ci.nsISSLStatusProvider).SSLStatus;
// Update the identity block.
if (this._identityBox) {
this._identityBox.className = mode;
this.refreshIdentityBlock(mode);
}
// NOTE: We do NOT update the identity popup (the control center) when
// we receive a new security state. If the user opened the popup and looks
// at the provided information we don't want to suddenly change the panel
// contents.
// Show the doorhanger when:
// - mixed active content is blocked
// - mixed active content is loaded (detected but not blocked)
@ -6961,46 +6969,22 @@ var gIdentityHandler = {
.getService(Ci.nsIIDNService);
try {
let baseDomain =
Services.eTLD.getBaseDomainFromHost(this._lastUri.host);
Services.eTLD.getBaseDomainFromHost(this._uri.host);
return this._IDNService.convertToDisplayIDN(baseDomain, {});
} catch (e) {
// If something goes wrong (e.g. host is an IP address) just fail back
// to the full domain.
return this._lastUri.host;
return this._uri.host;
}
},
/**
* Update the UI to reflect the specified mode, which should be one of the
* IDENTITY_MODE_* constants.
*/
setMode : function(newMode) {
if (!this._identityBox) {
// No identity box means the identity box is not visible, in which
// case there's nothing to do.
return;
}
this._identityPopup.className = newMode;
this._identityBox.className = newMode;
this.setIdentityMessages(newMode);
// Update the popup too, if it's open
if (this._identityPopup.state == "open") {
this.setPopupMessages(newMode);
this.updateSitePermissions();
}
this._mode = newMode;
},
/**
* Set up the messages for the primary identity UI based on the specified mode,
* and the details of the SSL cert, where applicable
*
* @param newMode The newly set identity mode. Should be one of the IDENTITY_MODE_* constants.
*/
setIdentityMessages : function(newMode) {
refreshIdentityBlock(newMode) {
let icon_label = "";
let tooltip = "";
let icon_country_label = "";
@ -7017,11 +7001,11 @@ var gIdentityHandler = {
[iData.caOrg]);
// This can't throw, because URI's with a host that throw don't end up in this case.
let host = this._lastUri.host;
let host = this._uri.host;
let port = 443;
try {
if (this._lastUri.port > 0)
port = this._lastUri.port;
if (this._uri.port > 0)
port = this._uri.port;
} catch (e) {}
if (this._overrideService.hasMatchingOverride(host, port, iData.cert, {}, {}))
@ -7070,15 +7054,78 @@ var gIdentityHandler = {
* Set up the title and content messages for the identity message popup,
* based on the specified mode, and the details of the SSL cert, where
* applicable
*
* @param newMode The newly set identity mode. Should be one of the IDENTITY_MODE_* constants.
*/
setPopupMessages : function(newMode) {
refreshIdentityPopup() {
// Update the "Learn More" hrefs for Mixed Content Blocking.
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
let learnMoreHref = `${baseURL}mixed-content`;
this._identityPopupMixedContentLearnMore.setAttribute("href", learnMoreHref);
this._identityPopup.className = newMode;
this._identityPopupMainView.className = newMode;
this._identityPopupSecurityView.className = newMode;
this._identityPopupSecurityContent.className = newMode;
// Basic connection properties.
let isBroken = this._state & Ci.nsIWebProgressListener.STATE_IS_BROKEN;
let isSecure = this._state & Ci.nsIWebProgressListener.STATE_IS_SECURE;
let isEV = this._state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL;
// Determine connection security information.
let connection = "not-secure";
if (this._isChromeUI) {
connection = "chrome";
} else if (this._isURILoadedFromFile(this._uri)) {
connection = "file";
} else if (isEV) {
connection = "secure-ev";
} else if (isSecure) {
connection = "secure";
}
// Mixed content flags.
let isMixedActiveContentLoaded =
this._state & Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT;
let isMixedActiveContentBlocked =
this._state & Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT;
let isMixedPassiveContentLoaded =
this._state & Ci.nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT;
// Determine the mixed content state.
let mixedcontent = [];
if (isMixedPassiveContentLoaded) {
mixedcontent.push("passive-loaded");
}
if (isMixedActiveContentLoaded) {
mixedcontent.push("active-loaded");
} else if (isMixedActiveContentBlocked) {
mixedcontent.push("active-blocked");
}
mixedcontent = mixedcontent.join(" ");
// We have no specific flags for weak ciphers (yet). If a connection is
// broken and we can't detect any mixed active content loaded then it's
// a weak cipher.
let ciphers = "";
if (isBroken && !isMixedActiveContentLoaded) {
ciphers = "weak";
}
// Update all elements.
let elementIDs = [
"identity-popup",
"identity-popup-securityView-body",
];
function updateAttribute(elem, attr, value) {
if (value) {
elem.setAttribute(attr, value);
} else {
elem.removeAttribute(attr);
}
}
for (let id of elementIDs) {
let element = document.getElementById(id);
updateAttribute(element, "connection", connection);
updateAttribute(element, "ciphers", ciphers);
updateAttribute(element, "mixedcontent", mixedcontent);
}
// Initialize the optional strings to empty values
let supplemental = "";
@ -7092,19 +7139,18 @@ var gIdentityHandler = {
// Some URIs might have no hosts.
}
// Fallback for special protocols.
if (!host) {
// Fallback for special protocols.
host = this._lastUri.specIgnoringRef;
host = this._uri.specIgnoringRef;
}
switch (newMode) {
case this.IDENTITY_MODE_DOMAIN_VERIFIED:
case this.IDENTITY_MODE_MIXED_ACTIVE_BLOCKED:
// Fill in the CA name if we have a valid TLS certificate.
if (isSecure) {
verifier = this._identityBox.tooltipText;
break;
case this.IDENTITY_MODE_IDENTIFIED:
case this.IDENTITY_MODE_MIXED_ACTIVE_BLOCKED_IDENTIFIED: {
// If it's identified, then we can populate the dialog with credentials
}
// Fill in organization information if we have a valid EV certificate.
if (isEV) {
let iData = this.getIdentityData();
host = owner = iData.subjectOrg;
verifier = this._identityBox.tooltipText;
@ -7119,21 +7165,6 @@ var gIdentityHandler = {
supplemental += iData.state;
else if (iData.country) // Country only
supplemental += iData.country;
break;
}
case this.IDENTITY_MODE_UNKNOWN:
supplemental = gNavigatorBundle.getString("identity.not_secure");
break;
case this.IDENTITY_MODE_USES_WEAK_CIPHER:
supplemental = gNavigatorBundle.getString("identity.uses_weak_cipher");
break;
case this.IDENTITY_MODE_MIXED_DISPLAY_LOADED:
case this.IDENTITY_MODE_MIXED_DISPLAY_LOADED_ACTIVE_BLOCKED:
supplemental = gNavigatorBundle.getString("identity.mixed_display_loaded");
break;
case this.IDENTITY_MODE_MIXED_ACTIVE_LOADED:
supplemental = gNavigatorBundle.getString("identity.mixed_active_loaded2");
break;
}
// Push the appropriate strings out to the UI. Need to use |value| for the
@ -7144,8 +7175,23 @@ var gIdentityHandler = {
this._identityPopupContentSupp.textContent = supplemental;
this._identityPopupContentVerif.textContent = verifier;
// Hide subviews when updating panel information.
document.getElementById("identity-popup-multiView").showMainView();
// Update per-site permissions section.
this.updateSitePermissions();
},
_isURILoadedFromFile(uri) {
// Create a channel for the sole purpose of getting the resolved URI
// of the request to determine if it's loaded from the file system.
let chanOptions = {uri, loadUsingSystemPrincipal: true};
let resolvedURI = NetUtil.newChannel(chanOptions).URI;
if (resolvedURI.schemeIs("jar")) {
// Given a URI "jar:<jar-file-uri>!/<jar-entry>"
// create a new URI using <jar-file-uri>!/<jar-entry>
resolvedURI = NetUtil.newURI(resolvedURI.path);
}
// Check the URI again after resolving.
return resolvedURI.schemeIs("file");
},
/**
@ -7170,9 +7216,7 @@ var gIdentityHandler = {
this._identityPopup.hidden = false;
// Update the popup strings
this.setPopupMessages(this._identityBox.className);
this.updateSitePermissions();
this.refreshIdentityPopup();
// Add the "open" attribute to the identity box for styling
this._identityBox.setAttribute("open", "true");

View File

@ -2,6 +2,8 @@
* Test the identity mode UI for a variety of page types
*/
"use strict";
const DUMMY = "browser/browser/base/content/test/general/dummy_page.html";
function loadNewTab(url) {
@ -12,6 +14,11 @@ function getIdentityMode() {
return document.getElementById("identity-box").className;
}
function getConnectionState() {
gIdentityHandler.refreshIdentityPopup();
return document.getElementById("identity-popup").getAttribute("connection");
}
// This test is slow on Linux debug e10s
requestLongerTimeout(2);
@ -49,13 +56,13 @@ add_task(function* test_chrome() {
let oldTab = gBrowser.selectedTab;
let newTab = yield loadNewTab("chrome://mozapps/content/extensions/extensions.xul");
is(getIdentityMode(), "fileURI", "Identity should be file");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.selectedTab = oldTab;
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.selectedTab = newTab;
is(getIdentityMode(), "fileURI", "Identity should be file");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.removeTab(newTab);
});
@ -95,30 +102,30 @@ add_task(function* test_file() {
let fileURI = getTestFilePath("");
let newTab = yield loadNewTab(fileURI);
is(getIdentityMode(), "fileURI", "Identity should be file");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.selectedTab = oldTab;
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.selectedTab = newTab;
is(getIdentityMode(), "fileURI", "Identity should be file");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.removeTab(newTab);
});
add_task(function test_resource_uri() {
let oldTab = gBrowser.selectedTab;
let dataURI = "resource://gre/modules/Services.jsm"
let dataURI = "resource://gre/modules/Services.jsm";
let newTab = yield loadNewTab(dataURI);
is(getIdentityMode(), "fileURI", "Identity should be unknown");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.selectedTab = oldTab;
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.selectedTab = newTab;
is(getIdentityMode(), "fileURI", "Identity should be unknown");
is(getConnectionState(), "file", "Connection should be file");
gBrowser.removeTab(newTab);
});
@ -138,3 +145,19 @@ add_task(function test_data_uri() {
gBrowser.removeTab(newTab);
});
add_task(function test_about_uri() {
let oldTab = gBrowser.selectedTab;
let aboutURI = "about:robots"
let newTab = yield loadNewTab(aboutURI);
is(getConnectionState(), "file", "Connection should be file");
gBrowser.selectedTab = oldTab;
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.selectedTab = newTab;
is(getConnectionState(), "file", "Connection should be file");
gBrowser.removeTab(newTab);
});

View File

@ -43,7 +43,6 @@ var tests = [
{
name: "subdomain HTTPS",
location: "https://test1.example.com/",
effectiveHost: "example.com",
isHTTPS: true
},
@ -104,12 +103,14 @@ function nextTest() {
function checkResult() {
// Sanity check other values, and the value of gIdentityHandler.getEffectiveHost()
is(gIdentityHandler._lastUri.spec, gCurrentTest.location, "location matches for test " + gTestDesc);
is(gIdentityHandler._uri.spec, gCurrentTest.location, "location matches for test " + gTestDesc);
// getEffectiveHost can't be called for all modes
if (gCurrentTest.effectiveHost === null)
is(gIdentityHandler._mode == gIdentityHandler.IDENTITY_MODE_UNKNOWN || gIdentityHandler._mode == gIdentityHandler.IDENTITY_MODE_CHROMEUI, true, "mode matched");
else
if (gCurrentTest.effectiveHost === null) {
let identityBox = document.getElementById("identity-box");
is(identityBox.className == gIdentityHandler.IDENTITY_MODE_UNKNOWN || identityBox.className == gIdentityHandler.IDENTITY_MODE_CHROMEUI, true, "mode matched");
} else {
is(gIdentityHandler.getEffectiveHost(), gCurrentTest.effectiveHost, "effectiveHost matches for test " + gTestDesc);
}
executeSoon(nextTest);
}

View File

@ -10,7 +10,8 @@
orient="vertical">
<broadcasterset>
<broadcaster id="identity-popup-content-host" value=""/>
<broadcaster id="identity-popup-content-host" class="identity-popup-headline" crop="end"/>
<broadcaster id="identity-popup-mcb-learn-more" class="text-link plain" value="&identity.learnMore;"/>
</broadcasterset>
<panelmultiview id="identity-popup-multiView"
@ -18,39 +19,50 @@
<panelview id="identity-popup-mainView" flex="1">
<!-- Security Section -->
<hbox class="identity-popup-section">
<hbox id="identity-popup-security" class="identity-popup-section">
<vbox id="identity-popup-security-content" flex="1">
<label class="identity-popup-headline" crop="end">
<observes element="identity-popup-content-host" attribute="value"/>
</label>
<label class="identity-popup-connection-secure identity-popup-text"
value="&identity.connectionSecure;"/>
<label class="identity-popup-connection-not-secure identity-popup-text"
value="&identity.connectionNotSecure;"/>
<label class="identity-popup-connection-file-uri identity-popup-text"
value="&identity.connectionFile;"/>
<label class="identity-popup-connection-internal identity-popup-text"
value="&identity.connectionInternal;"/>
<label observes="identity-popup-content-host"/>
<description class="identity-popup-connection-not-secure"
value="&identity.connectionNotSecure;"
when-connection="not-secure"/>
<description class="identity-popup-connection-secure"
value="&identity.connectionSecure;"
when-connection="secure secure-ev"/>
<description value="&identity.connectionInternal;"
when-connection="chrome"/>
<description value="&identity.connectionFile;"
when-connection="file"/>
<vbox id="identity-popup-security-descriptions">
<description class="identity-popup-warning-gray"
when-mixedcontent="active-blocked">&identity.activeBlocked;</description>
<description class="identity-popup-warning-yellow"
when-mixedcontent="passive-loaded">&identity.passiveLoaded;</description>
<description when-mixedcontent="active-loaded">&identity.activeLoaded;</description>
<description class="identity-popup-warning-yellow"
when-ciphers="weak">&identity.weakEncryption;</description>
</vbox>
</vbox>
<button class="identity-popup-expander"
<button id="identity-popup-security-expander"
class="identity-popup-expander"
when-connection="not-secure secure secure-ev"
oncommand="gIdentityHandler.toggleSubView('security', this)"/>
</hbox>
<!-- Tracking Protection Section -->
<hbox id="tracking-protection-container" class="identity-popup-section">
<hbox id="tracking-protection-container"
class="identity-popup-section"
when-connection="not-secure secure secure-ev file">
<vbox id="tracking-protection-content" flex="1">
<description class="identity-popup-text identity-popup-headline"
<description class="identity-popup-headline"
crop="end"
value="&trackingProtection.title;" />
<label id="tracking-blocked"
class="identity-popup-text"
crop="end">&trackingProtection.detectedBlocked2;</label>
<label id="tracking-loaded"
class="identity-popup-text"
crop="end">&trackingProtection.detectedNotBlocked2;</label>
<label id="tracking-not-detected"
class="identity-popup-text"
crop="end">&trackingProtection.notDetected2;</label>
<button id="tracking-action-unblock"
@ -71,7 +83,7 @@
<!-- Permissions Section -->
<hbox id="identity-popup-permissions" class="identity-popup-section">
<vbox id="identity-popup-permissions-content" flex="1">
<label class="identity-popup-text identity-popup-headline"
<label class="identity-popup-headline"
value="&identity.permissions;"/>
<vbox id="identity-popup-permission-list"/>
</vbox>
@ -90,29 +102,63 @@
<!-- Security SubView -->
<panelview id="identity-popup-securityView" flex="1">
<vbox id="identity-popup-securityView-header">
<label class="identity-popup-headline" crop="end">
<observes element="identity-popup-content-host" attribute="value"/>
</label>
<label class="identity-popup-connection-secure identity-popup-text"
value="&identity.connectionSecure;"/>
<label class="identity-popup-connection-not-secure identity-popup-text"
value="&identity.connectionNotSecure;"/>
<label class="identity-popup-connection-file-uri identity-popup-text"
value="&identity.connectionFile;"/>
<label class="identity-popup-connection-internal identity-popup-text"
value="&identity.connectionInternal;"/>
<label observes="identity-popup-content-host"/>
<description class="identity-popup-connection-not-secure"
value="&identity.connectionNotSecure;"
when-connection="not-secure"/>
<description class="identity-popup-connection-secure"
value="&identity.connectionSecure;"
when-connection="secure secure-ev"/>
</vbox>
<description id="identity-popup-content-verifier"
class="identity-popup-text"/>
<vbox id="identity-popup-securityView-body">
<!-- (EV) Certificate Information -->
<description id="identity-popup-content-verified-by"
when-connection="secure-ev">&identity.connectionVerified;</description>
<description id="identity-popup-content-owner"
when-connection="secure-ev"
class="header"/>
<description id="identity-popup-content-supplemental"
when-connection="secure-ev"/>
<description id="identity-popup-content-verifier"
when-connection="secure secure-ev"/>
<description id="identity-popup-securityView-connection"
class="identity-popup-text">&identity.connectionVerified;</description>
<!-- Connection is Not Secure -->
<description when-connection="not-secure">&identity.description.insecure;</description>
<description id="identity-popup-content-owner"
class="identity-popup-text"/>
<description id="identity-popup-content-supplemental"
class="identity-popup-text"/>
<!-- Weak Cipher -->
<description when-ciphers="weak">&identity.description.weakCipher;</description>
<description class="identity-popup-warning-yellow"
when-ciphers="weak">&identity.description.weakCipher2;</description>
<!-- Active Mixed Content Blocked -->
<description class="identity-popup-warning-gray"
when-mixedcontent="active-blocked">&identity.description.activeBlocked; <label observes="identity-popup-mcb-learn-more"/></description>
<!-- Passive Mixed Content Loaded -->
<description when-mixedcontent="passive-loaded">&identity.description.passiveLoaded;</description>
<description class="identity-popup-warning-yellow"
when-mixedcontent="passive-loaded">&identity.description.passiveLoaded2; <label observes="identity-popup-mcb-learn-more"/></description>
<!-- Passive Mixed Content Loaded, Active Mixed Content Blocked -->
<description when-mixedcontent="passive-loaded active-blocked">&identity.description.passiveLoaded;</description>
<description when-mixedcontent="passive-loaded active-blocked"
class="identity-popup-warning-yellow">&identity.description.passiveLoaded3; <label observes="identity-popup-mcb-learn-more"/></description>
<!-- Active Mixed Content Blocking Disabled -->
<description when-mixedcontent="active-loaded">&identity.description.activeLoaded;</description>
<description when-mixedcontent="active-loaded">&identity.description.activeLoaded2;</description>
<!-- Buttons to enable/disable mixed content blocking. -->
<button when-mixedcontent="active-blocked"
label="&identity.disableMixedContentBlocking.label;"
accesskey="&identity.disableMixedContentBlocking.accesskey;"
oncommand="gIdentityHandler.disableMixedContentProtection()"/>
<button when-mixedcontent="active-loaded"
label="&identity.enableMixedContentBlocking.label;"
accesskey="&identity.enableMixedContentBlocking.accesskey;"
oncommand="gIdentityHandler.enableMixedContentProtection()"/>
</vbox>
</panelview>
</panelmultiview>
</panel>

View File

@ -72,7 +72,9 @@ class BaseTestFrontendUnits(MarionetteTestCase):
# This extends the timeout for find_element. We need this as the tests
# take an amount of time to run after loading, which we have to wait for.
self.marionette.set_search_timeout(60000)
self.marionette.set_search_timeout(120000)
self.marionette.timeouts("page load", 120000)
# srcdir_path should be the directory relative to this file.
def set_server_prefix(self, srcdir_path):

View File

@ -6,10 +6,10 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'shared'))
from frontend_tester import BaseTestFrontendUnits
class TestDesktopUnits(BaseTestFrontendUnits):
class TestStandaloneUnits(BaseTestFrontendUnits):
def setUp(self):
super(TestDesktopUnits, self).setUp()
super(TestStandaloneUnits, self).setUp()
self.set_server_prefix("../standalone/")
def test_units(self):

View File

@ -6,10 +6,10 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'shared'))
from frontend_tester import BaseTestFrontendUnits
class TestDesktopUnits(BaseTestFrontendUnits):
class TestUiShowcaseUnits(BaseTestFrontendUnits):
def setUp(self):
super(TestDesktopUnits, self).setUp()
super(TestUiShowcaseUnits, self).setUp()
self.set_server_prefix("../../ui/")
def test_units(self):

View File

@ -293,7 +293,7 @@
</deck>
</groupbox>
<groupbox id="syncOptions">
<caption><label>&signedIn.engines.caption;</label></caption>
<caption><label>&signedIn.engines.label;</label></caption>
<hbox id="fxaSyncEngines">
<vbox align="start">
<checkbox label="&engine.tabs.label;"
@ -360,7 +360,7 @@
<label>&mobilePromo.end;</label>
</hbox>
<spacer flex="1"/>
<vbox id="tosPP-small">
<vbox id="tosPP-small" align="start">
<label id="tosPP-small-ToS" class="text-link">
&prefs.tosLink.label;
</label>

View File

@ -691,6 +691,29 @@ you can use these alternative items. Otherwise, their values should be empty. -
<!ENTITY identity.connectionVerified "&brandShortName; verified that you are securely connected to this site, run by:">
<!ENTITY identity.connectionInternal "This is a secure &brandShortName; page.">
<!-- Strings for connection state warnings. -->
<!ENTITY identity.activeBlocked "&brandShortName; has blocked parts of this page that are not secure.">
<!ENTITY identity.passiveLoaded "Parts of this page are not secure (such as images).">
<!ENTITY identity.activeLoaded "You have disabled protection on this page.">
<!ENTITY identity.weakEncryption "This page uses weak encryption.">
<!-- Strings for connection state warnings in the subview. -->
<!ENTITY identity.description.insecure "Your connection to this site is not private. Information you submit could be viewed by others (like passwords, messages, credit cards, etc.).">
<!ENTITY identity.description.weakCipher "Your connection to this website uses weak encryption and is not private.">
<!ENTITY identity.description.weakCipher2 "Other people can view your information or modify the website's behavior.">
<!ENTITY identity.description.activeBlocked "&brandShortName; has blocked parts of this page that are not secure.">
<!ENTITY identity.description.passiveLoaded "Your connection is not private and information you share with the site could be viewed by others.">
<!ENTITY identity.description.passiveLoaded2 "This website contains content that is not secure (such as images).">
<!ENTITY identity.description.passiveLoaded3 "Although &brandShortName; has blocked some content, there is still content on the page that is not secure (such as images).">
<!ENTITY identity.description.activeLoaded "This website contains content that is not secure (such as scripts) and your connection to it is not private.">
<!ENTITY identity.description.activeLoaded2 "Information you share with this site could be viewed by others (like passwords, messages, credit cards, etc.).">
<!ENTITY identity.enableMixedContentBlocking.label "Enable protection">
<!ENTITY identity.enableMixedContentBlocking.accesskey "E">
<!ENTITY identity.disableMixedContentBlocking.label "Disable protection for now">
<!ENTITY identity.disableMixedContentBlocking.accesskey "D">
<!ENTITY identity.learnMore "Learn More">
<!ENTITY identity.moreInfoLinkText2 "More Information">
<!ENTITY identity.permissions "Permissions">

View File

@ -329,11 +329,6 @@ identity.identified.verifier=Verified by: %S
identity.identified.verified_by_you=You have added a security exception for this site.
identity.identified.state_and_country=%S, %S
identity.not_secure=Your connection to this site is not private. Information you submit could be viewable to others (for example passwords, messages, credit cards, etc.).
identity.uses_weak_cipher=Your connection to this website uses weak encryption and is not private. Other people can view your information or modify the website's behavior.
identity.mixed_display_loaded=The connection to this website is not fully secure because it contains unencrypted elements (such as images).
identity.mixed_active_loaded2=This website contains interactive content that isn't encrypted (such as scripts). Other people can view your information or modify the website's behavior.
identity.unknown.tooltip=This website does not supply identity information.
trackingProtection.intro.title=How Tracking Protection works

View File

@ -89,7 +89,7 @@ both, to better adapt this sentence to their language.
<!ENTITY signedOut.accountBox.create "Create Account">
<!ENTITY signedOut.accountBox.signin "Sign In">
<!ENTITY signedIn.engines.caption "Sync between all devices">
<!ENTITY signedIn.engines.label "Sync across all devices">
<!ENTITY mobilePromo.start "Download Firefox for ">
<!-- LOCALIZATION NOTE (mobilePromo.androidLink): This is a link title that links to https://www.mozilla.org/firefox/android/ -->

View File

@ -21,20 +21,23 @@
#tracking-action-block,
#tracking-action-unblock,
#tracking-action-unblock-private {
#tracking-action-unblock-private,
#identity-popup-securityView-body > button {
@hudButton@
min-height: 30px;
}
#tracking-action-block:hover:active,
#tracking-action-unblock:hover:active,
#tracking-action-unblock-private:hover:active {
#tracking-action-unblock-private:hover:active,
#identity-popup-securityView-body > button:hover:active {
@hudButtonPressed@
}
#tracking-action-block:-moz-focusring,
#tracking-action-unblock:-moz-focusring,
#tracking-action-unblock-private:-moz-focusring {
#tracking-action-unblock-private:-moz-focusring,
#identity-popup-securityView-body > button:-moz-focusring {
@hudButtonFocused@
}

View File

@ -195,8 +195,10 @@ browser.jar:
skin/classic/browser/controlcenter/conn-degraded.svg (../shared/controlcenter/conn-degraded.svg)
skin/classic/browser/controlcenter/mcb-disabled.svg (../shared/controlcenter/mcb-disabled.svg)
skin/classic/browser/controlcenter/permissions.svg (../shared/controlcenter/permissions.svg)
skin/classic/browser/controlcenter/tracking-protection.svg (../shared/controlcenter/tracking-protection.svg)
skin/classic/browser/controlcenter/tracking-protection-disabled.svg (../shared/controlcenter/tracking-protection-disabled.svg)
skin/classic/browser/controlcenter/tracking-protection.svg (../shared/controlcenter/tracking-protection.svg)
skin/classic/browser/controlcenter/tracking-protection-disabled.svg (../shared/controlcenter/tracking-protection-disabled.svg)
skin/classic/browser/controlcenter/warning-gray.svg (../shared/controlcenter/warning-gray.svg)
skin/classic/browser/controlcenter/warning-yellow.svg (../shared/controlcenter/warning-yellow.svg)
skin/classic/browser/customizableui/background-noise-toolbar.png (customizableui/background-noise-toolbar.png)
skin/classic/browser/customizableui/customize-titleBar-toggle.png (customizableui/customize-titleBar-toggle.png)
skin/classic/browser/customizableui/customize-titleBar-toggle@2x.png (customizableui/customize-titleBar-toggle@2x.png)

View File

@ -1,33 +1,39 @@
/* Show the organization name only for EV certs. */
#identity-popup-securityView:not(.verifiedIdentity) > #identity-popup-content-owner,
#identity-popup-securityView:not(.verifiedIdentity) > #identity-popup-securityView-connection,
/* Show the "Verified by" label only for DV and EV certs. */
#identity-popup-securityView:not(.verifiedIdentity):not(.verifiedDomain) > #identity-popup-content-verifier,
/* Show a longer explanation for non-secure sites, mixed content, and weak
connection security. Show the organization address for EV certs. */
#identity-popup-securityView:not(.unknownIdentity):not(.verifiedIdentity):not(.mixedContent):not(.weakCipher) > #identity-popup-content-supplemental,
/* Show the "Connection is secure" labels only for EV and DV certs. */
#identity-popup-security-content:not(.verifiedIdentity):not(.verifiedDomain) > .identity-popup-connection-secure,
#identity-popup-securityView:not(.verifiedIdentity):not(.verifiedDomain) > #identity-popup-securityView-header > .identity-popup-connection-secure,
/* Show the "Connection is not secure" labels only for non-secure sites. */
#identity-popup-security-content:not(.unknownIdentity) > .identity-popup-connection-not-secure,
#identity-popup-securityView:not(.unknownIdentity) > #identity-popup-securityView-header > .identity-popup-connection-not-secure,
/* Show "This page is stored on your computer" only for file URLs. */
#identity-popup-security-content:not(.fileURI) > .identity-popup-connection-file-uri,
#identity-popup-securityView:not(.fileURI) > #identity-popup-securityView-header > .identity-popup-connection-file-uri,
/* Show "This is a secure internal page" only for whitelisted pages. */
#identity-popup-securityView:not(.chromeUI) > #identity-popup-securityView-header > .identity-popup-connection-internal,
#identity-popup-security-content:not(.chromeUI) > .identity-popup-connection-internal,
/* Hide the subsection arrow for whitelisted chromeUI pages. */
#identity-popup-security-content.chromeUI + .identity-popup-expander,
/* Hide the subsection arrow for whitelisted file URI pages. */
#identity-popup-security-content.fileURI + .identity-popup-expander,
/* Hide the tracking protection section for whitelisted chromeUI pages. */
#identity-popup-mainView.chromeUI > #tracking-protection-container {
%if 0
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
%endif
/* Hide all conditional elements by default. */
:-moz-any([when-connection],[when-mixedcontent],[when-ciphers]) {
display: none;
}
/* PANEL */
/* Show the right elements for the right connection states. */
#identity-popup[connection=not-secure] [when-connection~=not-secure],
#identity-popup[connection=secure-ev] [when-connection~=secure-ev],
#identity-popup[connection=secure] [when-connection~=secure],
#identity-popup[connection=chrome] [when-connection~=chrome],
#identity-popup[connection=file] [when-connection~=file],
/* Show weak cipher messages when needed. */
#identity-popup[ciphers=weak]:not([mixedcontent]) [when-ciphers~=weak],
/* Show mixed content warnings when needed */
#identity-popup[mixedcontent~=active-loaded] [when-mixedcontent=active-loaded],
#identity-popup[mixedcontent~=passive-loaded]:not([mixedcontent~=active-loaded]) [when-mixedcontent=passive-loaded],
#identity-popup[mixedcontent~=active-blocked]:not([mixedcontent~=passive-loaded]) [when-mixedcontent=active-blocked],
/* Show the right elements when there is mixed passive content loaded and active blocked. */
#identity-popup[mixedcontent~=active-blocked][mixedcontent~=passive-loaded] [when-mixedcontent~=active-blocked][when-mixedcontent~=passive-loaded],
/* Show 'disable MCB' button always when there is mixed active content blocked. */
#identity-popup-securityView-body[mixedcontent~=active-blocked] > button[when-mixedcontent=active-blocked] {
display: inherit;
}
/* Hide 'not secure' message in subview when weak cipher or mixed content messages are shown. */
#identity-popup-securityView-body:-moz-any([mixedcontent],[ciphers]) > description[when-connection=not-secure],
/* Hide 'passive-loaded (only)' message when there is mixed passive content loaded and active blocked. */
#identity-popup-securityView-body[mixedcontent~=passive-loaded][mixedcontent~=active-blocked] > description[when-mixedcontent=passive-loaded] {
display: none;
}
#identity-popup,
#identity-popup:not([panelopen]) .panel-viewstack[viewtype="main"]:not([transitioning]) #identity-popup-mainView {
@ -143,7 +149,11 @@
/* CONTENT */
.identity-popup-text {
#identity-popup-security-content > description,
#identity-popup-security-descriptions > description,
#identity-popup-securityView-header > description,
#identity-popup-securityView-body > description,
#tracking-protection-content > label {
white-space: pre-wrap;
font-size: 110%;
margin: 0;
@ -154,12 +164,18 @@
font-size: 150%;
}
/* SECURITY */
#identity-popup-securityView > .identity-popup-text:not(#identity-popup-content-owner) {
margin: 2px 0 4px;
.identity-popup-warning-gray {
-moz-padding-start: 24px;
background: url(chrome://browser/skin/controlcenter/warning-gray.svg) no-repeat 0 50%;
}
.identity-popup-warning-yellow {
-moz-padding-start: 24px;
background: url(chrome://browser/skin/controlcenter/warning-yellow.svg) no-repeat 0 50%;
}
/* SECURITY */
.identity-popup-connection-secure {
color: #418220;
}
@ -168,12 +184,6 @@
color: #d74345;
}
#identity-popup-security-content.chromeUI {
background-image: url(chrome://branding/content/icon48.png);
}
/* SECURITY SUBVIEW */
#identity-popup-securityView {
padding-bottom: 2em;
overflow: hidden;
@ -184,46 +194,59 @@
background-image: url(chrome://browser/skin/controlcenter/conn-not-secure.svg);
}
#identity-popup-securityView.verifiedDomain,
#identity-popup-securityView.verifiedIdentity,
#identity-popup-security-content.verifiedDomain,
#identity-popup-security-content.verifiedIdentity {
#identity-popup[connection=chrome] #identity-popup-securityView,
#identity-popup[connection=chrome] #identity-popup-security-content {
background-image: url(chrome://branding/content/icon48.png);
}
#identity-popup[connection^=secure] #identity-popup-securityView,
#identity-popup[connection^=secure] #identity-popup-security-content {
background-image: url(chrome://browser/skin/controlcenter/conn-secure.svg);
}
#identity-popup-securityView.weakCipher,
#identity-popup-securityView.mixedDisplayContent,
#identity-popup-securityView.mixedDisplayContentLoadedActiveBlocked,
#identity-popup-security-content.weakCipher,
#identity-popup-security-content.mixedDisplayContent,
#identity-popup-security-content.mixedDisplayContentLoadedActiveBlocked {
#identity-popup[ciphers=weak] #identity-popup-securityView,
#identity-popup[ciphers=weak] #identity-popup-security-content,
#identity-popup[mixedcontent~=passive-loaded] #identity-popup-securityView,
#identity-popup[mixedcontent~=passive-loaded] #identity-popup-security-content {
background-image: url(chrome://browser/skin/controlcenter/conn-degraded.svg);
}
#identity-popup-securityView.mixedActiveContent,
#identity-popup-security-content.mixedActiveContent {
#identity-popup[mixedcontent~=active-loaded] #identity-popup-securityView,
#identity-popup[mixedcontent~=active-loaded] #identity-popup-security-content {
background-image: url(chrome://browser/skin/controlcenter/mcb-disabled.svg);
}
#identity-popup-security-descriptions > description {
margin-top: 6px;
color: Graytext;
}
#identity-popup-securityView-header {
border-bottom: 1px solid var(--panel-separator-color);
padding-bottom: 1em;
margin-bottom: 1em;
}
#identity-popup-content-owner {
font-weight: 700;
#identity-popup-securityView-body {
-moz-padding-end: 1em;
}
#identity-popup-content-verifier {
#identity-popup-content-verifier ~ description {
margin-top: 1em;
color: Graytext;
}
#identity-popup-content-owner,
#identity-popup-securityView > #identity-popup-securityView-connection.identity-popup-text {
description#identity-popup-content-verified-by,
description#identity-popup-content-owner,
description#identity-popup-content-verifier,
#identity-popup-securityView-body > button {
margin-top: 1em;
}
#identity-popup-securityView-body > button {
margin-inline-start: 0;
margin-inline-end: 0;
}
/* TRACKING PROTECTION */
#tracking-protection-content {

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="16" height="16" viewBox="0 0 16 16">
<path fill="#808080" d="M14.8,12.5L9.3,1.9C9,1.3,8.5,1,8,1C7.5,1,7,1.3,6.7,1.9L1.2,12.5c-0.3,0.6-0.3,1.2,0,1.7C1.5,14.7,2,15,2.6,15h10.8 c0.6,0,1.1-0.3,1.4-0.8C15.1,13.7,15.1,13.1,14.8,12.5z"/>
<path fill="#fff" d="M8,11c-0.8,0-1.5,0.7-1.5,1.5C6.5,13.3,7.2,14,8,14 c0.8,0,1.5-0.7,1.5-1.5C9.5,11.7,8.8,11,8,11z M8,10L8,10C8.6,10,9,9.6,9,9l0.2-4.2c0-0.7-0.5-1.2-1.2-1.2S6.8,4.1,6.8,4.8L7,9 C7,9.6,7.4,10,8,10z"/>
</svg>

After

Width:  |  Height:  |  Size: 805 B

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="16" height="16" viewBox="0 0 16 16">
<path fill="#ffbf00" d="M14.8,12.5L9.3,1.9C9,1.3,8.5,1,8,1C7.5,1,7,1.3,6.7,1.9L1.2,12.5c-0.3,0.6-0.3,1.2,0,1.7C1.5,14.7,2,15,2.6,15h10.8 c0.6,0,1.1-0.3,1.4-0.8C15.1,13.7,15.1,13.1,14.8,12.5z"/>
<path fill="#fff" d="M8,11c-0.8,0-1.5,0.7-1.5,1.5C6.5,13.3,7.2,14,8,14 c0.8,0,1.5-0.7,1.5-1.5C9.5,11.7,8.8,11,8,11z M8,10L8,10C8.6,10,9,9.6,9,9l0.2-4.2c0-0.7-0.5-1.2-1.2-1.2S6.8,4.1,6.8,4.8L7,9 C7,9.6,7.4,10,8,10z"/>
</svg>

After

Width:  |  Height:  |  Size: 805 B

View File

@ -50,7 +50,7 @@ public class GeneratableElementIterator implements Iterator<AnnotatableEntity> {
// Check for "Wrap ALL the things" flag.
for (Annotation annotation : aClass.getDeclaredAnnotations()) {
final String annotationTypeName = annotation.annotationType().getName();
if (annotationTypeName.equals("org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI")) {
if (annotationTypeName.equals("org.mozilla.gecko.annotation.WrapForJNI")) {
mIterateEveryEntry = true;
break;
}
@ -71,7 +71,7 @@ public class GeneratableElementIterator implements Iterator<AnnotatableEntity> {
// WrappedJNIMethod has parameters. Use Reflection to obtain them.
Class<? extends Annotation> annotationType = annotation.annotationType();
final String annotationTypeName = annotationType.getName();
if (annotationTypeName.equals("org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI")) {
if (annotationTypeName.equals("org.mozilla.gecko.annotation.WrapForJNI")) {
String stubName = null;
boolean isMultithreadedStub = false;
boolean noThrow = false;
@ -104,15 +104,15 @@ public class GeneratableElementIterator implements Iterator<AnnotatableEntity> {
catchException = (Boolean) catchExceptionMethod.invoke(annotation);
} catch (NoSuchMethodException e) {
System.err.println("Unable to find expected field on WrapElementForJNI annotation. Did the signature change?");
System.err.println("Unable to find expected field on WrapForJNI annotation. Did the signature change?");
e.printStackTrace(System.err);
System.exit(3);
} catch (IllegalAccessException e) {
System.err.println("IllegalAccessException reading fields on WrapElementForJNI annotation. Seems the semantics of Reflection have changed...");
System.err.println("IllegalAccessException reading fields on WrapForJNI annotation. Seems the semantics of Reflection have changed...");
e.printStackTrace(System.err);
System.exit(4);
} catch (InvocationTargetException e) {
System.err.println("InvocationTargetException reading fields on WrapElementForJNI annotation. This really shouldn't happen.");
System.err.println("InvocationTargetException reading fields on WrapForJNI annotation. This really shouldn't happen.");
e.printStackTrace(System.err);
System.exit(5);
}

View File

@ -1,6 +1,7 @@
[DEFAULT]
support-files =
file_empty.html
system_message_chrome_script.js
[test_alarm_add_data.html]
skip-if = ((buildapp == 'mulet' || buildapp == 'b2g') && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage

View File

@ -0,0 +1,18 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
const { classes: Cc, interfaces: Ci } = Components;
const systemMessenger = Cc["@mozilla.org/system-message-internal;1"]
.getService(Ci.nsISystemMessagesInternal);
const ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
addMessageListener("trigger-register-page", function(aData) {
systemMessenger.registerPage(aData.type,
ioService.newURI(aData.pageURL, null, null),
ioService.newURI(aData.manifestURL, null, null));
sendAsyncMessage("page-registered");
});

View File

@ -14,6 +14,20 @@
"use strict";
function registerPage() {
var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('system_message_chrome_script.js'));
gScript.addMessageListener("page-registered", function pageRegisteredHandler() {
gScript.removeMessageListener("page-registered", pageRegisteredHandler);
gScript.destroy();
testFireTimeAlert();
});
gScript.sendAsyncMessage("trigger-register-page",
{ type: "alarm",
manifestURL: window.location.origin + "/manifest.webapp",
pageURL: window.location.href });
}
function testFireTimeAlert() {
var secondsLater = new Date();
secondsLater.setSeconds(secondsLater.getSeconds() + 10);
@ -27,7 +41,7 @@
});
domRequest = navigator.mozAlarms.add(secondsLater, "honorTimezone",
{type: "timer"});
{type: "timer"});
} catch (e) {
ok(false, "Unexpected exception trying to set time alert.");
@ -62,7 +76,7 @@
if (isAllowedToTest) {
ok(true, "Start to test...");
testFireTimeAlert();
registerPage();
} else {
// A sanity check to make sure we must run tests on Firefox OS (B2G).
if (navigator.userAgent.indexOf("Mobile") != -1 &&

View File

@ -14,6 +14,20 @@
"use strict";
function registerPage() {
var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('system_message_chrome_script.js'));
gScript.addMessageListener("page-registered", function pageRegisteredHandler() {
gScript.removeMessageListener("page-registered", pageRegisteredHandler);
gScript.destroy();
testFireTimeAlertWithNoData();
});
gScript.sendAsyncMessage("trigger-register-page",
{ type: "alarm",
manifestURL: window.location.origin + "/manifest.webapp",
pageURL: window.location.href });
}
function testFireTimeAlertWithNoData() {
var secondsLater = new Date();
secondsLater.setSeconds(secondsLater.getSeconds() + 1);
@ -61,7 +75,7 @@
if (isAllowedToTest) {
ok(true, "Start to test...");
testFireTimeAlertWithNoData();
registerPage();
} else {
// A sanity check to make sure we must run tests on Firefox OS (B2G).
if (navigator.userAgent.indexOf("Mobile") != -1 &&

View File

@ -234,6 +234,7 @@ DecodedStream::DecodedStream(MediaQueue<MediaData>& aAudioQueue,
MediaQueue<MediaData>& aVideoQueue)
: mMonitor("DecodedStream::mMonitor")
, mPlaying(false)
, mVolume(1.0)
, mAudioQueue(aAudioQueue)
, mVideoQueue(aVideoQueue)
{
@ -418,6 +419,13 @@ DecodedStream::SetPlaying(bool aPlaying)
}
}
void
DecodedStream::SetVolume(double aVolume)
{
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
mVolume = aVolume;
}
void
DecodedStream::InitTracks()
{
@ -666,13 +674,13 @@ DecodedStream::AdvanceTracks()
}
bool
DecodedStream::SendData(double aVolume, bool aIsSameOrigin)
DecodedStream::SendData(bool aIsSameOrigin)
{
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
MOZ_ASSERT(mStartTime.isSome(), "Must be called after StartPlayback()");
InitTracks();
SendAudio(aVolume, aIsSameOrigin);
SendAudio(mVolume, aIsSameOrigin);
SendVideo(aIsSameOrigin);
AdvanceTracks();

View File

@ -61,14 +61,17 @@ public:
void RecreateData();
void Connect(ProcessedMediaStream* aStream, bool aFinishWhenEnded);
void Remove(MediaStream* aStream);
void SetPlaying(bool aPlaying);
void SetVolume(double aVolume);
int64_t AudioEndTime() const;
int64_t GetPosition() const;
bool IsFinished() const;
bool HasConsumers() const;
// Return true if stream is finished.
bool SendData(double aVolume, bool aIsSameOrigin);
bool SendData(bool aIsSameOrigin);
protected:
virtual ~DecodedStream();
@ -97,6 +100,8 @@ private:
mutable ReentrantMonitor mMonitor;
bool mPlaying;
double mVolume;
Maybe<int64_t> mStartTime;
MediaInfo mInfo;

View File

@ -376,7 +376,7 @@ void MediaDecoderStateMachine::SendStreamData()
AssertCurrentThreadInMonitor();
MOZ_ASSERT(!mAudioSink, "Should've been stopped in RunStateMachine()");
bool finished = mDecodedStream->SendData(mVolume, mSameOriginMedia);
bool finished = mDecodedStream->SendData(mSameOriginMedia);
const auto clockTime = GetClock();
while (true) {
@ -1169,6 +1169,7 @@ void MediaDecoderStateMachine::VolumeChanged()
if (mAudioSink) {
mAudioSink->SetVolume(mVolume);
}
mDecodedStream->SetVolume(mVolume);
}
void MediaDecoderStateMachine::RecomputeDuration()

View File

@ -174,7 +174,7 @@ public:
EmptyString(), EmptyString(), true, 2)
, mDisplay(nsIntSize(aWidth, aHeight))
, mStereoMode(StereoMode::MONO)
, mImage(nsIntSize(aWidth, aHeight))
, mImage(nsIntRect(0, 0, aWidth, aHeight))
, mCodecSpecificConfig(new MediaByteBuffer)
, mExtraData(new MediaByteBuffer)
{
@ -217,8 +217,8 @@ public:
// Indicates the frame layout for single track stereo videos.
StereoMode mStereoMode;
// Size in pixels of decoded video's image.
nsIntSize mImage;
// Visible area of the decoded video's image.
nsIntRect mImage;
nsRefPtr<MediaByteBuffer> mCodecSpecificConfig;
nsRefPtr<MediaByteBuffer> mExtraData;
};

View File

@ -323,6 +323,12 @@ RTCPeerConnection.prototype = {
__init: function(rtcConfig) {
this._winID = this._win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
// TODO: Update this code once we support pc.setConfiguration, to track
// setting from content independently from pref (Bug 1181768).
if (rtcConfig.iceTransportPolicy == "all" &&
Services.prefs.getBoolPref("media.peerconnection.ice.relay_only")) {
rtcConfig.iceTransportPolicy = "relay";
}
if (!rtcConfig.iceServers ||
!Services.prefs.getBoolPref("media.peerconnection.use_document_iceservers")) {
try {

View File

@ -260,7 +260,8 @@ CreateTestH264Decoder(layers::LayersBackend aBackend,
aConfig.mId = 1;
aConfig.mDuration = 40000;
aConfig.mMediaTime = 0;
aConfig.mDisplay = aConfig.mImage = nsIntSize(64, 64);
aConfig.mDisplay = nsIntSize(64, 64);
aConfig.mImage = nsIntRect(0, 0, 64, 64);
aConfig.mExtraData = new MediaByteBuffer();
aConfig.mExtraData->AppendElements(sTestH264ExtraData,
MOZ_ARRAY_LENGTH(sTestH264ExtraData));

View File

@ -315,12 +315,17 @@ TrackBuffersManager::Detach()
MOZ_ASSERT(NS_IsMainThread());
MSE_DEBUG("");
// Abort pending operations if any.
AbortAppendData();
nsRefPtr<TrackBuffersManager> self = this;
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableFunction([self] () {
// Clear our sourcebuffer
self->CodedFrameRemoval(TimeInterval(TimeUnit::FromSeconds(0),
TimeUnit::FromInfinity()));
self->mProcessingPromise.RejectIfExists(NS_ERROR_ABORT, __func__);
self->mAppendPromise.RejectIfExists(NS_ERROR_ABORT, __func__);
self->mMediaSourceDuration.DisconnectIfConnected();
});
GetTaskQueue()->Dispatch(task.forget());
@ -661,10 +666,9 @@ TrackBuffersManager::SegmentParserLoop()
SetAppendState(AppendState::PARSING_MEDIA_SEGMENT);
continue;
}
// We have neither an init segment nor a media segment, this is invalid
// data. We can ignore it.
MSE_DEBUG("Found invalid data, ignoring.");
mInputBuffer = nullptr;
// We have neither an init segment nor a media segment, this is either
// invalid data or not enough data to detect a segment type.
MSE_DEBUG("Found invalid or incomplete data.");
NeedMoreData();
return;
}
@ -1034,18 +1038,23 @@ TrackBuffersManager::CodedFrameProcessing()
{
MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(mProcessingPromise.IsEmpty());
nsRefPtr<CodedFrameProcessingPromise> p = mProcessingPromise.Ensure(__func__);
MediaByteRange mediaRange = mParser->MediaSegmentRange();
if (mediaRange.IsNull()) {
AppendDataToCurrentInputBuffer(mInputBuffer);
mInputBuffer = nullptr;
} else {
MOZ_ASSERT(mProcessedInput >= mInputBuffer->Length());
if (int64_t(mProcessedInput - mInputBuffer->Length()) > mediaRange.mEnd) {
// Something is not quite right with the data appended. Refuse it.
// This would typically happen if the previous media segment was partial
// yet a new complete media segment was added.
return CodedFrameProcessingPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
}
// The mediaRange is offset by the init segment position previously added.
uint32_t length =
mediaRange.mEnd - (mProcessedInput - mInputBuffer->Length());
nsRefPtr<MediaByteBuffer> segment = new MediaByteBuffer;
MOZ_ASSERT(mInputBuffer->Length() >= length);
if (!segment->AppendElements(mInputBuffer->Elements(), length, fallible)) {
return CodedFrameProcessingPromise::CreateAndReject(NS_ERROR_OUT_OF_MEMORY, __func__);
}
@ -1053,6 +1062,8 @@ TrackBuffersManager::CodedFrameProcessing()
mInputBuffer->RemoveElementsAt(0, length);
}
nsRefPtr<CodedFrameProcessingPromise> p = mProcessingPromise.Ensure(__func__);
DoDemuxVideo();
return p;
@ -1632,6 +1643,7 @@ TrackBuffersManager::RemoveFrames(const TimeIntervals& aIntervals,
if (aTrackData.mNextInsertionIndex.ref() > firstRemovedIndex.ref() &&
aTrackData.mNextInsertionIndex.ref() <= lastRemovedIndex + 1) {
aTrackData.ResetAppendState();
MSE_DEBUG("NextInsertionIndex got reset.");
} else if (aTrackData.mNextInsertionIndex.ref() > lastRemovedIndex + 1) {
aTrackData.mNextInsertionIndex.ref() -=
lastRemovedIndex - firstRemovedIndex.ref() + 1;
@ -1639,6 +1651,7 @@ TrackBuffersManager::RemoveFrames(const TimeIntervals& aIntervals,
}
// Update our buffered range to exclude the range just removed.
removedIntervals.SetFuzz(TimeUnit::FromMicroseconds(maxSampleDuration/2));
aTrackData.mBufferedRanges -= removedIntervals;
data.RemoveElementsAt(firstRemovedIndex.ref(),

View File

@ -30,8 +30,7 @@ VPXDecoder::VPXDecoder(const VideoInfo& aConfig,
, mTaskQueue(aTaskQueue)
, mCallback(aCallback)
, mIter(nullptr)
, mDisplayWidth(aConfig.mDisplay.width)
, mDisplayHeight(aConfig.mDisplay.height)
, mInfo(aConfig)
{
MOZ_COUNT_CTOR(VPXDecoder);
if (aConfig.mMimeType.EqualsLiteral("video/webm; codecs=vp8")) {
@ -125,9 +124,8 @@ VPXDecoder::DoDecodeFrame(MediaRawData* aSample)
b.mPlanes[2].mWidth = (img->d_w + 1) >> img->x_chroma_shift;
b.mPlanes[2].mOffset = b.mPlanes[2].mSkip = 0;
IntRect picture = IntRect(0, 0, img->d_w, img->d_h);
VideoInfo info;
info.mDisplay = nsIntSize(mDisplayWidth, mDisplayHeight);
info.mDisplay = mInfo.mDisplay;
nsRefPtr<VideoData> v = VideoData::Create(info,
mImageContainer,
aSample->mOffset,
@ -136,12 +134,12 @@ VPXDecoder::DoDecodeFrame(MediaRawData* aSample)
b,
aSample->mKeyframe,
aSample->mTimecode,
picture);
mInfo.mImage);
if (!v) {
LOG("Image allocation error source %ldx%ld display %ldx%ld picture %ldx%ld",
img->d_w, img->d_h, mDisplayWidth, mDisplayHeight,
picture.width, picture.height);
img->d_w, img->d_h, mInfo.mDisplay.width, mInfo.mDisplay.height,
mInfo.mImage.width, mInfo.mImage.height);
return -1;
}
mCallback->Output(v);

View File

@ -56,8 +56,7 @@ private:
vpx_codec_ctx_t mVPX;
vpx_codec_iter_t mIter;
uint32_t mDisplayWidth;
uint32_t mDisplayHeight;
const VideoInfo& mInfo;
int mCodec;
};

View File

@ -255,6 +255,9 @@ public:
bool AndroidDecoderModule::SupportsMimeType(const nsACString& aMimeType)
{
if (!AndroidBridge::Bridge() || (AndroidBridge::Bridge()->GetAPIVersion() < 16)) {
return false;
}
if (aMimeType.EqualsLiteral("video/mp4") ||
aMimeType.EqualsLiteral("video/avc")) {
return true;

View File

@ -207,6 +207,12 @@ WMFVideoMFTManager::InitInternal(bool aForceD3D9)
attr->GetUINT32(MF_SA_D3D_AWARE, &aware);
attr->SetUINT32(CODECAPI_AVDecNumWorkerThreads,
WMFDecoderModule::GetNumDecoderThreads());
hr = attr->SetUINT32(CODECAPI_AVLowLatencyMode, TRUE);
if (SUCCEEDED(hr)) {
LOG("Enabling Low Latency Mode");
} else {
LOG("Couldn't enable Low Latency Mode");
}
}
if (useDxva) {

View File

@ -25,6 +25,7 @@ function startTest(test, token) {
element.src = test.name;
element.test = test;
element.stream = element.mozCaptureStream();
element.loop = true;
var mediaRecorder = new MediaRecorder(element.stream);
@ -68,7 +69,7 @@ function startTest(test, token) {
if (!onDataAvailableFirst) {
ok(false, 'onstop unexpectedly fired before ondataavailable');
}
element.pause();
manager.finished(token);
};
@ -84,9 +85,9 @@ function startTest(test, token) {
}
};
// Start recording once canplaythrough fires
element.oncanplaythrough = function() {
element.oncanplaythrough = null;
// Start recording once metadataloaded fires
element.onloadedmetadata = function() {
element.onloadedmetadata = null;
mediaRecorder.start(250);
is(mediaRecorder.state, 'recording', 'Media recorder should be recording');
is(mediaRecorder.stream, element.stream,

View File

@ -118,6 +118,8 @@ skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video suppo
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_promiseSendOnly.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_relayOnly.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_callbacks.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_replaceTrack.html]

View File

@ -1189,18 +1189,15 @@ PeerConnectionWrapper.prototype = {
* resolves when connected, rejects on failure
*/
waitForIceConnected : function() {
return new Promise((resolve, reject) => {
var iceConnectedChanged = () => {
if (this.isIceConnected()) {
delete this.ice_connection_callbacks.waitForIceConnected;
resolve();
} else if (! this.isIceConnectionPending()) {
delete this.ice_connection_callbacks.waitForIceConnected;
resolve();
}
return new Promise((resolve, reject) =>
this.ice_connection_callbacks.waitForIceConnected = () => {
if (this.isIceConnected()) {
delete this.ice_connection_callbacks.waitForIceConnected;
resolve();
} else if (!this.isIceConnectionPending()) {
delete this.ice_connection_callbacks.waitForIceConnected;
reject(new Error('ICE failed'));
}
this.ice_connection_callbacks.waitForIceConnected = iceConnectedChanged;
});
},

View File

@ -0,0 +1,61 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1187775",
title: "peer connection ICE fails on relay-only without TURN"
});
function PC_LOCAL_NO_CANDIDATES(test) {
var isnt = can => is(can, null, "No candidates: " + JSON.stringify(can));
test.pcLocal._pc.addEventListener("icecandidate", e => isnt(e.candidate));
}
function PC_BOTH_WAIT_FOR_ICE_FAILED(test) {
var isFail = (f, reason, msg) =>
f().then(() => { throw new Error(msg + " must fail"); },
e => is(e.message, reason, msg + " must fail with: " + e.message));
return Promise.all([
isFail(() => waitForIceConnected(test, test.pcLocal), "ICE failed", "Local ICE"),
isFail(() => waitForIceConnected(test, test.pcRemote), "ICE failed", "Remote ICE")
])
.then(() => ok(true, "ICE on both sides must fail."));
}
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
var test;
runNetworkTest(options =>
pushPrefs(['media.peerconnection.ice.stun_client_maximum_transmits', 3],
['media.peerconnection.ice.trickle_grace_period', 5000]).then(() => {
options = options || {};
options.config_local = options.config_local || {};
var servers = options.config_local.iceServers || [];
// remove any turn servers
options.config_local.iceServers = servers.filter(server =>
server.urls.every(u => !u.toLowerCase().startsWith('turn')));
// Here's the setting we're testing. Comment out and this test should fail:
options.config_local.iceTransportPolicy = "relay";
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]);
test.chain.remove("PC_LOCAL_SETUP_ICE_LOGGER"); // Needed to suppress failing
test.chain.remove("PC_REMOTE_SETUP_ICE_LOGGER"); // on ICE-failure.
test.chain.insertAfter("PC_LOCAL_SETUP_ICE_HANDLER", PC_LOCAL_NO_CANDIDATES);
test.chain.replace("PC_LOCAL_WAIT_FOR_ICE_CONNECTED", PC_BOTH_WAIT_FOR_ICE_FAILED);
test.chain.removeAfter("PC_BOTH_WAIT_FOR_ICE_FAILED");
test.run();
}));
</script>
</pre>
</body>
</html>

View File

@ -316,8 +316,7 @@ WebMDemuxer::ReadMetadata()
mHasVideo = true;
mInfo.mVideo.mDisplay = displaySize;
mPicture = pictureRect;
mInfo.mVideo.mImage = pictureRect;
switch (params.stereo_mode) {
case NESTEGG_VIDEO_MONO:

View File

@ -148,9 +148,6 @@ private:
// previous frame's timestamp. In NS.
int64_t mLastVideoFrameTime;
// Picture region, as relative to the initial frame size.
nsIntRect mPicture;
// Codec ID of audio track
int mAudioCodec;
// Codec ID of video track

View File

@ -742,11 +742,9 @@ SystemMessageInternal.prototype = {
if (!page) {
debug("Message " + aType + " is not registered for " +
aPageURL + " @ " + aManifestURL);
// FIXME bug 1140275 should only send message to page registered in manifest
// return MSG_SENT_FAILURE_PERM_DENIED;
return MSG_SENT_FAILURE_PERM_DENIED;
}
if (page)
this._queueMessage(page, aMessage, aMessageID);
this._queueMessage(page, aMessage, aMessageID);
let appPageIsRunning = false;
let pageKey = this._createKeyForPage({ type: aType,
@ -801,8 +799,7 @@ SystemMessageInternal.prototype = {
result = MSG_SENT_FAILURE_APP_NOT_RUNNING;
this._acquireCpuWakeLock(pageKey);
}
if (page)
this._openAppPage(page, aMessage, aExtra, result);
this._openAppPage(page, aMessage, aExtra, result);
return result;
},

View File

@ -1,2 +1,6 @@
[DEFAULT]
support-files =
system_message_chrome_script.js
[test_bug_993732.html]
skip-if = buildapp == 'mulet' || (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage

View File

@ -0,0 +1,18 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
const { classes: Cc, interfaces: Ci } = Components;
const systemMessenger = Cc["@mozilla.org/system-message-internal;1"]
.getService(Ci.nsISystemMessagesInternal);
const ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
addMessageListener("trigger-register-page", function(aData) {
systemMessenger.registerPage(aData.type,
ioService.newURI(aData.pageURL, null, null),
ioService.newURI(aData.manifestURL, null, null));
sendAsyncMessage("page-registered");
});

View File

@ -19,6 +19,20 @@
// listening system message is broadcast. So this test case uses the alarm message
// to test if a running app can receive the system message.
function registerPage() {
var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('system_message_chrome_script.js'));
gScript.addMessageListener("page-registered", function pageRegisteredHandler() {
gScript.removeMessageListener("page-registered", pageRegisteredHandler);
gScript.destroy();
testAlarm(10000);
});
gScript.sendAsyncMessage("trigger-register-page",
{ type: "alarm",
manifestURL: window.location.origin + "/manifest.webapp",
pageURL: window.location.href });
}
function testAlarm(aMillisecondsFromNow) {
var at = new Date();
at.setTime(at.getTime() + aMillisecondsFromNow);
@ -40,7 +54,7 @@
// Waiting for alarm message.
};
domRequest.onerror = function(e) {
ok(false, "Unable to add alarm for tomorrow`.");
ok(false, "Unable to add alarm.");
SimpleTest.finish();
};
}
@ -52,7 +66,7 @@
if (navigator.userAgent.indexOf("Mobile") != -1 &&
navigator.appVersion.indexOf("Android") == -1)
{
testAlarm(10000);
registerPage();
} else {
ok(true, "mozAlarms on Firefox OS only.");
SimpleTest.finish();

View File

@ -68,10 +68,12 @@ intr protocol PPluginInstance
child:
intr __delete__();
// Return value is only used on Windows and only when the window needs its
// parent set to the chrome widget native window.
intr NPP_SetWindow(NPRemoteWindow window)
returns (NPRemoteWindow childWindowToBeAdopted);
// This is only used on Windows and, for windowed plugins, must be called
// before the first call to NPP_SetWindow.
intr CreateChildPluginWindow(NPRemoteWindow window)
returns (NPRemoteWindow createdChild);
intr NPP_SetWindow(NPRemoteWindow window);
intr NPP_GetValue_NPPVpluginWantsAllNetworkStreams()
returns (bool value, NPError result);

View File

@ -1146,8 +1146,34 @@ void PluginInstanceChild::DeleteWindow()
#endif
bool
PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow,
NPRemoteWindow* aChildWindowToBeAdopted)
PluginInstanceChild::AnswerCreateChildPluginWindow(const NPRemoteWindow& aWindow,
NPRemoteWindow* aCreatedChild)
{
#if defined(XP_WIN)
MOZ_ASSERT(aWindow.type == NPWindowTypeWindow);
MOZ_ASSERT(!mPluginWindowHWND);
if ((GetQuirks() & PluginModuleChild::QUIRK_QUICKTIME_AVOID_SETWINDOW) &&
aWindow.width == 0 && aWindow.height == 0) {
// Skip CreateChildPluginWindow call for hidden QuickTime plugins.
return true;
}
if (!CreatePluginWindow()) {
return false;
}
aCreatedChild->window = reinterpret_cast<uint64_t>(mPluginWindowHWND);
return true;
#else
NS_NOTREACHED("PluginInstanceChild::CreateChildPluginWindow not implemented!");
return false;
#endif
}
bool
PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
{
PLUGIN_LOG_DEBUG(("%s (aWindow=<window: 0x%lx, x: %d, y: %d, width: %d, height: %d>)",
FULLFUNCTION,
@ -1235,35 +1261,17 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow,
return true;
}
if (!CreatePluginWindow())
return false;
MOZ_ASSERT(mPluginWindowHWND,
"Child plugin window must exist before call to SetWindow");
HWND parentHWND = reinterpret_cast<HWND>(aWindow.window);
if (mPluginWindowHWND != parentHWND) {
mPluginParentHWND = parentHWND;
ShowWindow(mPluginWindowHWND, SW_SHOWNA);
}
SizePluginWindow(aWindow.width, aWindow.height);
// If the window is not our parent set the return child window so that
// it can be re-parented in the chrome process. Re-parenting now
// happens there as we might not have sufficient permission.
// Also, this needs to be after SizePluginWindow because SetWindowPos
// relies on things that it sets.
HWND parentWindow = reinterpret_cast<HWND>(aWindow.window);
if (mPluginParentHWND != parentWindow && IsWindow(parentWindow)) {
mPluginParentHWND = parentWindow;
aChildWindowToBeAdopted->window =
reinterpret_cast<uint64_t>(mPluginWindowHWND);
} else {
// Now we know that the window has the correct parent we can show
// it. The actual visibility is controlled by its parent.
// First time round, these calls are made by our caller after the
// parent is set.
ShowWindow(mPluginWindowHWND, SW_SHOWNA);
// This used to be called in SizePluginWindow, but we need to make
// sure that mPluginWindowHWND has had it's parent set correctly,
// otherwise it can cause a focus issue.
SetWindowPos(mPluginWindowHWND, nullptr, 0, 0, aWindow.width,
aWindow.height, SWP_NOZORDER | SWP_NOREPOSITION);
}
mWindow.window = (void*)mPluginWindowHWND;
mWindow.x = aWindow.x;
mWindow.y = aWindow.y;
@ -1458,6 +1466,8 @@ PluginInstanceChild::SizePluginWindow(int width,
if (mPluginWindowHWND) {
mPluginSize.x = width;
mPluginSize.y = height;
SetWindowPos(mPluginWindowHWND, nullptr, 0, 0, width, height,
SWP_NOZORDER | SWP_NOREPOSITION);
}
}

View File

@ -65,8 +65,10 @@ class PluginInstanceChild : public PPluginInstanceChild
#endif
protected:
bool AnswerNPP_SetWindow(const NPRemoteWindow& window,
NPRemoteWindow* aChildWindowToBeAdopted) override;
bool AnswerCreateChildPluginWindow(const NPRemoteWindow& window,
NPRemoteWindow* aCreatedChild) override;
bool AnswerNPP_SetWindow(const NPRemoteWindow& window) override;
virtual bool
AnswerNPP_GetValue_NPPVpluginWantsAllNetworkStreams(bool* wantsAllStreams, NPError* rv) override;

View File

@ -117,6 +117,8 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent,
, mDrawingModel(kDefaultDrawingModel)
#if defined(OS_WIN)
, mPluginHWND(nullptr)
, mChildPluginHWND(nullptr)
, mChildPluginsParentHWND(nullptr)
, mPluginWndProc(nullptr)
, mNestedEventState(false)
#endif // defined(XP_WIN)
@ -1025,31 +1027,37 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
window.colormap = ws_info->colormap;
#endif
NPRemoteWindow childWindow;
if (!CallNPP_SetWindow(window, &childWindow)) {
return NPERR_GENERIC_ERROR;
#if defined(XP_WIN)
// On Windows we need to create and set the parent before we set the window
// on the plugin, or certain things like keyboard interaction will not work.
if (!mChildPluginHWND && mWindowType == NPWindowTypeWindow) {
NPRemoteWindow childWindow;
if (!CallCreateChildPluginWindow(window, &childWindow)) {
return NPERR_GENERIC_ERROR;
}
mChildPluginHWND = reinterpret_cast<HWND>(childWindow.window);
}
#if defined(XP_WIN)
// If a child window is returned it means that we need to re-parent it.
if (childWindow.window) {
// It's not clear if the parent window would ever change, but when this was
// done in the NPAPI child it used to allow for this.
if (mChildPluginHWND && mPluginHWND != mChildPluginsParentHWND) {
nsCOMPtr<nsIWidget> widget;
static_cast<const nsPluginNativeWindow*>(aWindow)->
GetPluginWidget(getter_AddRefs(widget));
if (widget) {
widget->SetNativeData(NS_NATIVE_CHILD_WINDOW,
static_cast<uintptr_t>(childWindow.window));
reinterpret_cast<uintptr_t>(mChildPluginHWND));
}
// Now it has got the correct parent, make sure it is visible.
// In subsequent calls to SetWindow these calls happen in the Child.
HWND childHWND = reinterpret_cast<HWND>(childWindow.window);
ShowWindow(childHWND, SW_SHOWNA);
SetWindowPos(childHWND, nullptr, 0, 0, window.width, window.height,
SWP_NOZORDER | SWP_NOREPOSITION);
mChildPluginsParentHWND = mPluginHWND;
}
#endif
if (!CallNPP_SetWindow(window)) {
return NPERR_GENERIC_ERROR;
}
return NPERR_NO_ERROR;
}

View File

@ -366,6 +366,8 @@ private:
nsIntRect mPluginPort;
nsIntRect mSharedSize;
HWND mPluginHWND;
HWND mChildPluginHWND;
HWND mChildPluginsParentHWND;
WNDPROC mPluginWndProc;
bool mNestedEventState;

View File

@ -28,7 +28,8 @@ static const mozilla::Module::ContractIDEntry kPresentationDeviceProviderContrac
};
static const mozilla::Module::CategoryEntry kPresentationDeviceProviderCategories[] = {
#if defined(MOZ_WIDGET_ANDROID) || (defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16)
#if (defined(MOZ_WIDGET_ANDROID) && ANDROID_VERSION >= 21) || \
(defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16)
{ PRESENTATION_DEVICE_PROVIDER_CATEGORY, "MulticastDNSDeviceProvider", MULTICAST_DNS_PROVIDER_CONTRACT_ID },
#endif
{ nullptr }

View File

@ -6,6 +6,7 @@ support-files =
file_basic_app.html
common_app.js
common_basic.js
system_message_chrome_script.js
[test_webidl.html]
[test_minInterval.html]

View File

@ -0,0 +1,18 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
const { classes: Cc, interfaces: Ci } = Components;
const systemMessenger = Cc["@mozilla.org/system-message-internal;1"]
.getService(Ci.nsISystemMessagesInternal);
const ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
addMessageListener("trigger-register-page", function(aData) {
systemMessenger.registerPage(aData.type,
ioService.newURI(aData.pageURL, null, null),
ioService.newURI(aData.manifestURL, null, null));
sendAsyncMessage("page-registered");
});

View File

@ -13,6 +13,20 @@
var taskExecuted = false;
function registerPage() {
var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('system_message_chrome_script.js'));
gScript.addMessageListener("page-registered", function pageRegisteredHandler() {
gScript.removeMessageListener("page-registered", pageRegisteredHandler);
gScript.destroy();
runTests();
});
gScript.sendAsyncMessage("trigger-register-page",
{ type: "request-sync",
manifestURL: window.location.origin + "/manifest.webapp",
pageURL: window.location.href });
}
function setMessageHandler() {
navigator.mozSetMessageHandler('request-sync', function(e) {
ok(true, "One event has been received!");
@ -85,6 +99,8 @@
runTests();
},
registerPage,
setMessageHandler,
test_register_oneShot,

View File

@ -20,6 +20,20 @@
}
}
function registerPage() {
var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('system_message_chrome_script.js'));
gScript.addMessageListener("page-registered", function pageRegisteredHandler() {
gScript.removeMessageListener("page-registered", pageRegisteredHandler);
gScript.destroy();
runTests();
});
gScript.sendAsyncMessage("trigger-register-page",
{ type: "request-sync",
manifestURL: window.location.origin + "/manifest.webapp",
pageURL: window.location.href });
}
function setMessageHandler() {
navigator.mozSetMessageHandler('request-sync', function(e) {
ok(true, "One event has been received!");
@ -146,6 +160,7 @@
runTests();
},
registerPage,
setMessageHandler,
test_register_oneShot,

View File

@ -187,18 +187,18 @@ DOMStorageDBThread::InsertDBOp(DOMStorageDBThread::DBOperation* aOperation)
// Sentinel to don't forget to delete the operation when we exit early.
nsAutoPtr<DOMStorageDBThread::DBOperation> opScope(aOperation);
if (mStopIOThread) {
// Thread use after shutdown demanded.
MOZ_ASSERT(false);
return NS_ERROR_NOT_INITIALIZED;
}
if (NS_FAILED(mStatus)) {
MonitorAutoUnlock unlock(mThreadObserver->GetMonitor());
aOperation->Finalize(mStatus);
return mStatus;
}
if (mStopIOThread) {
// Thread use after shutdown demanded.
MOZ_ASSERT(false);
return NS_ERROR_NOT_INITIALIZED;
}
switch (aOperation->Type()) {
case DBOperation::opPreload:
case DBOperation::opPreloadUrgent:

View File

@ -14,6 +14,12 @@ dictionary RTCIceServer {
DOMString? username = null;
};
enum RTCIceTransportPolicy {
"none",
"relay",
"all"
};
enum RTCBundlePolicy {
"balanced",
"max-compat",
@ -22,6 +28,7 @@ enum RTCBundlePolicy {
dictionary RTCConfiguration {
sequence<RTCIceServer> iceServers;
RTCIceTransportPolicy iceTransportPolicy = "all";
RTCBundlePolicy bundlePolicy = "balanced";
DOMString? peerIdentity = null;
sequence<RTCCertificate> certificates;

View File

@ -11,6 +11,7 @@ support-files =
[test_bug667087.js]
[test_cookies_async_failure.js]
[test_cookies_persistence.js]
skip-if = true # Bug 863738
[test_cookies_privatebrowsing.js]
[test_cookies_profile_close.js]
[test_cookies_read.js]

View File

@ -1060,6 +1060,20 @@ gfxPlatformFontList::SizeOfFontFamilyTableExcludingThis(
return n;
}
/*static*/ size_t
gfxPlatformFontList::SizeOfFontEntryTableExcludingThis(
const FontEntryTable& aTable,
MallocSizeOf aMallocSizeOf)
{
size_t n = aTable.ShallowSizeOfExcludingThis(aMallocSizeOf);
for (auto iter = aTable.ConstIter(); !iter.Done(); iter.Next()) {
// The font itself is counted by its owning family; here we only care
// about the names stored in the hashtable keys.
n += iter.Key().SizeOfExcludingThisIfUnshared(aMallocSizeOf);
}
return n;
}
void
gfxPlatformFontList::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const
@ -1076,25 +1090,12 @@ gfxPlatformFontList::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
SizeOfFontFamilyTableExcludingThis(mOtherFamilyNames, aMallocSizeOf);
if (mExtraNames) {
// For these two tables, the font itself is counted by its owning
// family; here we only care about the names stored in the hashtable
// keys.
aSizes->mFontListSize +=
mExtraNames->mFullnames.ShallowSizeOfExcludingThis(aMallocSizeOf);
for (auto iter = mExtraNames->mFullnames.ConstIter();
!iter.Done();
iter.Next()) {
aSizes->mFontListSize +=
iter.Key().SizeOfExcludingThisIfUnshared(aMallocSizeOf);
}
SizeOfFontEntryTableExcludingThis(mExtraNames->mFullnames,
aMallocSizeOf);
aSizes->mFontListSize +=
mExtraNames->mPostscriptNames.ShallowSizeOfExcludingThis(aMallocSizeOf);
for (auto iter = mExtraNames->mPostscriptNames.ConstIter();
!iter.Done();
iter.Next()) {
aSizes->mFontListSize +=
iter.Key().SizeOfExcludingThisIfUnshared(aMallocSizeOf);
}
SizeOfFontEntryTableExcludingThis(mExtraNames->mPostscriptNames,
aMallocSizeOf);
}
aSizes->mFontListSize +=

View File

@ -302,11 +302,15 @@ protected:
void RebuildLocalFonts();
typedef nsRefPtrHashtable<nsStringHashKey, gfxFontFamily> FontFamilyTable;
typedef nsRefPtrHashtable<nsStringHashKey, gfxFontEntry> FontEntryTable;
// used by memory reporter to accumulate sizes of family names in the table
static size_t
SizeOfFontFamilyTableExcludingThis(const FontFamilyTable& aTable,
mozilla::MallocSizeOf aMallocSizeOf);
static size_t
SizeOfFontEntryTableExcludingThis(const FontEntryTable& aTable,
mozilla::MallocSizeOf aMallocSizeOf);
// canonical family name ==> family entry (unique, one name per family entry)
FontFamilyTable mFontFamilies;
@ -328,10 +332,11 @@ protected:
struct ExtraNames {
ExtraNames() : mFullnames(64), mPostscriptNames(64) {}
// fullname ==> font entry (unique, one name per font entry)
nsRefPtrHashtable<nsStringHashKey, gfxFontEntry> mFullnames;
FontEntryTable mFullnames;
// Postscript name ==> font entry (unique, one name per font entry)
nsRefPtrHashtable<nsStringHashKey, gfxFontEntry> mPostscriptNames;
FontEntryTable mPostscriptNames;
};
nsAutoPtr<ExtraNames> mExtraNames;

View File

@ -1418,6 +1418,7 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
}
}
}
fragmentClip = fragmentClip.Intersect(aDirtyRect);
renderContext->
Clip(NSRectToSnappedRect(fragmentClip,
aForFrame->PresContext()->AppUnitsPerDevPixel(),

View File

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html><head>
<meta charset="utf-8">
<title>Testcase #2 for bug 1178575</title>
<style type="text/css">
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:20px;
}
div {
position: absolute;
left: 0;
right: 0;
box-shadow: 0 0 0 10px rgba(0, 255, 0, 0.5);
margin-top: 10px;
height: 40px;
}
span {
position: relative;
display: block;
overflow: hidden;
height: 100px;
}
</style>
</head>
<body><span><div></div><span></body></html>

View File

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html class="reftest-wait"><head>
<meta charset="utf-8">
<title>Testcase #2 for bug 1178575</title>
<style type="text/css">
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:20px;
}
div {
position: absolute;
left: 0;
right: 0;
box-shadow: 0 0 0 10px rgba(0, 255, 0, 0.5);
margin-top: 10px;
}
span {
position: relative;
display: block;
overflow: hidden;
height: 200px;
}
</style>
<script>
function tweak() {
document.querySelector('div').style.height = "40px";
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", tweak, false);
</script>
</head>
<body><span><div></div><span></body></html>

View File

@ -0,0 +1,22 @@
<!DOCTYPE HTML>
<html><head>
<meta charset="utf-8">
<title>Testcase for bug 1178575</title>
<style type="text/css">
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}
div {
position: absolute;
left: 0;
right: 0;
box-shadow: 0 0 0 10px rgba(0, 255, 0, 0.5);
margin-top: 10px;
height: 3em;
}
</style>
</head>
<body><div></div></body></html>

View File

@ -0,0 +1,28 @@
<!DOCTYPE HTML>
<html class="reftest-wait"><head>
<meta charset="utf-8">
<title>Testcase for bug 1178575</title>
<style type="text/css">
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}
div {
position: absolute;
left: 0;
right: 0;
box-shadow: 0 0 0 10px rgba(0, 255, 0, 0.5);
margin-top: 10px;
}
</style>
<script>
function tweak() {
document.querySelector('div').style.height = "3em";
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", tweak, false);
</script>
</head>
<body><div></div></body></html>

View File

@ -29,3 +29,5 @@ fails-if(B2G||Mulet) == 611574-1.html 611574-1-ref.html # Initial mulet triage:
fails-if(B2G||Mulet) == 611574-2.html 611574-2-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
fuzzy-if(winWidget,5,30) == fieldset.html fieldset-ref.html # minor anti-aliasing problem on Windows
fuzzy-if(winWidget,5,30) == fieldset-inset.html fieldset-inset-ref.html # minor anti-aliasing problem on Windows
== 1178575.html 1178575-ref.html
== 1178575-2.html 1178575-2-ref.html

View File

@ -381,9 +381,10 @@ RefPtr<NrIceCtx> NrIceCtx::Create(const std::string& name,
bool set_interface_priorities,
bool allow_loopback,
bool tcp_enabled,
bool allow_link_local) {
bool allow_link_local,
Policy policy) {
RefPtr<NrIceCtx> ctx = new NrIceCtx(name, offerer);
RefPtr<NrIceCtx> ctx = new NrIceCtx(name, offerer, policy);
// Initialize the crypto callbacks and logging stuff
if (!initialized) {
@ -485,6 +486,9 @@ RefPtr<NrIceCtx> NrIceCtx::Create(const std::string& name,
UINT4 flags = offerer ? NR_ICE_CTX_FLAGS_OFFERER:
NR_ICE_CTX_FLAGS_ANSWERER;
flags |= NR_ICE_CTX_FLAGS_AGGRESSIVE_NOMINATION;
if (policy == ICE_POLICY_RELAY) {
flags |= NR_ICE_CTX_FLAGS_RELAY_ONLY;
}
r = nr_ice_ctx_create(const_cast<char *>(name.c_str()), flags,
&ctx->ctx_);
@ -609,6 +613,11 @@ NrIceCtx::Controlling NrIceCtx::GetControlling() {
return (peer_->controlling) ? ICE_CONTROLLING : ICE_CONTROLLED;
}
nsresult NrIceCtx::SetPolicy(Policy policy) {
policy_ = policy;
return NS_OK;
}
nsresult NrIceCtx::SetStunServers(const std::vector<NrIceStunServer>&
stun_servers) {
if (stun_servers.empty())
@ -714,6 +723,9 @@ abort:
nsresult NrIceCtx::StartGathering() {
ASSERT_ON_THREAD(sts_target_);
if (policy_ == ICE_POLICY_NONE) {
return NS_OK;
}
SetGatheringState(ICE_CTX_GATHER_STARTED);
// This might start gathering for the first time, or again after
// renegotiation, or might do nothing at all if gathering has already
@ -788,6 +800,11 @@ nsresult NrIceCtx::ParseGlobalAttributes(std::vector<std::string> attrs) {
nsresult NrIceCtx::StartChecks() {
int r;
if (policy_ == ICE_POLICY_NONE) {
MOZ_MTLOG(ML_ERROR, "Couldn't start peer checks because policy == none");
SetConnectionState(ICE_CTX_FAILED);
return NS_ERROR_FAILURE;
}
r=nr_ice_peer_ctx_pair_candidates(peer_);
if (r) {
MOZ_MTLOG(ML_ERROR, "Couldn't pair candidates on "

View File

@ -208,12 +208,18 @@ class NrIceCtx {
ICE_CONTROLLED
};
enum Policy { ICE_POLICY_NONE,
ICE_POLICY_RELAY,
ICE_POLICY_ALL
};
static RefPtr<NrIceCtx> Create(const std::string& name,
bool offerer,
bool set_interface_priorities = true,
bool allow_loopback = false,
bool tcp_enabled = true,
bool allow_link_local = false);
bool allow_link_local = false,
Policy policy = ICE_POLICY_ALL);
// Deinitialize all ICE global state. Used only for testing.
static void internal_DeinitializeGlobal();
@ -272,6 +278,14 @@ class NrIceCtx {
Controlling GetControlling();
// Set whether we're allowed to produce none, relay or all candidates.
// TODO(jib@mozilla.com): Work out what change means mid-connection (1181768)
nsresult SetPolicy(Policy policy);
Policy policy() const {
return policy_;
}
// Set the STUN servers. Must be called before StartGathering
// (if at all).
nsresult SetStunServers(const std::vector<NrIceStunServer>& stun_servers);
@ -315,7 +329,8 @@ class NrIceCtx {
private:
NrIceCtx(const std::string& name,
bool offerer)
bool offerer,
Policy policy)
: connection_state_(ICE_CTX_INIT),
gathering_state_(ICE_CTX_GATHER_INIT),
name_(name),
@ -325,7 +340,8 @@ class NrIceCtx {
peer_(nullptr),
ice_handler_vtbl_(nullptr),
ice_handler_(nullptr),
trickle_(true) {
trickle_(true),
policy_(policy) {
// XXX: offerer_ will be used eventually; placate clang in the meantime.
(void)offerer_;
}
@ -371,6 +387,7 @@ class NrIceCtx {
nr_ice_handler* ice_handler_; // Must be pointer
bool trickle_;
nsCOMPtr<nsIEventTarget> sts_target_; // The thread to run on
Policy policy_;
};

View File

@ -504,7 +504,8 @@ int main(int argc, char **argv)
std::string dummy("dummy");
RUN_ON_THREAD(test_utils->sts_target(),
WrapRunnableNM(&NrIceCtx::Create,
dummy, false, false, false, false, false),
dummy, false, false, false, false, false,
NrIceCtx::ICE_POLICY_ALL),
NS_DISPATCH_SYNC);
// Start the tests

View File

@ -134,6 +134,7 @@ static int nr_ice_candidate_format_stun_label(char *label, size_t size, nr_ice_c
int nr_ice_candidate_create(nr_ice_ctx *ctx,nr_ice_component *comp,nr_ice_socket *isock, nr_socket *osock, nr_ice_candidate_type ctype, nr_socket_tcp_type tcp_type, nr_ice_stun_server *stun_server, UCHAR component_id, nr_ice_candidate **candp)
{
assert(!(ctx->flags & NR_ICE_CTX_FLAGS_RELAY_ONLY) || ctype == RELAYED);
nr_ice_candidate *cand=0;
nr_ice_candidate *tmp=0;
int r,_status;
@ -921,6 +922,7 @@ int nr_ice_format_candidate_attribute(nr_ice_candidate *cand, char *attr, int ma
char addr[64];
int port;
int len;
nr_transport_addr *raddr;
assert(!strcmp(nr_ice_candidate_type_names[HOST], "host"));
assert(!strcmp(nr_ice_candidate_type_names[RELAYED], "relay"));
@ -939,23 +941,26 @@ int nr_ice_format_candidate_attribute(nr_ice_candidate *cand, char *attr, int ma
len=strlen(attr); attr+=len; maxlen-=len;
/* raddr, rport */
raddr = (cand->stream->ctx->flags & NR_ICE_CTX_FLAGS_RELAY_ONLY) ?
&cand->addr : &cand->base;
switch(cand->type){
case HOST:
break;
case SERVER_REFLEXIVE:
case PEER_REFLEXIVE:
if(r=nr_transport_addr_get_addrstring(&cand->base,addr,sizeof(addr)))
if(r=nr_transport_addr_get_addrstring(raddr,addr,sizeof(addr)))
ABORT(r);
if(r=nr_transport_addr_get_port(&cand->base,&port))
if(r=nr_transport_addr_get_port(raddr,&port))
ABORT(r);
snprintf(attr,maxlen," raddr %s rport %d",addr,port);
break;
case RELAYED:
// comes from XorMappedAddress via AllocateResponse
if(r=nr_transport_addr_get_addrstring(&cand->base,addr,sizeof(addr)))
if(r=nr_transport_addr_get_addrstring(raddr,addr,sizeof(addr)))
ABORT(r);
if(r=nr_transport_addr_get_port(&cand->base,&port))
if(r=nr_transport_addr_get_port(raddr,&port))
ABORT(r);
snprintf(attr,maxlen," raddr %s rport %d",addr,port);

View File

@ -260,7 +260,12 @@ static void nr_ice_candidate_pair_stun_cb(NR_SOCKET s, int how, void *cb_arg)
}
/* OK, nothing found, must be peer reflexive */
if(!cand){
if(!cand) {
if (pair->pctx->ctx->flags & NR_ICE_CTX_FLAGS_RELAY_ONLY) {
/* Any STUN response with a reflexive address in it is unwanted
when we'll send on relay only. Bail since cand is used below. */
goto done;
}
if(r=nr_ice_candidate_create(pair->pctx->ctx,
pair->local->component,pair->local->isock,pair->local->osock,
PEER_REFLEXIVE,pair->local->tcp_type,0,pair->local->component->component_id,&cand))

View File

@ -226,53 +226,59 @@ static int nr_ice_component_initialize_udp(struct nr_ice_ctx_ *ctx,nr_ice_compon
if(r=nr_ice_socket_create(ctx,component,sock,NR_ICE_SOCKET_TYPE_DGRAM,&isock))
ABORT(r);
/* Create one host candidate */
if(r=nr_ice_candidate_create(ctx,component,isock,sock,HOST,0,0,
component->component_id,&cand))
ABORT(r);
TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
component->candidate_ct++;
cand=0;
/* And a srvrflx candidate for each STUN server */
for(j=0;j<ctx->stun_server_ct;j++){
/* Skip non-UDP */
if(ctx->stun_servers[j].transport!=IPPROTO_UDP)
continue;
if(r=nr_ice_candidate_create(ctx,component,
isock,sock,SERVER_REFLEXIVE,0,
&ctx->stun_servers[j],component->component_id,&cand))
if (!(ctx->flags & NR_ICE_CTX_FLAGS_RELAY_ONLY)) {
/* Create one host candidate */
if(r=nr_ice_candidate_create(ctx,component,isock,sock,HOST,0,0,
component->component_id,&cand))
ABORT(r);
TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
component->candidate_ct++;
cand=0;
/* And a srvrflx candidate for each STUN server */
for(j=0;j<ctx->stun_server_ct;j++){
/* Skip non-UDP */
if(ctx->stun_servers[j].transport!=IPPROTO_UDP)
continue;
if(r=nr_ice_candidate_create(ctx,component,
isock,sock,SERVER_REFLEXIVE,0,
&ctx->stun_servers[j],component->component_id,&cand))
ABORT(r);
TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
component->candidate_ct++;
cand=0;
}
}
#ifdef USE_TURN
/* And both a srvrflx and relayed candidate for each TURN server */
/* And both a srvrflx and relayed candidate for each TURN server (unless
we're in relay-only mode, in which case just the relayed one) */
for(j=0;j<ctx->turn_server_ct;j++){
nr_socket *turn_sock;
nr_ice_candidate *srvflx_cand;
nr_ice_candidate *srvflx_cand=0;
/* Skip non-UDP */
if (ctx->turn_servers[j].turn_server.transport != IPPROTO_UDP)
continue;
/* srvrflx */
if(r=nr_ice_candidate_create(ctx,component,
isock,sock,SERVER_REFLEXIVE,0,
&ctx->turn_servers[j].turn_server,component->component_id,&cand))
ABORT(r);
cand->state=NR_ICE_CAND_STATE_INITIALIZING; /* Don't start */
cand->done_cb=nr_ice_gather_finished_cb;
cand->cb_arg=cand;
TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
component->candidate_ct++;
srvflx_cand=cand;
if (!(ctx->flags & NR_ICE_CTX_FLAGS_RELAY_ONLY)) {
/* srvrflx */
if(r=nr_ice_candidate_create(ctx,component,
isock,sock,SERVER_REFLEXIVE,0,
&ctx->turn_servers[j].turn_server,component->component_id,&cand))
ABORT(r);
cand->state=NR_ICE_CAND_STATE_INITIALIZING; /* Don't start */
cand->done_cb=nr_ice_gather_finished_cb;
cand->cb_arg=cand;
TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
component->candidate_ct++;
srvflx_cand=cand;
cand=0;
}
/* relayed*/
if(r=nr_socket_turn_create(sock, &turn_sock))
ABORT(r);
@ -408,6 +414,9 @@ static int nr_ice_component_initialize_tcp(struct nr_ice_ctx_ *ctx,nr_ice_compon
if (r != R_NOT_FOUND)
ABORT(r);
}
if (ctx->flags & NR_ICE_CTX_FLAGS_RELAY_ONLY) {
ice_tcp_disabled = 1;
}
for(i=0;i<addr_ct;i++){
char suppress;

View File

@ -157,6 +157,7 @@ int nr_ice_ctx_create(char *label, UINT4 flags, nr_ice_ctx **ctxp);
#define NR_ICE_CTX_FLAGS_ANSWERER (1<<1)
#define NR_ICE_CTX_FLAGS_AGGRESSIVE_NOMINATION (1<<2)
#define NR_ICE_CTX_FLAGS_LITE (1<<3)
#define NR_ICE_CTX_FLAGS_RELAY_ONLY (1<<4)
int nr_ice_ctx_destroy(nr_ice_ctx **ctxp);
int nr_ice_gather(nr_ice_ctx *ctx, NR_async_cb done_cb, void *cb_arg);

View File

@ -522,6 +522,20 @@ PeerConnectionConfiguration::Init(const RTCConfiguration& aSrc)
default:
MOZ_CRASH();
}
switch (aSrc.mIceTransportPolicy) {
case dom::RTCIceTransportPolicy::None:
setIceTransportPolicy(NrIceCtx::ICE_POLICY_NONE);
break;
case dom::RTCIceTransportPolicy::Relay:
setIceTransportPolicy(NrIceCtx::ICE_POLICY_RELAY);
break;
case dom::RTCIceTransportPolicy::All:
setIceTransportPolicy(NrIceCtx::ICE_POLICY_ALL);
break;
default:
MOZ_CRASH();
}
return NS_OK;
}
@ -738,7 +752,8 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
// Initialize the media object.
res = mMedia->Init(aConfiguration.getStunServers(),
aConfiguration.getTurnServers());
aConfiguration.getTurnServers(),
aConfiguration.getIceTransportPolicy());
if (NS_FAILED(res)) {
CSFLogError(logTag, "%s: Couldn't initialize media object", __FUNCTION__);
return res;

View File

@ -149,7 +149,9 @@ class PCUuidGenerator : public mozilla::JsepUuidGenerator {
class PeerConnectionConfiguration
{
public:
PeerConnectionConfiguration() : mBundlePolicy(kBundleBalanced) {}
PeerConnectionConfiguration()
: mBundlePolicy(kBundleBalanced),
mIceTransportPolicy(NrIceCtx::ICE_POLICY_ALL) {}
bool addStunServer(const std::string& addr, uint16_t port,
const char* transport)
@ -186,6 +188,8 @@ public:
const std::vector<NrIceTurnServer>& getTurnServers() const { return mTurnServers; }
void setBundlePolicy(JsepBundlePolicy policy) { mBundlePolicy = policy;}
JsepBundlePolicy getBundlePolicy() const { return mBundlePolicy; }
void setIceTransportPolicy(NrIceCtx::Policy policy) { mIceTransportPolicy = policy;}
NrIceCtx::Policy getIceTransportPolicy() const { return mIceTransportPolicy; }
#ifndef MOZILLA_EXTERNAL_LINKAGE
nsresult Init(const RTCConfiguration& aSrc);
@ -196,6 +200,7 @@ private:
std::vector<NrIceStunServer> mStunServers;
std::vector<NrIceTurnServer> mTurnServers;
JsepBundlePolicy mBundlePolicy;
NrIceCtx::Policy mIceTransportPolicy;
};
#if !defined(MOZILLA_EXTERNAL_LINKAGE)

View File

@ -230,7 +230,8 @@ PeerConnectionMedia::PeerConnectionMedia(PeerConnectionImpl *parent)
}
nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_servers,
const std::vector<NrIceTurnServer>& turn_servers)
const std::vector<NrIceTurnServer>& turn_servers,
NrIceCtx::Policy policy)
{
nsresult rv;
#if defined(MOZILLA_XPCOMRT_API)
@ -314,7 +315,8 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
true, // Explicitly set priorities
mParent->GetAllowIceLoopback(),
ice_tcp,
mParent->GetAllowIceLinkLocal());
mParent->GetAllowIceLinkLocal(),
policy);
if(!mIceCtx) {
CSFLogError(logTag, "%s: Failed to create Ice Context", __FUNCTION__);
return NS_ERROR_FAILURE;

View File

@ -228,7 +228,8 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
PeerConnectionImpl* GetPC() { return mParent; }
nsresult Init(const std::vector<NrIceStunServer>& stun_servers,
const std::vector<NrIceTurnServer>& turn_servers);
const std::vector<NrIceTurnServer>& turn_servers,
NrIceCtx::Policy policy);
// WARNING: This destroys the object!
void SelfDestruct();

View File

@ -6782,7 +6782,7 @@ _recalloc(void *ptr, size_t count, size_t size)
* trailing bytes.
*/
ptr = realloc(ptr, newsize);
ptr = realloc_impl(ptr, newsize);
if (ptr != NULL && oldsize < newsize) {
memset((void *)((uintptr_t)ptr + oldsize), 0, newsize -
oldsize);

View File

@ -20,8 +20,8 @@ import java.util.UUID;
import java.util.regex.Pattern;
import org.json.JSONObject;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.util.ThreadUtils;
import android.content.BroadcastReceiver;
@ -54,11 +54,11 @@ public final class ANRReporter extends BroadcastReceiver
private Handler mHandler;
private volatile boolean mPendingANR;
@WrapElementForJNI
@WrapForJNI
private static native boolean requestNativeStack(boolean unwind);
@WrapElementForJNI
@WrapForJNI
private static native String getNativeStack();
@WrapElementForJNI
@WrapForJNI
private static native void releaseNativeStack();
public static void register(Context context) {

View File

@ -5,11 +5,11 @@
package org.mozilla.gecko;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.util.NativeEventListener;
import org.mozilla.gecko.util.NativeJSObject;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import java.io.File;
import java.lang.IllegalArgumentException;
@ -108,7 +108,7 @@ public class DownloadsIntegration implements NativeEventListener
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT == state);
}
@WrapElementForJNI
@WrapForJNI
public static void scanMedia(final String aFile, String aMimeType) {
String mimeType = aMimeType;
if (UNKNOWN_MIME_TYPES.contains(mimeType)) {

View File

@ -30,6 +30,7 @@ import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.favicons.Favicons;
@ -41,7 +42,6 @@ import org.mozilla.gecko.mozglue.ContextUtils;
import org.mozilla.gecko.mozglue.GeckoLoader;
import org.mozilla.gecko.mozglue.JNITarget;
import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.overlays.ui.ShareDialog;
import org.mozilla.gecko.prompts.PromptService;
import org.mozilla.gecko.util.EventCallback;
@ -461,19 +461,19 @@ public class GeckoAppShell
* The Gecko-side API: API methods that Gecko calls
*/
@WrapElementForJNI(allowMultithread = true, noThrow = true)
@WrapForJNI(allowMultithread = true, noThrow = true)
public static void handleUncaughtException(Thread thread, Throwable e) {
CRASH_HANDLER.uncaughtException(thread, e);
}
@WrapElementForJNI
@WrapForJNI
public static void notifyIME(int type) {
if (editableListener != null) {
editableListener.notifyIME(type);
}
}
@WrapElementForJNI
@WrapForJNI
public static void notifyIMEContext(int state, String typeHint,
String modeHint, String actionHint) {
if (editableListener != null) {
@ -482,7 +482,7 @@ public class GeckoAppShell
}
}
@WrapElementForJNI
@WrapForJNI
public static void notifyIMEChange(String text, int start, int end, int newEnd) {
if (newEnd < 0) { // Selection change
editableListener.onSelectionChange(start, end);
@ -534,7 +534,7 @@ public class GeckoAppShell
}
// Signal the Java thread that it's time to wake up
@WrapElementForJNI
@WrapForJNI
public static void acknowledgeEvent() {
synchronized (sEventAckLock) {
sWaitingForEventAck = false;
@ -555,7 +555,7 @@ public class GeckoAppShell
private static native long runUiThreadCallback();
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
private static void requestUiThreadCallback(long delay) {
ThreadUtils.getUiHandler().postDelayed(sCallbackRunnable, delay);
}
@ -591,7 +591,7 @@ public class GeckoAppShell
return lastKnownLocation;
}
@WrapElementForJNI
@WrapForJNI
public static void enableLocation(final boolean enable) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -647,12 +647,12 @@ public class GeckoAppShell
}
}
@WrapElementForJNI
@WrapForJNI
public static void enableLocationHighAccuracy(final boolean enable) {
locationHighAccuracyEnabled = enable;
}
@WrapElementForJNI
@WrapForJNI
public static void enableSensor(int aSensortype) {
GeckoInterface gi = getGeckoInterface();
if (gi == null)
@ -722,7 +722,7 @@ public class GeckoAppShell
}
}
@WrapElementForJNI
@WrapForJNI
public static void disableSensor(int aSensortype) {
GeckoInterface gi = getGeckoInterface();
if (gi == null)
@ -776,7 +776,7 @@ public class GeckoAppShell
}
}
@WrapElementForJNI
@WrapForJNI
public static void startMonitoringGamepad() {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -786,7 +786,7 @@ public class GeckoAppShell
});
}
@WrapElementForJNI
@WrapForJNI
public static void stopMonitoringGamepad() {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -796,7 +796,7 @@ public class GeckoAppShell
});
}
@WrapElementForJNI
@WrapForJNI
public static void gamepadAdded(final int device_id, final int service_id) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -806,20 +806,20 @@ public class GeckoAppShell
});
}
@WrapElementForJNI
@WrapForJNI
public static void moveTaskToBack() {
if (getGeckoInterface() != null)
getGeckoInterface().getActivity().moveTaskToBack(true);
}
@WrapElementForJNI
@WrapForJNI
static void scheduleRestart() {
getGeckoInterface().doRestart();
}
// Creates a homescreen shortcut for a web page.
// This is the entry point from nsIShellService.
@WrapElementForJNI
@WrapForJNI
static void createShortcut(final String aTitle, final String aURI, final String aIconData) {
// We have the favicon data (base64) decoded on the background thread, callback here, then
// call the other createShortcut method with the decoded favicon.
@ -943,7 +943,7 @@ public class GeckoAppShell
return bitmap;
}
@WrapElementForJNI(stubName = "GetHandlersForMimeTypeWrapper")
@WrapForJNI(stubName = "GetHandlersForMimeTypeWrapper")
static String[] getHandlersForMimeType(String aMimeType, String aAction) {
Intent intent = getIntentForActionString(aAction);
if (aMimeType != null && aMimeType.length() > 0)
@ -951,7 +951,7 @@ public class GeckoAppShell
return getHandlersForIntent(intent);
}
@WrapElementForJNI(stubName = "GetHandlersForURLWrapper")
@WrapForJNI(stubName = "GetHandlersForURLWrapper")
static String[] getHandlersForURL(String aURL, String aAction) {
// aURL may contain the whole URL or just the protocol
Uri uri = aURL.indexOf(':') >= 0 ? Uri.parse(aURL) : new Uri.Builder().scheme(aURL).build();
@ -962,12 +962,12 @@ public class GeckoAppShell
return getHandlersForIntent(intent);
}
@WrapElementForJNI(stubName = "GetHWEncoderCapability")
@WrapForJNI(stubName = "GetHWEncoderCapability")
static boolean getHWEncoderCapability() {
return HardwareCodecCapabilityUtils.getHWEncoderCapability();
}
@WrapElementForJNI(stubName = "GetHWDecoderCapability")
@WrapForJNI(stubName = "GetHWDecoderCapability")
static boolean getHWDecoderCapability() {
return HardwareCodecCapabilityUtils.getHWDecoderCapability();
}
@ -1028,12 +1028,12 @@ public class GeckoAppShell
return new Intent(aAction);
}
@WrapElementForJNI(stubName = "GetExtensionFromMimeTypeWrapper")
@WrapForJNI(stubName = "GetExtensionFromMimeTypeWrapper")
static String getExtensionFromMimeType(String aMimeType) {
return MimeTypeMap.getSingleton().getExtensionFromMimeType(aMimeType);
}
@WrapElementForJNI(stubName = "GetMimeTypeFromExtensionsWrapper")
@WrapForJNI(stubName = "GetMimeTypeFromExtensionsWrapper")
static String getMimeTypeFromExtensions(String aFileExt) {
StringTokenizer st = new StringTokenizer(aFileExt, ".,; ");
String type = null;
@ -1094,7 +1094,7 @@ public class GeckoAppShell
* @param title the title to use in <code>ACTION_SEND</code> intents.
* @return true if the activity started successfully; false otherwise.
*/
@WrapElementForJNI
@WrapForJNI
public static boolean openUriExternal(String targetURI,
String mimeType,
String packageName,
@ -1382,7 +1382,7 @@ public class GeckoAppShell
}
}
@WrapElementForJNI(stubName = "ShowAlertNotificationWrapper")
@WrapForJNI(stubName = "ShowAlertNotificationWrapper")
public static void showAlertNotification(String aImageUrl, String aAlertTitle, String aAlertText,
String aAlertCookie, String aAlertName) {
// The intent to launch when the user clicks the expanded notification
@ -1409,13 +1409,13 @@ public class GeckoAppShell
notificationClient.add(notificationID, aImageUrl, aAlertTitle, aAlertText, contentIntent);
}
@WrapElementForJNI
@WrapForJNI
public static void alertsProgressListener_OnProgress(String aAlertName, long aProgress, long aProgressMax, String aAlertText) {
int notificationID = aAlertName.hashCode();
notificationClient.update(notificationID, aProgress, aProgressMax, aAlertText);
}
@WrapElementForJNI
@WrapForJNI
public static void closeNotification(String aAlertName) {
String alertCookie = ALERT_COOKIES.get(aAlertName);
if (alertCookie != null) {
@ -1443,7 +1443,7 @@ public class GeckoAppShell
closeNotification(aAlertName);
}
@WrapElementForJNI(stubName = "GetDpiWrapper")
@WrapForJNI(stubName = "GetDpiWrapper")
public static int getDpi() {
if (sDensityDpi == 0) {
sDensityDpi = getContext().getResources().getDisplayMetrics().densityDpi;
@ -1452,7 +1452,7 @@ public class GeckoAppShell
return sDensityDpi;
}
@WrapElementForJNI
@WrapForJNI
public static float getDensity() {
return getContext().getResources().getDisplayMetrics().density;
}
@ -1465,7 +1465,7 @@ public class GeckoAppShell
* Returns the colour depth of the default screen. This will either be
* 24 or 16.
*/
@WrapElementForJNI(stubName = "GetScreenDepthWrapper")
@WrapForJNI(stubName = "GetScreenDepthWrapper")
public static synchronized int getScreenDepth() {
if (sScreenDepth == 0) {
sScreenDepth = 16;
@ -1488,13 +1488,13 @@ public class GeckoAppShell
sScreenDepth = aScreenDepth;
}
@WrapElementForJNI
@WrapForJNI
public static void setFullScreen(boolean fullscreen) {
if (getGeckoInterface() != null)
getGeckoInterface().setFullScreen(fullscreen);
}
@WrapElementForJNI
@WrapForJNI
public static void performHapticFeedback(boolean aIsLongPress) {
// Don't perform haptic feedback if a vibration is currently playing,
// because the haptic feedback will nuke the vibration.
@ -1527,14 +1527,14 @@ public class GeckoAppShell
}
}
@WrapElementForJNI(stubName = "Vibrate1")
@WrapForJNI(stubName = "Vibrate1")
public static void vibrate(long milliseconds) {
sVibrationEndTime = System.nanoTime() + milliseconds * 1000000;
sVibrationMaybePlaying = true;
vibrator().vibrate(milliseconds);
}
@WrapElementForJNI(stubName = "VibrateA")
@WrapForJNI(stubName = "VibrateA")
public static void vibrate(long[] pattern, int repeat) {
// If pattern.length is even, the last element in the pattern is a
// meaningless delay, so don't include it in vibrationDuration.
@ -1549,21 +1549,21 @@ public class GeckoAppShell
vibrator().vibrate(pattern, repeat);
}
@WrapElementForJNI
@WrapForJNI
public static void cancelVibrate() {
sVibrationMaybePlaying = false;
sVibrationEndTime = 0;
vibrator().cancel();
}
@WrapElementForJNI
@WrapForJNI
public static void showInputMethodPicker() {
InputMethodManager imm = (InputMethodManager)
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();
}
@WrapElementForJNI
@WrapForJNI
public static void setKeepScreenOn(final boolean on) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -1573,7 +1573,7 @@ public class GeckoAppShell
});
}
@WrapElementForJNI
@WrapForJNI
public static void notifyDefaultPrevented(final boolean defaultPrevented) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -1587,7 +1587,7 @@ public class GeckoAppShell
});
}
@WrapElementForJNI
@WrapForJNI
public static boolean isNetworkLinkUp() {
ConnectivityManager cm = (ConnectivityManager)
getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
@ -1601,7 +1601,7 @@ public class GeckoAppShell
return true;
}
@WrapElementForJNI
@WrapForJNI
public static boolean isNetworkLinkKnown() {
ConnectivityManager cm = (ConnectivityManager)
getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
@ -1614,7 +1614,7 @@ public class GeckoAppShell
return true;
}
@WrapElementForJNI
@WrapForJNI
public static int networkLinkType() {
ConnectivityManager cm = (ConnectivityManager)
getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
@ -1673,7 +1673,7 @@ public class GeckoAppShell
}
}
@WrapElementForJNI(stubName = "GetSystemColoursWrapper")
@WrapForJNI(stubName = "GetSystemColoursWrapper")
public static int[] getSystemColors() {
// attrsAppearance[] must correspond to AndroidSystemColors structure in android/AndroidBridge.h
final int[] attrsAppearance = {
@ -1710,7 +1710,7 @@ public class GeckoAppShell
return result;
}
@WrapElementForJNI
@WrapForJNI
public static void killAnyZombies() {
GeckoProcessesVisitor visitor = new GeckoProcessesVisitor() {
@Override
@ -1840,7 +1840,7 @@ public class GeckoAppShell
} catch (Exception e) { }
}
@WrapElementForJNI(stubName = "GetIconForExtensionWrapper")
@WrapForJNI(stubName = "GetIconForExtensionWrapper")
public static byte[] getIconForExtension(String aExt, int iconSize) {
try {
if (iconSize <= 0)
@ -1898,7 +1898,7 @@ public class GeckoAppShell
return activityInfo.loadIcon(pm);
}
@WrapElementForJNI
@WrapForJNI
public static boolean getShowPasswordSetting() {
try {
int showPassword =
@ -1911,7 +1911,7 @@ public class GeckoAppShell
}
}
@WrapElementForJNI(stubName = "AddPluginViewWrapper")
@WrapForJNI(stubName = "AddPluginViewWrapper")
public static void addPluginView(View view,
float x, float y,
float w, float h,
@ -1920,7 +1920,7 @@ public class GeckoAppShell
getGeckoInterface().addPluginView(view, new RectF(x, y, x + w, y + h), isFullScreen);
}
@WrapElementForJNI
@WrapForJNI
public static void removePluginView(View view, boolean isFullScreen) {
if (getGeckoInterface() != null)
getGeckoInterface().removePluginView(view, isFullScreen);
@ -2126,7 +2126,7 @@ public class GeckoAppShell
return pluginCL.loadClass(className);
}
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public static Class<?> loadPluginClass(String className, String libName) {
if (getGeckoInterface() == null)
return null;
@ -2146,7 +2146,7 @@ public class GeckoAppShell
private static ContextGetter sContextGetter;
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public static Context getContext() {
return sContextGetter.getContext();
}
@ -2210,7 +2210,7 @@ public class GeckoAppShell
static byte[] sCameraBuffer;
@WrapElementForJNI(stubName = "InitCameraWrapper")
@WrapForJNI(stubName = "InitCameraWrapper")
static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -2304,7 +2304,7 @@ public class GeckoAppShell
return result;
}
@WrapElementForJNI
@WrapForJNI
static synchronized void closeCamera() {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -2326,33 +2326,33 @@ public class GeckoAppShell
/*
* Battery API related methods.
*/
@WrapElementForJNI
@WrapForJNI
public static void enableBatteryNotifications() {
GeckoBatteryManager.enableNotifications();
}
@WrapElementForJNI(stubName = "HandleGeckoMessageWrapper")
@WrapForJNI(stubName = "HandleGeckoMessageWrapper")
public static void handleGeckoMessage(final NativeJSContainer message) {
EventDispatcher.getInstance().dispatchEvent(message);
message.disposeNative();
}
@WrapElementForJNI
@WrapForJNI
public static void disableBatteryNotifications() {
GeckoBatteryManager.disableNotifications();
}
@WrapElementForJNI(stubName = "GetCurrentBatteryInformationWrapper")
@WrapForJNI(stubName = "GetCurrentBatteryInformationWrapper")
public static double[] getCurrentBatteryInformation() {
return GeckoBatteryManager.getCurrentInformation();
}
@WrapElementForJNI(stubName = "CheckURIVisited")
@WrapForJNI(stubName = "CheckURIVisited")
static void checkUriVisited(String uri) {
GlobalHistory.getInstance().checkUriVisited(uri);
}
@WrapElementForJNI(stubName = "MarkURIVisited")
@WrapForJNI(stubName = "MarkURIVisited")
static void markUriVisited(final String uri) {
final Context context = getContext();
final BrowserDB db = GeckoProfile.get(context).getDB();
@ -2364,7 +2364,7 @@ public class GeckoAppShell
});
}
@WrapElementForJNI(stubName = "SetURITitle")
@WrapForJNI(stubName = "SetURITitle")
static void setUriTitle(final String uri, final String title) {
final Context context = getContext();
final BrowserDB db = GeckoProfile.get(context).getDB();
@ -2376,7 +2376,7 @@ public class GeckoAppShell
});
}
@WrapElementForJNI
@WrapForJNI
static void hideProgressDialog() {
// unused stub
}
@ -2384,7 +2384,7 @@ public class GeckoAppShell
/*
* WebSMS related methods.
*/
@WrapElementForJNI(stubName = "SendMessageWrapper")
@WrapForJNI(stubName = "SendMessageWrapper")
public static void sendMessage(String aNumber, String aMessage, int aRequestId) {
if (!SmsManager.isEnabled()) {
return;
@ -2393,7 +2393,7 @@ public class GeckoAppShell
SmsManager.getInstance().send(aNumber, aMessage, aRequestId);
}
@WrapElementForJNI(stubName = "GetMessageWrapper")
@WrapForJNI(stubName = "GetMessageWrapper")
public static void getMessage(int aMessageId, int aRequestId) {
if (!SmsManager.isEnabled()) {
return;
@ -2402,7 +2402,7 @@ public class GeckoAppShell
SmsManager.getInstance().getMessage(aMessageId, aRequestId);
}
@WrapElementForJNI(stubName = "DeleteMessageWrapper")
@WrapForJNI(stubName = "DeleteMessageWrapper")
public static void deleteMessage(int aMessageId, int aRequestId) {
if (!SmsManager.isEnabled()) {
return;
@ -2411,7 +2411,7 @@ public class GeckoAppShell
SmsManager.getInstance().deleteMessage(aMessageId, aRequestId);
}
@WrapElementForJNI(stubName = "CreateMessageListWrapper")
@WrapForJNI(stubName = "CreateMessageListWrapper")
public static void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, long aThreadId, boolean aReverse, int aRequestId) {
if (!SmsManager.isEnabled()) {
return;
@ -2420,7 +2420,7 @@ public class GeckoAppShell
SmsManager.getInstance().createMessageList(aStartDate, aEndDate, aNumbers, aNumbersCount, aDelivery, aHasRead, aRead, aThreadId, aReverse, aRequestId);
}
@WrapElementForJNI(stubName = "GetNextMessageInListWrapper")
@WrapForJNI(stubName = "GetNextMessageInListWrapper")
public static void getNextMessageInList(int aListId, int aRequestId) {
if (!SmsManager.isEnabled()) {
return;
@ -2429,7 +2429,7 @@ public class GeckoAppShell
SmsManager.getInstance().getNextMessageInList(aListId, aRequestId);
}
@WrapElementForJNI
@WrapForJNI
public static void clearMessageList(int aListId) {
if (!SmsManager.isEnabled()) {
return;
@ -2439,7 +2439,7 @@ public class GeckoAppShell
}
/* Called by JNI from AndroidBridge, and by reflection from tests/BaseTest.java.in */
@WrapElementForJNI
@WrapForJNI
@RobocopTarget
public static boolean isTablet() {
return HardwareUtils.isTablet();
@ -2453,12 +2453,12 @@ public class GeckoAppShell
}
}
@WrapElementForJNI(stubName = "GetCurrentNetworkInformationWrapper")
@WrapForJNI(stubName = "GetCurrentNetworkInformationWrapper")
public static double[] getCurrentNetworkInformation() {
return GeckoNetworkManager.getInstance().getCurrentInformation();
}
@WrapElementForJNI
@WrapForJNI
public static void enableNetworkNotifications() {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -2468,7 +2468,7 @@ public class GeckoAppShell
});
}
@WrapElementForJNI
@WrapForJNI
public static void disableNetworkNotifications() {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -2478,32 +2478,32 @@ public class GeckoAppShell
});
}
@WrapElementForJNI(stubName = "GetScreenOrientationWrapper")
@WrapForJNI(stubName = "GetScreenOrientationWrapper")
public static short getScreenOrientation() {
return GeckoScreenOrientation.getInstance().getScreenOrientation().value;
}
@WrapElementForJNI
@WrapForJNI
public static void enableScreenOrientationNotifications() {
GeckoScreenOrientation.getInstance().enableNotifications();
}
@WrapElementForJNI
@WrapForJNI
public static void disableScreenOrientationNotifications() {
GeckoScreenOrientation.getInstance().disableNotifications();
}
@WrapElementForJNI
@WrapForJNI
public static void lockScreenOrientation(int aOrientation) {
GeckoScreenOrientation.getInstance().lock(aOrientation);
}
@WrapElementForJNI
@WrapForJNI
public static void unlockScreenOrientation() {
GeckoScreenOrientation.getInstance().unlock();
}
@WrapElementForJNI
@WrapForJNI
public static boolean pumpMessageLoop(final Message msg) {
final Handler geckoHandler = ThreadUtils.sGeckoHandler;
@ -2521,13 +2521,13 @@ public class GeckoAppShell
return true;
}
@WrapElementForJNI
@WrapForJNI
public static void notifyWakeLockChanged(String topic, String state) {
if (getGeckoInterface() != null)
getGeckoInterface().notifyWakeLockChanged(topic, state);
}
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public static void registerSurfaceTextureFrameListener(Object surfaceTexture, final int id) {
((SurfaceTexture)surfaceTexture).setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() {
@Override
@ -2537,12 +2537,12 @@ public class GeckoAppShell
});
}
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public static void unregisterSurfaceTextureFrameListener(Object surfaceTexture) {
((SurfaceTexture)surfaceTexture).setOnFrameAvailableListener(null);
}
@WrapElementForJNI
@WrapForJNI
public static boolean unlockProfile() {
// Try to kill any zombie Fennec's that might be running
GeckoAppShell.killAnyZombies();
@ -2556,7 +2556,7 @@ public class GeckoAppShell
return false;
}
@WrapElementForJNI(stubName = "GetProxyForURIWrapper")
@WrapForJNI(stubName = "GetProxyForURIWrapper")
public static String getProxyForURI(String spec, String scheme, String host, int port) {
final ProxySelector ps = new ProxySelector();
@ -2653,12 +2653,12 @@ public class GeckoAppShell
toast.show();
}
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
static InputStream createInputStream(URLConnection connection) throws IOException {
return connection.getInputStream();
}
@WrapElementForJNI(allowMultithread = true, narrowChars = true)
@WrapForJNI(allowMultithread = true, narrowChars = true)
static URLConnection getConnection(String url) {
try {
String spec;
@ -2679,7 +2679,7 @@ public class GeckoAppShell
return null;
}
@WrapElementForJNI(allowMultithread = true, narrowChars = true)
@WrapForJNI(allowMultithread = true, narrowChars = true)
static String connectionGetMimeType(URLConnection connection) {
return connection.getContentType();
}
@ -2690,7 +2690,7 @@ public class GeckoAppShell
* @param type The type of directory to return
* @return Absolute path of the specified directory or null on failure
*/
@WrapElementForJNI
@WrapForJNI
static String getExternalPublicDirectory(final String type) {
final String state = Environment.getExternalStorageState();
if (!Environment.MEDIA_MOUNTED.equals(state) &&
@ -2719,7 +2719,7 @@ public class GeckoAppShell
return Environment.getExternalStoragePublicDirectory(systemType).getAbsolutePath();
}
@WrapElementForJNI
@WrapForJNI
static int getMaxTouchPoints() {
PackageManager pm = getContext().getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND)) {

View File

@ -9,7 +9,7 @@ import android.os.SystemClock;
import android.util.Log;
import android.util.SparseArray;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.annotation.WrapForJNI;
import java.lang.Thread;
import java.util.Set;
@ -126,7 +126,7 @@ public class GeckoJavaSampler {
}
@WrapElementForJNI(allowMultithread = true, stubName = "GetThreadNameJavaProfilingWrapper")
@WrapForJNI(allowMultithread = true, stubName = "GetThreadNameJavaProfilingWrapper")
public synchronized static String getThreadName(int aThreadId) {
if (aThreadId == 0 && sMainThread != null) {
return sMainThread.getName();
@ -138,7 +138,7 @@ public class GeckoJavaSampler {
return sSamplingRunnable.getSample(aThreadId, aSampleId);
}
@WrapElementForJNI(allowMultithread = true, stubName = "GetSampleTimeJavaProfiling")
@WrapForJNI(allowMultithread = true, stubName = "GetSampleTimeJavaProfiling")
public synchronized static double getSampleTime(int aThreadId, int aSampleId) {
Sample sample = getSample(aThreadId, aSampleId);
if (sample != null) {
@ -152,7 +152,7 @@ public class GeckoJavaSampler {
return 0;
}
@WrapElementForJNI(allowMultithread = true, stubName = "GetFrameNameJavaProfilingWrapper")
@WrapForJNI(allowMultithread = true, stubName = "GetFrameNameJavaProfilingWrapper")
public synchronized static String getFrameName(int aThreadId, int aSampleId, int aFrameId) {
Sample sample = getSample(aThreadId, aSampleId);
if (sample != null && aFrameId < sample.mFrames.length) {
@ -165,7 +165,7 @@ public class GeckoJavaSampler {
return null;
}
@WrapElementForJNI(allowMultithread = true, stubName = "StartJavaProfiling")
@WrapForJNI(allowMultithread = true, stubName = "StartJavaProfiling")
public static void start(int aInterval, int aSamples) {
synchronized (GeckoJavaSampler.class) {
if (sSamplingRunnable != null) {
@ -177,21 +177,21 @@ public class GeckoJavaSampler {
}
}
@WrapElementForJNI(allowMultithread = true, stubName = "PauseJavaProfiling")
@WrapForJNI(allowMultithread = true, stubName = "PauseJavaProfiling")
public static void pause() {
synchronized (GeckoJavaSampler.class) {
sSamplingRunnable.mPauseSampler = true;
}
}
@WrapElementForJNI(allowMultithread = true, stubName = "UnpauseJavaProfiling")
@WrapForJNI(allowMultithread = true, stubName = "UnpauseJavaProfiling")
public static void unpause() {
synchronized (GeckoJavaSampler.class) {
sSamplingRunnable.mPauseSampler = false;
}
}
@WrapElementForJNI(allowMultithread = true, stubName = "StopJavaProfiling")
@WrapForJNI(allowMultithread = true, stubName = "StopJavaProfiling")
public static void stop() {
synchronized (GeckoJavaSampler.class) {
if (sSamplingThread == null) {

View File

@ -5,9 +5,9 @@
package org.mozilla.gecko;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.restrictions.DefaultConfiguration;
import org.mozilla.gecko.restrictions.GuestProfileConfiguration;
import org.mozilla.gecko.restrictions.RestrictedProfileConfiguration;
@ -90,7 +90,7 @@ public class RestrictedProfiles {
return getConfiguration(context).canLoadUrl(url);
}
@WrapElementForJNI
@WrapForJNI
public static boolean isUserRestricted() {
return isUserRestricted(GeckoAppShell.getContext());
}
@ -103,7 +103,7 @@ public class RestrictedProfiles {
return getConfiguration(context).isAllowed(restriction);
}
@WrapElementForJNI
@WrapForJNI
public static boolean isAllowed(int action, String url) {
final Restriction restriction;
try {

View File

@ -4,11 +4,11 @@
package org.mozilla.gecko;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.annotation.WrapForJNI;
import java.nio.ByteBuffer;
@WrapElementForJNI
@WrapForJNI
public class SurfaceBits {
public int width;
public int height;

View File

@ -5,9 +5,9 @@
package org.mozilla.gecko;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.gfx.BitmapUtils;
import org.mozilla.gecko.mozglue.DirectBufferAllocator;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import android.content.res.Resources;
import android.graphics.Bitmap;
@ -153,7 +153,7 @@ public final class ThumbnailHelper {
}
/* This method is invoked by JNI once the thumbnail data is ready. */
@WrapElementForJNI(stubName = "SendThumbnail")
@WrapForJNI(stubName = "SendThumbnail")
public static void notifyThumbnail(ByteBuffer data, int tabId, boolean success, boolean shouldStore) {
Tab tab = Tabs.getInstance().getTab(tabId);
ThumbnailHelper helper = ThumbnailHelper.getInstance();

View File

@ -2,7 +2,7 @@
* 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/. */
package org.mozilla.gecko.mozglue.generatorannotations;
package org.mozilla.gecko.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@ -24,7 +24,7 @@ import java.lang.annotation.Target;
*/
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
@Retention(RetentionPolicy.RUNTIME)
public @interface WrapElementForJNI {
public @interface WrapForJNI {
// Optional parameter specifying the name of the generated method stub. If omitted, the name
// of the Java method will be used.
String stubName() default "";

View File

@ -5,7 +5,7 @@
package org.mozilla.gecko.gfx;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.util.FloatUtils;
import android.graphics.RectF;
@ -19,16 +19,16 @@ import android.graphics.RectF;
* subsection of that with compositor scaling.
*/
public final class DisplayPortMetrics {
@WrapElementForJNI
@WrapForJNI
public final float resolution;
@WrapElementForJNI
@WrapForJNI
private final RectF mPosition;
public DisplayPortMetrics() {
this(0, 0, 0, 0, 1);
}
@WrapElementForJNI
@WrapForJNI
public DisplayPortMetrics(float left, float top, float right, float bottom, float resolution) {
this.resolution = resolution;
mPosition = new RectF(left, top, right, bottom);

View File

@ -5,11 +5,11 @@
package org.mozilla.gecko.gfx;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.GeckoThread;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.util.ThreadUtils;
import android.util.Log;
@ -250,7 +250,7 @@ public class GLController {
return mEGLSurfaceForCompositor != null;
}
@WrapElementForJNI(allowMultithread = true, stubName = "CreateEGLSurfaceForCompositorWrapper")
@WrapForJNI(allowMultithread = true, stubName = "CreateEGLSurfaceForCompositorWrapper")
private synchronized EGLSurface createEGLSurfaceForCompositor() {
AttemptPreallocateEGLSurfaceForCompositor();
EGLSurface result = mEGLSurfaceForCompositor;

View File

@ -5,6 +5,7 @@
package org.mozilla.gecko.gfx;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.gfx.LayerView.DrawListener;
@ -12,7 +13,6 @@ import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.ZoomConstraints;
import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.util.FloatUtils;
import org.mozilla.gecko.AppConstants;
@ -436,7 +436,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
return mDisplayPort;
}
@WrapElementForJNI
@WrapForJNI
DisplayPortMetrics getDisplayPort(boolean pageSizeUpdate, boolean isBrowserContentDisplayed, int tabId, ImmutableViewportMetrics metrics) {
Tabs tabs = Tabs.getInstance();
if (isBrowserContentDisplayed && tabs.isSelectedTabId(tabId)) {
@ -453,12 +453,12 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
}
}
@WrapElementForJNI
@WrapForJNI
void contentDocumentChanged() {
mContentDocumentIsDisplayed = false;
}
@WrapElementForJNI
@WrapForJNI
boolean isContentDocumentDisplayed() {
return mContentDocumentIsDisplayed;
}
@ -468,7 +468,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
// to abort the current update and continue with any subsequent ones. This
// is useful for slow-to-render pages when the display-port starts lagging
// behind enough that continuing to draw it is wasted effort.
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public ProgressiveUpdateData progressiveUpdateCallback(boolean aHasPendingNewThebesContent,
float x, float y, float width, float height,
float resolution, boolean lowPrecision) {
@ -582,7 +582,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
* viewport information provided. setPageRect will never be invoked on the same frame that
* this function is invoked on; and this function will always be called prior to syncViewportInfo.
*/
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public void setFirstPaintViewport(float offsetX, float offsetY, float zoom,
float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) {
synchronized (getLock()) {
@ -642,7 +642,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
* is invoked on a frame, then this function will not be. For any given frame, this
* function will be invoked before syncViewportInfo.
*/
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public void setPageRect(float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) {
synchronized (getLock()) {
RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
@ -663,7 +663,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
* every time we're called. NOTE: we might be able to return a ImmutableViewportMetrics
* which would avoid the copy into mCurrentViewTransform.
*/
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public ViewTransform syncViewportInfo(int x, int y, int width, int height, float resolution, boolean layersUpdated) {
// getViewportMetrics is thread safe so we don't need to synchronize.
// We save the viewport metrics here, so we later use it later in
@ -720,7 +720,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
return mCurrentViewTransform;
}
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public ViewTransform syncFrameMetrics(float offsetX, float offsetY, float zoom,
float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom,
boolean layersUpdated, int x, int y, int width, int height, float resolution,
@ -734,7 +734,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
return syncViewportInfo(x, y, width, height, resolution, layersUpdated);
}
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public LayerRenderer.Frame createFrame() {
// Create the shaders and textures if necessary.
if (!mLayerRendererInitialized) {
@ -754,12 +754,12 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
}
}
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public void activateProgram() {
mLayerRenderer.activateDefaultProgram();
}
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public void deactivateProgramAndRestoreState(boolean enableScissor,
int scissorX, int scissorY, int scissorW, int scissorH)
{

View File

@ -5,7 +5,7 @@
package org.mozilla.gecko.gfx;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.util.FloatUtils;
import android.graphics.PointF;
@ -53,7 +53,7 @@ public class ImmutableViewportMetrics {
/** This constructor is used by native code in AndroidJavaWrappers.cpp, be
* careful when modifying the signature.
*/
@WrapElementForJNI(allowMultithread = true)
@WrapForJNI(allowMultithread = true)
public ImmutableViewportMetrics(float aPageRectLeft, float aPageRectTop,
float aPageRectRight, float aPageRectBottom, float aCssPageRectLeft,
float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,

View File

@ -10,6 +10,7 @@ import java.nio.IntBuffer;
import java.util.ArrayList;
import org.mozilla.gecko.AndroidGamepadManager;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.GeckoAccessibility;
@ -20,7 +21,6 @@ import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.ZoomConstraints;
import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import android.content.Context;
import android.graphics.Bitmap;
@ -515,7 +515,7 @@ public class LayerView extends FrameLayout implements Tabs.OnTabsChangedListener
return mTextureView.getSurfaceTexture();
}
@WrapElementForJNI(allowMultithread = true, stubName = "RegisterCompositorWrapper")
@WrapForJNI(allowMultithread = true, stubName = "RegisterCompositorWrapper")
public static GLController registerCxxCompositor() {
try {
LayerView layerView = GeckoAppShell.getLayerView();
@ -529,7 +529,7 @@ public class LayerView extends FrameLayout implements Tabs.OnTabsChangedListener
}
//This method is called on the Gecko main thread.
@WrapElementForJNI(allowMultithread = true, stubName = "updateZoomedView")
@WrapForJNI(allowMultithread = true, stubName = "updateZoomedView")
public static void updateZoomedView(ByteBuffer data) {
LayerView layerView = GeckoAppShell.getLayerView();
if (layerView != null) {

View File

@ -5,9 +5,9 @@
package org.mozilla.gecko.gfx;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.GeckoThread;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.util.GeckoEventListener;
@ -97,7 +97,7 @@ class NativePanZoomController implements PanZoomController, GeckoEventListener {
@Override
public native int getOverScrollMode();
@WrapElementForJNI(allowMultithread = true, stubName = "RequestContentRepaintWrapper")
@WrapForJNI(allowMultithread = true, stubName = "RequestContentRepaintWrapper")
private void requestContentRepaint(float x, float y, float width, float height, float resolution) {
mTarget.forceRedraw(new DisplayPortMetrics(x, y, x + width, y + height, resolution));
}

View File

@ -5,7 +5,7 @@
package org.mozilla.gecko.gfx;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.annotation.WrapForJNI;
/**
* This is the data structure that's returned by the progressive tile update
@ -13,7 +13,7 @@ import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
* representing whether the front-end is interested in the current progressive
* update continuing.
*/
@WrapElementForJNI
@WrapForJNI
public class ProgressiveUpdateData {
public float x;
public float y;

View File

@ -5,9 +5,9 @@
package org.mozilla.gecko.gfx;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.annotation.WrapForJNI;
@WrapElementForJNI
@WrapForJNI
public class ViewTransform {
public float x;
public float y;

View File

@ -37,7 +37,8 @@ public abstract class MulticastDNSManager {
public static MulticastDNSManager getInstance(final Context context) {
if (instance == null) {
if (Versions.feature16Plus) {
// Bug 1188935: There's a bug on Android 4.4 and before.
if (Versions.feature21Plus) {
instance = new NsdMulticastDNSManager(context);
} else {
instance = new DummyMulticastDNSManager();

View File

@ -14,6 +14,7 @@ thirdparty_source_dir = TOPSRCDIR + '/mobile/android/thirdparty/'
constants_jar = add_java_jar('constants')
constants_jar.sources = [
'adjust/AdjustHelperInterface.java',
'annotation/WrapForJNI.java',
'SysInfo.java',
]
constants_jar.generated_sources = [
@ -54,7 +55,6 @@ mgjar.sources += [
'mozglue/ContextUtils.java',
'mozglue/DirectBufferAllocator.java',
'mozglue/GeckoLoader.java',
'mozglue/generatorannotations/WrapElementForJNI.java',
'mozglue/JNIObject.java',
'mozglue/JNITarget.java',
'mozglue/NativeReference.java',
@ -133,6 +133,7 @@ if CONFIG['MOZ_WEBRTC']:
audio_root + 'WebRtcAudioTrack.java',
]
wrjar.extra_jars = [
'constants.jar',
'gecko-R.jar',
'gecko-browser.jar',
'gecko-util.jar',

View File

@ -5,7 +5,7 @@
package org.mozilla.gecko.mozglue;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.mozglue.JNITarget;
import java.io.InputStream;
import java.nio.ByteBuffer;
@ -69,7 +69,7 @@ public class NativeZip implements NativeReference {
private static native void _release(long obj);
private native InputStream _getInputStream(long obj, String path);
@WrapElementForJNI
@JNITarget
private InputStream createInputStream(ByteBuffer buffer, int compression) {
if (compression != STORE && compression != DEFLATE) {
throw new IllegalArgumentException("Unexpected compression: " + compression);

View File

@ -20,8 +20,8 @@ package org.mozilla.gecko.sqlite;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import android.database.AbstractCursor;
import android.database.CursorIndexOutOfBoundsException;
@ -56,7 +56,7 @@ public class MatrixBlobCursor extends AbstractCursor {
* determines column ordering elsewhere in this cursor
* @param initialCapacity in rows
*/
@WrapElementForJNI
@WrapForJNI
public MatrixBlobCursor(String[] columnNames, int initialCapacity) {
this.columnNames = columnNames;
this.columnCount = columnNames.length;
@ -77,7 +77,7 @@ public class MatrixBlobCursor extends AbstractCursor {
* @param columnNames names of the columns, the ordering of which
* determines column ordering elsewhere in this cursor
*/
@WrapElementForJNI
@WrapForJNI
public MatrixBlobCursor(String[] columnNames) {
this(columnNames, 16);
}
@ -132,7 +132,7 @@ public class MatrixBlobCursor extends AbstractCursor {
* @param columnValues in the same order as the the column names specified
* at cursor construction time
*/
@WrapElementForJNI
@WrapForJNI
public void addRow(Object[] columnValues) {
if (columnValues.length != columnCount) {
throw new IllegalArgumentException("columnNames.length = "
@ -154,7 +154,7 @@ public class MatrixBlobCursor extends AbstractCursor {
* @param columnValues in the same order as the the column names specified
* at cursor construction time
*/
@WrapElementForJNI
@WrapForJNI
public void addRow(Iterable<?> columnValues) {
final int start = rowCount * columnCount;
@ -188,7 +188,7 @@ public class MatrixBlobCursor extends AbstractCursor {
}
/** Optimization for {@link ArrayList}. */
@WrapElementForJNI
@WrapForJNI
private void addRow(ArrayList<?> columnValues, int start) {
final int size = columnValues.size();
if (size != columnCount) {

View File

@ -5,9 +5,9 @@
package org.mozilla.gecko.sqlite;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.annotation.WrapForJNI;
@WrapElementForJNI
@WrapForJNI
public class SQLiteBridgeException extends RuntimeException {
static final long serialVersionUID = 1L;

View File

@ -6,8 +6,8 @@ package org.mozilla.gecko.util;
import java.util.concurrent.SynchronousQueue;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import android.content.ClipData;
import android.content.Context;
@ -32,7 +32,7 @@ public final class Clipboard {
mContext = c.getApplicationContext();
}
@WrapElementForJNI(stubName = "GetClipboardTextWrapper")
@WrapForJNI(stubName = "GetClipboardTextWrapper")
public static String getText() {
// If we're on the UI thread or the background thread, we have a looper on the thread
// and can just call this directly. For any other threads, post the call to the
@ -59,7 +59,7 @@ public final class Clipboard {
}
}
@WrapElementForJNI(stubName = "SetClipboardText")
@WrapForJNI(stubName = "SetClipboardText")
public static void setText(final CharSequence text) {
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
@ -90,7 +90,7 @@ public final class Clipboard {
/**
* @return true if the clipboard is nonempty, false otherwise.
*/
@WrapElementForJNI
@WrapForJNI
public static boolean hasText() {
if (Versions.feature11Plus) {
android.content.ClipboardManager cm = (android.content.ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
@ -105,7 +105,7 @@ public final class Clipboard {
/**
* Deletes all text from the clipboard.
*/
@WrapElementForJNI
@WrapForJNI
public static void clearText() {
setText(null);
}

View File

@ -5,7 +5,7 @@
package org.mozilla.gecko.util;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.mozglue.JNITarget;
/**
@ -16,8 +16,7 @@ import org.mozilla.gecko.mozglue.JNITarget;
* thread, call {@link #clone()} to make a copy, and use the copy on the other thread.
* When a copy is first used, it becomes attached to the thread using it.
*/
@JNITarget
@WrapElementForJNI
@WrapForJNI
public final class NativeJSContainer extends NativeJSObject
{
private NativeJSContainer() {

View File

@ -5,7 +5,7 @@
package org.mozilla.gecko.util;
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.mozglue.JNIObject;
import org.mozilla.gecko.mozglue.JNITarget;
@ -15,8 +15,7 @@ import android.os.Bundle;
* NativeJSObject is a wrapper around the SpiderMonkey JSAPI to make it possible to
* access Javascript objects in Java.
*/
@JNITarget
@WrapElementForJNI
@WrapForJNI
public class NativeJSObject extends JNIObject
{
@SuppressWarnings("serial")

View File

@ -179,20 +179,20 @@
}
# Keep generator-targeted entry points.
-keep @interface org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI
-keep @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI class *
-keep @interface org.mozilla.gecko.annotation.WrapForJNI
-keep @org.mozilla.gecko.annotation.WrapForJNI class *
-keepclassmembers class * {
@org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI *;
@org.mozilla.gecko.annotation.WrapForJNI *;
}
-keepclasseswithmembers class * {
@org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI <methods>;
@org.mozilla.gecko.annotation.WrapForJNI <methods>;
}
-keepclasseswithmembers class * {
@org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI <fields>;
@org.mozilla.gecko.annotation.WrapForJNI <fields>;
}
# Keep all members of an annotated class.
-keepclassmembers @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI class * {
-keepclassmembers @org.mozilla.gecko.annotation.WrapForJNI class * {
*;
}

Some files were not shown because too many files have changed in this diff Show More