mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
commit
0dea121078
4
CLOBBER
4
CLOBBER
@ -22,6 +22,4 @@
|
||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 1033481 - Use a .mozbuild file rather than a .mk in
|
||||
m/a/tests/background/junit3 -- doesn't clean the classes* directory
|
||||
when moving from in APK to in JAR building.
|
||||
Bug 1024707 - It seems like changing 3 uuids is just too much!
|
@ -167,7 +167,7 @@ endif
|
||||
endif
|
||||
|
||||
default all::
|
||||
$(call BUILDSTATUS,TIERS export $(if $(COMPILE_ENVIRONMENT),$(if $(MOZ_PSEUDO_DERECURSE),compile ))libs tools $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
|
||||
$(call BUILDSTATUS,TIERS export $(if $(COMPILE_ENVIRONMENT),compile )libs tools $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@ -309,11 +309,9 @@ config/export:
|
||||
|
||||
endif
|
||||
|
||||
ifdef MOZ_PSEUDO_DERECURSE
|
||||
# Interdependencies for parallel export.
|
||||
js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
|
||||
accessible/xpcom/export: xpcom/xpidl/export
|
||||
ifdef ENABLE_CLANG_PLUGIN
|
||||
js/src/export config/export: build/clang-plugin/export
|
||||
endif
|
||||
endif
|
||||
|
@ -459,6 +459,18 @@ pref("services.push.retryBaseInterval", 5000);
|
||||
pref("services.push.pingInterval", 1800000); // 30 minutes
|
||||
// How long before a DOMRequest errors as timeout
|
||||
pref("services.push.requestTimeout", 10000);
|
||||
pref("services.push.pingInterval.default", 180000);// 3 min
|
||||
pref("services.push.pingInterval.mobile", 180000); // 3 min
|
||||
pref("services.push.pingInterval.wifi", 180000); // 3 min
|
||||
// Adaptive ping
|
||||
pref("services.push.adaptive.enabled", true);
|
||||
pref("services.push.adaptive.lastGoodPingInterval", 180000);// 3 min
|
||||
pref("services.push.adaptive.lastGoodPingInterval.mobile", 180000);// 3 min
|
||||
pref("services.push.adaptive.lastGoodPingInterval.wifi", 180000);// 3 min
|
||||
// Valid gap between the biggest good ping and the bad ping
|
||||
pref("services.push.adaptive.gap", 60000); // 1 minute
|
||||
// We limit the ping to this maximum value
|
||||
pref("services.push.adaptive.upperLimit", 1740000); // 29 min
|
||||
// enable udp wakeup support
|
||||
pref("services.push.udp.wakeupEnabled", true);
|
||||
// This value should be the prefix to be added to the current PDP context[1]
|
||||
|
@ -11,8 +11,11 @@ Cu.import("resource://services-common/utils.js");
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsMgmtService",
|
||||
"resource://gre/modules/FxAccountsMgmtService.jsm",
|
||||
"FxAccountsMgmtService");
|
||||
"resource://gre/modules/FxAccountsMgmtService.jsm",
|
||||
"FxAccountsMgmtService");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsManager",
|
||||
"resource://gre/modules/FxAccountsManager.jsm");
|
||||
|
||||
// At end of test, restore original state
|
||||
const ORIGINAL_AUTH_URI = Services.prefs.getCharPref("identity.fxaccounts.auth.uri");
|
||||
@ -158,6 +161,22 @@ add_test(function test_invalidEmailCase_signIn() {
|
||||
});
|
||||
});
|
||||
|
||||
add_test(function testHandleGetAssertionError_defaultCase() {
|
||||
do_test_pending();
|
||||
|
||||
FxAccountsManager.getAssertion(null).then(
|
||||
success => {
|
||||
// getAssertion should throw with invalid audience
|
||||
ok(false);
|
||||
},
|
||||
reason => {
|
||||
equal("INVALID_AUDIENCE", reason.error);
|
||||
do_test_finished();
|
||||
run_next_test();
|
||||
}
|
||||
)
|
||||
});
|
||||
|
||||
// End of tests
|
||||
// Utility functions follow
|
||||
|
||||
|
@ -23,7 +23,9 @@ DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
|
||||
# Set MSVC dlls version to package, if any.
|
||||
ifdef WIN32_REDIST_DIR
|
||||
ifdef MOZ_NO_DEBUG_RTL
|
||||
DEFINES += -DMOZ_MSVC_REDIST=$(_MSC_VER)
|
||||
DEFINES += -DMOZ_PACKAGE_MSVC_DLLS=1
|
||||
DEFINES += -DMSVC_C_RUNTIME_DLL=$(MSVC_C_RUNTIME_DLL)
|
||||
DEFINES += -DMSVC_CXX_RUNTIME_DLL=$(MSVC_CXX_RUNTIME_DLL)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -69,15 +69,9 @@
|
||||
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
|
||||
#endif
|
||||
#ifdef XP_WIN32
|
||||
#if MOZ_MSVC_REDIST == 1600
|
||||
@BINPATH@/msvcp100.dll
|
||||
@BINPATH@/msvcr100.dll
|
||||
#elif MOZ_MSVC_REDIST == 1700
|
||||
@BINPATH@/msvcp110.dll
|
||||
@BINPATH@/msvcr110.dll
|
||||
#elif MOZ_MSVC_REDIST == 1800
|
||||
@BINPATH@/msvcp120.dll
|
||||
@BINPATH@/msvcr120.dll
|
||||
#if MOZ_PACKAGE_MSVC_DLLS
|
||||
@BINPATH@/@MSVC_C_RUNTIME_DLL@
|
||||
@BINPATH@/@MSVC_CXX_RUNTIME_DLL@
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MOZ_SHARED_MOZGLUE
|
||||
|
@ -495,7 +495,10 @@ var gPluginHandler = {
|
||||
if (this.getPluginUI(plugin, "submitURLOptIn").checked)
|
||||
keyVals.PluginContentURL = plugin.ownerDocument.URL;
|
||||
}
|
||||
this.CrashSubmit.submit(pluginDumpID, { extraExtraKeyVals: keyVals });
|
||||
|
||||
let pluginProcessType = Services.crashmanager.PROCESS_TYPE_PLUGIN;
|
||||
this.CrashSubmit.submit(pluginDumpID, { processType: pluginProcessType,
|
||||
extraExtraKeyVals: keyVals });
|
||||
if (browserDumpID)
|
||||
this.CrashSubmit.submit(browserDumpID);
|
||||
},
|
||||
|
@ -22,26 +22,81 @@ loop.panel = (function(_, mozL10n) {
|
||||
var router;
|
||||
|
||||
/**
|
||||
* Do not disturb panel subview.
|
||||
* Availability drop down menu subview.
|
||||
*/
|
||||
var DoNotDisturb = React.createClass({displayName: 'DoNotDisturb',
|
||||
var AvailabilityDropdown = React.createClass({displayName: 'AvailabilityDropdown',
|
||||
getInitialState: function() {
|
||||
return {doNotDisturb: navigator.mozLoop.doNotDisturb};
|
||||
return {
|
||||
doNotDisturb: navigator.mozLoop.doNotDisturb,
|
||||
showMenu: false
|
||||
};
|
||||
},
|
||||
|
||||
handleCheckboxChange: function() {
|
||||
// Note: side effect!
|
||||
navigator.mozLoop.doNotDisturb = !navigator.mozLoop.doNotDisturb;
|
||||
this.setState({doNotDisturb: navigator.mozLoop.doNotDisturb});
|
||||
showDropdownMenu: function() {
|
||||
this.setState({showMenu: true});
|
||||
},
|
||||
|
||||
hideDropdownMenu: function() {
|
||||
this.setState({showMenu: false});
|
||||
},
|
||||
|
||||
// XXX target event can either be the li, the span or the i tag
|
||||
// this makes it easier to figure out the target by making a
|
||||
// closure with the desired status already passed in.
|
||||
changeAvailability: function(newAvailabilty) {
|
||||
return function(event) {
|
||||
// Note: side effect!
|
||||
switch (newAvailabilty) {
|
||||
case 'available':
|
||||
this.setState({doNotDisturb: false});
|
||||
navigator.mozLoop.doNotDisturb = false;
|
||||
break;
|
||||
case 'do-not-disturb':
|
||||
this.setState({doNotDisturb: true});
|
||||
navigator.mozLoop.doNotDisturb = true;
|
||||
break;
|
||||
}
|
||||
this.hideDropdownMenu();
|
||||
}.bind(this);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// XXX https://github.com/facebook/react/issues/310 for === htmlFor
|
||||
var cx = React.addons.classSet;
|
||||
var availabilityStatus = cx({
|
||||
'status': true,
|
||||
'status-dnd': this.state.doNotDisturb,
|
||||
'status-available': !this.state.doNotDisturb
|
||||
});
|
||||
var availabilityDropdown = cx({
|
||||
'dnd-menu': true,
|
||||
'hide': !this.state.showMenu
|
||||
});
|
||||
var availabilityText = this.state.doNotDisturb ?
|
||||
__("display_name_dnd_status") :
|
||||
__("display_name_available_status");
|
||||
|
||||
return (
|
||||
React.DOM.p( {className:"dnd"},
|
||||
React.DOM.input( {type:"checkbox", checked:this.state.doNotDisturb,
|
||||
id:"dnd-component", onChange:this.handleCheckboxChange} ),
|
||||
React.DOM.label( {htmlFor:"dnd-component"}, __("do_not_disturb"))
|
||||
React.DOM.div( {className:"footer component-spacer"},
|
||||
React.DOM.div( {className:"do-not-disturb"},
|
||||
React.DOM.p( {className:"dnd-status", onClick:this.showDropdownMenu},
|
||||
React.DOM.span(null, availabilityText),
|
||||
React.DOM.i( {className:availabilityStatus})
|
||||
),
|
||||
React.DOM.ul( {className:availabilityDropdown,
|
||||
onMouseLeave:this.hideDropdownMenu},
|
||||
React.DOM.li( {onClick:this.changeAvailability("available"),
|
||||
className:"dnd-menu-item dnd-make-available"},
|
||||
React.DOM.i( {className:"status status-available"}),
|
||||
React.DOM.span(null, __("display_name_available_status"))
|
||||
),
|
||||
React.DOM.li( {onClick:this.changeAvailability("do-not-disturb"),
|
||||
className:"dnd-menu-item dnd-make-unavailable"},
|
||||
React.DOM.i( {className:"status status-dnd"}),
|
||||
React.DOM.span(null, __("display_name_dnd_status"))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -60,7 +115,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
if (!this.state.seenToS) {
|
||||
navigator.mozLoop.setLoopCharPref('seenToS', 'seen');
|
||||
return React.DOM.p( {className:"tos",
|
||||
return React.DOM.p( {className:"terms-service",
|
||||
dangerouslySetInnerHTML:{__html: tosHTML}});
|
||||
} else {
|
||||
return React.DOM.div(null );
|
||||
@ -75,9 +130,9 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
React.DOM.div( {className:"share generate-url"},
|
||||
React.DOM.div( {className:"component-spacer share generate-url"},
|
||||
React.DOM.div( {className:"description"},
|
||||
React.DOM.p(null, this.props.summary)
|
||||
React.DOM.p( {className:"description-content"}, this.props.summary)
|
||||
),
|
||||
React.DOM.div( {className:"action"},
|
||||
this.props.children
|
||||
@ -88,61 +143,27 @@ loop.panel = (function(_, mozL10n) {
|
||||
});
|
||||
|
||||
var CallUrlResult = React.createClass({displayName: 'CallUrlResult',
|
||||
propTypes: {
|
||||
callUrl: React.PropTypes.string.isRequired,
|
||||
retry: React.PropTypes.func.isRequired
|
||||
},
|
||||
|
||||
handleButtonClick: function() {
|
||||
this.props.retry();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// XXX setting elem value from a state (in the callUrl input)
|
||||
// makes it immutable ie read only but that is fine in our case.
|
||||
// readOnly attr will suppress a warning regarding this issue
|
||||
// from the react lib.
|
||||
return (
|
||||
PanelLayout( {summary:__("share_link_url")},
|
||||
React.DOM.div( {className:"invite"},
|
||||
React.DOM.input( {type:"url", value:this.props.callUrl, readOnly:"true"} ),
|
||||
React.DOM.button( {onClick:this.handleButtonClick,
|
||||
className:"btn btn-success"}, __("new_url"))
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var CallUrlForm = React.createClass({displayName: 'CallUrlForm',
|
||||
propTypes: {
|
||||
client: React.PropTypes.object.isRequired,
|
||||
notifier: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
pending: false,
|
||||
disabled: true,
|
||||
callUrl: false
|
||||
callUrl: ''
|
||||
};
|
||||
},
|
||||
|
||||
retry: function() {
|
||||
this.setState(this.getInitialState());
|
||||
/**
|
||||
* Returns a random 5 character string used to identify
|
||||
* the conversation.
|
||||
* XXX this will go away once the backend changes
|
||||
*/
|
||||
conversationIdentifier: function() {
|
||||
return Math.random().toString(36).substring(5);
|
||||
},
|
||||
|
||||
handleTextChange: function(event) {
|
||||
this.setState({disabled: !event.currentTarget.value});
|
||||
},
|
||||
|
||||
handleFormSubmit: function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
componentDidMount: function() {
|
||||
this.setState({pending: true});
|
||||
|
||||
this.props.client.requestCallUrl(
|
||||
this.refs.caller.getDOMNode().value, this._onCallUrlReceived);
|
||||
this.props.client.requestCallUrl(this.conversationIdentifier(),
|
||||
this._onCallUrlReceived);
|
||||
},
|
||||
|
||||
_onCallUrlReceived: function(err, callUrlData) {
|
||||
@ -160,30 +181,17 @@ loop.panel = (function(_, mozL10n) {
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// If we have a call url, render result
|
||||
if (this.state.callUrl) {
|
||||
return (
|
||||
CallUrlResult( {callUrl:this.state.callUrl, retry:this.retry})
|
||||
);
|
||||
}
|
||||
|
||||
// If we don't display the form
|
||||
// XXX setting elem value from a state (in the callUrl input)
|
||||
// makes it immutable ie read only but that is fine in our case.
|
||||
// readOnly attr will suppress a warning regarding this issue
|
||||
// from the react lib.
|
||||
var cx = React.addons.classSet;
|
||||
return (
|
||||
PanelLayout( {summary:__("get_link_to_share")},
|
||||
React.DOM.form( {className:"invite", onSubmit:this.handleFormSubmit},
|
||||
|
||||
React.DOM.input( {type:"text", name:"caller", ref:"caller", required:"required",
|
||||
className:cx({'pending': this.state.pending}),
|
||||
onChange:this.handleTextChange,
|
||||
placeholder:__("call_identifier_textinput_placeholder")} ),
|
||||
|
||||
React.DOM.button( {type:"submit", className:"get-url btn btn-success",
|
||||
disabled:this.state.disabled},
|
||||
__("get_a_call_url")
|
||||
)
|
||||
),
|
||||
ToSView(null )
|
||||
PanelLayout( {summary:__("share_link_header_text")},
|
||||
React.DOM.div( {className:"invite"},
|
||||
React.DOM.input( {type:"url", value:this.state.callUrl, readOnly:"true",
|
||||
className:cx({'pending': this.state.pending})} )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -201,9 +209,10 @@ loop.panel = (function(_, mozL10n) {
|
||||
render: function() {
|
||||
return (
|
||||
React.DOM.div(null,
|
||||
CallUrlForm( {client:this.props.client,
|
||||
CallUrlResult( {client:this.props.client,
|
||||
notifier:this.props.notifier} ),
|
||||
DoNotDisturb(null )
|
||||
ToSView(null ),
|
||||
AvailabilityDropdown(null )
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -229,7 +238,8 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
this._registerVisibilityChangeEvent();
|
||||
|
||||
this.on("panel:open panel:closed", this.reset, this);
|
||||
this.on("panel:open panel:closed", this.clearNotifications, this);
|
||||
this.on("panel:open", this.reset, this);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -242,6 +252,8 @@ loop.panel = (function(_, mozL10n) {
|
||||
* @link http://www.w3.org/TR/page-visibility/
|
||||
*/
|
||||
_registerVisibilityChangeEvent: function() {
|
||||
// XXX pass in the visibility status to detect when to generate a new
|
||||
// panel view
|
||||
this.document.addEventListener("visibilitychange", function(event) {
|
||||
this.trigger(event.currentTarget.hidden ? "panel:closed"
|
||||
: "panel:open");
|
||||
@ -255,6 +267,10 @@ loop.panel = (function(_, mozL10n) {
|
||||
this.reset();
|
||||
},
|
||||
|
||||
clearNotifications: function() {
|
||||
this._notifier.clear();
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets this router to its initial state.
|
||||
*/
|
||||
@ -290,8 +306,8 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
return {
|
||||
init: init,
|
||||
DoNotDisturb: DoNotDisturb,
|
||||
CallUrlForm: CallUrlForm,
|
||||
AvailabilityDropdown: AvailabilityDropdown,
|
||||
CallUrlResult: CallUrlResult,
|
||||
PanelView: PanelView,
|
||||
PanelRouter: PanelRouter,
|
||||
ToSView: ToSView
|
||||
|
@ -22,27 +22,82 @@ loop.panel = (function(_, mozL10n) {
|
||||
var router;
|
||||
|
||||
/**
|
||||
* Do not disturb panel subview.
|
||||
* Availability drop down menu subview.
|
||||
*/
|
||||
var DoNotDisturb = React.createClass({
|
||||
var AvailabilityDropdown = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {doNotDisturb: navigator.mozLoop.doNotDisturb};
|
||||
return {
|
||||
doNotDisturb: navigator.mozLoop.doNotDisturb,
|
||||
showMenu: false
|
||||
};
|
||||
},
|
||||
|
||||
handleCheckboxChange: function() {
|
||||
// Note: side effect!
|
||||
navigator.mozLoop.doNotDisturb = !navigator.mozLoop.doNotDisturb;
|
||||
this.setState({doNotDisturb: navigator.mozLoop.doNotDisturb});
|
||||
showDropdownMenu: function() {
|
||||
this.setState({showMenu: true});
|
||||
},
|
||||
|
||||
hideDropdownMenu: function() {
|
||||
this.setState({showMenu: false});
|
||||
},
|
||||
|
||||
// XXX target event can either be the li, the span or the i tag
|
||||
// this makes it easier to figure out the target by making a
|
||||
// closure with the desired status already passed in.
|
||||
changeAvailability: function(newAvailabilty) {
|
||||
return function(event) {
|
||||
// Note: side effect!
|
||||
switch (newAvailabilty) {
|
||||
case 'available':
|
||||
this.setState({doNotDisturb: false});
|
||||
navigator.mozLoop.doNotDisturb = false;
|
||||
break;
|
||||
case 'do-not-disturb':
|
||||
this.setState({doNotDisturb: true});
|
||||
navigator.mozLoop.doNotDisturb = true;
|
||||
break;
|
||||
}
|
||||
this.hideDropdownMenu();
|
||||
}.bind(this);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// XXX https://github.com/facebook/react/issues/310 for === htmlFor
|
||||
var cx = React.addons.classSet;
|
||||
var availabilityStatus = cx({
|
||||
'status': true,
|
||||
'status-dnd': this.state.doNotDisturb,
|
||||
'status-available': !this.state.doNotDisturb
|
||||
});
|
||||
var availabilityDropdown = cx({
|
||||
'dnd-menu': true,
|
||||
'hide': !this.state.showMenu
|
||||
});
|
||||
var availabilityText = this.state.doNotDisturb ?
|
||||
__("display_name_dnd_status") :
|
||||
__("display_name_available_status");
|
||||
|
||||
return (
|
||||
<p className="dnd">
|
||||
<input type="checkbox" checked={this.state.doNotDisturb}
|
||||
id="dnd-component" onChange={this.handleCheckboxChange} />
|
||||
<label htmlFor="dnd-component">{__("do_not_disturb")}</label>
|
||||
</p>
|
||||
<div className="footer component-spacer">
|
||||
<div className="do-not-disturb">
|
||||
<p className="dnd-status" onClick={this.showDropdownMenu}>
|
||||
<span>{availabilityText}</span>
|
||||
<i className={availabilityStatus}></i>
|
||||
</p>
|
||||
<ul className={availabilityDropdown}
|
||||
onMouseLeave={this.hideDropdownMenu}>
|
||||
<li onClick={this.changeAvailability("available")}
|
||||
className="dnd-menu-item dnd-make-available">
|
||||
<i className="status status-available"></i>
|
||||
<span>{__("display_name_available_status")}</span>
|
||||
</li>
|
||||
<li onClick={this.changeAvailability("do-not-disturb")}
|
||||
className="dnd-menu-item dnd-make-unavailable">
|
||||
<i className="status status-dnd"></i>
|
||||
<span>{__("display_name_dnd_status")}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -60,7 +115,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
if (!this.state.seenToS) {
|
||||
navigator.mozLoop.setLoopCharPref('seenToS', 'seen');
|
||||
return <p className="tos"
|
||||
return <p className="terms-service"
|
||||
dangerouslySetInnerHTML={{__html: tosHTML}}></p>;
|
||||
} else {
|
||||
return <div />;
|
||||
@ -75,9 +130,9 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<div className="share generate-url">
|
||||
<div className="component-spacer share generate-url">
|
||||
<div className="description">
|
||||
<p>{this.props.summary}</p>
|
||||
<p className="description-content">{this.props.summary}</p>
|
||||
</div>
|
||||
<div className="action">
|
||||
{this.props.children}
|
||||
@ -88,61 +143,27 @@ loop.panel = (function(_, mozL10n) {
|
||||
});
|
||||
|
||||
var CallUrlResult = React.createClass({
|
||||
propTypes: {
|
||||
callUrl: React.PropTypes.string.isRequired,
|
||||
retry: React.PropTypes.func.isRequired
|
||||
},
|
||||
|
||||
handleButtonClick: function() {
|
||||
this.props.retry();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// XXX setting elem value from a state (in the callUrl input)
|
||||
// makes it immutable ie read only but that is fine in our case.
|
||||
// readOnly attr will suppress a warning regarding this issue
|
||||
// from the react lib.
|
||||
return (
|
||||
<PanelLayout summary={__("share_link_url")}>
|
||||
<div className="invite">
|
||||
<input type="url" value={this.props.callUrl} readOnly="true" />
|
||||
<button onClick={this.handleButtonClick}
|
||||
className="btn btn-success">{__("new_url")}</button>
|
||||
</div>
|
||||
</PanelLayout>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var CallUrlForm = React.createClass({
|
||||
propTypes: {
|
||||
client: React.PropTypes.object.isRequired,
|
||||
notifier: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
pending: false,
|
||||
disabled: true,
|
||||
callUrl: false
|
||||
callUrl: ''
|
||||
};
|
||||
},
|
||||
|
||||
retry: function() {
|
||||
this.setState(this.getInitialState());
|
||||
/**
|
||||
* Returns a random 5 character string used to identify
|
||||
* the conversation.
|
||||
* XXX this will go away once the backend changes
|
||||
*/
|
||||
conversationIdentifier: function() {
|
||||
return Math.random().toString(36).substring(5);
|
||||
},
|
||||
|
||||
handleTextChange: function(event) {
|
||||
this.setState({disabled: !event.currentTarget.value});
|
||||
},
|
||||
|
||||
handleFormSubmit: function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
componentDidMount: function() {
|
||||
this.setState({pending: true});
|
||||
|
||||
this.props.client.requestCallUrl(
|
||||
this.refs.caller.getDOMNode().value, this._onCallUrlReceived);
|
||||
this.props.client.requestCallUrl(this.conversationIdentifier(),
|
||||
this._onCallUrlReceived);
|
||||
},
|
||||
|
||||
_onCallUrlReceived: function(err, callUrlData) {
|
||||
@ -160,30 +181,17 @@ loop.panel = (function(_, mozL10n) {
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// If we have a call url, render result
|
||||
if (this.state.callUrl) {
|
||||
return (
|
||||
<CallUrlResult callUrl={this.state.callUrl} retry={this.retry}/>
|
||||
);
|
||||
}
|
||||
|
||||
// If we don't display the form
|
||||
// XXX setting elem value from a state (in the callUrl input)
|
||||
// makes it immutable ie read only but that is fine in our case.
|
||||
// readOnly attr will suppress a warning regarding this issue
|
||||
// from the react lib.
|
||||
var cx = React.addons.classSet;
|
||||
return (
|
||||
<PanelLayout summary={__("get_link_to_share")}>
|
||||
<form className="invite" onSubmit={this.handleFormSubmit}>
|
||||
|
||||
<input type="text" name="caller" ref="caller" required="required"
|
||||
className={cx({'pending': this.state.pending})}
|
||||
onChange={this.handleTextChange}
|
||||
placeholder={__("call_identifier_textinput_placeholder")} />
|
||||
|
||||
<button type="submit" className="get-url btn btn-success"
|
||||
disabled={this.state.disabled}>
|
||||
{__("get_a_call_url")}
|
||||
</button>
|
||||
</form>
|
||||
<ToSView />
|
||||
<PanelLayout summary={__("share_link_header_text")}>
|
||||
<div className="invite">
|
||||
<input type="url" value={this.state.callUrl} readOnly="true"
|
||||
className={cx({'pending': this.state.pending})} />
|
||||
</div>
|
||||
</PanelLayout>
|
||||
);
|
||||
}
|
||||
@ -201,9 +209,10 @@ loop.panel = (function(_, mozL10n) {
|
||||
render: function() {
|
||||
return (
|
||||
<div>
|
||||
<CallUrlForm client={this.props.client}
|
||||
<CallUrlResult client={this.props.client}
|
||||
notifier={this.props.notifier} />
|
||||
<DoNotDisturb />
|
||||
<ToSView />
|
||||
<AvailabilityDropdown />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -229,7 +238,8 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
this._registerVisibilityChangeEvent();
|
||||
|
||||
this.on("panel:open panel:closed", this.reset, this);
|
||||
this.on("panel:open panel:closed", this.clearNotifications, this);
|
||||
this.on("panel:open", this.reset, this);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -242,6 +252,8 @@ loop.panel = (function(_, mozL10n) {
|
||||
* @link http://www.w3.org/TR/page-visibility/
|
||||
*/
|
||||
_registerVisibilityChangeEvent: function() {
|
||||
// XXX pass in the visibility status to detect when to generate a new
|
||||
// panel view
|
||||
this.document.addEventListener("visibilitychange", function(event) {
|
||||
this.trigger(event.currentTarget.hidden ? "panel:closed"
|
||||
: "panel:open");
|
||||
@ -255,6 +267,10 @@ loop.panel = (function(_, mozL10n) {
|
||||
this.reset();
|
||||
},
|
||||
|
||||
clearNotifications: function() {
|
||||
this._notifier.clear();
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets this router to its initial state.
|
||||
*/
|
||||
@ -290,8 +306,8 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
return {
|
||||
init: init,
|
||||
DoNotDisturb: DoNotDisturb,
|
||||
CallUrlForm: CallUrlForm,
|
||||
AvailabilityDropdown: AvailabilityDropdown,
|
||||
CallUrlResult: CallUrlResult,
|
||||
PanelView: PanelView,
|
||||
PanelRouter: PanelRouter,
|
||||
ToSView: ToSView
|
||||
|
@ -17,7 +17,7 @@ body {
|
||||
padding: 0;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans;
|
||||
font-size: 14px;
|
||||
background: #f2f2f2;
|
||||
background: #fbfbfb;
|
||||
}
|
||||
|
||||
button {
|
||||
@ -70,7 +70,15 @@ img {
|
||||
}
|
||||
|
||||
.btn-info {
|
||||
background: #428BCA;
|
||||
background: #0095dd;
|
||||
}
|
||||
|
||||
.btn-info:hover {
|
||||
background: #008acb;
|
||||
}
|
||||
|
||||
.btn-info:active {
|
||||
background: #006b9d;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
|
@ -3,9 +3,8 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* Panel styles */
|
||||
|
||||
a {
|
||||
color: #0095DD;
|
||||
body {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.panel {
|
||||
@ -14,18 +13,16 @@ a {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.component-spacer {
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.share {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
.share .description {
|
||||
background: #f7f7f7 url("../img/icon_32.png") no-repeat 1em 1.5em;
|
||||
border-bottom: 1px solid #c3c3c3;
|
||||
padding: 1em 1em 0 4em;
|
||||
background: #fbfbfb;
|
||||
}
|
||||
|
||||
.share .description .field {
|
||||
@ -43,21 +40,16 @@ a {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.description-content {
|
||||
margin: .5em 0;
|
||||
font-size: 1em;
|
||||
font-weight: 700;
|
||||
font-family: Open Sans,sans-serif;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.share .action {
|
||||
clear: right;
|
||||
padding: 1em;
|
||||
border-top: 1px solid #fafafa;
|
||||
}
|
||||
|
||||
.share .action p {
|
||||
margin: 0 0 1em 0;
|
||||
}
|
||||
|
||||
p.dnd {
|
||||
margin: 0 10px 10px 10px;
|
||||
/* The panel won't increase its height when using a bottom margin, while it
|
||||
works using a padding */
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.share .action input[type="text"],
|
||||
@ -65,10 +57,13 @@ p.dnd {
|
||||
border: 1px solid #ccc; /* Overriding background style for a text input (see
|
||||
below) resets its borders to a weird beveled style;
|
||||
defining a default 1px border solves the issue. */
|
||||
font-size: .9em;
|
||||
width: 65%;
|
||||
padding: .5em;
|
||||
margin-right: .35em;
|
||||
font-size: 1em;
|
||||
width: 100%;
|
||||
padding: 0 10px;
|
||||
margin: 5px 0;
|
||||
border-radius: 2px;
|
||||
outline: 0;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.share .action input.pending {
|
||||
@ -84,15 +79,102 @@ p.dnd {
|
||||
padding-top: 6px;
|
||||
}
|
||||
|
||||
.tos {
|
||||
font-size: .6rem;
|
||||
color: #a8a8a8;
|
||||
text-align: center;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
/* Specific cases */
|
||||
|
||||
.panel #messages .alert {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* DnD menu */
|
||||
|
||||
.dnd-status {
|
||||
border: 1px solid transparent;
|
||||
padding: 2px 4px;
|
||||
font-size: .9em;
|
||||
cursor: pointer;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.dnd-status:hover {
|
||||
border: 1px solid #DDD;
|
||||
background: #F1F1F1;
|
||||
}
|
||||
|
||||
.do-not-disturb {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.dnd-menu {
|
||||
position: absolute;
|
||||
top: -35px;
|
||||
left: 10px;
|
||||
background: #fdfdfd;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,.3);
|
||||
list-style: none;
|
||||
padding: 5px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.dnd-menu-item {
|
||||
text-align: left;
|
||||
margin: .3em 0;
|
||||
padding: .2em .5em;
|
||||
cursor: pointer;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 2px;
|
||||
font-size: 1em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dnd-menu-item:hover {
|
||||
border: 1px solid #ccc;
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
/* Status badges -- Available/Unavailable */
|
||||
|
||||
.status {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin: 0 5px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.status-available {
|
||||
background: #6cb23e;
|
||||
}
|
||||
|
||||
.status-dnd {
|
||||
border: 1px solid #888;
|
||||
}
|
||||
|
||||
/* Terms of Service */
|
||||
|
||||
.terms-service {
|
||||
padding: 3px 10px 10px;
|
||||
background: #FFF;
|
||||
text-align: center;
|
||||
opacity: .5;
|
||||
transition: opacity .3s;
|
||||
font-family: 'Lucida Grande', sans-serif;
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
.terms-service a {
|
||||
color: #0095dd;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
|
||||
.footer {
|
||||
font-size: 1em;
|
||||
border-top: 1px solid #D1D1D1;
|
||||
background: #EAEAEA;
|
||||
color: #7F7F7F;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: auto;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ describe("loop.panel", function() {
|
||||
});
|
||||
|
||||
sinon.assert.calledOnce(router.trigger);
|
||||
sinon.assert.calledWithExactly(router.trigger, "panel:open");
|
||||
sinon.assert.calledWith(router.trigger, "panel:open");
|
||||
});
|
||||
|
||||
it("should trigger panel:closed when the panel document is hidden",
|
||||
@ -158,37 +158,44 @@ describe("loop.panel", function() {
|
||||
});
|
||||
|
||||
sinon.assert.calledOnce(router.trigger);
|
||||
sinon.assert.calledWithExactly(router.trigger, "panel:closed");
|
||||
sinon.assert.calledWith(router.trigger, "panel:closed");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("loop.panel.DoNotDisturb", function() {
|
||||
describe("loop.panel.AvailabilityDropdown", function() {
|
||||
var view;
|
||||
|
||||
beforeEach(function() {
|
||||
view = TestUtils.renderIntoDocument(loop.panel.DoNotDisturb());
|
||||
view = TestUtils.renderIntoDocument(loop.panel.AvailabilityDropdown());
|
||||
});
|
||||
|
||||
describe("Checkbox change event", function() {
|
||||
describe("doNotDisturb preference change", function() {
|
||||
beforeEach(function() {
|
||||
navigator.mozLoop.doNotDisturb = false;
|
||||
|
||||
var checkbox = TestUtils.findRenderedDOMComponentWithTag(view, "input");
|
||||
TestUtils.Simulate.change(checkbox);
|
||||
navigator.mozLoop.doNotDisturb = true;
|
||||
});
|
||||
|
||||
it("should toggle the value of mozLoop.doNotDisturb", function() {
|
||||
expect(navigator.mozLoop.doNotDisturb).eql(true);
|
||||
var availableMenuOption = view.getDOMNode()
|
||||
.querySelector(".dnd-make-available");
|
||||
|
||||
TestUtils.Simulate.click(availableMenuOption);
|
||||
|
||||
expect(navigator.mozLoop.doNotDisturb).eql(false);
|
||||
});
|
||||
|
||||
it("should update the DnD checkbox value", function() {
|
||||
expect(view.getDOMNode().querySelector("input").checked).eql(true);
|
||||
it("should toggle the dropdown menu", function() {
|
||||
var availableMenuOption = view.getDOMNode()
|
||||
.querySelector(".dnd-status span");
|
||||
|
||||
TestUtils.Simulate.click(availableMenuOption);
|
||||
|
||||
expect(view.state.showMenu).eql(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("loop.panel.CallUrlForm", function() {
|
||||
describe("loop.panel.PanelView", function() {
|
||||
var fakeClient, callUrlData, view;
|
||||
|
||||
beforeEach(function() {
|
||||
@ -203,7 +210,7 @@ describe("loop.panel", function() {
|
||||
}
|
||||
};
|
||||
|
||||
view = TestUtils.renderIntoDocument(loop.panel.CallUrlForm({
|
||||
view = TestUtils.renderIntoDocument(loop.panel.PanelView({
|
||||
notifier: notifier,
|
||||
client: fakeClient
|
||||
}));
|
||||
@ -215,69 +222,71 @@ describe("loop.panel", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Form submit event", function() {
|
||||
});
|
||||
|
||||
function submitForm(callerValue) {
|
||||
// fill caller field
|
||||
TestUtils.Simulate.change(
|
||||
TestUtils.findRenderedDOMComponentWithTag(view, "input"), {
|
||||
target: {value: callerValue}
|
||||
});
|
||||
describe("loop.panel.CallUrlResult", function() {
|
||||
var fakeClient, callUrlData, view;
|
||||
|
||||
// submit form
|
||||
TestUtils.Simulate.submit(
|
||||
TestUtils.findRenderedDOMComponentWithTag(view, "form"));
|
||||
}
|
||||
beforeEach(function() {
|
||||
callUrlData = {
|
||||
call_url: "http://call.invalid/",
|
||||
expiresAt: 1000
|
||||
};
|
||||
|
||||
it("should reset all pending notifications", function() {
|
||||
submitForm("foo");
|
||||
fakeClient = {
|
||||
requestCallUrl: function(_, cb) {
|
||||
cb(null, callUrlData);
|
||||
}
|
||||
};
|
||||
|
||||
sinon.assert.calledOnce(notifier.clear, "clear");
|
||||
});
|
||||
view = TestUtils.renderIntoDocument(loop.panel.CallUrlResult({
|
||||
notifier: notifier,
|
||||
client: fakeClient
|
||||
}));
|
||||
});
|
||||
|
||||
it("should request a call url to the server", function() {
|
||||
fakeClient.requestCallUrl = sandbox.stub();
|
||||
describe("Rendering the component should generate a call URL", function() {
|
||||
|
||||
submitForm("foo");
|
||||
it("should make a request to requestCallUrl", function() {
|
||||
sandbox.stub(fakeClient, "requestCallUrl");
|
||||
var view = TestUtils.renderIntoDocument(loop.panel.CallUrlResult({
|
||||
notifier: notifier,
|
||||
client: fakeClient
|
||||
}));
|
||||
|
||||
sinon.assert.calledOnce(fakeClient.requestCallUrl);
|
||||
sinon.assert.calledWith(fakeClient.requestCallUrl, "foo");
|
||||
sinon.assert.calledOnce(view.props.client.requestCallUrl);
|
||||
sinon.assert.calledWithExactly(view.props.client.requestCallUrl,
|
||||
sinon.match.string, sinon.match.func);
|
||||
});
|
||||
|
||||
it("should set the call url form in a pending state", function() {
|
||||
// Cancel requestCallUrl effect to keep the state pending
|
||||
fakeClient.requestCallUrl = sandbox.stub();
|
||||
|
||||
submitForm("foo");
|
||||
var view = TestUtils.renderIntoDocument(loop.panel.CallUrlResult({
|
||||
notifier: notifier,
|
||||
client: fakeClient
|
||||
}));
|
||||
|
||||
expect(view.state.pending).eql(true);
|
||||
});
|
||||
|
||||
it("should update state with the call url received", function() {
|
||||
submitForm("foo");
|
||||
|
||||
expect(view.state.pending).eql(false);
|
||||
expect(view.state.callUrl).eql(callUrlData.call_url);
|
||||
});
|
||||
|
||||
it("should clear the pending state when a response is received",
|
||||
function() {
|
||||
submitForm("foo");
|
||||
|
||||
expect(view.state.pending).eql(false);
|
||||
});
|
||||
|
||||
it("should update CallUrlResult with the call url", function() {
|
||||
submitForm("foo");
|
||||
|
||||
var urlField = view.getDOMNode().querySelector("input[type='url']");
|
||||
|
||||
expect(urlField.value).eql(callUrlData.call_url);
|
||||
});
|
||||
|
||||
it("should reset all pending notifications", function() {
|
||||
submitForm("foo");
|
||||
|
||||
sinon.assert.calledOnce(view.props.notifier.clear);
|
||||
});
|
||||
|
||||
@ -285,8 +294,10 @@ describe("loop.panel", function() {
|
||||
fakeClient.requestCallUrl = function(_, cb) {
|
||||
cb("fake error");
|
||||
};
|
||||
|
||||
submitForm("foo");
|
||||
var view = TestUtils.renderIntoDocument(loop.panel.CallUrlResult({
|
||||
notifier: notifier,
|
||||
client: fakeClient
|
||||
}));
|
||||
|
||||
sinon.assert.calledOnce(notifier.errorL10n);
|
||||
sinon.assert.calledWithExactly(notifier.errorL10n,
|
||||
@ -320,7 +331,7 @@ describe("loop.panel", function() {
|
||||
it("should render when the value of loop.seenToS is not set", function() {
|
||||
var view = TestUtils.renderIntoDocument(loop.panel.ToSView());
|
||||
|
||||
TestUtils.findRenderedDOMComponentWithClass(view, "tos");
|
||||
TestUtils.findRenderedDOMComponentWithClass(view, "terms-service");
|
||||
});
|
||||
|
||||
it("should not render when the value of loop.seenToS is set to 'seen'",
|
||||
|
@ -16,8 +16,8 @@ function test_getStrings() {
|
||||
|
||||
// XXX This depends on the L10n values, which I'd prefer not to do, but is the
|
||||
// simplest way for now.
|
||||
Assert.equal(MozLoopService.getStrings("get_link_to_share"),
|
||||
'{"textContent":"Get a link and invite someone to talk"}');
|
||||
Assert.equal(MozLoopService.getStrings("share_link_header_text"),
|
||||
'{"textContent":"Share this link to invite someone to talk:"}');
|
||||
}
|
||||
|
||||
function run_test()
|
||||
|
@ -157,6 +157,29 @@ var gAdvancedPane = {
|
||||
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* security.OCSP.enabled is an integer value for legacy reasons.
|
||||
* A value of 1 means OCSP is enabled. Any other value means it is disabled.
|
||||
*/
|
||||
readEnableOCSP: function ()
|
||||
{
|
||||
var preference = document.getElementById("security.OCSP.enabled");
|
||||
// This is the case if the preference is the default value.
|
||||
if (preference.value === undefined) {
|
||||
return true;
|
||||
}
|
||||
return preference.value == 1;
|
||||
},
|
||||
|
||||
/**
|
||||
* See documentation for readEnableOCSP.
|
||||
*/
|
||||
writeEnableOCSP: function ()
|
||||
{
|
||||
var checkbox = document.getElementById("enableOCSP");
|
||||
return checkbox.checked ? 1 : 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* When the user toggles the layers.acceleration.disabled pref,
|
||||
* sync its new value to the gfx.direct2d.disabled pref too.
|
||||
@ -822,15 +845,6 @@ var gAdvancedPane = {
|
||||
"", null);
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays a dialog in which OCSP preferences can be configured.
|
||||
*/
|
||||
showOCSP: function ()
|
||||
{
|
||||
document.documentElement.openSubDialog("chrome://mozapps/content/preferences/ocsp.xul",
|
||||
"", null);
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays a dialog from which the user can manage his security devices.
|
||||
*/
|
||||
|
@ -91,7 +91,7 @@
|
||||
|
||||
<preference id="browser.search.update" name="browser.search.update" type="bool"/>
|
||||
|
||||
<!-- Encryption tab -->
|
||||
<!-- Certificates tab -->
|
||||
<preference id="security.default_personal_cert" name="security.default_personal_cert" type="string"/>
|
||||
|
||||
<preference id="security.disable_button.openCertManager"
|
||||
@ -100,6 +100,9 @@
|
||||
<preference id="security.disable_button.openDeviceManager"
|
||||
name="security.disable_button.openDeviceManager"
|
||||
type="bool"/>
|
||||
<preference id="security.OCSP.enabled"
|
||||
name="security.OCSP.enabled"
|
||||
type="int"/>
|
||||
</preferences>
|
||||
|
||||
#ifdef HAVE_SHELL_SERVICE
|
||||
@ -417,14 +420,20 @@
|
||||
|
||||
<separator/>
|
||||
|
||||
<checkbox id="enableOCSP"
|
||||
label="&enableOCSP.label;"
|
||||
accesskey="&enableOCSP.accesskey;"
|
||||
onsyncfrompreference="return gAdvancedPane.readEnableOCSP();"
|
||||
onsynctopreference="return gAdvancedPane.writeEnableOCSP();"
|
||||
preference="security.OCSP.enabled"/>
|
||||
|
||||
<separator/>
|
||||
|
||||
<hbox>
|
||||
<button id="viewCertificatesButton"
|
||||
label="&viewCerts.label;" accesskey="&viewCerts.accesskey;"
|
||||
oncommand="gAdvancedPane.showCertificates();"
|
||||
preference="security.disable_button.openCertManager"/>
|
||||
<button id="verificationButton"
|
||||
label="&verify2.label;" accesskey="&verify2.accesskey;"
|
||||
oncommand="gAdvancedPane.showOCSP();"/>
|
||||
<button id="viewSecurityDevicesButton"
|
||||
label="&viewSecurityDevices.label;" accesskey="&viewSecurityDevices.accesskey;"
|
||||
oncommand="gAdvancedPane.showSecurityDevices();"
|
||||
|
@ -144,6 +144,28 @@ var gAdvancedPane = {
|
||||
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* security.OCSP.enabled is an integer value for legacy reasons.
|
||||
* A value of 1 means OCSP is enabled. Any other value means it is disabled.
|
||||
*/
|
||||
readEnableOCSP: function ()
|
||||
{
|
||||
var preference = document.getElementById("security.OCSP.enabled");
|
||||
// This is the case if the preference is the default value.
|
||||
if (preference.value === undefined) {
|
||||
return true;
|
||||
}
|
||||
return preference.value == 1;
|
||||
},
|
||||
|
||||
/**
|
||||
* See documentation for readEnableOCSP.
|
||||
*/
|
||||
writeEnableOCSP: function ()
|
||||
{
|
||||
var checkbox = document.getElementById("enableOCSP");
|
||||
return checkbox.checked ? 1 : 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* When the user toggles the layers.acceleration.disabled pref,
|
||||
@ -794,16 +816,6 @@ var gAdvancedPane = {
|
||||
"modal=yes", null);
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays a dialog in which OCSP preferences can be configured.
|
||||
*/
|
||||
showOCSP: function ()
|
||||
{
|
||||
openDialog("chrome://mozapps/content/preferences/ocsp.xul",
|
||||
"mozilla:crlmanager",
|
||||
"modal=yes", null);
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays a dialog from which the user can manage his security devices.
|
||||
*/
|
||||
|
@ -107,7 +107,7 @@
|
||||
name="browser.search.update"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Encryption tab -->
|
||||
<!-- Certificates tab -->
|
||||
<preference id="security.default_personal_cert"
|
||||
name="security.default_personal_cert"
|
||||
type="string"/>
|
||||
@ -115,9 +115,14 @@
|
||||
<preference id="security.disable_button.openCertManager"
|
||||
name="security.disable_button.openCertManager"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="security.disable_button.openDeviceManager"
|
||||
name="security.disable_button.openDeviceManager"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="security.OCSP.enabled"
|
||||
name="security.OCSP.enabled"
|
||||
type="int"/>
|
||||
</preferences>
|
||||
|
||||
#ifdef HAVE_SHELL_SERVICE
|
||||
@ -439,14 +444,20 @@
|
||||
|
||||
<separator/>
|
||||
|
||||
<checkbox id="enableOCSP"
|
||||
label="&enableOCSP.label;"
|
||||
accesskey="&enableOCSP.accesskey;"
|
||||
onsyncfrompreference="return gAdvancedPane.readEnableOCSP();"
|
||||
onsynctopreference="return gAdvancedPane.writeEnableOCSP();"
|
||||
preference="security.OCSP.enabled"/>
|
||||
|
||||
<separator/>
|
||||
|
||||
<hbox>
|
||||
<button id="viewCertificatesButton"
|
||||
label="&viewCerts.label;" accesskey="&viewCerts.accesskey;"
|
||||
oncommand="gAdvancedPane.showCertificates();"
|
||||
preference="security.disable_button.openCertManager"/>
|
||||
<button id="verificationButton"
|
||||
label="&verify2.label;" accesskey="&verify2.accesskey;"
|
||||
oncommand="gAdvancedPane.showOCSP();"/>
|
||||
<button id="viewSecurityDevicesButton"
|
||||
label="&viewSecurityDevices.label;" accesskey="&viewSecurityDevices.accesskey;"
|
||||
oncommand="gAdvancedPane.showSecurityDevices();"
|
||||
|
@ -36,7 +36,6 @@
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
autocompletesearch="search-autocomplete"
|
||||
autocompletesearchparam="searchbar-history"
|
||||
timeout="250"
|
||||
maxrows="10"
|
||||
completeselectedindex="true"
|
||||
showcommentcolumn="true"
|
||||
@ -536,22 +535,7 @@
|
||||
<![CDATA[
|
||||
// Speculatively connect to the current engine's search URI (and
|
||||
// suggest URI, if different) to reduce request latency
|
||||
|
||||
const SUGGEST_TYPE = "application/x-suggestions+json";
|
||||
var engine = this.currentEngine;
|
||||
var connector =
|
||||
Services.io.QueryInterface(Components.interfaces.nsISpeculativeConnect);
|
||||
var searchURI = engine.getSubmission("dummy", null, "searchbar").uri;
|
||||
let callbacks = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsILoadContext);
|
||||
connector.speculativeConnect(searchURI, callbacks);
|
||||
|
||||
if (engine.supportsResponseType(SUGGEST_TYPE)) {
|
||||
var suggestURI = engine.getSubmission("dummy", SUGGEST_TYPE, "searchbar").uri;
|
||||
if (suggestURI.prePath != searchURI.prePath)
|
||||
connector.speculativeConnect(suggestURI, callbacks);
|
||||
}
|
||||
this.currentEngine.speculativeConnect({window: window});
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
@ -55,10 +55,6 @@ ifdef NSS_DISABLE_DBM
|
||||
DEFINES += -DNSS_DISABLE_DBM=1
|
||||
endif
|
||||
|
||||
ifdef _MSC_VER
|
||||
DEFINES += -D_MSC_VER=$(_MSC_VER)
|
||||
endif
|
||||
|
||||
DEFINES += -DJAREXT=
|
||||
|
||||
ifdef MOZ_ANGLE_RENDERER
|
||||
@ -76,7 +72,9 @@ DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
|
||||
# Set MSVC dlls version to package, if any.
|
||||
ifdef WIN32_REDIST_DIR
|
||||
ifdef MOZ_NO_DEBUG_RTL
|
||||
DEFINES += -DMOZ_MSVC_REDIST=$(_MSC_VER)
|
||||
DEFINES += -DMOZ_PACKAGE_MSVC_DLLS=1
|
||||
DEFINES += -DMSVC_C_RUNTIME_DLL=$(MSVC_C_RUNTIME_DLL)
|
||||
DEFINES += -DMSVC_CXX_RUNTIME_DLL=$(MSVC_CXX_RUNTIME_DLL)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -85,15 +85,9 @@
|
||||
#endif
|
||||
#ifdef XP_WIN32
|
||||
@BINPATH@/plugin-hang-ui@BIN_SUFFIX@
|
||||
#if MOZ_MSVC_REDIST == 1600
|
||||
@BINPATH@/msvcp100.dll
|
||||
@BINPATH@/msvcr100.dll
|
||||
#elif MOZ_MSVC_REDIST == 1700
|
||||
@BINPATH@/msvcp110.dll
|
||||
@BINPATH@/msvcr110.dll
|
||||
#elif MOZ_MSVC_REDIST == 1800
|
||||
@BINPATH@/msvcp120.dll
|
||||
@BINPATH@/msvcr120.dll
|
||||
#if MOZ_PACKAGE_MSVC_DLLS
|
||||
@BINPATH@/@MSVC_C_RUNTIME_DLL@
|
||||
@BINPATH@/@MSVC_CXX_RUNTIME_DLL@
|
||||
#endif
|
||||
#endif
|
||||
#ifndef MOZ_NATIVE_ICU
|
||||
|
@ -4,13 +4,11 @@
|
||||
|
||||
# Panel Strings
|
||||
|
||||
get_link_to_share=Get a link and invite someone to talk
|
||||
share_link_url=Share the link below with your friend to start your call!
|
||||
do_not_disturb=Do not disturb
|
||||
share_link_header_text=Share this link to invite someone to talk:
|
||||
|
||||
get_a_call_url=Get a call url
|
||||
new_url=New url
|
||||
call_identifier_textinput_placeholder=Identify this call
|
||||
# Status text
|
||||
display_name_dnd_status=Do Not Disturb
|
||||
display_name_available_status=Available
|
||||
|
||||
unable_retrieve_url=Sorry, we were unable to retrieve a call url.
|
||||
|
||||
@ -38,4 +36,4 @@ connection_error_see_console_notification=Call failed; see console for details.
|
||||
## part between {{..}}
|
||||
legal_text_and_links=By using this product you agree to the <a \
|
||||
target="_blank" href="{{terms_of_use_url}}">Terms of Use</a> and <a \
|
||||
href="{{privacy_notice_url}}">Privacy Notice</a>
|
||||
href="{{privacy_notice_url}}">Privacy Notice</a>.
|
||||
|
@ -128,9 +128,9 @@
|
||||
<!ENTITY certs.auto.accesskey "S">
|
||||
<!ENTITY certs.ask "Ask me every time">
|
||||
<!ENTITY certs.ask.accesskey "A">
|
||||
<!ENTITY enableOCSP.label "Query OCSP responder servers to confirm the current validity of certificates">
|
||||
<!ENTITY enableOCSP.accesskey "Q">
|
||||
<!ENTITY viewCerts.label "View Certificates">
|
||||
<!ENTITY viewCerts.accesskey "C">
|
||||
<!ENTITY verify2.label "Validation">
|
||||
<!ENTITY verify2.accesskey "V">
|
||||
<!ENTITY viewSecurityDevices.label "Security Devices">
|
||||
<!ENTITY viewSecurityDevices.accesskey "D">
|
||||
|
@ -184,10 +184,6 @@ fi
|
||||
dnl A high level macro for selecting compiler options.
|
||||
AC_DEFUN([MOZ_COMPILER_OPTS],
|
||||
[
|
||||
if test "${MOZ_PSEUDO_DERECURSE-unset}" = unset; then
|
||||
MOZ_PSEUDO_DERECURSE=1
|
||||
fi
|
||||
|
||||
MOZ_DEBUGGING_OPTS
|
||||
MOZ_RTTI
|
||||
if test "$CLANG_CXX"; then
|
||||
|
@ -209,5 +209,3 @@ MOZ_RUN_CONFIG_STATUS()],
|
||||
define([AC_CONFIG_HEADER],
|
||||
[m4_fatal([Use CONFIGURE_DEFINE_FILES in moz.build files to produce header files.])
|
||||
])
|
||||
|
||||
AC_SUBST([MOZ_PSEUDO_DERECURSE])
|
||||
|
@ -20,7 +20,6 @@ export
|
||||
|
||||
compile
|
||||
Build the *compile* tier. The *compile* tier compiles all C/C++ files.
|
||||
Only applies to builds with ``MOZ_PSEUDO_DERECURSE``.
|
||||
|
||||
libs
|
||||
Build the *libs* tier. The *libs* tier performs linking and performs
|
||||
@ -36,7 +35,6 @@ binaries:
|
||||
build, but allows for much faster rebuilds of C/C++ code. For performance
|
||||
reasons, however, it skips nss, nspr, icu and ffi. This is targeted to
|
||||
improve local developer workflow when touching C/C++ code.
|
||||
Only applies to builds with ``MOZ_PSEUDO_DERECURSE``.
|
||||
|
||||
install-manifests
|
||||
Process install manifests. Install manifests handle the installation of
|
||||
|
@ -29,21 +29,3 @@ MACH_NO_WRITE_TIMES
|
||||
If defined, mach commands will not prefix output lines with the
|
||||
elapsed time since program start. This option is equivalent to
|
||||
passing ``--log-no-times`` to mach.
|
||||
|
||||
MOZ_PSEUDO_DERECURSE
|
||||
Activate an *experimental* build mode where make directory traversal
|
||||
is derecursified. This mode should result in faster build times at
|
||||
the expense of busted builds from time-to-time. The end goal is for
|
||||
this build mode to be the default. At which time, this variable will
|
||||
likely go away.
|
||||
|
||||
A value of ``1`` activates the mode with full optimizations.
|
||||
|
||||
A value of ``no-parallel-export`` activates the mode without
|
||||
optimizations to the *export* tier, which are known to be slightly
|
||||
buggy.
|
||||
|
||||
A value of ``no-skip`` activates the mode without optimizations to skip
|
||||
some directories during traversal.
|
||||
|
||||
Values may be combined with a comma.
|
||||
|
@ -8,35 +8,17 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef WIN32_REDIST_DIR
|
||||
|
||||
ifeq (1600,$(_MSC_VER))
|
||||
REDIST_FILES = \
|
||||
msvcp100.dll \
|
||||
msvcr100.dll \
|
||||
$(MSVC_C_RUNTIME_DLL) \
|
||||
$(MSVC_CXX_RUNTIME_DLL) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq (1700,$(_MSC_VER))
|
||||
REDIST_FILES = \
|
||||
msvcp110.dll \
|
||||
msvcr110.dll \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq (1800,$(_MSC_VER))
|
||||
REDIST_FILES = \
|
||||
msvcp120.dll \
|
||||
msvcr120.dll \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef REDIST_FILES
|
||||
libs-preqs = \
|
||||
$(call mkdir_deps,$(FINAL_TARGET)) \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(libs-preqs)
|
||||
install --preserve-timestamps $(foreach f,$(REDIST_FILES),'$(WIN32_REDIST_DIR)'/$(f)) $(FINAL_TARGET)
|
||||
endif
|
||||
|
||||
endif # WIN32_REDIST_DIR
|
||||
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsILoadInfo.h"
|
||||
|
||||
// This should be probably defined on some other place... but I couldn't find it
|
||||
#define WEBAPPS_PERM_NAME "webapps-manage"
|
||||
@ -265,6 +266,20 @@ nsScriptSecurityManager::GetChannelPrincipal(nsIChannel* aChannel,
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether we have an nsILoadInfo that says what we should do.
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
|
||||
if (loadInfo) {
|
||||
if (loadInfo->GetLoadingSandboxed()) {
|
||||
return CallCreateInstance(NS_NULLPRINCIPAL_CONTRACTID, aPrincipal);
|
||||
}
|
||||
|
||||
if (loadInfo->GetForceInheritPrincipal()) {
|
||||
NS_ADDREF(*aPrincipal = loadInfo->LoadingPrincipal());
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// OK, get the principal from the URI. Make sure this does the same thing
|
||||
// as nsDocument::Reset and XULDocument::StartDocumentLoad.
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
@ -198,11 +198,6 @@ endif
|
||||
CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
|
||||
AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf
|
||||
|
||||
# Disable MOZ_PSEUDO_DERECURSE on PGO builds until it's fixed.
|
||||
ifneq (,$(MOZ_PROFILE_USE)$(MOZ_PROFILE_GENERATE))
|
||||
MOZ_PSEUDO_DERECURSE :=
|
||||
endif
|
||||
|
||||
#
|
||||
# Strip off the excessively long version numbers on these platforms,
|
||||
# but save the version to allow multiple versions of the same base
|
||||
|
@ -100,7 +100,6 @@ endif
|
||||
|
||||
endif # !NO_DIST_INSTALL
|
||||
|
||||
ifdef MOZ_PSEUDO_DERECURSE
|
||||
BINARIES_INSTALL_TARGETS := $(foreach category,$(INSTALL_TARGETS),$(if $(filter binaries,$($(category)_TARGET)),$(category)))
|
||||
|
||||
# Fill a dependency file with all the binaries installed somewhere in $(DIST)
|
||||
@ -114,9 +113,4 @@ $(BINARIES_PP): Makefile $(wildcard backend.mk) $(call mkdir_deps,$(MDDEPDIR))
|
||||
)\
|
||||
))binaries: Makefile $(wildcard backend.mk)' | tr % '\n' > $@
|
||||
|
||||
else
|
||||
binaries::
|
||||
$(error The binaries target is not supported without MOZ_PSEUDO_DERECURSE)
|
||||
endif
|
||||
|
||||
# EOF
|
||||
|
@ -22,8 +22,7 @@ endif
|
||||
# make -C foo/baz
|
||||
# make -C qux
|
||||
|
||||
# MOZ_PSEUDO_DERECURSE can have values other than 1.
|
||||
ifeq (1_.,$(if $(MOZ_PSEUDO_DERECURSE),1)_$(DEPTH))
|
||||
ifeq (.,$(DEPTH))
|
||||
|
||||
include root.mk
|
||||
|
||||
@ -106,6 +105,8 @@ $(addsuffix /$(CURRENT_TIER),$(filter-out config,$(CURRENT_DIRS))): config/$(CUR
|
||||
endif
|
||||
|
||||
ifdef COMPILE_ENVIRONMENT
|
||||
# Disable dependency aggregation on PGO builds because of bug 934166.
|
||||
ifeq (,$(MOZ_PGO)$(MOZ_PROFILE_USE)$(MOZ_PROFILE_GENERATE))
|
||||
ifneq (,$(filter libs binaries,$(CURRENT_TIER)))
|
||||
# When doing a "libs" build, target_libs.mk ensures the interesting dependency data
|
||||
# is available in the "binaries" stamp. Once recursion is done, aggregate all that
|
||||
@ -135,6 +136,8 @@ DIST_GARBAGE += binaries-deps.mk binaries-deps
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
# Don't recurse if MAKELEVEL is NO_RECURSE_MAKELEVEL as defined above
|
||||
@ -185,9 +188,7 @@ endif # ifdef TIERS
|
||||
|
||||
endif # ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
|
||||
|
||||
endif # ifeq (1_.,$(MOZ_PSEUDO_DERECURSE)_$(DEPTH))
|
||||
|
||||
ifdef MOZ_PSEUDO_DERECURSE
|
||||
endif # ifeq (.,$(DEPTH))
|
||||
|
||||
ifdef COMPILE_ENVIRONMENT
|
||||
|
||||
@ -204,13 +205,14 @@ ALL_DEP_FILES := \
|
||||
endif
|
||||
|
||||
binaries libs:: $(TARGETS) $(BINARIES_PP)
|
||||
# Disable dependency aggregation on PGO builds because of bug 934166.
|
||||
ifeq (,$(MOZ_PGO)$(MOZ_PROFILE_USE)$(MOZ_PROFILE_GENERATE))
|
||||
ifneq (.,$(DEPTH))
|
||||
@$(if $^,$(call py_action,link_deps,-o binaries --group-all --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) $(ALL_DEP_FILES)))
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
endif # ifdef MOZ_PSEUDO_DERECURSE
|
||||
endif
|
||||
|
||||
recurse:
|
||||
@$(RECURSED_COMMAND)
|
||||
|
@ -177,18 +177,20 @@ else
|
||||
SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
|
||||
endif
|
||||
|
||||
ifdef SONAME
|
||||
DSO_SONAME = $(DLL_PREFIX)$(SONAME)$(DLL_SUFFIX)
|
||||
else
|
||||
DSO_SONAME = $(notdir $@)
|
||||
endif
|
||||
|
||||
EMBED_MANIFEST_AT=2
|
||||
|
||||
endif # MKSHLIB
|
||||
endif # FORCE_SHARED_LIB
|
||||
endif # LIBRARY
|
||||
|
||||
ifdef MKSHLIB
|
||||
ifdef SONAME
|
||||
DSO_SONAME = $(DLL_PREFIX)$(SONAME)$(DLL_SUFFIX)
|
||||
else
|
||||
DSO_SONAME = $(notdir $@)
|
||||
endif
|
||||
endif # MKSHLIB
|
||||
|
||||
ifdef FORCE_STATIC_LIB
|
||||
ifndef FORCE_SHARED_LIB
|
||||
SHARED_LIBRARY := $(NULL)
|
||||
@ -581,10 +583,8 @@ endif
|
||||
# default rule before including rules.mk
|
||||
default all::
|
||||
$(MAKE) export
|
||||
ifdef MOZ_PSEUDO_DERECURSE
|
||||
ifdef COMPILE_ENVIRONMENT
|
||||
$(MAKE) compile
|
||||
endif
|
||||
endif
|
||||
$(MAKE) libs
|
||||
$(MAKE) tools
|
||||
|
@ -481,16 +481,24 @@ case "$target" in
|
||||
if test "$_CC_MAJOR_VERSION" = "16"; then
|
||||
_CC_SUITE=10
|
||||
MSVS_VERSION=2010
|
||||
MSVC_C_RUNTIME_DLL=msvcr100.dll
|
||||
MSVC_CXX_RUNTIME_DLL=msvcp100.dll
|
||||
elif test "$_CC_MAJOR_VERSION" = "17"; then
|
||||
_CC_SUITE=11
|
||||
MSVS_VERSION=2012
|
||||
MSVC_C_RUNTIME_DLL=msvcr110.dll
|
||||
MSVC_CXX_RUNTIME_DLL=msvcp110.dll
|
||||
elif test "$_CC_MAJOR_VERSION" = "18"; then
|
||||
_CC_SUITE=12
|
||||
MSVS_VERSION=2013
|
||||
MSVC_C_RUNTIME_DLL=msvcr120.dll
|
||||
MSVC_CXX_RUNTIME_DLL=msvcp120.dll
|
||||
else
|
||||
AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
|
||||
fi
|
||||
AC_SUBST(MSVS_VERSION)
|
||||
AC_SUBST(MSVC_C_RUNTIME_DLL)
|
||||
AC_SUBST(MSVC_CXX_RUNTIME_DLL)
|
||||
|
||||
# Disable SEH on clang-cl because it doesn't implement them yet.
|
||||
if test -z "$CLANG_CL"; then
|
||||
|
@ -1993,20 +1993,27 @@ public:
|
||||
static nsresult URIInheritsSecurityContext(nsIURI *aURI, bool *aResult);
|
||||
|
||||
/**
|
||||
* Set the given principal as the owner of the given channel, if
|
||||
* needed. aURI must be the URI of aChannel. aPrincipal may be
|
||||
* null. If aSetUpForAboutBlank is true, then about:blank will get
|
||||
* the principal set up on it. If aForceOwner is true, the owner
|
||||
* will be set on the channel, even if the principal can be determined
|
||||
* from the channel.
|
||||
* The return value is whether the principal was set up as the owner
|
||||
* of the channel.
|
||||
* Set the given principal as the principal on the nsILoadInfo of the given
|
||||
* channel, and tell the channel to inherit it if needed. aPrincipal may be
|
||||
* null, in which case this method is a no-op.
|
||||
*
|
||||
* If aLoadingPrincipal is not null, aURI must be the URI of aChannel. If
|
||||
* aInheritForAboutBlank is true, then about:blank will be told to inherit the
|
||||
* principal. If aForceInherit is true, the channel will be told to inherit
|
||||
* the principal no matter what, as long as the principal is not null.
|
||||
*
|
||||
* If aIsSandboxed is true, then aLoadingPrincipal must not be null. In this
|
||||
* case, the owner on the channel, if any, will be reset to null and the
|
||||
* nsILoadInfo will say the channel should be sandboxed.
|
||||
*
|
||||
* The return value is whether the channel was told to inherit the principal.
|
||||
*/
|
||||
static bool SetUpChannelOwner(nsIPrincipal* aLoadingPrincipal,
|
||||
nsIChannel* aChannel,
|
||||
nsIURI* aURI,
|
||||
bool aSetUpForAboutBlank,
|
||||
bool aForceOwner = false);
|
||||
bool aInheritForAboutBlank,
|
||||
bool aIsSandboxed,
|
||||
bool aForceInherit);
|
||||
|
||||
static nsresult Btoa(const nsAString& aBinaryData,
|
||||
nsAString& aAsciiBase64String);
|
||||
|
@ -132,8 +132,8 @@ typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0xc9e11955, 0xaa55, 0x49a1, \
|
||||
{ 0x94, 0x29, 0x58, 0xe9, 0xbe, 0xf6, 0x79, 0x54 } }
|
||||
{ 0xa45ef8f0, 0x7c5b, 0x425d, \
|
||||
{ 0xa5, 0xe7, 0x11, 0x41, 0x5c, 0x41, 0x0c, 0x7a } }
|
||||
|
||||
// Enum for requesting a particular type of document when creating a doc
|
||||
enum DocumentFlavor {
|
||||
@ -851,6 +851,7 @@ public:
|
||||
};
|
||||
|
||||
virtual nsresult LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetURI) = 0;
|
||||
virtual nsresult AddAdditionalStyleSheet(additionalSheetType aType, nsIStyleSheet* aSheet) = 0;
|
||||
virtual void RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* sheetURI) = 0;
|
||||
virtual nsIStyleSheet* FirstAdditionalAuthorSheet() = 0;
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsError.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -241,8 +242,11 @@ DOMParser::ParseFromStream(nsIInputStream *stream,
|
||||
nsDependentCString(contentType), nullptr);
|
||||
NS_ENSURE_STATE(parserChannel);
|
||||
|
||||
// More principal-faking here
|
||||
parserChannel->SetOwner(mOriginalPrincipal);
|
||||
// More principal-faking here
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(mOriginalPrincipal, LoadInfo::eInheritPrincipal,
|
||||
LoadInfo::eNotSandboxed);
|
||||
parserChannel->SetLoadInfo(loadInfo);
|
||||
|
||||
if (charset) {
|
||||
parserChannel->SetContentCharset(nsDependentCString(charset));
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/EventSourceBinding.h"
|
||||
#include "mozilla/dom/MessageEvent.h"
|
||||
@ -375,7 +376,10 @@ EventSource::OnStartRequest(nsIRequest *aRequest,
|
||||
principal = do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
rv = httpChannel->SetOwner(principal);
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(principal, LoadInfo::eInheritPrincipal,
|
||||
LoadInfo::eNotSandboxed);
|
||||
rv = httpChannel->SetLoadInfo(loadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "mozilla/dom/DocumentFragment.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLMediaElement.h"
|
||||
@ -6429,15 +6430,25 @@ bool
|
||||
nsContentUtils::SetUpChannelOwner(nsIPrincipal* aLoadingPrincipal,
|
||||
nsIChannel* aChannel,
|
||||
nsIURI* aURI,
|
||||
bool aSetUpForAboutBlank,
|
||||
bool aForceOwner)
|
||||
bool aInheritForAboutBlank,
|
||||
bool aIsSandboxed,
|
||||
bool aForceInherit)
|
||||
{
|
||||
if (!aLoadingPrincipal) {
|
||||
// Nothing to do here
|
||||
MOZ_ASSERT(!aIsSandboxed);
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we're sandboxed, make sure to clear any owner the channel
|
||||
// might already have.
|
||||
if (aIsSandboxed) {
|
||||
aChannel->SetOwner(nullptr);
|
||||
}
|
||||
|
||||
// Set the loadInfo of the channel, but only tell the channel to
|
||||
// inherit if it can't provide its own security context.
|
||||
//
|
||||
// Set the owner of the channel, but only for channels that can't
|
||||
// provide their own security context.
|
||||
//
|
||||
// XXX: It seems wrong that the owner is ignored - even if one is
|
||||
// supplied) unless the URI is javascript or data or about:blank.
|
||||
// XXX: If this is ever changed, check all callers for what owners
|
||||
// they're passing in. In particular, see the code and
|
||||
// comments in nsDocShell::LoadURI where we fall back on
|
||||
@ -6445,57 +6456,40 @@ nsContentUtils::SetUpChannelOwner(nsIPrincipal* aLoadingPrincipal,
|
||||
// very wrong if this code changed anything but channels that
|
||||
// can't provide their own security context!
|
||||
//
|
||||
// (Currently chrome URIs set the owner when they are created!
|
||||
// So setting a nullptr owner would be bad!)
|
||||
//
|
||||
// If aForceOwner is true, the owner will be set, even for a channel that
|
||||
// can provide its own security context. This is used for the HTML5 IFRAME
|
||||
// sandbox attribute, so we can force the channel (and its document) to
|
||||
// explicitly have a null principal.
|
||||
bool inherit;
|
||||
// We expect URIInheritsSecurityContext to return success for an
|
||||
// about:blank URI, so don't call NS_IsAboutBlank() if this call fails.
|
||||
// This condition needs to match the one in nsDocShell::InternalLoad where
|
||||
// we're checking for things that will use the owner.
|
||||
if (aForceOwner || ((NS_SUCCEEDED(URIInheritsSecurityContext(aURI, &inherit)) &&
|
||||
(inherit || (aSetUpForAboutBlank && NS_IsAboutBlank(aURI)))))) {
|
||||
#ifdef DEBUG
|
||||
// Assert that aForceOwner is only set for null principals for non-srcdoc
|
||||
// loads. (Strictly speaking not all uses of about:srcdoc would be
|
||||
// srcdoc loads, but the URI is non-resolvable in cases where it is not).
|
||||
if (aForceOwner) {
|
||||
nsAutoCString uriStr;
|
||||
aURI->GetSpec(uriStr);
|
||||
if(!uriStr.EqualsLiteral("about:srcdoc") &&
|
||||
!uriStr.EqualsLiteral("view-source:about:srcdoc")) {
|
||||
nsCOMPtr<nsIURI> ownerURI;
|
||||
nsresult rv = aLoadingPrincipal->GetURI(getter_AddRefs(ownerURI));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv) && SchemeIs(ownerURI, NS_NULLPRINCIPAL_SCHEME));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
aChannel->SetOwner(aLoadingPrincipal);
|
||||
return true;
|
||||
// If aForceInherit is true, we will inherit, even for a channel that
|
||||
// can provide its own security context. This is used for srcdoc loads.
|
||||
bool inherit = aForceInherit;
|
||||
if (!inherit) {
|
||||
bool uriInherits;
|
||||
// We expect URIInheritsSecurityContext to return success for an
|
||||
// about:blank URI, so don't call NS_IsAboutBlank() if this call fails.
|
||||
// This condition needs to match the one in nsDocShell::InternalLoad where
|
||||
// we're checking for things that will use the owner.
|
||||
inherit =
|
||||
(NS_SUCCEEDED(URIInheritsSecurityContext(aURI, &uriInherits)) &&
|
||||
(uriInherits || (aInheritForAboutBlank && NS_IsAboutBlank(aURI)))) ||
|
||||
//
|
||||
// file: uri special-casing
|
||||
//
|
||||
// If this is a file: load opened from another file: then it may need
|
||||
// to inherit the owner from the referrer so they can script each other.
|
||||
// If we don't set the owner explicitly then each file: gets an owner
|
||||
// based on its own codebase later.
|
||||
//
|
||||
(URIIsLocalFile(aURI) &&
|
||||
NS_SUCCEEDED(aLoadingPrincipal->CheckMayLoad(aURI, false, false)) &&
|
||||
// One more check here. CheckMayLoad will always return true for the
|
||||
// system principal, but we do NOT want to inherit in that case.
|
||||
!IsSystemPrincipal(aLoadingPrincipal));
|
||||
}
|
||||
|
||||
//
|
||||
// file: uri special-casing
|
||||
//
|
||||
// If this is a file: load opened from another file: then it may need
|
||||
// to inherit the owner from the referrer so they can script each other.
|
||||
// If we don't set the owner explicitly then each file: gets an owner
|
||||
// based on its own codebase later.
|
||||
//
|
||||
if (URIIsLocalFile(aURI) && aLoadingPrincipal &&
|
||||
NS_SUCCEEDED(aLoadingPrincipal->CheckMayLoad(aURI, false, false)) &&
|
||||
// One more check here. CheckMayLoad will always return true for the
|
||||
// system principal, but we do NOT want to inherit in that case.
|
||||
!IsSystemPrincipal(aLoadingPrincipal)) {
|
||||
aChannel->SetOwner(aLoadingPrincipal);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(aLoadingPrincipal,
|
||||
inherit ?
|
||||
LoadInfo::eInheritPrincipal : LoadInfo::eDontInheritPrincipal,
|
||||
aIsSandboxed ? LoadInfo::eSandboxed : LoadInfo::eNotSandboxed);
|
||||
aChannel->SetLoadInfo(loadInfo);
|
||||
return inherit && !aIsSandboxed;
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -4221,22 +4221,34 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetUR
|
||||
true, getter_AddRefs(sheet));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mAdditionalSheets[aType].AppendObject(sheet);
|
||||
sheet->SetOwningDocument(this);
|
||||
MOZ_ASSERT(sheet->IsApplicable());
|
||||
|
||||
return AddAdditionalStyleSheet(aType, sheet);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, nsIStyleSheet* aSheet)
|
||||
{
|
||||
if (mAdditionalSheets[aType].Contains(aSheet))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (!aSheet->IsApplicable())
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
mAdditionalSheets[aType].AppendObject(aSheet);
|
||||
|
||||
BeginUpdate(UPDATE_STYLE);
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
nsStyleSet::sheetType type = ConvertAdditionalSheetType(aType);
|
||||
shell->StyleSet()->AppendStyleSheet(type, sheet);
|
||||
shell->StyleSet()->AppendStyleSheet(type, aSheet);
|
||||
}
|
||||
|
||||
// Passing false, so documet.styleSheets.length will not be affected by
|
||||
// these additional sheets.
|
||||
NotifyStyleSheetAdded(sheet, false);
|
||||
NotifyStyleSheetAdded(aSheet, false);
|
||||
EndUpdate(UPDATE_STYLE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -11875,6 +11887,10 @@ SizeOfStyleSheetsElementIncludingThis(nsIStyleSheet* aStyleSheet,
|
||||
MallocSizeOf aMallocSizeOf,
|
||||
void* aData)
|
||||
{
|
||||
if (!aStyleSheet->GetOwningDocument()) {
|
||||
// Avoid over-reporting shared sheets.
|
||||
return 0;
|
||||
}
|
||||
return aStyleSheet->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
|
@ -809,6 +809,7 @@ public:
|
||||
bool aApplicable) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetURI) MOZ_OVERRIDE;
|
||||
virtual nsresult AddAdditionalStyleSheet(additionalSheetType aType, nsIStyleSheet* aSheet) MOZ_OVERRIDE;
|
||||
virtual void RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* sheetURI) MOZ_OVERRIDE;
|
||||
virtual nsIStyleSheet* FirstAdditionalAuthorSheet() MOZ_OVERRIDE;
|
||||
|
||||
|
@ -15,8 +15,10 @@
|
||||
#include "mozilla/dom/MediaSource.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
|
||||
using mozilla::dom::DOMFileImpl;
|
||||
using mozilla::LoadInfo;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Hash table
|
||||
@ -506,8 +508,6 @@ nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
|
||||
stream);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISupports> owner = do_QueryInterface(info->mPrincipal);
|
||||
|
||||
nsString type;
|
||||
rv = blob->GetType(type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -523,7 +523,10 @@ nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
|
||||
rv = blob->GetSize(&size);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
channel->SetOwner(owner);
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new mozilla::LoadInfo(info->mPrincipal, LoadInfo::eInheritPrincipal,
|
||||
LoadInfo::eNotSandboxed);
|
||||
channel->SetLoadInfo(loadInfo);
|
||||
channel->SetOriginalURI(uri);
|
||||
channel->SetContentType(NS_ConvertUTF16toUTF8(type));
|
||||
channel->SetContentLength(size);
|
||||
|
@ -2367,18 +2367,11 @@ nsObjectLoadingContent::OpenChannel()
|
||||
|
||||
// Set up the channel's principal and such, like nsDocShell::DoURILoad does.
|
||||
// If the content being loaded should be sandboxed with respect to origin we
|
||||
// create a new null principal here. nsContentUtils::SetUpChannelOwner is
|
||||
// used with a flag to force it to be set as the channel owner.
|
||||
nsCOMPtr<nsIPrincipal> ownerPrincipal;
|
||||
uint32_t sandboxFlags = doc->GetSandboxFlags();
|
||||
if (sandboxFlags & SANDBOXED_ORIGIN) {
|
||||
ownerPrincipal = do_CreateInstance("@mozilla.org/nullprincipal;1");
|
||||
} else {
|
||||
// Not sandboxed - we allow the content to assume its natural owner.
|
||||
ownerPrincipal = thisContent->NodePrincipal();
|
||||
}
|
||||
nsContentUtils::SetUpChannelOwner(ownerPrincipal, chan, mURI, true,
|
||||
sandboxFlags & SANDBOXED_ORIGIN);
|
||||
// tell SetUpChannelOwner that.
|
||||
nsContentUtils::SetUpChannelOwner(thisContent->NodePrincipal(), chan, mURI,
|
||||
true,
|
||||
doc->GetSandboxFlags() & SANDBOXED_ORIGIN,
|
||||
false);
|
||||
|
||||
nsCOMPtr<nsIScriptChannel> scriptChannel = do_QueryInterface(chan);
|
||||
if (scriptChannel) {
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsDOMBlobBuilder.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
@ -1973,7 +1974,10 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
documentPrincipal = mPrincipal;
|
||||
}
|
||||
|
||||
channel->SetOwner(documentPrincipal);
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(documentPrincipal, LoadInfo::eInheritPrincipal,
|
||||
LoadInfo::eNotSandboxed);
|
||||
channel->SetLoadInfo(loadInfo);
|
||||
|
||||
nsresult status;
|
||||
request->GetStatus(&status);
|
||||
|
@ -2112,14 +2112,14 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
|
||||
case LOCAL_GL_UNSIGNED_BYTE:
|
||||
isReadTypeValid = true;
|
||||
bytesPerPixel = 1*channels;
|
||||
requiredDataType = js::ArrayBufferView::TYPE_UINT8;
|
||||
requiredDataType = js::Scalar::Uint8;
|
||||
break;
|
||||
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
|
||||
isReadTypeValid = true;
|
||||
bytesPerPixel = 2;
|
||||
requiredDataType = js::ArrayBufferView::TYPE_UINT16;
|
||||
requiredDataType = js::Scalar::Uint16;
|
||||
break;
|
||||
case LOCAL_GL_FLOAT:
|
||||
if (IsExtensionEnabled(WebGLExtensionID::WEBGL_color_buffer_float) ||
|
||||
@ -2128,7 +2128,7 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
|
||||
isReadTypeValid = true;
|
||||
isReadTypeFloat = true;
|
||||
bytesPerPixel = 4*channels;
|
||||
requiredDataType = js::ArrayBufferView::TYPE_FLOAT32;
|
||||
requiredDataType = js::Scalar::Float32;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1202,7 +1202,7 @@ WebGLContext::ValidateTexInputData(GLenum type, int jsArrayType, WebGLTexImageFu
|
||||
// First, we check for packed types
|
||||
switch (type) {
|
||||
case LOCAL_GL_UNSIGNED_BYTE:
|
||||
validInput = (jsArrayType == -1 || jsArrayType == js::ArrayBufferView::TYPE_UINT8);
|
||||
validInput = (jsArrayType == -1 || jsArrayType == js::Scalar::Uint8);
|
||||
break;
|
||||
|
||||
case LOCAL_GL_HALF_FLOAT:
|
||||
@ -1211,16 +1211,16 @@ WebGLContext::ValidateTexInputData(GLenum type, int jsArrayType, WebGLTexImageFu
|
||||
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
|
||||
validInput = (jsArrayType == -1 || jsArrayType == js::ArrayBufferView::TYPE_UINT16);
|
||||
validInput = (jsArrayType == -1 || jsArrayType == js::Scalar::Uint16);
|
||||
break;
|
||||
|
||||
case LOCAL_GL_UNSIGNED_INT:
|
||||
case LOCAL_GL_UNSIGNED_INT_24_8:
|
||||
validInput = (jsArrayType == -1 || jsArrayType == js::ArrayBufferView::TYPE_UINT32);
|
||||
validInput = (jsArrayType == -1 || jsArrayType == js::Scalar::Uint32);
|
||||
break;
|
||||
|
||||
case LOCAL_GL_FLOAT:
|
||||
validInput = (jsArrayType == -1 || jsArrayType == js::ArrayBufferView::TYPE_FLOAT32);
|
||||
validInput = (jsArrayType == -1 || jsArrayType == js::Scalar::Float32);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -83,6 +83,7 @@
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/FallbackEncoding.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "nsIEditingSession.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
@ -1525,7 +1526,10 @@ nsHTMLDocument::Open(JSContext* cx,
|
||||
|
||||
// Set the caller principal, if any, on the channel so that we'll
|
||||
// make sure to use it when we reset.
|
||||
rv = channel->SetOwner(callerPrincipal);
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(callerPrincipal, LoadInfo::eInheritPrincipal,
|
||||
LoadInfo::eNotSandboxed);
|
||||
rv = channel->SetLoadInfo(loadInfo);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -2388,7 +2392,10 @@ nsHTMLDocument::CreateAndAddWyciwygChannel(void)
|
||||
GetDocumentCharacterSet());
|
||||
|
||||
// Use our new principal
|
||||
channel->SetOwner(NodePrincipal());
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(NodePrincipal(), LoadInfo::eInheritPrincipal,
|
||||
LoadInfo::eNotSandboxed);
|
||||
channel->SetLoadInfo(loadInfo);
|
||||
|
||||
// Inherit load flags from the original document's channel
|
||||
channel->SetLoadFlags(mLoadFlags);
|
||||
|
@ -813,7 +813,7 @@ public:
|
||||
// Called when the backend has changed the current playback
|
||||
// position. It dispatches a timeupdate event and invalidates the frame.
|
||||
// This must be called on the main thread only.
|
||||
void PlaybackPositionChanged();
|
||||
virtual void PlaybackPositionChanged();
|
||||
|
||||
// Calls mElement->UpdateReadyStateForData, telling it whether we have
|
||||
// data for the next frame and if we're buffering. Main thread only.
|
||||
|
@ -23,17 +23,17 @@ SOURCES += [
|
||||
if CONFIG['MOZ_WMF']:
|
||||
EXPORTS += [
|
||||
'wmf/MFTDecoder.h',
|
||||
'wmf/WMFAudioOutputSource.h',
|
||||
'wmf/WMFAudioMFTManager.h',
|
||||
'wmf/WMFDecoderModule.h',
|
||||
'wmf/WMFMediaDataDecoder.h',
|
||||
'wmf/WMFVideoOutputSource.h',
|
||||
'wmf/WMFVideoMFTManager.h',
|
||||
]
|
||||
UNIFIED_SOURCES += [
|
||||
'wmf/MFTDecoder.cpp',
|
||||
'wmf/WMFAudioOutputSource.cpp',
|
||||
'wmf/WMFAudioMFTManager.cpp',
|
||||
'wmf/WMFDecoderModule.cpp',
|
||||
'wmf/WMFMediaDataDecoder.cpp',
|
||||
'wmf/WMFVideoOutputSource.cpp',
|
||||
'wmf/WMFVideoMFTManager.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_FFMPEG']:
|
||||
|
@ -21,6 +21,7 @@ namespace mozilla {
|
||||
|
||||
MFTDecoder::MFTDecoder()
|
||||
: mMFTProvidesOutputSamples(false)
|
||||
, mDiscontinuity(true)
|
||||
{
|
||||
memset(&mInputStreamInfo, 0, sizeof(MFT_INPUT_STREAM_INFO));
|
||||
memset(&mOutputStreamInfo, 0, sizeof(MFT_OUTPUT_STREAM_INFO));
|
||||
@ -237,6 +238,11 @@ MFTDecoder::Output(RefPtr<IMFSample>* aOutput)
|
||||
|
||||
MOZ_ASSERT(output.pSample);
|
||||
|
||||
if (mDiscontinuity) {
|
||||
output.pSample->SetUINT32(MFSampleExtension_Discontinuity, TRUE);
|
||||
mDiscontinuity = false;
|
||||
}
|
||||
|
||||
*aOutput = output.pSample; // AddRefs
|
||||
if (mMFTProvidesOutputSamples) {
|
||||
// If the MFT is providing samples, we must release the sample here.
|
||||
@ -277,6 +283,8 @@ MFTDecoder::Flush()
|
||||
HRESULT hr = SendMFTMessage(MFT_MESSAGE_COMMAND_FLUSH, 0);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
|
||||
mDiscontinuity = true;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,9 @@ private:
|
||||
|
||||
// True if the IMFTransform allocates the samples that it returns.
|
||||
bool mMFTProvidesOutputSamples;
|
||||
|
||||
// True if we need to mark the next sample as a discontinuity.
|
||||
bool mDiscontinuity;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -4,7 +4,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/. */
|
||||
|
||||
#include "WMFAudioOutputSource.h"
|
||||
#include "WMFAudioMFTManager.h"
|
||||
#include "mp4_demuxer/DecoderData.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "WMFUtils.h"
|
||||
@ -66,7 +66,7 @@ AACAudioSpecificConfigToUserData(const uint8_t* aAudioSpecConfig,
|
||||
aOutUserData.AppendElements(aAudioSpecConfig, aConfigLength);
|
||||
}
|
||||
|
||||
WMFAudioOutputSource::WMFAudioOutputSource(
|
||||
WMFAudioMFTManager::WMFAudioMFTManager(
|
||||
const mp4_demuxer::AudioDecoderConfig& aConfig)
|
||||
: mAudioChannels(aConfig.channel_count)
|
||||
, mAudioBytesPerSample(aConfig.bits_per_sample / 8)
|
||||
@ -75,19 +75,19 @@ WMFAudioOutputSource::WMFAudioOutputSource(
|
||||
, mAudioFrameSum(0)
|
||||
, mMustRecaptureAudioPosition(true)
|
||||
{
|
||||
MOZ_COUNT_CTOR(WMFAudioOutputSource);
|
||||
MOZ_COUNT_CTOR(WMFAudioMFTManager);
|
||||
AACAudioSpecificConfigToUserData(&aConfig.audio_specific_config[0],
|
||||
aConfig.audio_specific_config.length(),
|
||||
mUserData);
|
||||
}
|
||||
|
||||
WMFAudioOutputSource::~WMFAudioOutputSource()
|
||||
WMFAudioMFTManager::~WMFAudioMFTManager()
|
||||
{
|
||||
MOZ_COUNT_DTOR(WMFAudioOutputSource);
|
||||
MOZ_COUNT_DTOR(WMFAudioMFTManager);
|
||||
}
|
||||
|
||||
TemporaryRef<MFTDecoder>
|
||||
WMFAudioOutputSource::Init()
|
||||
WMFAudioMFTManager::Init()
|
||||
{
|
||||
RefPtr<MFTDecoder> decoder(new MFTDecoder());
|
||||
|
||||
@ -129,7 +129,7 @@ WMFAudioOutputSource::Init()
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WMFAudioOutputSource::Input(mp4_demuxer::MP4Sample* aSample)
|
||||
WMFAudioMFTManager::Input(mp4_demuxer::MP4Sample* aSample)
|
||||
{
|
||||
const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data);
|
||||
uint32_t length = aSample->size;
|
||||
@ -137,8 +137,8 @@ WMFAudioOutputSource::Input(mp4_demuxer::MP4Sample* aSample)
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WMFAudioOutputSource::Output(int64_t aStreamOffset,
|
||||
nsAutoPtr<MediaData>& aOutData)
|
||||
WMFAudioMFTManager::Output(int64_t aStreamOffset,
|
||||
nsAutoPtr<MediaData>& aOutData)
|
||||
{
|
||||
aOutData = nullptr;
|
||||
RefPtr<IMFSample> sample;
|
@ -15,10 +15,10 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class WMFAudioOutputSource : public WMFOutputSource {
|
||||
class WMFAudioMFTManager : public MFTManager {
|
||||
public:
|
||||
WMFAudioOutputSource(const mp4_demuxer::AudioDecoderConfig& aConfig);
|
||||
~WMFAudioOutputSource();
|
||||
WMFAudioMFTManager(const mp4_demuxer::AudioDecoderConfig& aConfig);
|
||||
~WMFAudioMFTManager();
|
||||
|
||||
virtual TemporaryRef<MFTDecoder> Init() MOZ_OVERRIDE;
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include "WMF.h"
|
||||
#include "WMFDecoderModule.h"
|
||||
#include "WMFDecoder.h"
|
||||
#include "WMFVideoOutputSource.h"
|
||||
#include "WMFAudioOutputSource.h"
|
||||
#include "WMFVideoMFTManager.h"
|
||||
#include "WMFAudioMFTManager.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "WMFMediaDataDecoder.h"
|
||||
@ -70,10 +70,10 @@ WMFDecoderModule::CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConf
|
||||
MediaTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
return new WMFMediaDataDecoder(new WMFVideoOutputSource(aConfig,
|
||||
aLayersBackend,
|
||||
aImageContainer,
|
||||
sDXVAEnabled),
|
||||
return new WMFMediaDataDecoder(new WMFVideoMFTManager(aConfig,
|
||||
aLayersBackend,
|
||||
aImageContainer,
|
||||
sDXVAEnabled),
|
||||
aVideoTaskQueue,
|
||||
aCallback);
|
||||
}
|
||||
@ -83,7 +83,7 @@ WMFDecoderModule::CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfi
|
||||
MediaTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
return new WMFMediaDataDecoder(new WMFAudioOutputSource(aConfig),
|
||||
return new WMFMediaDataDecoder(new WMFAudioMFTManager(aConfig),
|
||||
aAudioTaskQueue,
|
||||
aCallback);
|
||||
}
|
||||
|
@ -21,12 +21,12 @@ PRLogModuleInfo* GetDemuxerLog();
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
WMFMediaDataDecoder::WMFMediaDataDecoder(WMFOutputSource* aSource,
|
||||
WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager,
|
||||
MediaTaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
: mTaskQueue(aTaskQueue)
|
||||
, mCallback(aCallback)
|
||||
, mSource(aSource)
|
||||
, mMFTManager(aMFTManager)
|
||||
{
|
||||
MOZ_COUNT_CTOR(WMFMediaDataDecoder);
|
||||
}
|
||||
@ -39,7 +39,7 @@ WMFMediaDataDecoder::~WMFMediaDataDecoder()
|
||||
nsresult
|
||||
WMFMediaDataDecoder::Init()
|
||||
{
|
||||
mDecoder = mSource->Init();
|
||||
mDecoder = mMFTManager->Init();
|
||||
NS_ENSURE_TRUE(mDecoder, NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
@ -67,9 +67,9 @@ WMFMediaDataDecoder::Input(mp4_demuxer::MP4Sample* aSample)
|
||||
void
|
||||
WMFMediaDataDecoder::ProcessDecode(mp4_demuxer::MP4Sample* aSample)
|
||||
{
|
||||
HRESULT hr = mSource->Input(aSample);
|
||||
HRESULT hr = mMFTManager->Input(aSample);
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("WMFOutputSource rejected sample");
|
||||
NS_WARNING("MFTManager rejected sample");
|
||||
mCallback->Error();
|
||||
return;
|
||||
}
|
||||
@ -84,7 +84,7 @@ WMFMediaDataDecoder::ProcessOutput()
|
||||
{
|
||||
nsAutoPtr<MediaData> output;
|
||||
HRESULT hr = S_OK;
|
||||
while (SUCCEEDED(hr = mSource->Output(mLastStreamOffset, output)) &&
|
||||
while (SUCCEEDED(hr = mMFTManager->Output(mLastStreamOffset, output)) &&
|
||||
output) {
|
||||
mCallback->Output(output.forget());
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ namespace mozilla {
|
||||
// Encapsulates the initialization of the MFTDecoder appropriate for decoding
|
||||
// a given stream, and the process of converting the IMFSample produced
|
||||
// by the MFT into a MediaData object.
|
||||
class WMFOutputSource {
|
||||
class MFTManager {
|
||||
public:
|
||||
virtual ~WMFOutputSource() {}
|
||||
virtual ~MFTManager() {}
|
||||
|
||||
// Creates an initializs the MFTDecoder.
|
||||
// Returns nullptr on failure.
|
||||
@ -46,13 +46,13 @@ public:
|
||||
};
|
||||
|
||||
// Decodes audio and video using Windows Media Foundation. Samples are decoded
|
||||
// using the MFTDecoder created by the WMFOutputSource. This class implements
|
||||
// using the MFTDecoder created by the MFTManager. This class implements
|
||||
// the higher-level logic that drives mapping the MFT to the async
|
||||
// MediaDataDecoder interface. The specifics of decoding the exact stream
|
||||
// type are handled by WMFOutputSource and the MFTDecoder it creates.
|
||||
// type are handled by MFTManager and the MFTDecoder it creates.
|
||||
class WMFMediaDataDecoder : public MediaDataDecoder {
|
||||
public:
|
||||
WMFMediaDataDecoder(WMFOutputSource* aOutputSource,
|
||||
WMFMediaDataDecoder(MFTManager* aOutputSource,
|
||||
MediaTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback);
|
||||
~WMFMediaDataDecoder();
|
||||
@ -85,7 +85,7 @@ private:
|
||||
MediaDataDecoderCallback* mCallback;
|
||||
|
||||
RefPtr<MFTDecoder> mDecoder;
|
||||
nsAutoPtr<WMFOutputSource> mSource;
|
||||
nsAutoPtr<MFTManager> mMFTManager;
|
||||
|
||||
// The last offset into the media resource that was passed into Input().
|
||||
// This is used to approximate the decoder's position in the media resource.
|
||||
|
@ -4,7 +4,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/. */
|
||||
|
||||
#include "WMFVideoOutputSource.h"
|
||||
#include "WMFVideoMFTManager.h"
|
||||
#include "MediaDecoderReader.h"
|
||||
#include "WMFUtils.h"
|
||||
#include "ImageContainer.h"
|
||||
@ -32,7 +32,7 @@ using mozilla::layers::LayersBackend;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
WMFVideoOutputSource::WMFVideoOutputSource(
|
||||
WMFVideoMFTManager::WMFVideoMFTManager(
|
||||
const mp4_demuxer::VideoDecoderConfig& aConfig,
|
||||
mozilla::layers::LayersBackend aLayersBackend,
|
||||
mozilla::layers::ImageContainer* aImageContainer,
|
||||
@ -48,12 +48,12 @@ WMFVideoOutputSource::WMFVideoOutputSource(
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Should not be on main thread.");
|
||||
MOZ_ASSERT(mImageContainer);
|
||||
MOZ_COUNT_CTOR(WMFVideoOutputSource);
|
||||
MOZ_COUNT_CTOR(WMFVideoMFTManager);
|
||||
}
|
||||
|
||||
WMFVideoOutputSource::~WMFVideoOutputSource()
|
||||
WMFVideoMFTManager::~WMFVideoMFTManager()
|
||||
{
|
||||
MOZ_COUNT_DTOR(WMFVideoOutputSource);
|
||||
MOZ_COUNT_DTOR(WMFVideoMFTManager);
|
||||
// Ensure DXVA/D3D9 related objects are released on the main thread.
|
||||
DeleteOnMainThread(mDXVA2Manager);
|
||||
}
|
||||
@ -69,7 +69,7 @@ public:
|
||||
};
|
||||
|
||||
bool
|
||||
WMFVideoOutputSource::InitializeDXVA()
|
||||
WMFVideoMFTManager::InitializeDXVA()
|
||||
{
|
||||
// If we use DXVA but aren't running with a D3D layer manager then the
|
||||
// readback of decoded video frames from GPU to CPU memory grinds painting
|
||||
@ -90,7 +90,7 @@ WMFVideoOutputSource::InitializeDXVA()
|
||||
}
|
||||
|
||||
TemporaryRef<MFTDecoder>
|
||||
WMFVideoOutputSource::Init()
|
||||
WMFVideoMFTManager::Init()
|
||||
{
|
||||
bool useDxva = InitializeDXVA();
|
||||
|
||||
@ -144,7 +144,7 @@ WMFVideoOutputSource::Init()
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WMFVideoOutputSource::Input(mp4_demuxer::MP4Sample* aSample)
|
||||
WMFVideoMFTManager::Input(mp4_demuxer::MP4Sample* aSample)
|
||||
{
|
||||
// We must prepare samples in AVC Annex B.
|
||||
mp4_demuxer::AnnexB::ConvertSample(aSample, mConfig.annex_b);
|
||||
@ -155,7 +155,7 @@ WMFVideoOutputSource::Input(mp4_demuxer::MP4Sample* aSample)
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WMFVideoOutputSource::ConfigureVideoFrameGeometry()
|
||||
WMFVideoMFTManager::ConfigureVideoFrameGeometry()
|
||||
{
|
||||
RefPtr<IMFMediaType> mediaType;
|
||||
HRESULT hr = mDecoder->GetOutputMediaType(mediaType);
|
||||
@ -216,9 +216,9 @@ WMFVideoOutputSource::ConfigureVideoFrameGeometry()
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WMFVideoOutputSource::CreateBasicVideoFrame(IMFSample* aSample,
|
||||
int64_t aStreamOffset,
|
||||
VideoData** aOutVideoData)
|
||||
WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample,
|
||||
int64_t aStreamOffset,
|
||||
VideoData** aOutVideoData)
|
||||
{
|
||||
NS_ENSURE_TRUE(aSample, E_POINTER);
|
||||
NS_ENSURE_TRUE(aOutVideoData, E_POINTER);
|
||||
@ -311,9 +311,9 @@ WMFVideoOutputSource::CreateBasicVideoFrame(IMFSample* aSample,
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WMFVideoOutputSource::CreateD3DVideoFrame(IMFSample* aSample,
|
||||
int64_t aStreamOffset,
|
||||
VideoData** aOutVideoData)
|
||||
WMFVideoMFTManager::CreateD3DVideoFrame(IMFSample* aSample,
|
||||
int64_t aStreamOffset,
|
||||
VideoData** aOutVideoData)
|
||||
{
|
||||
NS_ENSURE_TRUE(aSample, E_POINTER);
|
||||
NS_ENSURE_TRUE(aOutVideoData, E_POINTER);
|
||||
@ -351,8 +351,8 @@ WMFVideoOutputSource::CreateD3DVideoFrame(IMFSample* aSample,
|
||||
|
||||
// Blocks until decoded sample is produced by the deoder.
|
||||
HRESULT
|
||||
WMFVideoOutputSource::Output(int64_t aStreamOffset,
|
||||
nsAutoPtr<MediaData>& aOutData)
|
||||
WMFVideoMFTManager::Output(int64_t aStreamOffset,
|
||||
nsAutoPtr<MediaData>& aOutData)
|
||||
{
|
||||
RefPtr<IMFSample> sample;
|
||||
HRESULT hr;
|
||||
@ -379,7 +379,7 @@ WMFVideoOutputSource::Output(int64_t aStreamOffset,
|
||||
break;
|
||||
}
|
||||
// Else unexpected error, assert, and bail.
|
||||
NS_WARNING("WMFVideoOutputSource::Output() unexpected error");
|
||||
NS_WARNING("WMFVideoMFTManager::Output() unexpected error");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#if !defined(WMFVideoOutputSource_h_)
|
||||
#define WMFVideoOutputSource_h_
|
||||
#if !defined(WMFVideoMFTManager_h_)
|
||||
#define WMFVideoMFTManager_h_
|
||||
|
||||
#include "WMF.h"
|
||||
#include "MP4Reader.h"
|
||||
@ -18,13 +18,13 @@ namespace mozilla {
|
||||
|
||||
class DXVA2Manager;
|
||||
|
||||
class WMFVideoOutputSource : public WMFOutputSource {
|
||||
class WMFVideoMFTManager : public MFTManager {
|
||||
public:
|
||||
WMFVideoOutputSource(const mp4_demuxer::VideoDecoderConfig& aConfig,
|
||||
mozilla::layers::LayersBackend aLayersBackend,
|
||||
mozilla::layers::ImageContainer* aImageContainer,
|
||||
bool aDXVAEnabled);
|
||||
~WMFVideoOutputSource();
|
||||
WMFVideoMFTManager(const mp4_demuxer::VideoDecoderConfig& aConfig,
|
||||
mozilla::layers::LayersBackend aLayersBackend,
|
||||
mozilla::layers::ImageContainer* aImageContainer,
|
||||
bool aDXVAEnabled);
|
||||
~WMFVideoMFTManager();
|
||||
|
||||
virtual TemporaryRef<MFTDecoder> Init() MOZ_OVERRIDE;
|
||||
|
||||
@ -69,4 +69,4 @@ private:
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // WMFVideoOutputSource_h_
|
||||
#endif // WMFVideoMFTManager_h_
|
@ -180,22 +180,28 @@ private:
|
||||
int64_t mTimeThreshold;
|
||||
bool mDropVideoBeforeThreshold;
|
||||
|
||||
bool MaybeSwitchVideoReaders() {
|
||||
enum SwitchState {
|
||||
SWITCHSTATE_SEEKING,
|
||||
SWITCHSTATE_PLAYING
|
||||
};
|
||||
|
||||
bool MaybeSwitchVideoReaders(SwitchState aState = SWITCHSTATE_PLAYING) {
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
MOZ_ASSERT(mActiveVideoDecoder != -1);
|
||||
|
||||
InitializePendingDecoders();
|
||||
|
||||
for (uint32_t i = mActiveVideoDecoder + 1; i < mDecoders.Length(); ++i) {
|
||||
if (!mDecoders[i]->GetReader()->GetMediaInfo().HasVideo()) {
|
||||
SubBufferDecoder* decoder = mDecoders[i];
|
||||
if (decoder->IsDiscarded() || !decoder->GetReader()->GetMediaInfo().HasVideo()) {
|
||||
continue;
|
||||
}
|
||||
if (mTimeThreshold >= mDecoders[i]->GetMediaStartTime()) {
|
||||
|
||||
if (aState == SWITCHSTATE_SEEKING || mTimeThreshold >= mDecoders[i]->GetMediaStartTime()) {
|
||||
GetVideoReader()->SetIdle();
|
||||
|
||||
mActiveVideoDecoder = i;
|
||||
MSE_DEBUG("%p MSR::DecodeVF switching to %d", this, mActiveVideoDecoder);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -478,7 +484,7 @@ MediaSourceReader::Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime,
|
||||
while (!mMediaSource->ActiveSourceBuffers()->AllContainsTime(target)
|
||||
&& !IsShutdown()) {
|
||||
mMediaSource->WaitForData();
|
||||
MaybeSwitchVideoReaders();
|
||||
MaybeSwitchVideoReaders(SWITCHSTATE_SEEKING);
|
||||
}
|
||||
|
||||
if (IsShutdown()) {
|
||||
|
@ -412,7 +412,7 @@ void
|
||||
SourceBuffer::DiscardDecoder()
|
||||
{
|
||||
if (mDecoder) {
|
||||
mDecoder->GetResource()->Ended();
|
||||
mDecoder->SetDiscarded();
|
||||
}
|
||||
mDecoder = nullptr;
|
||||
mDecoderInitialized = false;
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
// of the caller to manage the memory of the MediaResource object.
|
||||
SubBufferDecoder(MediaResource* aResource, MediaSourceDecoder* aParentDecoder)
|
||||
: BufferDecoder(aResource), mParentDecoder(aParentDecoder), mReader(nullptr)
|
||||
, mMediaDuration(-1), mMediaStartTime(0)
|
||||
, mMediaDuration(-1), mMediaStartTime(0), mDiscarded(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -83,11 +83,23 @@ public:
|
||||
mMediaStartTime = aMediaStartTime;
|
||||
}
|
||||
|
||||
bool IsDiscarded()
|
||||
{
|
||||
return mDiscarded;
|
||||
}
|
||||
|
||||
void SetDiscarded()
|
||||
{
|
||||
GetResource()->Ended();
|
||||
mDiscarded = true;
|
||||
}
|
||||
|
||||
private:
|
||||
MediaSourceDecoder* mParentDecoder;
|
||||
nsRefPtr<MediaDecoderReader> mReader;
|
||||
int64_t mMediaDuration;
|
||||
int64_t mMediaStartTime;
|
||||
bool mDiscarded;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -274,10 +274,16 @@ nsresult WinProcMon::QuerySystemLoad(float* load_percent)
|
||||
}
|
||||
#endif
|
||||
|
||||
class LoadStats
|
||||
// Use a non-generic class name, because otherwise we can get name collisions
|
||||
// with other classes in the codebase. The normal way of dealing with that is
|
||||
// to put the class in an anonymous namespace, but this class is used as a
|
||||
// member of RTCLoadInfo, which can't be in the anonymous namespace, so it also
|
||||
// can't be in an anonymous namespace: gcc warns about that setup and this
|
||||
// directory is fail-on-warnings.
|
||||
class RTCLoadStats
|
||||
{
|
||||
public:
|
||||
LoadStats() :
|
||||
RTCLoadStats() :
|
||||
mPrevTotalTimes(0),
|
||||
mPrevCpuTimes(0),
|
||||
mPrevLoad(0) {};
|
||||
@ -289,11 +295,17 @@ public:
|
||||
float mPrevLoad; // Previous load value.
|
||||
};
|
||||
|
||||
class LoadInfo : public mozilla::RefCounted<LoadInfo>
|
||||
// Use a non-generic class name, because otherwise we can get name collisions
|
||||
// with other classes in the codebase. The normal way of dealing with that is
|
||||
// to put the class in an anonymous namespace, but this class is used as a
|
||||
// member of LoadInfoCollectRunner, which can't be in the anonymous namespace,
|
||||
// so it also can't be in an anonymous namespace: gcc warns about that setup
|
||||
// and this directory is fail-on-warnings.
|
||||
class RTCLoadInfo : public mozilla::RefCounted<RTCLoadInfo>
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_TYPENAME(LoadInfo)
|
||||
LoadInfo(): mLoadUpdateInterval(0) {};
|
||||
MOZ_DECLARE_REFCOUNTED_TYPENAME(RTCLoadInfo)
|
||||
RTCLoadInfo(): mLoadUpdateInterval(0) {};
|
||||
nsresult Init(int aLoadUpdateInterval);
|
||||
double GetSystemLoad() { return mSystemLoad.GetLoad(); };
|
||||
double GetProcessLoad() { return mProcessLoad.GetLoad(); };
|
||||
@ -304,19 +316,19 @@ private:
|
||||
void UpdateCpuLoad(uint64_t ticks_per_interval,
|
||||
uint64_t current_total_times,
|
||||
uint64_t current_cpu_times,
|
||||
LoadStats* loadStat);
|
||||
RTCLoadStats* loadStat);
|
||||
#ifdef XP_WIN
|
||||
WinProcMon mSysMon;
|
||||
HANDLE mProcHandle;
|
||||
int mNumProcessors;
|
||||
#endif
|
||||
LoadStats mSystemLoad;
|
||||
LoadStats mProcessLoad;
|
||||
RTCLoadStats mSystemLoad;
|
||||
RTCLoadStats mProcessLoad;
|
||||
uint64_t mTicksPerInterval;
|
||||
int mLoadUpdateInterval;
|
||||
};
|
||||
|
||||
nsresult LoadInfo::Init(int aLoadUpdateInterval)
|
||||
nsresult RTCLoadInfo::Init(int aLoadUpdateInterval)
|
||||
{
|
||||
mLoadUpdateInterval = aLoadUpdateInterval;
|
||||
#ifdef XP_WIN
|
||||
@ -331,10 +343,10 @@ nsresult LoadInfo::Init(int aLoadUpdateInterval)
|
||||
#endif
|
||||
}
|
||||
|
||||
void LoadInfo::UpdateCpuLoad(uint64_t ticks_per_interval,
|
||||
uint64_t current_total_times,
|
||||
uint64_t current_cpu_times,
|
||||
LoadStats *loadStat) {
|
||||
void RTCLoadInfo::UpdateCpuLoad(uint64_t ticks_per_interval,
|
||||
uint64_t current_total_times,
|
||||
uint64_t current_cpu_times,
|
||||
RTCLoadStats *loadStat) {
|
||||
// Check if we get an inconsistent number of ticks.
|
||||
if (((current_total_times - loadStat->mPrevTotalTimes)
|
||||
> (ticks_per_interval * 10))
|
||||
@ -366,7 +378,7 @@ void LoadInfo::UpdateCpuLoad(uint64_t ticks_per_interval,
|
||||
loadStat->mPrevCpuTimes = current_cpu_times;
|
||||
}
|
||||
|
||||
nsresult LoadInfo::UpdateSystemLoad()
|
||||
nsresult RTCLoadInfo::UpdateSystemLoad()
|
||||
{
|
||||
#if defined(LINUX) || defined(ANDROID)
|
||||
nsCOMPtr<nsIFile> procStatFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
|
||||
@ -472,7 +484,7 @@ nsresult LoadInfo::UpdateSystemLoad()
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult LoadInfo::UpdateProcessLoad() {
|
||||
nsresult RTCLoadInfo::UpdateProcessLoad() {
|
||||
#if defined(XP_UNIX)
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
@ -518,11 +530,13 @@ nsresult LoadInfo::UpdateProcessLoad() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Note: This class can't be in the anonymous namespace, because then we can't
|
||||
// declare it as a friend of LoadMonitor.
|
||||
class LoadInfoCollectRunner : public nsRunnable
|
||||
{
|
||||
public:
|
||||
LoadInfoCollectRunner(nsRefPtr<LoadMonitor> loadMonitor,
|
||||
RefPtr<LoadInfo> loadInfo,
|
||||
RefPtr<RTCLoadInfo> loadInfo,
|
||||
nsIThread *loadInfoThread)
|
||||
: mThread(loadInfoThread),
|
||||
mLoadUpdateInterval(loadMonitor->mLoadUpdateInterval),
|
||||
@ -571,7 +585,7 @@ public:
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIThread> mThread;
|
||||
RefPtr<LoadInfo> mLoadInfo;
|
||||
RefPtr<RTCLoadInfo> mLoadInfo;
|
||||
nsRefPtr<LoadMonitor> mLoadMonitor;
|
||||
int mLoadUpdateInterval;
|
||||
int mLoadNoiseCounter;
|
||||
@ -615,11 +629,11 @@ LoadMonitor::Init(nsRefPtr<LoadMonitor> &self)
|
||||
{
|
||||
LOG(("Initializing LoadMonitor"));
|
||||
|
||||
RefPtr<LoadInfo> load_info = new LoadInfo();
|
||||
RefPtr<RTCLoadInfo> load_info = new RTCLoadInfo();
|
||||
nsresult rv = load_info->Init(mLoadUpdateInterval);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("LoadInfo::Init error"));
|
||||
LOG(("RTCLoadInfo::Init error"));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ skip-if = true
|
||||
[test_pointer-events-3.xhtml]
|
||||
[test_pointer-events-4.xhtml]
|
||||
[test_pointer-events-5.xhtml]
|
||||
[test_pointer-events-6.xhtml]
|
||||
[test_scientific.html]
|
||||
[test_selectSubString.xhtml]
|
||||
[test_stroke-linecap-hit-testing.xhtml]
|
||||
|
70
content/svg/content/test/test_pointer-events-6.xhtml
Normal file
70
content/svg/content/test/test_pointer-events-6.xhtml
Normal file
@ -0,0 +1,70 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=500174
|
||||
-->
|
||||
<head>
|
||||
<title>Test pointer events for clip-path on non-SVG elements</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="run()">
|
||||
<script class="testbody" type="text/javascript">
|
||||
<![CDATA[
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run()
|
||||
{
|
||||
var div = document.getElementById("div");
|
||||
// Get the coords of the origin of the SVG canvas:
|
||||
var originX = div.offsetLeft;
|
||||
var originY = div.offsetTop;
|
||||
var elementFromPoint;
|
||||
|
||||
elementFromPoint = document.elementFromPoint(originX + 18, originY + 30);
|
||||
isnot(elementFromPoint, div, 'Outside left edge of clipped area');
|
||||
|
||||
elementFromPoint = document.elementFromPoint(originX + 22, originY + 30);
|
||||
is(elementFromPoint, div, 'Inside left edge of clipped area');
|
||||
|
||||
elementFromPoint = document.elementFromPoint(originX + 30, originY + 18);
|
||||
isnot(elementFromPoint, div, 'Outside top edge of clipped area');
|
||||
|
||||
elementFromPoint = document.elementFromPoint(originX + 30, originY + 22);
|
||||
is(elementFromPoint, div, 'Inside top edge of clipped area');
|
||||
|
||||
elementFromPoint = document.elementFromPoint(originX + 42, originY + 30);
|
||||
isnot(elementFromPoint, div, 'Outside right edge of clipped area');
|
||||
|
||||
elementFromPoint = document.elementFromPoint(originX + 38, originY + 30);
|
||||
is(elementFromPoint, div, 'Inside right edge of clipped area');
|
||||
|
||||
elementFromPoint = document.elementFromPoint(originX + 30, originY + 42);
|
||||
isnot(elementFromPoint, div, 'Outside bottom edge of clipped area');
|
||||
|
||||
elementFromPoint = document.elementFromPoint(originX + 30, originY + 38);
|
||||
is(elementFromPoint, div, 'Inside bottom edge of clipped area');
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=500174">Mozilla Bug 500174</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" id="svg">
|
||||
<defs>
|
||||
<clipPath id="clip">
|
||||
<rect x="20" y="20" width="20" height="20"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
<div id="div" style="width:100px; height:100px; clip-path:url(#clip)"></div>
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -89,6 +89,7 @@
|
||||
#include "mozilla/dom/ProcessingInstruction.h"
|
||||
#include "mozilla/dom/XULDocumentBinding.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsTextNode.h"
|
||||
#include "nsJSUtils.h"
|
||||
@ -2829,7 +2830,10 @@ XULDocument::LoadOverlayInternal(nsIURI* aURI, bool aIsDynamic,
|
||||
// that the overlay's JSObjects etc end up being created
|
||||
// with the right principal and in the correct
|
||||
// compartment.
|
||||
channel->SetOwner(NodePrincipal());
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(NodePrincipal(), LoadInfo::eInheritPrincipal,
|
||||
LoadInfo::eNotSandboxed);
|
||||
channel->SetLoadInfo(loadInfo);
|
||||
|
||||
rv = channel->AsyncOpen(listener, nullptr);
|
||||
}
|
||||
|
59
docshell/base/LoadInfo.cpp
Normal file
59
docshell/base/LoadInfo.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
/* 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/. */
|
||||
|
||||
#include "mozilla/LoadInfo.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
LoadInfo::LoadInfo(nsIPrincipal* aPrincipal,
|
||||
InheritType aInheritPrincipal,
|
||||
SandboxType aSandboxed)
|
||||
: mPrincipal(aPrincipal)
|
||||
, mInheritPrincipal(aInheritPrincipal == eInheritPrincipal &&
|
||||
aSandboxed != eSandboxed)
|
||||
, mSandboxed(aSandboxed == eSandboxed)
|
||||
{
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
}
|
||||
|
||||
LoadInfo::~LoadInfo()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(LoadInfo, nsILoadInfo)
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetLoadingPrincipal(nsIPrincipal** aPrincipal)
|
||||
{
|
||||
NS_ADDREF(*aPrincipal = mPrincipal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIPrincipal*
|
||||
LoadInfo::LoadingPrincipal()
|
||||
{
|
||||
return mPrincipal;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetForceInheritPrincipal(bool* aInheritPrincipal)
|
||||
{
|
||||
*aInheritPrincipal = mInheritPrincipal;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetLoadingSandboxed(bool* aLoadingSandboxed)
|
||||
{
|
||||
*aLoadingSandboxed = mSandboxed;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
54
docshell/base/LoadInfo.h
Normal file
54
docshell/base/LoadInfo.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_LoadInfo_h
|
||||
#define mozilla_LoadInfo_h
|
||||
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsILoadInfo.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* Class that provides an nsILoadInfo implementation.
|
||||
*/
|
||||
class LoadInfo MOZ_FINAL : public nsILoadInfo
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSILOADINFO
|
||||
|
||||
enum InheritType
|
||||
{
|
||||
eInheritPrincipal,
|
||||
eDontInheritPrincipal
|
||||
};
|
||||
|
||||
enum SandboxType
|
||||
{
|
||||
eSandboxed,
|
||||
eNotSandboxed
|
||||
};
|
||||
|
||||
// aPrincipal MUST NOT BE NULL. If aSandboxed is eSandboxed, the
|
||||
// value passed for aInheritPrincipal will be ignored and
|
||||
// eDontInheritPrincipal will be used instead.
|
||||
LoadInfo(nsIPrincipal* aPrincipal,
|
||||
InheritType aInheritPrincipal,
|
||||
SandboxType aSandboxed);
|
||||
|
||||
private:
|
||||
~LoadInfo();
|
||||
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
bool mInheritPrincipal;
|
||||
bool mSandboxed;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_LoadInfo_h
|
||||
|
@ -20,6 +20,7 @@ XPIDL_SOURCES += [
|
||||
'nsIDownloadHistory.idl',
|
||||
'nsIGlobalHistory2.idl',
|
||||
'nsILoadContext.idl',
|
||||
'nsILoadInfo.idl',
|
||||
'nsIMarkupDocumentViewer.idl',
|
||||
'nsIPrivacyTransitionObserver.idl',
|
||||
'nsIReflowObserver.idl',
|
||||
@ -45,10 +46,12 @@ EXPORTS += [
|
||||
EXPORTS.mozilla += [
|
||||
'IHistory.h',
|
||||
'LoadContext.h',
|
||||
'LoadInfo.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'LoadContext.cpp',
|
||||
'LoadInfo.cpp',
|
||||
'nsAboutRedirector.cpp',
|
||||
'nsDefaultURIFixup.cpp',
|
||||
'nsDocShellEditorData.cpp',
|
||||
|
@ -101,6 +101,7 @@
|
||||
#include "nsITimer.h"
|
||||
#include "nsISHistoryInternal.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsNullPrincipal.h"
|
||||
#include "nsISHEntry.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIPromptFactory.h"
|
||||
@ -168,6 +169,7 @@
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIChannelPolicy.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsILoadInfo.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
@ -10006,21 +10008,9 @@ nsDocShell::DoURILoad(nsIURI * aURI,
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> ownerPrincipal;
|
||||
|
||||
// If the content being loaded should be sandboxed with respect to origin
|
||||
// we need to create a new null principal here, and then tell
|
||||
// nsContentUtils::SetUpChannelOwner to force it to be set as the
|
||||
// channel owner.
|
||||
if (mSandboxFlags & SANDBOXED_ORIGIN) {
|
||||
ownerPrincipal = do_CreateInstance("@mozilla.org/nullprincipal;1");
|
||||
} else {
|
||||
// Not sandboxed - we allow the content to assume its natural owner.
|
||||
ownerPrincipal = do_QueryInterface(aOwner);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> ownerPrincipal = do_QueryInterface(aOwner);
|
||||
nsContentUtils::SetUpChannelOwner(ownerPrincipal, channel, aURI, true,
|
||||
(mSandboxFlags & SANDBOXED_ORIGIN) ||
|
||||
mSandboxFlags & SANDBOXED_ORIGIN,
|
||||
isSrcdoc);
|
||||
|
||||
nsCOMPtr<nsIScriptChannel> scriptChannel = do_QueryInterface(channel);
|
||||
@ -11091,6 +11081,21 @@ nsDocShell::AddToSessionHistory(nsIURI * aURI, nsIChannel * aChannel,
|
||||
discardLayoutState = ShouldDiscardLayoutState(httpChannel);
|
||||
}
|
||||
aChannel->GetOwner(getter_AddRefs(owner));
|
||||
if (!owner) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
|
||||
if (loadInfo) {
|
||||
// For now keep storing just the principal in the SHEntry.
|
||||
if (loadInfo->GetLoadingSandboxed()) {
|
||||
owner = do_CreateInstance(NS_NULLPRINCIPAL_CONTRACTID, &rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
} else if (loadInfo->GetForceInheritPrincipal()) {
|
||||
owner = loadInfo->LoadingPrincipal();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Title is set in nsDocShell::SetTitle()
|
||||
|
42
docshell/base/nsILoadInfo.idl
Normal file
42
docshell/base/nsILoadInfo.idl
Normal file
@ -0,0 +1,42 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin
|
||||
* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIPrincipal;
|
||||
/**
|
||||
* An nsILoadOwner represents per-load information about who started the load.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(046db047-a1c1-4519-8ec7-99f3054bc9ac)]
|
||||
interface nsILoadInfo : nsISupports
|
||||
{
|
||||
/**
|
||||
* loadingPrincipal is the principal that started the load. Will
|
||||
* never be null.
|
||||
*/
|
||||
readonly attribute nsIPrincipal loadingPrincipal;
|
||||
|
||||
/**
|
||||
* A C++-friendly version of loadingPrincipal.
|
||||
*/
|
||||
[noscript, notxpcom, nostdcall, binaryname(LoadingPrincipal)]
|
||||
nsIPrincipal binaryLoadingPrincipal();
|
||||
|
||||
/**
|
||||
* If forceInheritPrincipal is true, the data coming from the channel should
|
||||
* use loadingPrincipal for its principal, even when the data is loaded over
|
||||
* http:// or another protocol that would normally use a URI-based principal.
|
||||
* This attribute will never be true when loadingSandboxed is true.
|
||||
*/
|
||||
[infallible] readonly attribute boolean forceInheritPrincipal;
|
||||
|
||||
/**
|
||||
* If loadingSandboxed is true, the data coming from the channel is
|
||||
* being loaded sandboxed, so it should have a nonce origin and
|
||||
* hence should use a NullPrincipal.
|
||||
*/
|
||||
[infallible] readonly attribute boolean loadingSandboxed;
|
||||
};
|
@ -15,8 +15,6 @@
|
||||
|
||||
using mozilla::dom::ContentChild;
|
||||
|
||||
using namespace js::ArrayBufferView;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@ -67,13 +65,13 @@ Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
|
||||
// Throw if the wrong type of ArrayBufferView is passed in
|
||||
// (Part of the Web Crypto API spec)
|
||||
switch (JS_GetArrayBufferViewType(view)) {
|
||||
case TYPE_INT8:
|
||||
case TYPE_UINT8:
|
||||
case TYPE_UINT8_CLAMPED:
|
||||
case TYPE_INT16:
|
||||
case TYPE_UINT16:
|
||||
case TYPE_INT32:
|
||||
case TYPE_UINT32:
|
||||
case js::Scalar::Int8:
|
||||
case js::Scalar::Uint8:
|
||||
case js::Scalar::Uint8Clamped:
|
||||
case js::Scalar::Int16:
|
||||
case js::Scalar::Uint16:
|
||||
case js::Scalar::Int32:
|
||||
case js::Scalar::Uint32:
|
||||
break;
|
||||
default:
|
||||
aRv.Throw(NS_ERROR_DOM_TYPE_MISMATCH_ERR);
|
||||
|
@ -161,6 +161,7 @@ LOCAL_INCLUDES += [
|
||||
'/content/base/src',
|
||||
'/content/html/document/src',
|
||||
'/content/xul/document/src',
|
||||
'/layout/base',
|
||||
'/layout/generic',
|
||||
'/layout/style',
|
||||
'/layout/xul',
|
||||
|
@ -90,6 +90,8 @@
|
||||
#include "GeckoProfiler.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsIContentIterator.h"
|
||||
#include "nsIDOMStyleSheet.h"
|
||||
#include "nsIStyleSheet.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
@ -3367,6 +3369,28 @@ nsDOMWindowUtils::LoadSheet(nsIURI *aSheetURI, uint32_t aSheetType)
|
||||
return doc->LoadAdditionalStyleSheet(type, aSheetURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::AddSheet(nsIDOMStyleSheet *aSheet, uint32_t aSheetType)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aSheet);
|
||||
NS_ENSURE_ARG(aSheetType == AGENT_SHEET ||
|
||||
aSheetType == USER_SHEET ||
|
||||
aSheetType == AUTHOR_SHEET);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = GetDocument();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
nsIDocument::additionalSheetType type = convertSheetType(aSheetType);
|
||||
nsCOMPtr<nsIStyleSheet> sheet = do_QueryInterface(aSheet);
|
||||
NS_ENSURE_TRUE(sheet, NS_ERROR_FAILURE);
|
||||
if (sheet->GetOwningDocument()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
return doc->AddAdditionalStyleSheet(type, sheet);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::RemoveSheet(nsIURI *aSheetURI, uint32_t aSheetType)
|
||||
{
|
||||
@ -3642,7 +3666,7 @@ HandlingUserInputHelper::Destruct()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
}
|
||||
} // unnamed namespace
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SetHandlingUserInput(bool aHandlingUserInput,
|
||||
|
@ -128,7 +128,7 @@ TouchEvent::Touches()
|
||||
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
|
||||
if (mEvent->message == NS_TOUCH_END || mEvent->message == NS_TOUCH_CANCEL) {
|
||||
// for touchend events, remove any changed touches from the touches array
|
||||
WidgetTouchEvent::TouchArray unchangedTouches;
|
||||
WidgetTouchEvent::AutoTouchArray unchangedTouches;
|
||||
const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
if (!touches[i]->mChanged) {
|
||||
@ -147,7 +147,7 @@ TouchList*
|
||||
TouchEvent::TargetTouches()
|
||||
{
|
||||
if (!mTargetTouches) {
|
||||
nsTArray< nsRefPtr<Touch> > targetTouches;
|
||||
WidgetTouchEvent::AutoTouchArray targetTouches;
|
||||
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
|
||||
const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
@ -169,7 +169,7 @@ TouchList*
|
||||
TouchEvent::ChangedTouches()
|
||||
{
|
||||
if (!mChangedTouches) {
|
||||
nsTArray< nsRefPtr<Touch> > changedTouches;
|
||||
WidgetTouchEvent::AutoTouchArray changedTouches;
|
||||
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
|
||||
const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsAString;
|
||||
@ -33,7 +33,7 @@ public:
|
||||
nsJSContext::LikelyShortLivingObjectCreated();
|
||||
}
|
||||
TouchList(nsISupports* aParent,
|
||||
const nsTArray<nsRefPtr<Touch> >& aTouches)
|
||||
const WidgetTouchEvent::TouchArray& aTouches)
|
||||
: mParent(aParent)
|
||||
, mPoints(aTouches)
|
||||
{
|
||||
@ -78,7 +78,7 @@ protected:
|
||||
~TouchList() {}
|
||||
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
nsTArray<nsRefPtr<Touch> > mPoints;
|
||||
WidgetTouchEvent::TouchArray mPoints;
|
||||
};
|
||||
|
||||
class TouchEvent : public UIEvent
|
||||
|
@ -35,6 +35,7 @@ interface nsIDOMNodeList;
|
||||
interface nsIDOMElement;
|
||||
interface nsIDOMHTMLCanvasElement;
|
||||
interface nsIDOMEvent;
|
||||
interface nsIDOMStyleSheet;
|
||||
interface nsITransferable;
|
||||
interface nsIQueryContentEventResult;
|
||||
interface nsIDOMWindow;
|
||||
@ -50,7 +51,7 @@ interface nsITranslationNodeList;
|
||||
interface nsIJSRAIIHelper;
|
||||
interface nsIContentPermissionRequest;
|
||||
|
||||
[scriptable, uuid(ca202fa7-7b8f-4814-acc3-a8545f67320b)]
|
||||
[scriptable, uuid(0ef9e8bb-b934-4f6b-ae05-e98774d8d3d3)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
@ -1563,15 +1564,22 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
*
|
||||
* Sheets added via this API take effect immediately on the document.
|
||||
*/
|
||||
void loadSheet(in nsIURI sheetURI,
|
||||
in unsigned long type);
|
||||
void loadSheet(in nsIURI sheetURI, in unsigned long type);
|
||||
|
||||
/**
|
||||
* Adds a style sheet to the list of additional style sheets of the document.
|
||||
*
|
||||
* Style sheets can be preloaded with nsIStyleSheetService.preloadSheet.
|
||||
*
|
||||
* Sheets added via this API take effect immediately on the document.
|
||||
*/
|
||||
void addSheet(in nsIDOMStyleSheet sheet, in unsigned long type);
|
||||
|
||||
/**
|
||||
* Remove the document style sheet at |sheetURI| from the list of additional
|
||||
* style sheets of the document. The removal takes effect immediately.
|
||||
*/
|
||||
void removeSheet(in nsIURI sheetURI,
|
||||
in unsigned long type);
|
||||
void removeSheet(in nsIURI sheetURI, in unsigned long type);
|
||||
|
||||
/**
|
||||
* Returns true if a user input is being handled.
|
||||
@ -1641,8 +1649,10 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
AString getOMTAStyle(in nsIDOMElement aElement, in AString aProperty);
|
||||
|
||||
/**
|
||||
* If we are currently handling user input, this informs the event state
|
||||
* manager. Remember to call destruct() on the return value!
|
||||
* If aHandlingInput is true, this informs the event state manager that
|
||||
* we're handling user input. Otherwise, this is a no-op (as by default
|
||||
* we're not handling user input).
|
||||
* Remember to call destruct() on the return value!
|
||||
* See also nsIDOMWindowUtils::isHandlingUserInput.
|
||||
*/
|
||||
nsIJSRAIIHelper setHandlingUserInput(in boolean aHandlingInput);
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMWindowUtils.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsILoadInfo.h"
|
||||
#include "nsIPromptFactory.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
@ -2185,6 +2186,16 @@ public:
|
||||
}
|
||||
NS_IMETHOD GetOwner(nsISupports**) NO_IMPL
|
||||
NS_IMETHOD SetOwner(nsISupports*) NO_IMPL
|
||||
NS_IMETHOD GetLoadInfo(nsILoadInfo** aLoadInfo)
|
||||
{
|
||||
NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetLoadInfo(nsILoadInfo* aLoadInfo)
|
||||
{
|
||||
mLoadInfo = aLoadInfo;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor** aRequestor)
|
||||
{
|
||||
NS_ADDREF(*aRequestor = this);
|
||||
@ -2237,6 +2248,7 @@ protected:
|
||||
nsCOMPtr<nsIURI> mUri;
|
||||
uint64_t mCallbackId;
|
||||
nsCOMPtr<Element> mElement;
|
||||
nsCOMPtr<nsILoadInfo> mLoadInfo;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(FakeChannel, nsIChannel, nsIAuthPromptCallback,
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "nsIWritablePropertyBag2.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsPluginStreamListenerPeer.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
#include "nsEnumeratorUtils.h"
|
||||
@ -2851,7 +2852,10 @@ nsresult nsPluginHost::NewPluginURLStream(const nsString& aURL,
|
||||
|
||||
if (doc) {
|
||||
// Set the owner of channel to the document principal...
|
||||
channel->SetOwner(doc->NodePrincipal());
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(doc->NodePrincipal(), LoadInfo::eInheritPrincipal,
|
||||
LoadInfo::eNotSandboxed);
|
||||
channel->SetLoadInfo(loadInfo);
|
||||
|
||||
// And if it's a script allow it to execute against the
|
||||
// document's script context.
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* jshint moz: true, esnext: true */
|
||||
/* 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/. */
|
||||
@ -449,6 +450,41 @@ this.PushService = {
|
||||
*/
|
||||
_willBeWokenUpByUDP: false,
|
||||
|
||||
/**
|
||||
* Holds if the adaptive ping is enabled. This is read on init().
|
||||
* If adaptive ping is enabled, a new ping is calculed each time we receive
|
||||
* a pong message, trying to maximize network resources while minimizing
|
||||
* cellular signalling storms.
|
||||
*/
|
||||
_adaptiveEnabled: false,
|
||||
|
||||
/**
|
||||
* This saves a flag about if we need to recalculate a new ping, based on:
|
||||
* 1) the gap between the maximum working ping and the first ping that
|
||||
* gives an error (timeout) OR
|
||||
* 2) we have reached the pref of the maximum value we allow for a ping
|
||||
* (services.push.adaptive.upperLimit)
|
||||
*/
|
||||
_recalculatePing: true,
|
||||
|
||||
/**
|
||||
* This map holds a (pingInterval, triedTimes) of each pingInterval tried.
|
||||
* It is used to check if the pingInterval has been tested enough to know that
|
||||
* is incorrect and is above the limit the network allow us to keep the
|
||||
* connection open.
|
||||
*/
|
||||
_pingIntervalRetryTimes: {},
|
||||
|
||||
/**
|
||||
* Holds the lastGoodPingInterval for our current connection.
|
||||
*/
|
||||
_lastGoodPingInterval: 0,
|
||||
|
||||
/**
|
||||
* Maximum ping interval that we can reach.
|
||||
*/
|
||||
_upperLimit: 0,
|
||||
|
||||
/**
|
||||
* Sends a message to the Push Server through an open websocket.
|
||||
* typeof(msg) shall be an object
|
||||
@ -480,6 +516,8 @@ this.PushService = {
|
||||
this._alarmID = null;
|
||||
|
||||
this._requestTimeout = prefs.get("requestTimeout");
|
||||
this._adaptiveEnabled = prefs.get('adaptive.enabled');
|
||||
this._upperLimit = prefs.get('adaptive.upperLimit');
|
||||
|
||||
this._startListeningIfChannelsPresent();
|
||||
|
||||
@ -592,6 +630,8 @@ this.PushService = {
|
||||
*/
|
||||
_reconnectAfterBackoff: function() {
|
||||
debug("reconnectAfterBackoff()");
|
||||
//Calculate new ping interval
|
||||
this._calculateAdaptivePing(true /* wsWentDown */);
|
||||
|
||||
// Calculate new timeout, but cap it to pingInterval.
|
||||
let retryTimeout = prefs.get("retryBaseInterval") *
|
||||
@ -604,6 +644,146 @@ this.PushService = {
|
||||
this._setAlarm(retryTimeout);
|
||||
},
|
||||
|
||||
/**
|
||||
* We need to calculate a new ping based on:
|
||||
* 1) Latest good ping
|
||||
* 2) A safe gap between 1) and the calculated new ping (which is
|
||||
* by default, 1 minute)
|
||||
*
|
||||
* This is for 3G networks, whose connections keepalives differ broadly,
|
||||
* for example:
|
||||
* 1) Movistar Spain: 29 minutes
|
||||
* 2) VIVO Brazil: 5 minutes
|
||||
* 3) Movistar Colombia: XXX minutes
|
||||
*
|
||||
* So a fixed ping is not good for us for two reasons:
|
||||
* 1) We might lose the connection, so we need to reconnect again (wasting
|
||||
* resources)
|
||||
* 2) We use a lot of network signaling just for pinging.
|
||||
*
|
||||
* This algorithm tries to search the best value between a disconnection and a
|
||||
* valid ping, to ensure better battery life and network resources usage.
|
||||
*
|
||||
* The value is saved in services.push.pingInterval
|
||||
* @param wsWentDown [Boolean] if the WebSocket was closed or it is still alive
|
||||
*
|
||||
*/
|
||||
_calculateAdaptivePing: function(wsWentDown) {
|
||||
debug('_calculateAdaptivePing()');
|
||||
if (!this._adaptiveEnabled) {
|
||||
debug('Adaptive ping is disabled');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._retryFailCount > 0) {
|
||||
debug('Push has failed to connect to the Push Server ' +
|
||||
this._retryFailCount + ' times. ' +
|
||||
'Do not calculate a new pingInterval now');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this._recalculatePing && !wsWentDown) {
|
||||
debug('We do not need to recalculate the ping now, based on previous data');
|
||||
return;
|
||||
}
|
||||
|
||||
// Save actual state of the network
|
||||
let ns = this._getNetworkInformation();
|
||||
|
||||
if (ns.ip) {
|
||||
// mobile
|
||||
debug('mobile');
|
||||
let oldNetwork = prefs.get('adaptive.mobile');
|
||||
let newNetwork = 'mobile-' + ns.mcc + '-' + ns.mnc;
|
||||
|
||||
// Mobile networks differ, reset all intervals and pings
|
||||
if (oldNetwork !== newNetwork) {
|
||||
// Network differ, reset all values
|
||||
debug('Mobile networks differ. Old network is ' + oldNetwork +
|
||||
' and new is ' + newNetwork);
|
||||
prefs.set('adaptive.mobile', newNetwork);
|
||||
//We reset the upper bound member
|
||||
this._recalculatePing = true;
|
||||
this._pingIntervalRetryTimes = {};
|
||||
|
||||
// Put default values
|
||||
let defaultPing = prefs.get('pingInterval.default');
|
||||
prefs.set('pingInterval', defaultPing);
|
||||
this._lastGoodPingInterval = defaultPing;
|
||||
|
||||
} else {
|
||||
// Mobile network is the same, let's just update things
|
||||
prefs.set('pingInterval', prefs.get('pingInterval.mobile'));
|
||||
this._lastGoodPingInterval = prefs.get('adaptive.lastGoodPingInterval.mobile');
|
||||
}
|
||||
|
||||
} else {
|
||||
// wifi
|
||||
debug('wifi');
|
||||
prefs.set('pingInterval', prefs.get('pingInterval.wifi'));
|
||||
this._lastGoodPingInterval = prefs.get('adaptive.lastGoodPingInterval.wifi');
|
||||
}
|
||||
|
||||
let nextPingInterval;
|
||||
let lastTriedPingInterval = prefs.get('pingInterval');
|
||||
if (wsWentDown) {
|
||||
debug('The WebSocket was disconnected, calculating next ping');
|
||||
|
||||
// If we have not tried this pingInterval yet, initialize
|
||||
this._pingIntervalRetryTimes[lastTriedPingInterval] =
|
||||
(this._pingIntervalRetryTimes[lastTriedPingInterval] || 0) + 1;
|
||||
|
||||
// Try the pingInterval at least 3 times, just to be sure that the
|
||||
// calculated interval is not valid.
|
||||
if (this._pingIntervalRetryTimes[lastTriedPingInterval] < 2) {
|
||||
debug('pingInterval= ' + lastTriedPingInterval + ' tried only ' +
|
||||
this._pingIntervalRetryTimes[lastTriedPingInterval] + ' times');
|
||||
return;
|
||||
}
|
||||
|
||||
// Latest ping was invalid, we need to lower the limit to limit / 2
|
||||
nextPingInterval = Math.floor(lastTriedPingInterval / 2);
|
||||
|
||||
// If the new ping interval is close to the last good one, we are near
|
||||
// optimum, so stop calculating.
|
||||
if (nextPingInterval - this._lastGoodPingInterval < prefs.get('adaptive.gap')) {
|
||||
debug('We have reached the gap, we have finished the calculation');
|
||||
debug('nextPingInterval=' + nextPingInterval);
|
||||
debug('lastGoodPing=' + this._lastGoodPingInterval);
|
||||
nextPingInterval = this._lastGoodPingInterval;
|
||||
this._recalculatePing = false;
|
||||
} else {
|
||||
debug('We need to calculate next time');
|
||||
this._recalculatePing = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
debug('The WebSocket is still up');
|
||||
this._lastGoodPingInterval = lastTriedPingInterval;
|
||||
nextPingInterval = Math.floor(lastTriedPingInterval * 1.5);
|
||||
}
|
||||
|
||||
// Check if we have reached the upper limit
|
||||
if (this._upperLimit < nextPingInterval) {
|
||||
debug('Next ping will be bigger than the configured upper limit, capping interval');
|
||||
this._recalculatePing = false;
|
||||
this._lastGoodPingInterval = lastTriedPingInterval;
|
||||
nextPingInterval = lastTriedPingInterval;
|
||||
}
|
||||
|
||||
debug('Setting the pingInterval to ' + nextPingInterval);
|
||||
prefs.set('pingInterval', nextPingInterval);
|
||||
|
||||
//Save values for our current network
|
||||
if (ns.ip) {
|
||||
prefs.set('pingInterval.mobile', nextPingInterval);
|
||||
prefs.set('adaptive.lastGoodPingInterval.mobile', this._lastGoodPingInterval);
|
||||
} else {
|
||||
prefs.set('pingInterval.wifi', nextPingInterval);
|
||||
prefs.set('adaptive.lastGoodPingInterval.wifi', this._lastGoodPingInterval);
|
||||
}
|
||||
},
|
||||
|
||||
_beginWSSetup: function() {
|
||||
debug("beginWSSetup()");
|
||||
if (this._currentState != STATE_SHUT_DOWN) {
|
||||
@ -1393,10 +1573,6 @@ this.PushService = {
|
||||
|
||||
this._waitingForPong = false;
|
||||
|
||||
// Reset the ping timer. Note: This path is executed at every step of the
|
||||
// handshake, so this alarm does not need to be set explicitly at startup.
|
||||
this._setAlarm(prefs.get("pingInterval"));
|
||||
|
||||
let reply = undefined;
|
||||
try {
|
||||
reply = JSON.parse(message);
|
||||
@ -1405,8 +1581,29 @@ this.PushService = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof reply.messageType != "string") {
|
||||
debug("messageType not a string " + reply.messageType);
|
||||
// If we are not waiting for a hello message, reset the retry fail count
|
||||
if (this._currentState != STATE_WAITING_FOR_HELLO) {
|
||||
debug('Reseting _retryFailCount and _pingIntervalRetryTimes');
|
||||
this._retryFailCount = 0;
|
||||
this._pingIntervalRetryTimes = {};
|
||||
}
|
||||
|
||||
let doNotHandle = false;
|
||||
if ((message === '{}') ||
|
||||
(reply.messageType === undefined) ||
|
||||
(reply.messageType === "ping") ||
|
||||
(typeof reply.messageType != "string")) {
|
||||
debug('Pong received');
|
||||
this._calculateAdaptivePing(false);
|
||||
doNotHandle = true;
|
||||
}
|
||||
|
||||
// Reset the ping timer. Note: This path is executed at every step of the
|
||||
// handshake, so this alarm does not need to be set explicitly at startup.
|
||||
this._setAlarm(prefs.get("pingInterval"));
|
||||
|
||||
// If it is a ping, do not handle the message.
|
||||
if (doNotHandle) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -41,12 +41,14 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIScriptChannel.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsILoadInfo.h"
|
||||
#include "nsIObjectInputStream.h"
|
||||
#include "nsIObjectOutputStream.h"
|
||||
#include "nsIWritablePropertyBag2.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "nsILoadInfo.h"
|
||||
|
||||
using mozilla::dom::AutoEntryScript;
|
||||
|
||||
@ -152,10 +154,16 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
|
||||
aChannel->GetOwner(getter_AddRefs(owner));
|
||||
nsCOMPtr<nsIPrincipal> principal = do_QueryInterface(owner);
|
||||
if (!principal) {
|
||||
// No execution without a principal!
|
||||
NS_ASSERTION(!owner, "Non-principal owner?");
|
||||
NS_WARNING("No principal to execute JS with");
|
||||
return NS_ERROR_DOM_RETVAL_UNDEFINED;
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
|
||||
if (loadInfo && loadInfo->GetForceInheritPrincipal()) {
|
||||
principal = loadInfo->LoadingPrincipal();
|
||||
} else {
|
||||
// No execution without a principal!
|
||||
NS_ASSERTION(!owner, "Non-principal owner?");
|
||||
NS_WARNING("No principal to execute JS with");
|
||||
return NS_ERROR_DOM_RETVAL_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
@ -889,6 +897,18 @@ nsJSChannel::SetOwner(nsISupports* aOwner)
|
||||
return mStreamChannel->SetOwner(aOwner);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSChannel::GetLoadInfo(nsILoadInfo* *aLoadInfo)
|
||||
{
|
||||
return mStreamChannel->GetLoadInfo(aLoadInfo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSChannel::SetLoadInfo(nsILoadInfo* aLoadInfo)
|
||||
{
|
||||
return mStreamChannel->SetLoadInfo(aLoadInfo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aCallbacks)
|
||||
{
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "BackgroundChild.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "js/OldDebugAPI.h"
|
||||
#include "jsfriendapi.h"
|
||||
@ -40,6 +41,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCycleCollector.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsIIPCBackgroundChildCreateCallback.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsLayoutStatics.h"
|
||||
#include "nsNetUtil.h"
|
||||
@ -64,6 +66,12 @@
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
|
||||
#ifdef ENABLE_TESTS
|
||||
#include "BackgroundChildImpl.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "prrng.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@ -161,6 +169,10 @@ RuntimeService* gRuntimeService = nullptr;
|
||||
// Only non-null during the call to Init.
|
||||
RuntimeService* gRuntimeServiceDuringInit = nullptr;
|
||||
|
||||
#ifdef ENABLE_TESTS
|
||||
bool gTestPBackground = false;
|
||||
#endif // ENABLE_TESTS
|
||||
|
||||
enum {
|
||||
ID_Worker = 0,
|
||||
ID_ChromeWorker,
|
||||
@ -901,6 +913,38 @@ private:
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
};
|
||||
|
||||
class WorkerBackgroundChildCallback MOZ_FINAL :
|
||||
public nsIIPCBackgroundChildCreateCallback
|
||||
{
|
||||
bool* mDone;
|
||||
|
||||
public:
|
||||
WorkerBackgroundChildCallback(bool* aDone)
|
||||
: mDone(aDone)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(mDone);
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
private:
|
||||
~WorkerBackgroundChildCallback()
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
ActorCreated(PBackgroundChild* aActor) MOZ_OVERRIDE
|
||||
{
|
||||
*mDone = true;
|
||||
}
|
||||
|
||||
virtual void
|
||||
ActorFailed() MOZ_OVERRIDE
|
||||
{
|
||||
*mDone = true;
|
||||
}
|
||||
};
|
||||
|
||||
class WorkerThreadPrimaryRunnable MOZ_FINAL : public nsRunnable
|
||||
{
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
@ -943,6 +987,9 @@ private:
|
||||
~WorkerThreadPrimaryRunnable()
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
SynchronouslyCreatePBackground();
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
};
|
||||
|
||||
@ -1042,6 +1089,28 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_TESTS
|
||||
void
|
||||
TestPBackground()
|
||||
{
|
||||
using namespace mozilla::ipc;
|
||||
if (gTestPBackground) {
|
||||
// Randomize value to validate workers are not cross-posting messages.
|
||||
uint32_t testValue;
|
||||
PRSize randomSize = PR_GetRandomNoise(&testValue, sizeof(testValue));
|
||||
MOZ_RELEASE_ASSERT(randomSize == sizeof(testValue));
|
||||
nsCString testStr;
|
||||
testStr.AppendInt(testValue);
|
||||
testStr.AppendInt(reinterpret_cast<int64_t>(PR_GetCurrentThread()));
|
||||
PBackgroundChild* existingBackgroundChild =
|
||||
BackgroundChild::GetForCurrentThread();
|
||||
MOZ_RELEASE_ASSERT(existingBackgroundChild);
|
||||
bool ok = existingBackgroundChild->SendPBackgroundTestConstructor(testStr);
|
||||
MOZ_RELEASE_ASSERT(ok);
|
||||
}
|
||||
}
|
||||
#endif // #ENABLE_TESTS
|
||||
|
||||
private:
|
||||
WorkerThread()
|
||||
: nsThread(nsThread::NOT_MAIN_THREAD, WORKER_STACK_SIZE),
|
||||
@ -1247,6 +1316,10 @@ RuntimeService::GetOrCreateService()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TESTS
|
||||
gTestPBackground = mozilla::Preferences::GetBool("pbackground.testing", false);
|
||||
#endif // ENABLE_TESTS
|
||||
|
||||
// The observer service now owns us until shutdown.
|
||||
gRuntimeService = service;
|
||||
}
|
||||
@ -1536,10 +1609,6 @@ RuntimeService::ScheduleWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
thread->SetAcceptingNonWorkerRunnables(false);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2528,8 +2597,20 @@ RuntimeService::WorkerThread::Observer::OnProcessNextEvent(
|
||||
bool aMayWait,
|
||||
uint32_t aRecursionDepth)
|
||||
{
|
||||
using mozilla::ipc::BackgroundChild;
|
||||
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
MOZ_ASSERT(!aMayWait);
|
||||
|
||||
// If the PBackground child is not created yet, then we must permit
|
||||
// blocking event processing to support SynchronouslyCreatePBackground().
|
||||
// If this occurs then we are spinning on the event queue at the start of
|
||||
// PrimaryWorkerRunnable::Run() and don't want to process the event in
|
||||
// mWorkerPrivate yet.
|
||||
if (aMayWait) {
|
||||
MOZ_ASSERT(aRecursionDepth == 2);
|
||||
MOZ_ASSERT(!BackgroundChild::GetForCurrentThread());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mWorkerPrivate->OnProcessNextEvent(aRecursionDepth);
|
||||
return NS_OK;
|
||||
@ -2573,11 +2654,15 @@ LogViolationDetailsRunnable::Run()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(WorkerBackgroundChildCallback, nsIIPCBackgroundChildCreateCallback)
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(WorkerThreadPrimaryRunnable, nsRunnable)
|
||||
|
||||
NS_IMETHODIMP
|
||||
WorkerThreadPrimaryRunnable::Run()
|
||||
{
|
||||
using mozilla::ipc::BackgroundChild;
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
if (IsNuwaProcess()) {
|
||||
NS_ASSERTION(NuwaMarkCurrentThread != nullptr,
|
||||
@ -2596,6 +2681,19 @@ WorkerThreadPrimaryRunnable::Run()
|
||||
|
||||
profiler_register_thread(threadName.get(), &stackBaseGuess);
|
||||
|
||||
// Note: SynchronouslyCreatePBackground() must be called prior to
|
||||
// mThread->SetWorker() in order to avoid accidentally consuming
|
||||
// worker messages here.
|
||||
nsresult rv = SynchronouslyCreatePBackground();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
// XXX need to fire an error at parent.
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TESTS
|
||||
mThread->TestPBackground();
|
||||
#endif
|
||||
|
||||
mThread->SetWorker(mWorkerPrivate);
|
||||
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
@ -2629,6 +2727,12 @@ WorkerThreadPrimaryRunnable::Run()
|
||||
JS_ReportPendingException(cx);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TESTS
|
||||
mThread->TestPBackground();
|
||||
#endif
|
||||
|
||||
BackgroundChild::CloseForCurrentThread();
|
||||
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
if (stack) {
|
||||
stack->sampleRuntime(nullptr);
|
||||
@ -2667,6 +2771,38 @@ WorkerThreadPrimaryRunnable::Run()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
WorkerThreadPrimaryRunnable::SynchronouslyCreatePBackground()
|
||||
{
|
||||
using mozilla::ipc::BackgroundChild;
|
||||
|
||||
MOZ_ASSERT(!BackgroundChild::GetForCurrentThread());
|
||||
|
||||
bool done = false;
|
||||
nsCOMPtr<nsIIPCBackgroundChildCreateCallback> callback =
|
||||
new WorkerBackgroundChildCallback(&done);
|
||||
|
||||
if (NS_WARN_IF(!BackgroundChild::GetOrCreateForCurrentThread(callback))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
while (!done) {
|
||||
if (NS_WARN_IF(!NS_ProcessNextEvent(mThread, true /* aMayWait */))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!BackgroundChild::GetForCurrentThread())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
mThread->SetAcceptingNonWorkerRunnables(false);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(WorkerThreadPrimaryRunnable::FinishedRunnable,
|
||||
nsRunnable)
|
||||
|
||||
|
@ -7,6 +7,9 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
|
||||
using mozilla::LoadInfo;
|
||||
|
||||
/**
|
||||
* URIUtils
|
||||
@ -62,7 +65,10 @@ URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
|
||||
loadGroup))) {
|
||||
return;
|
||||
}
|
||||
channel->SetOwner(sourcePrincipal);
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(sourcePrincipal, LoadInfo::eInheritPrincipal,
|
||||
LoadInfo::eNotSandboxed);
|
||||
channel->SetLoadInfo(loadInfo);
|
||||
}
|
||||
aNewDoc->Reset(channel, loadGroup);
|
||||
aNewDoc->SetPrincipal(sourcePrincipal);
|
||||
|
@ -208,7 +208,10 @@ public:
|
||||
*/
|
||||
struct PaintState {
|
||||
PaintState()
|
||||
: mMode(SurfaceMode::SURFACE_NONE)
|
||||
: mRegionToDraw()
|
||||
, mRegionToInvalidate()
|
||||
, mMode(SurfaceMode::SURFACE_NONE)
|
||||
, mClip(DrawRegionClip::CLIP_NONE)
|
||||
, mContentType(gfxContentType::SENTINEL)
|
||||
, mDidSelfCopy(false)
|
||||
{}
|
||||
|
@ -808,6 +808,10 @@ APZCTreeManager::DispatchScroll(AsyncPanZoomController* aPrev, ScreenPoint aStar
|
||||
return false;
|
||||
}
|
||||
|
||||
if (next->GetGuid().mLayersId != aPrev->GetGuid().mLayersId) {
|
||||
NS_WARNING("Handing off scroll across a layer tree boundary; may need to revise approach to bug 1031067");
|
||||
}
|
||||
|
||||
// Convert the start and end points from |aPrev|'s coordinate space to
|
||||
// |next|'s coordinate space. Since |aPrev| may be the same as |next|
|
||||
// (if |aPrev| is the APZC that is initiating the scroll and there is no
|
||||
|
@ -1240,6 +1240,15 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
|
||||
|
||||
{
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
||||
// We can get into a situation where we are overscrolled at the end of a
|
||||
// pinch if we go into overscroll with a two-finger pan, and then turn
|
||||
// that into a pinch by increasing the span sufficiently. In such a case,
|
||||
// there is no snap-back animation to get us out of overscroll, so we need
|
||||
// to get out of it somehow.
|
||||
mX.ClearOverscroll();
|
||||
mY.ClearOverscroll();
|
||||
|
||||
ScheduleComposite();
|
||||
RequestContentRepaint();
|
||||
UpdateSharedCompositorFrameMetrics();
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "SkTypes.h"
|
||||
|
||||
template <typename T> class SK_API SkTDArray {
|
||||
template <typename T> class SkTDArray {
|
||||
public:
|
||||
SkTDArray() {
|
||||
fReserve = fCount = 0;
|
||||
|
@ -1769,6 +1769,9 @@ gfxContext::GetUserPathExtent()
|
||||
cairo_path_extents(mCairo, &xmin, &ymin, &xmax, &ymax);
|
||||
return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
|
||||
} else {
|
||||
if (mPathIsRect) {
|
||||
return ThebesRect(mTransform.TransformBounds(mRect));
|
||||
}
|
||||
EnsurePath();
|
||||
return ThebesRect(mPath->GetBounds());
|
||||
}
|
||||
@ -1782,6 +1785,9 @@ gfxContext::GetUserFillExtent()
|
||||
cairo_fill_extents(mCairo, &xmin, &ymin, &xmax, &ymax);
|
||||
return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
|
||||
} else {
|
||||
if (mPathIsRect) {
|
||||
return ThebesRect(mTransform.TransformBounds(mRect));
|
||||
}
|
||||
EnsurePath();
|
||||
return ThebesRect(mPath->GetBounds());
|
||||
}
|
||||
@ -1795,6 +1801,11 @@ gfxContext::GetUserStrokeExtent()
|
||||
cairo_stroke_extents(mCairo, &xmin, &ymin, &xmax, &ymax);
|
||||
return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
|
||||
} else {
|
||||
if (mPathIsRect) {
|
||||
Rect rect = mRect;
|
||||
rect.Inflate(CurrentState().strokeOptions.mLineWidth / 2);
|
||||
return ThebesRect(mTransform.TransformBounds(rect));
|
||||
}
|
||||
EnsurePath();
|
||||
return ThebesRect(mPath->GetStrokedBounds(CurrentState().strokeOptions, mTransform));
|
||||
}
|
||||
|
@ -5180,7 +5180,7 @@ gfxFontGroup::FindPlatformFont(const nsAString& aName,
|
||||
// If the fontSet matches the family, but the font has not yet finished
|
||||
// loading (nor has its load timeout fired), the fontGroup should wait
|
||||
// for the download, and not actually draw its text yet.
|
||||
family = mUserFontSet->GetFamily(aName);
|
||||
family = mUserFontSet->LookupFamily(aName);
|
||||
if (family) {
|
||||
bool waitForUserFont = false;
|
||||
fe = mUserFontSet->FindFontEntry(family, mStyle,
|
||||
|
@ -818,7 +818,11 @@ public:
|
||||
{
|
||||
aFontEntry->mIgnoreGDEF = true;
|
||||
}
|
||||
aFontEntry->mFamilyName = Name();
|
||||
if (aFontEntry->mFamilyName.IsEmpty()) {
|
||||
aFontEntry->mFamilyName = Name();
|
||||
} else {
|
||||
MOZ_ASSERT(aFontEntry->mFamilyName.Equals(Name()));
|
||||
}
|
||||
aFontEntry->mSkipDefaultFeatureSpaceCheck = mSkipDefaultFeatureSpaceCheck;
|
||||
mAvailableFonts.AppendElement(aFontEntry);
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ FindFontPatterns(gfxUserFontSet *mUserFontSet,
|
||||
style.stretch = aStretch;
|
||||
|
||||
gfxUserFcFontEntry *fontEntry = nullptr;
|
||||
gfxFontFamily *family = mUserFontSet->GetFamily(utf16Family);
|
||||
gfxFontFamily *family = mUserFontSet->LookupFamily(utf16Family);
|
||||
if (family) {
|
||||
fontEntry = static_cast<gfxUserFcFontEntry*>
|
||||
(mUserFontSet->FindFontEntry(family, style, needsBold,
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsHostObjectProtocolHandler.h"
|
||||
@ -371,7 +372,10 @@ gfxSVGGlyphsDocument::ParseDocument(const uint8_t *aBuffer, uint32_t aBufLen)
|
||||
SVG_CONTENT_TYPE, UTF8_CHARSET);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
channel->SetOwner(principal);
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(principal, LoadInfo::eInheritPrincipal,
|
||||
LoadInfo::eNotSandboxed);
|
||||
channel->SetLoadInfo(loadInfo);
|
||||
|
||||
// Set this early because various decisions during page-load depend on it.
|
||||
document->SetIsBeingUsedAsImage();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -103,7 +103,11 @@ public:
|
||||
break;
|
||||
}
|
||||
}
|
||||
aFontEntry->mFamilyName = Name();
|
||||
if (aFontEntry->mFamilyName.IsEmpty()) {
|
||||
aFontEntry->mFamilyName = Name();
|
||||
} else {
|
||||
MOZ_ASSERT(aFontEntry->mFamilyName.Equals(Name()));
|
||||
}
|
||||
ResetCharacterMap();
|
||||
}
|
||||
|
||||
@ -118,7 +122,11 @@ public:
|
||||
// Note that this may delete aProxyFontEntry, if there's no
|
||||
// other reference to it except from its family.
|
||||
mAvailableFonts[i] = aRealFontEntry;
|
||||
aRealFontEntry->mFamilyName = Name();
|
||||
if (aRealFontEntry->mFamilyName.IsEmpty()) {
|
||||
aRealFontEntry->mFamilyName = Name();
|
||||
} else {
|
||||
MOZ_ASSERT(aRealFontEntry->mFamilyName.Equals(Name()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -135,6 +143,7 @@ public:
|
||||
class gfxProxyFontEntry;
|
||||
|
||||
class gfxUserFontSet {
|
||||
friend class gfxProxyFontEntry;
|
||||
|
||||
public:
|
||||
|
||||
@ -157,14 +166,6 @@ public:
|
||||
FLAG_FORMAT_NOT_USED = ~((1 << 7)-1)
|
||||
};
|
||||
|
||||
enum LoadStatus {
|
||||
STATUS_LOADING = 0,
|
||||
STATUS_LOADED,
|
||||
STATUS_FORMAT_NOT_SUPPORTED,
|
||||
STATUS_ERROR,
|
||||
STATUS_END_OF_LIST
|
||||
};
|
||||
|
||||
|
||||
// add in a font face
|
||||
// weight - [100, 900] (multiples of 100)
|
||||
@ -187,13 +188,15 @@ public:
|
||||
// Whether there is a face with this family name
|
||||
bool HasFamily(const nsAString& aFamilyName) const
|
||||
{
|
||||
return GetFamily(aFamilyName) != nullptr;
|
||||
return LookupFamily(aFamilyName) != nullptr;
|
||||
}
|
||||
|
||||
gfxFontFamily *GetFamily(const nsAString& aName) const;
|
||||
// Look up and return the gfxMixedFontFamily in mFontFamilies with
|
||||
// the given name
|
||||
gfxMixedFontFamily* LookupFamily(const nsAString& aName) const;
|
||||
|
||||
// Lookup a font entry for a given style, returns null if not loaded.
|
||||
// aFamily must be a family returned by our GetFamily method.
|
||||
// aFamily must be a family returned by our LookupFamily method.
|
||||
gfxFontEntry *FindFontEntry(gfxFontFamily *aFamily,
|
||||
const gfxFontStyle& aFontStyle,
|
||||
bool& aNeedsBold,
|
||||
@ -413,19 +416,6 @@ protected:
|
||||
// Return whether the font set is associated with a private-browsing tab.
|
||||
virtual bool GetPrivateBrowsing() = 0;
|
||||
|
||||
// for a given proxy font entry, attempt to load the next resource
|
||||
// in the src list
|
||||
LoadStatus LoadNext(gfxMixedFontFamily *aFamily,
|
||||
gfxProxyFontEntry *aProxyEntry);
|
||||
|
||||
// helper method for creating a platform font
|
||||
// returns font entry if platform font creation successful
|
||||
// Ownership of aFontData is passed in here; the font set must
|
||||
// ensure that it is eventually deleted with NS_Free().
|
||||
gfxFontEntry* LoadFont(gfxMixedFontFamily *aFamily,
|
||||
gfxProxyFontEntry *aProxy,
|
||||
const uint8_t *aFontData, uint32_t &aLength);
|
||||
|
||||
// parse data for a data URL
|
||||
virtual nsresult SyncLoadFontData(gfxProxyFontEntry *aFontToLoad,
|
||||
const gfxFontFaceSrc *aFontFaceSrc,
|
||||
@ -439,18 +429,13 @@ protected:
|
||||
uint32_t aFlags = nsIScriptError::errorFlag,
|
||||
nsresult aStatus = NS_OK) = 0;
|
||||
|
||||
const uint8_t* SanitizeOpenTypeData(gfxMixedFontFamily *aFamily,
|
||||
gfxProxyFontEntry *aProxy,
|
||||
const uint8_t* aData,
|
||||
uint32_t aLength,
|
||||
uint32_t& aSaneLength,
|
||||
bool aIsCompressed);
|
||||
|
||||
static bool OTSMessage(void *aUserData, const char *format, ...);
|
||||
|
||||
// helper method for performing the actual userfont set rebuild
|
||||
virtual void DoRebuildUserFontSet() = 0;
|
||||
|
||||
// creates a new gfxMixedFontFamily in mFontFamilies, or returns an existing
|
||||
// family if there is one
|
||||
gfxMixedFontFamily* GetFamily(const nsAString& aFamilyName);
|
||||
|
||||
// font families defined by @font-face rules
|
||||
nsRefPtrHashtable<nsStringHashKey, gfxMixedFontFamily> mFontFamilies;
|
||||
|
||||
@ -460,21 +445,26 @@ protected:
|
||||
bool mLocalRulesUsed;
|
||||
|
||||
static PRLogModuleInfo* GetUserFontsLog();
|
||||
|
||||
private:
|
||||
static void CopyWOFFMetadata(const uint8_t* aFontData,
|
||||
uint32_t aLength,
|
||||
FallibleTArray<uint8_t>* aMetadata,
|
||||
uint32_t* aMetaOrigLen);
|
||||
};
|
||||
|
||||
// acts a placeholder until the real font is downloaded
|
||||
|
||||
class gfxProxyFontEntry : public gfxFontEntry {
|
||||
friend class gfxUserFontSet;
|
||||
friend class nsUserFontSet;
|
||||
friend class nsFontFaceLoader;
|
||||
|
||||
public:
|
||||
gfxProxyFontEntry(const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
|
||||
enum LoadStatus {
|
||||
STATUS_LOADING = 0,
|
||||
STATUS_LOADED,
|
||||
STATUS_FORMAT_NOT_SUPPORTED,
|
||||
STATUS_ERROR,
|
||||
STATUS_END_OF_LIST
|
||||
};
|
||||
|
||||
gfxProxyFontEntry(gfxUserFontSet *aFontSet,
|
||||
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
|
||||
uint32_t aWeight,
|
||||
int32_t aStretch,
|
||||
uint32_t aItalicStyle,
|
||||
@ -495,6 +485,35 @@ public:
|
||||
|
||||
virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold);
|
||||
|
||||
protected:
|
||||
const uint8_t* SanitizeOpenTypeData(gfxMixedFontFamily *aFamily,
|
||||
const uint8_t* aData,
|
||||
uint32_t aLength,
|
||||
uint32_t& aSaneLength,
|
||||
bool aIsCompressed);
|
||||
|
||||
// Attempt to load the next resource in the src list.
|
||||
// aLocalRules is set to true if an attempt was made to load a
|
||||
// local() font was loaded, and left as it is otherwise.
|
||||
LoadStatus LoadNext(gfxMixedFontFamily *aFamily,
|
||||
bool& aLocalRulesUsed);
|
||||
|
||||
// helper method for creating a platform font
|
||||
// returns font entry if platform font creation successful
|
||||
// Ownership of aFontData is passed in here; the font must
|
||||
// ensure that it is eventually deleted with NS_Free().
|
||||
gfxFontEntry* LoadFont(gfxMixedFontFamily *aFamily,
|
||||
const uint8_t *aFontData, uint32_t &aLength);
|
||||
|
||||
// store metadata and src details for current src into aFontEntry
|
||||
void StoreUserFontData(gfxFontEntry* aFontEntry,
|
||||
bool aPrivate,
|
||||
const nsAString& aOriginalName,
|
||||
FallibleTArray<uint8_t>* aMetadata,
|
||||
uint32_t aMetaOrigLen);
|
||||
|
||||
static bool OTSMessage(void *aUserData, const char *format, ...);
|
||||
|
||||
// note that code depends on the ordering of these values!
|
||||
enum LoadingState {
|
||||
NOT_LOADING = 0, // not started to load any font resources yet
|
||||
@ -511,6 +530,7 @@ public:
|
||||
nsTArray<gfxFontFaceSrc> mSrcList;
|
||||
uint32_t mSrcIndex; // index of loading src item
|
||||
nsFontFaceLoader *mLoader; // current loader for this entry, if any
|
||||
gfxUserFontSet *mFontSet; // font-set to which the proxy belongs
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
};
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsILoadInfo.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIInputStreamPump.h"
|
||||
@ -42,7 +43,8 @@ protected:
|
||||
int64_t mContentLength;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<nsILoadInfo> mLoadInfo;
|
||||
|
||||
nsCOMPtr<nsIInputStreamPump> mPump;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
|
@ -437,6 +437,18 @@ NS_IMETHODIMP nsIconChannel::SetOwner(nsISupports* aOwner)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetLoadInfo(nsILoadInfo* *aLoadInfo)
|
||||
{
|
||||
NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetLoadInfo(nsILoadInfo* aLoadInfo)
|
||||
{
|
||||
mLoadInfo = aLoadInfo;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
|
||||
{
|
||||
*aNotificationCallbacks = mCallbacks.get();
|
||||
|
@ -664,6 +664,18 @@ NS_IMETHODIMP nsIconChannel::SetOwner(nsISupports* aOwner)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetLoadInfo(nsILoadInfo* *aLoadInfo)
|
||||
{
|
||||
NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetLoadInfo(nsILoadInfo* aLoadInfo)
|
||||
{
|
||||
mLoadInfo = aLoadInfo;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
|
||||
{
|
||||
*aNotificationCallbacks = mCallbacks.get();
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsILoadInfo.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIURI.h"
|
||||
@ -45,6 +46,7 @@ protected:
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<nsILoadInfo> mLoadInfo;
|
||||
|
||||
nsCOMPtr<nsIInputStreamPump> mPump;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
|
@ -637,7 +637,8 @@ static nsresult NewImageChannel(nsIChannel **aResult,
|
||||
}
|
||||
|
||||
bool setOwner = nsContentUtils::SetUpChannelOwner(aLoadingPrincipal,
|
||||
*aResult, aURI, false);
|
||||
*aResult, aURI, false,
|
||||
false, false);
|
||||
*aForcePrincipalCheckForCacheEntry = setOwner;
|
||||
|
||||
// Create a new loadgroup for this new channel, using the old group as
|
||||
|
@ -19,3 +19,6 @@
|
||||
== bmp-not-square-4bpp.bmp bmp-not-square-4bpp.png
|
||||
== os2bmp-size-32x32-4bpp.bmp bmp-size-32x32-4bpp.png
|
||||
== top-to-bottom-16x16-4bpp.bmp bmp-size-16x16-4bpp.png
|
||||
# test that delta skips are drawn as transparent
|
||||
# taken from http://bmptestsuite.sourceforge.net/
|
||||
== rle4-delta-320x240.bmp rle4-delta-320x240.png
|
||||
|
BIN
image/test/reftest/bmp/bmp-4bpp/rle4-delta-320x240.bmp
Normal file
BIN
image/test/reftest/bmp/bmp-4bpp/rle4-delta-320x240.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
image/test/reftest/bmp/bmp-4bpp/rle4-delta-320x240.png
Normal file
BIN
image/test/reftest/bmp/bmp-4bpp/rle4-delta-320x240.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 886 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user