зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to b2g-inbound. a=merge
This commit is contained in:
Коммит
0655f2811b
|
@ -1686,7 +1686,7 @@ pref("pdfjs.previousHandler.alwaysAskBeforeHandling", false);
|
|||
pref("shumway.disabled", true);
|
||||
#else
|
||||
pref("shumway.disabled", false);
|
||||
pref("shumway.swf.whitelist", "http://g-ecx.images-amazon.com/*/AiryBasicRenderer*.swf");
|
||||
pref("shumway.swf.whitelist", "http://g-ecx.images-amazon.com/*/AiryBasicRenderer*.swf,http://z-ecx.images-amazon.com/*/AiryFlashlsRenderer._TTW_.swf,http://ia.media-imdb.com/*/AiryFlashlsRenderer._TTW_.swf");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -1718,15 +1718,17 @@ pref("loop.debug.dispatcher", false);
|
|||
pref("loop.debug.websocket", false);
|
||||
pref("loop.debug.sdk", false);
|
||||
#ifdef DEBUG
|
||||
pref("loop.CSP", "default-src 'self' about: file: chrome: http://localhost:*; img-src 'self' data: http://www.gravatar.com/ about: file: chrome:; font-src 'none'; connect-src wss://*.tokbox.com https://*.opentok.com https://*.tokbox.com wss://*.mozilla.com https://*.mozilla.org wss://*.mozaws.net http://localhost:* ws://localhost:*; media-src blob:");
|
||||
pref("loop.CSP", "default-src 'self' about: file: chrome: http://localhost:*; img-src 'self' data: https://www.gravatar.com/ about: file: chrome:; font-src 'none'; connect-src wss://*.tokbox.com https://*.opentok.com https://*.tokbox.com wss://*.mozilla.com https://*.mozilla.org wss://*.mozaws.net http://localhost:* ws://localhost:*; media-src blob:");
|
||||
#else
|
||||
pref("loop.CSP", "default-src 'self' about: file: chrome:; img-src 'self' data: http://www.gravatar.com/ about: file: chrome:; font-src 'none'; connect-src wss://*.tokbox.com https://*.opentok.com https://*.tokbox.com wss://*.mozilla.com https://*.mozilla.org wss://*.mozaws.net; media-src blob:");
|
||||
pref("loop.CSP", "default-src 'self' about: file: chrome:; img-src 'self' data: https://www.gravatar.com/ about: file: chrome:; font-src 'none'; connect-src wss://*.tokbox.com https://*.opentok.com https://*.tokbox.com wss://*.mozilla.com https://*.mozilla.org wss://*.mozaws.net; media-src blob:");
|
||||
#endif
|
||||
pref("loop.oauth.google.redirect_uri", "urn:ietf:wg:oauth:2.0:oob:auto");
|
||||
pref("loop.oauth.google.scope", "https://www.google.com/m8/feeds");
|
||||
pref("loop.fxa_oauth.tokendata", "");
|
||||
pref("loop.fxa_oauth.profile", "");
|
||||
pref("loop.support_url", "https://support.mozilla.org/kb/group-conversations-firefox-hello-webrtc");
|
||||
pref("loop.contacts.gravatars.show", false);
|
||||
pref("loop.contacts.gravatars.promo", true);
|
||||
|
||||
// serverURL to be assigned by services team
|
||||
pref("services.push.serverURL", "wss://push.services.mozilla.com/");
|
||||
|
|
|
@ -446,7 +446,9 @@
|
|||
</menu>
|
||||
#ifndef XP_MACOSX
|
||||
# Disabled on Mac because we can't fill native menupopups asynchronously
|
||||
<menuseparator/>
|
||||
<menuseparator id="menu_readingListSeparator">
|
||||
<observes element="readingListSidebar" attribute="hidden"/>
|
||||
</menuseparator>
|
||||
<menu id="menu_readingList"
|
||||
class="menu-iconic bookmark-item"
|
||||
label="&readingList.label;"
|
||||
|
|
|
@ -117,6 +117,15 @@ const cloneValueInto = function(value, targetWindow) {
|
|||
return clone;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the two-digit hexadecimal code for a byte
|
||||
*
|
||||
* @param {byte} charCode
|
||||
*/
|
||||
const toHexString = function(charCode) {
|
||||
return ("0" + charCode.toString(16)).slice(-2);
|
||||
};
|
||||
|
||||
/**
|
||||
* Inject any API containing _only_ function properties into the given window.
|
||||
*
|
||||
|
@ -740,6 +749,43 @@ function injectLoopAPI(targetWindow) {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Compose a URL pointing to the location of an avatar by email address.
|
||||
* At the moment we use the Gravatar service to match email addresses with
|
||||
* avatars. This might change in the future as avatars might come from another
|
||||
* source.
|
||||
*
|
||||
* @param {String} emailAddress Users' email address
|
||||
* @param {Number} size Size of the avatar image to return in pixels.
|
||||
* Optional. Default value: 40.
|
||||
* @return the URL pointing to an avatar matching the provided email address.
|
||||
*/
|
||||
getUserAvatar: {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: function(emailAddress, size = 40) {
|
||||
const kEmptyGif = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
||||
if (!emailAddress || !MozLoopService.getLoopPref("contacts.gravatars.show")) {
|
||||
return kEmptyGif;
|
||||
}
|
||||
|
||||
// Do the MD5 dance.
|
||||
let hasher = Cc["@mozilla.org/security/hash;1"]
|
||||
.createInstance(Ci.nsICryptoHash);
|
||||
hasher.init(Ci.nsICryptoHash.MD5);
|
||||
let stringStream = Cc["@mozilla.org/io/string-input-stream;1"]
|
||||
.createInstance(Ci.nsIStringInputStream);
|
||||
stringStream.data = emailAddress.trim().toLowerCase();
|
||||
hasher.updateFromStream(stringStream, -1);
|
||||
let hash = hasher.finish(false);
|
||||
// Convert the binary hash data to a hex string.
|
||||
let md5Email = [toHexString(hash.charCodeAt(i)) for (i in hash)].join("");
|
||||
|
||||
// Compose the Gravatar URL.
|
||||
return "https://www.gravatar.com/avatar/" + md5Email + ".jpg?default=blank&s=" + size;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Associates a session-id and a call-id with a window for debugging.
|
||||
*
|
||||
|
|
|
@ -229,3 +229,44 @@
|
|||
.contact-form > .button-group {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.contacts-gravatar-promo {
|
||||
position: relative;
|
||||
border: 1px dashed #c1c1c1;
|
||||
border-radius: 2px;
|
||||
background-color: #fbfbfb;
|
||||
padding: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.contacts-gravatar-promo > p {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 8px;
|
||||
margin-right: 4px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
body[dir=rtl] .contacts-gravatar-promo > p {
|
||||
margin-right: 0;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.contacts-gravatar-promo > p > a {
|
||||
color: #0295df;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.contacts-gravatar-promo > p > a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.contacts-gravatar-promo > .button-close {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
}
|
||||
|
||||
body[dir=rtl] .contacts-gravatar-promo > .button-close {
|
||||
right: auto;
|
||||
left: 8px;
|
||||
}
|
||||
|
|
|
@ -390,6 +390,23 @@ body {
|
|||
color: #fff;
|
||||
}
|
||||
|
||||
.button-close {
|
||||
background-color: transparent;
|
||||
background-image: url(../shared/img/icons-10x10.svg#close);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 8px 8px;
|
||||
border: none;
|
||||
padding: 0;
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.button-close:hover,
|
||||
.button-close:hover:active {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Dropdown menu */
|
||||
|
||||
.dropdown {
|
||||
|
|
|
@ -81,6 +81,59 @@ loop.contacts = (function(_, mozL10n) {
|
|||
contact[field][0].value = value;
|
||||
};
|
||||
|
||||
const GravatarPromo = React.createClass({displayName: "GravatarPromo",
|
||||
propTypes: {
|
||||
handleUse: React.PropTypes.func.isRequired
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
showMe: navigator.mozLoop.getLoopPref("contacts.gravatars.promo") &&
|
||||
!navigator.mozLoop.getLoopPref("contacts.gravatars.show")
|
||||
};
|
||||
},
|
||||
|
||||
handleCloseButtonClick: function() {
|
||||
navigator.mozLoop.setLoopPref("contacts.gravatars.promo", false);
|
||||
this.setState({ showMe: false });
|
||||
},
|
||||
|
||||
handleUseButtonClick: function() {
|
||||
navigator.mozLoop.setLoopPref("contacts.gravatars.promo", false);
|
||||
navigator.mozLoop.setLoopPref("contacts.gravatars.show", true);
|
||||
this.setState({ showMe: false });
|
||||
this.props.handleUse();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
if (!this.state.showMe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let privacyUrl = navigator.mozLoop.getLoopPref("legal.privacy_url");
|
||||
let message = mozL10n.get("gravatars_promo_message", {
|
||||
"learn_more": React.renderToStaticMarkup(
|
||||
React.createElement("a", {href: privacyUrl, target: "_blank"},
|
||||
mozL10n.get("gravatars_promo_message_learnmore")
|
||||
)
|
||||
)
|
||||
});
|
||||
return (
|
||||
React.createElement("div", {className: "contacts-gravatar-promo"},
|
||||
React.createElement(Button, {additionalClass: "button-close", onClick: this.handleCloseButtonClick}),
|
||||
React.createElement("p", {dangerouslySetInnerHTML: {__html: message}}),
|
||||
React.createElement(ButtonGroup, null,
|
||||
React.createElement(Button, {caption: mozL10n.get("gravatars_promo_button_nothanks"),
|
||||
onClick: this.handleCloseButtonClick}),
|
||||
React.createElement(Button, {caption: mozL10n.get("gravatars_promo_button_use"),
|
||||
additionalClass: "button-accept",
|
||||
onClick: this.handleUseButtonClick})
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
const ContactDropdown = React.createClass({displayName: "ContactDropdown",
|
||||
propTypes: {
|
||||
handleAction: React.PropTypes.func.isRequired,
|
||||
|
@ -232,7 +285,9 @@ loop.contacts = (function(_, mozL10n) {
|
|||
|
||||
return (
|
||||
React.createElement("li", {className: contactCSSClass, onMouseLeave: this.hideDropdownMenu},
|
||||
React.createElement("div", {className: "avatar"}),
|
||||
React.createElement("div", {className: "avatar"},
|
||||
React.createElement("img", {src: navigator.mozLoop.getUserAvatar(email.value)})
|
||||
),
|
||||
React.createElement("div", {className: "details"},
|
||||
React.createElement("div", {className: "username"}, React.createElement("strong", null, names.firstName), " ", names.lastName,
|
||||
React.createElement("i", {className: cx({"icon icon-google": this.props.contact.category[0] == "google"})}),
|
||||
|
@ -462,6 +517,12 @@ loop.contacts = (function(_, mozL10n) {
|
|||
}
|
||||
},
|
||||
|
||||
handleUseGravatar: function() {
|
||||
// We got permission to use Gravatar icons now, so we need to redraw the
|
||||
// list entirely to show them.
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
sortContacts: function(contact1, contact2) {
|
||||
let comp = contact1.name[0].localeCompare(contact2.name[0]);
|
||||
if (comp !== 0) {
|
||||
|
@ -522,7 +583,8 @@ loop.contacts = (function(_, mozL10n) {
|
|||
React.createElement("input", {className: "contact-filter",
|
||||
placeholder: mozL10n.get("contacts_search_placesholder"),
|
||||
valueLink: this.linkState("filter")})
|
||||
: null
|
||||
: null,
|
||||
React.createElement(GravatarPromo, {handleUse: this.handleUseGravatar})
|
||||
),
|
||||
React.createElement("ul", {className: "contact-list"},
|
||||
shownContacts.available ?
|
||||
|
|
|
@ -81,6 +81,59 @@ loop.contacts = (function(_, mozL10n) {
|
|||
contact[field][0].value = value;
|
||||
};
|
||||
|
||||
const GravatarPromo = React.createClass({
|
||||
propTypes: {
|
||||
handleUse: React.PropTypes.func.isRequired
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
showMe: navigator.mozLoop.getLoopPref("contacts.gravatars.promo") &&
|
||||
!navigator.mozLoop.getLoopPref("contacts.gravatars.show")
|
||||
};
|
||||
},
|
||||
|
||||
handleCloseButtonClick: function() {
|
||||
navigator.mozLoop.setLoopPref("contacts.gravatars.promo", false);
|
||||
this.setState({ showMe: false });
|
||||
},
|
||||
|
||||
handleUseButtonClick: function() {
|
||||
navigator.mozLoop.setLoopPref("contacts.gravatars.promo", false);
|
||||
navigator.mozLoop.setLoopPref("contacts.gravatars.show", true);
|
||||
this.setState({ showMe: false });
|
||||
this.props.handleUse();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
if (!this.state.showMe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let privacyUrl = navigator.mozLoop.getLoopPref("legal.privacy_url");
|
||||
let message = mozL10n.get("gravatars_promo_message", {
|
||||
"learn_more": React.renderToStaticMarkup(
|
||||
<a href={privacyUrl} target="_blank">
|
||||
{mozL10n.get("gravatars_promo_message_learnmore")}
|
||||
</a>
|
||||
)
|
||||
});
|
||||
return (
|
||||
<div className="contacts-gravatar-promo">
|
||||
<Button additionalClass="button-close" onClick={this.handleCloseButtonClick}/>
|
||||
<p dangerouslySetInnerHTML={{__html: message}}></p>
|
||||
<ButtonGroup>
|
||||
<Button caption={mozL10n.get("gravatars_promo_button_nothanks")}
|
||||
onClick={this.handleCloseButtonClick}/>
|
||||
<Button caption={mozL10n.get("gravatars_promo_button_use")}
|
||||
additionalClass="button-accept"
|
||||
onClick={this.handleUseButtonClick}/>
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
const ContactDropdown = React.createClass({
|
||||
propTypes: {
|
||||
handleAction: React.PropTypes.func.isRequired,
|
||||
|
@ -232,7 +285,9 @@ loop.contacts = (function(_, mozL10n) {
|
|||
|
||||
return (
|
||||
<li className={contactCSSClass} onMouseLeave={this.hideDropdownMenu}>
|
||||
<div className="avatar" />
|
||||
<div className="avatar">
|
||||
<img src={navigator.mozLoop.getUserAvatar(email.value)} />
|
||||
</div>
|
||||
<div className="details">
|
||||
<div className="username"><strong>{names.firstName}</strong> {names.lastName}
|
||||
<i className={cx({"icon icon-google": this.props.contact.category[0] == "google"})} />
|
||||
|
@ -462,6 +517,12 @@ loop.contacts = (function(_, mozL10n) {
|
|||
}
|
||||
},
|
||||
|
||||
handleUseGravatar: function() {
|
||||
// We got permission to use Gravatar icons now, so we need to redraw the
|
||||
// list entirely to show them.
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
sortContacts: function(contact1, contact2) {
|
||||
let comp = contact1.name[0].localeCompare(contact2.name[0]);
|
||||
if (comp !== 0) {
|
||||
|
@ -523,6 +584,7 @@ loop.contacts = (function(_, mozL10n) {
|
|||
placeholder={mozL10n.get("contacts_search_placesholder")}
|
||||
valueLink={this.linkState("filter")} />
|
||||
: null }
|
||||
<GravatarPromo handleUse={this.handleUseGravatar}/>
|
||||
</div>
|
||||
<ul className="contact-list">
|
||||
{shownContacts.available ?
|
||||
|
|
|
@ -40,6 +40,18 @@ loop.panel = (function(_, mozL10n) {
|
|||
if (tabChange) {
|
||||
this.props.mozLoop.notifyUITour("Loop:PanelTabChanged", nextState.selectedTab);
|
||||
}
|
||||
|
||||
if (!tabChange && nextProps.buttonsHidden) {
|
||||
if (nextProps.buttonsHidden.length !== this.props.buttonsHidden.length) {
|
||||
tabChange = true;
|
||||
} else {
|
||||
for (var i = 0, l = nextProps.buttonsHidden.length; i < l && !tabChange; ++i) {
|
||||
if (this.props.buttonsHidden.indexOf(nextProps.buttonsHidden[i]) === -1) {
|
||||
tabChange = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return tabChange;
|
||||
},
|
||||
|
||||
|
|
|
@ -40,6 +40,18 @@ loop.panel = (function(_, mozL10n) {
|
|||
if (tabChange) {
|
||||
this.props.mozLoop.notifyUITour("Loop:PanelTabChanged", nextState.selectedTab);
|
||||
}
|
||||
|
||||
if (!tabChange && nextProps.buttonsHidden) {
|
||||
if (nextProps.buttonsHidden.length !== this.props.buttonsHidden.length) {
|
||||
tabChange = true;
|
||||
} else {
|
||||
for (var i = 0, l = nextProps.buttonsHidden.length; i < l && !tabChange; ++i) {
|
||||
if (this.props.buttonsHidden.indexOf(nextProps.buttonsHidden[i]) === -1) {
|
||||
tabChange = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return tabChange;
|
||||
},
|
||||
|
||||
|
|
|
@ -72,7 +72,11 @@ loop.Dispatcher = (function() {
|
|||
}
|
||||
|
||||
registeredStores.forEach(function(store) {
|
||||
store[type](action);
|
||||
try {
|
||||
store[type](action);
|
||||
} catch (x) {
|
||||
console.error("[Dispatcher] Dispatching action caused an exception: ", x);
|
||||
}
|
||||
});
|
||||
|
||||
this._active = false;
|
||||
|
|
|
@ -14,9 +14,71 @@ describe("loop.contacts", function() {
|
|||
var fakeAddContactButtonText = "Fake Add Contact";
|
||||
var fakeEditContactButtonText = "Fake Edit Contact";
|
||||
var fakeDoneButtonText = "Fake Done";
|
||||
// The fake contacts array is copied each time mozLoop.contacts.getAll() is called.
|
||||
var fakeContacts = [{
|
||||
id: 1,
|
||||
_guid: 1,
|
||||
name: ["Ally Avocado"],
|
||||
email: [{
|
||||
"pref": true,
|
||||
"type": ["work"],
|
||||
"value": "ally@mail.com"
|
||||
}],
|
||||
tel: [{
|
||||
"pref": true,
|
||||
"type": ["mobile"],
|
||||
"value": "+31-6-12345678"
|
||||
}],
|
||||
category: ["google"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
},{
|
||||
id: 2,
|
||||
_guid: 2,
|
||||
name: ["Bob Banana"],
|
||||
email: [{
|
||||
"pref": true,
|
||||
"type": ["work"],
|
||||
"value": "bob@gmail.com"
|
||||
}],
|
||||
tel: [{
|
||||
"pref": true,
|
||||
"type": ["mobile"],
|
||||
"value": "+1-214-5551234"
|
||||
}],
|
||||
category: ["local"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
}, {
|
||||
id: 3,
|
||||
_guid: 3,
|
||||
name: ["Caitlin Cantaloupe"],
|
||||
email: [{
|
||||
"pref": true,
|
||||
"type": ["work"],
|
||||
"value": "caitlin.cant@hotmail.com"
|
||||
}],
|
||||
category: ["local"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
}, {
|
||||
id: 4,
|
||||
_guid: 4,
|
||||
name: ["Dave Dragonfruit"],
|
||||
email: [{
|
||||
"pref": true,
|
||||
"type": ["work"],
|
||||
"value": "dd@dragons.net"
|
||||
}],
|
||||
category: ["google"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
}];
|
||||
var sandbox;
|
||||
var fakeWindow;
|
||||
var notifications;
|
||||
var listView;
|
||||
var oldMozLoop = navigator.mozLoop;
|
||||
|
||||
beforeEach(function() {
|
||||
sandbox = sinon.sandbox.create();
|
||||
|
@ -32,6 +94,27 @@ describe("loop.contacts", function() {
|
|||
}
|
||||
return JSON.stringify({textContent: textContentValue});
|
||||
},
|
||||
getLoopPref: function(pref) {
|
||||
if (pref == "contacts.gravatars.promo") {
|
||||
return true;
|
||||
} else if (pref == "contacts.gravatars.show") {
|
||||
return false;
|
||||
}
|
||||
return "";
|
||||
},
|
||||
setLoopPref: sandbox.stub(),
|
||||
getUserAvatar: function() {
|
||||
if (navigator.mozLoop.getLoopPref("contacts.gravatars.show")) {
|
||||
return "gravatarsEnabled";
|
||||
}
|
||||
return "gravatarsDisabled";
|
||||
},
|
||||
contacts: {
|
||||
getAll: function(callback) {
|
||||
callback(null, [].concat(fakeContacts));
|
||||
},
|
||||
on: sandbox.stub()
|
||||
}
|
||||
};
|
||||
|
||||
fakeWindow = {
|
||||
|
@ -39,18 +122,120 @@ describe("loop.contacts", function() {
|
|||
};
|
||||
loop.shared.mixins.setRootObject(fakeWindow);
|
||||
|
||||
notifications = new loop.shared.models.NotificationCollection();
|
||||
|
||||
document.mozL10n.initialize(navigator.mozLoop);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
listView = null;
|
||||
loop.shared.mixins.setRootObject(window);
|
||||
navigator.mozLoop = oldMozLoop;
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
describe("GravatarsPromo", function() {
|
||||
function checkGravatarContacts(enabled) {
|
||||
var node = listView.getDOMNode();
|
||||
|
||||
// When gravatars are enabled, contacts should be rendered with gravatars.
|
||||
var gravatars = node.querySelectorAll(".contact img[src=gravatarsEnabled]");
|
||||
expect(gravatars.length).to.equal(enabled ? fakeContacts.length : 0);
|
||||
// Sanity check the reverse:
|
||||
gravatars = node.querySelectorAll(".contact img[src=gravatarsDisabled]");
|
||||
expect(gravatars.length).to.equal(enabled ? 0 : fakeContacts.length);
|
||||
}
|
||||
|
||||
it("should show the gravatars promo box", function() {
|
||||
listView = TestUtils.renderIntoDocument(
|
||||
React.createElement(loop.contacts.ContactsList, {
|
||||
notifications: notifications
|
||||
}));
|
||||
|
||||
var promo = listView.getDOMNode().querySelector(".contacts-gravatar-promo");
|
||||
expect(promo).to.not.equal(null);
|
||||
|
||||
checkGravatarContacts(false);
|
||||
});
|
||||
|
||||
it("should not show the gravatars promo box when the 'contacts.gravatars.promo' pref is set", function() {
|
||||
navigator.mozLoop.getLoopPref = function(pref) {
|
||||
if (pref == "contacts.gravatars.promo") {
|
||||
return false;
|
||||
} else if (pref == "contacts.gravatars.show") {
|
||||
return true;
|
||||
}
|
||||
return "";
|
||||
};
|
||||
listView = TestUtils.renderIntoDocument(
|
||||
React.createElement(loop.contacts.ContactsList, {
|
||||
notifications: notifications
|
||||
}));
|
||||
|
||||
var promo = listView.getDOMNode().querySelector(".contacts-gravatar-promo");
|
||||
expect(promo).to.equal(null);
|
||||
|
||||
checkGravatarContacts(true);
|
||||
});
|
||||
|
||||
it("should hide the gravatars promo box when the 'use' button is clicked", function() {
|
||||
listView = TestUtils.renderIntoDocument(
|
||||
React.createElement(loop.contacts.ContactsList, {
|
||||
notifications: notifications
|
||||
}));
|
||||
|
||||
React.addons.TestUtils.Simulate.click(listView.getDOMNode().querySelector(
|
||||
".contacts-gravatar-promo .button-accept"));
|
||||
|
||||
sinon.assert.calledTwice(navigator.mozLoop.setLoopPref);
|
||||
|
||||
var promo = listView.getDOMNode().querySelector(".contacts-gravatar-promo");
|
||||
expect(promo).to.equal(null);
|
||||
});
|
||||
|
||||
it("should should set the prefs correctly when the 'use' button is clicked", function() {
|
||||
listView = TestUtils.renderIntoDocument(
|
||||
React.createElement(loop.contacts.ContactsList, {
|
||||
notifications: notifications
|
||||
}));
|
||||
|
||||
React.addons.TestUtils.Simulate.click(listView.getDOMNode().querySelector(
|
||||
".contacts-gravatar-promo .button-accept"));
|
||||
|
||||
sinon.assert.calledTwice(navigator.mozLoop.setLoopPref);
|
||||
sinon.assert.calledWithExactly(navigator.mozLoop.setLoopPref, "contacts.gravatars.promo", false);
|
||||
sinon.assert.calledWithExactly(navigator.mozLoop.setLoopPref, "contacts.gravatars.show", true);
|
||||
});
|
||||
|
||||
it("should hide the gravatars promo box when the 'close' button is clicked", function() {
|
||||
listView = TestUtils.renderIntoDocument(
|
||||
React.createElement(loop.contacts.ContactsList, {
|
||||
notifications: notifications
|
||||
}));
|
||||
|
||||
React.addons.TestUtils.Simulate.click(listView.getDOMNode().querySelector(
|
||||
".contacts-gravatar-promo .button-close"));
|
||||
|
||||
var promo = listView.getDOMNode().querySelector(".contacts-gravatar-promo");
|
||||
expect(promo).to.equal(null);
|
||||
});
|
||||
|
||||
it("should set prefs correctly when the 'close' button is clicked", function() {
|
||||
listView = TestUtils.renderIntoDocument(
|
||||
React.createElement(loop.contacts.ContactsList, {
|
||||
notifications: notifications
|
||||
}));
|
||||
|
||||
React.addons.TestUtils.Simulate.click(listView.getDOMNode().querySelector(
|
||||
".contacts-gravatar-promo .button-close"));
|
||||
|
||||
sinon.assert.calledOnce(navigator.mozLoop.setLoopPref);
|
||||
sinon.assert.calledWithExactly(navigator.mozLoop.setLoopPref,
|
||||
"contacts.gravatars.promo", false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("ContactsList", function () {
|
||||
var listView;
|
||||
|
||||
beforeEach(function() {
|
||||
navigator.mozLoop.calls = {
|
||||
startDirectCall: sandbox.stub(),
|
||||
|
@ -58,19 +243,12 @@ describe("loop.contacts", function() {
|
|||
};
|
||||
navigator.mozLoop.contacts = {getAll: sandbox.stub()};
|
||||
|
||||
notifications = new loop.shared.models.NotificationCollection();
|
||||
listView = TestUtils.renderIntoDocument(
|
||||
React.createElement(loop.contacts.ContactsList, {
|
||||
notifications: notifications
|
||||
}));
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
listView = null;
|
||||
delete navigator.mozLoop.calls;
|
||||
delete navigator.mozLoop.contacts;
|
||||
});
|
||||
|
||||
describe("#handleContactAction", function() {
|
||||
it("should call window.close when called with 'video-call' action",
|
||||
function() {
|
||||
|
|
|
@ -38,6 +38,8 @@ add_task(function* test_LoopUI_getters() {
|
|||
yield loadLoopPanel();
|
||||
Assert.ok(LoopUI.browser, "Browser element should be there");
|
||||
Assert.strictEqual(LoopUI.selectedTab, "rooms", "Initially the rooms tab should be selected");
|
||||
let panelTabs = LoopUI.browser.contentDocument.querySelectorAll(".tab-view > li");
|
||||
Assert.strictEqual(panelTabs.length, 1, "Only one tab, 'rooms', should be visible");
|
||||
|
||||
// Hide the panel.
|
||||
yield LoopUI.togglePanel();
|
||||
|
@ -48,6 +50,12 @@ add_task(function* test_LoopUI_getters() {
|
|||
MozLoopServiceInternal.fxAOAuthProfile = fxASampleProfile;
|
||||
yield MozLoopServiceInternal.notifyStatusChanged("login");
|
||||
|
||||
yield LoopUI.togglePanel();
|
||||
Assert.strictEqual(LoopUI.selectedTab, "rooms", "Rooms tab should still be selected");
|
||||
panelTabs = LoopUI.browser.contentDocument.querySelectorAll(".tab-view > li");
|
||||
Assert.strictEqual(panelTabs.length, 2, "Two tabs should be visible");
|
||||
yield LoopUI.togglePanel();
|
||||
|
||||
// Programmatically select the contacts tab.
|
||||
yield LoopUI.togglePanel(null, "contacts");
|
||||
Assert.strictEqual(LoopUI.selectedTab, "contacts", "Contacts tab should be selected now");
|
||||
|
|
|
@ -104,6 +104,31 @@ describe("loop.Dispatcher", function () {
|
|||
sinon.assert.calledOnce(getDataStore2.getWindowData);
|
||||
});
|
||||
|
||||
describe("Error handling", function() {
|
||||
beforeEach(function() {
|
||||
sandbox.stub(console, "error");
|
||||
});
|
||||
|
||||
it("should handle uncaught exceptions", function() {
|
||||
getDataStore1.getWindowData.throws("Uncaught Error");
|
||||
|
||||
dispatcher.dispatch(getDataAction);
|
||||
dispatcher.dispatch(cancelAction);
|
||||
|
||||
sinon.assert.calledOnce(getDataStore1.getWindowData);
|
||||
sinon.assert.calledOnce(getDataStore2.getWindowData);
|
||||
sinon.assert.calledOnce(cancelStore1.cancelCall);
|
||||
});
|
||||
|
||||
it("should log uncaught exceptions", function() {
|
||||
getDataStore1.getWindowData.throws("Uncaught Error");
|
||||
|
||||
dispatcher.dispatch(getDataAction);
|
||||
|
||||
sinon.assert.calledOnce(console.error);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Queued actions", function() {
|
||||
beforeEach(function() {
|
||||
// Restore the stub, so that we can easily add a function to be
|
||||
|
|
|
@ -43,6 +43,66 @@ var fakeRooms = [
|
|||
}
|
||||
];
|
||||
|
||||
var fakeContacts = [{
|
||||
id: 1,
|
||||
_guid: 1,
|
||||
name: ["Ally Avocado"],
|
||||
email: [{
|
||||
"pref": true,
|
||||
"type": ["work"],
|
||||
"value": "ally@mail.com"
|
||||
}],
|
||||
tel: [{
|
||||
"pref": true,
|
||||
"type": ["mobile"],
|
||||
"value": "+31-6-12345678"
|
||||
}],
|
||||
category: ["google"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
},{
|
||||
id: 2,
|
||||
_guid: 2,
|
||||
name: ["Bob Banana"],
|
||||
email: [{
|
||||
"pref": true,
|
||||
"type": ["work"],
|
||||
"value": "bob@gmail.com"
|
||||
}],
|
||||
tel: [{
|
||||
"pref": true,
|
||||
"type": ["mobile"],
|
||||
"value": "+1-214-5551234"
|
||||
}],
|
||||
category: ["local"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
}, {
|
||||
id: 3,
|
||||
_guid: 3,
|
||||
name: ["Caitlin Cantaloupe"],
|
||||
email: [{
|
||||
"pref": true,
|
||||
"type": ["work"],
|
||||
"value": "caitlin.cant@hotmail.com"
|
||||
}],
|
||||
category: ["local"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
}, {
|
||||
id: 4,
|
||||
_guid: 4,
|
||||
name: ["Dave Dragonfruit"],
|
||||
email: [{
|
||||
"pref": true,
|
||||
"type": ["work"],
|
||||
"value": "dd@dragons.net"
|
||||
}],
|
||||
category: ["google"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
}];
|
||||
|
||||
/**
|
||||
* Faking the mozLoop object which doesn't exist in regular web pages.
|
||||
* @type {Object}
|
||||
|
@ -54,21 +114,28 @@ navigator.mozLoop = {
|
|||
switch(pref) {
|
||||
// Ensure we skip FTE completely.
|
||||
case "gettingStarted.seen":
|
||||
case "contacts.gravatars.promo":
|
||||
return true;
|
||||
case "contacts.gravatars.show":
|
||||
return false;
|
||||
}
|
||||
},
|
||||
setLoopPref: function(){},
|
||||
releaseCallData: function() {},
|
||||
copyString: function() {},
|
||||
getUserAvatar: function(emailAddress) {
|
||||
return "http://www.gravatar.com/avatar/" + (Math.ceil(Math.random() * 3) === 2 ?
|
||||
"0a996f0fe2727ef1668bdb11897e4459" : "foo") + ".jpg?default=blank&s=40";
|
||||
},
|
||||
contacts: {
|
||||
getAll: function(callback) {
|
||||
callback(null, []);
|
||||
callback(null, [].concat(fakeContacts));
|
||||
},
|
||||
on: function() {}
|
||||
},
|
||||
rooms: {
|
||||
getAll: function(version, callback) {
|
||||
callback(null, fakeRooms);
|
||||
callback(null, [].concat(fakeRooms));
|
||||
},
|
||||
on: function() {}
|
||||
},
|
||||
|
|
|
@ -10,11 +10,22 @@ function checkRLState() {
|
|||
let sidebarBroadcaster = document.getElementById("readingListSidebar");
|
||||
let sidebarMenuitem = document.getElementById("menu_readingListSidebar");
|
||||
|
||||
let bookmarksMenubarItem = document.getElementById("menu_readingList");
|
||||
let bookmarksMenubarSeparator = document.getElementById("menu_readingListSeparator");
|
||||
|
||||
if (enabled) {
|
||||
Assert.notEqual(sidebarBroadcaster.getAttribute("hidden"), "true",
|
||||
"Sidebar broadcaster should not be hidden");
|
||||
Assert.notEqual(sidebarMenuitem.getAttribute("hidden"), "true",
|
||||
"Sidebar menuitem should be visible");
|
||||
|
||||
// Currently disabled on OSX.
|
||||
if (bookmarksMenubarItem) {
|
||||
Assert.notEqual(bookmarksMenubarItem.getAttribute("hidden"), "true",
|
||||
"RL bookmarks submenu in menubar should not be hidden");
|
||||
Assert.notEqual(sidebarMenuitem.getAttribute("hidden"), "true",
|
||||
"RL bookmarks separator in menubar should be visible");
|
||||
}
|
||||
} else {
|
||||
Assert.equal(sidebarBroadcaster.getAttribute("hidden"), "true",
|
||||
"Sidebar broadcaster should be hidden");
|
||||
|
@ -22,6 +33,14 @@ function checkRLState() {
|
|||
"Sidebar menuitem should be hidden");
|
||||
Assert.equal(ReadingListUI.isSidebarOpen, false,
|
||||
"ReadingListUI should not think sidebar is open");
|
||||
|
||||
// Currently disabled on OSX.
|
||||
if (bookmarksMenubarItem) {
|
||||
Assert.equal(bookmarksMenubarItem.getAttribute("hidden"), "true",
|
||||
"RL bookmarks submenu in menubar should not be hidden");
|
||||
Assert.equal(sidebarMenuitem.getAttribute("hidden"), "true",
|
||||
"RL bookmarks separator in menubar should be visible");
|
||||
}
|
||||
}
|
||||
|
||||
if (!enabled) {
|
||||
|
|
|
@ -100,6 +100,7 @@ skip-if = e10s # Bug 1091612
|
|||
[browser_net_sort-01.js]
|
||||
[browser_net_sort-02.js]
|
||||
[browser_net_sort-03.js]
|
||||
skip-if = (os == 'linux' && e10s && !debug) # bug 1137694
|
||||
[browser_net_statistics-01.js]
|
||||
[browser_net_statistics-02.js]
|
||||
[browser_net_statistics-03.js]
|
||||
|
|
|
@ -266,7 +266,10 @@ function mousedown (win, button) {
|
|||
EventUtils.sendMouseEvent({ type: "mousedown" }, button, win);
|
||||
}
|
||||
|
||||
function* startRecording(panel, options={}) {
|
||||
function* startRecording(panel, options = {
|
||||
waitForOverview: true,
|
||||
waitForStateChanged: true
|
||||
}) {
|
||||
let win = panel.panelWin;
|
||||
let clicked = panel.panelWin.PerformanceView.once(win.EVENTS.UI_START_RECORDING);
|
||||
let willStart = panel.panelWin.PerformanceController.once(win.EVENTS.RECORDING_WILL_START);
|
||||
|
@ -287,10 +290,14 @@ function* startRecording(panel, options={}) {
|
|||
"The record button should be locked.");
|
||||
|
||||
yield willStart;
|
||||
let stateChanged = once(win.PerformanceView, win.EVENTS.UI_STATE_CHANGED);
|
||||
let stateChanged = options.waitForStateChanged
|
||||
? once(win.PerformanceView, win.EVENTS.UI_STATE_CHANGED)
|
||||
: Promise.resolve();
|
||||
|
||||
yield hasStarted;
|
||||
let overviewRendered = options.waitForOverview ? once(win.OverviewView, win.EVENTS.OVERVIEW_RENDERED) : Promise.resolve();
|
||||
let overviewRendered = options.waitForOverview
|
||||
? once(win.OverviewView, win.EVENTS.OVERVIEW_RENDERED)
|
||||
: Promise.resolve();
|
||||
|
||||
yield stateChanged;
|
||||
yield overviewRendered;
|
||||
|
@ -304,7 +311,10 @@ function* startRecording(panel, options={}) {
|
|||
"The record button should not be locked.");
|
||||
}
|
||||
|
||||
function* stopRecording(panel, options={}) {
|
||||
function* stopRecording(panel, options = {
|
||||
waitForOverview: true,
|
||||
waitForStateChanged: true
|
||||
}) {
|
||||
let win = panel.panelWin;
|
||||
let clicked = panel.panelWin.PerformanceView.once(win.EVENTS.UI_STOP_RECORDING);
|
||||
let willStop = panel.panelWin.PerformanceController.once(win.EVENTS.RECORDING_WILL_STOP);
|
||||
|
@ -325,10 +335,14 @@ function* stopRecording(panel, options={}) {
|
|||
"The record button should be locked.");
|
||||
|
||||
yield willStop;
|
||||
let stateChanged = once(win.PerformanceView, win.EVENTS.UI_STATE_CHANGED);
|
||||
let stateChanged = options.waitForStateChanged
|
||||
? once(win.PerformanceView, win.EVENTS.UI_STATE_CHANGED)
|
||||
: Promise.resolve();
|
||||
|
||||
yield hasStopped;
|
||||
let overviewRendered = options.waitForOverview ? once(win.OverviewView, win.EVENTS.OVERVIEW_RENDERED) : Promise.resolve();
|
||||
let overviewRendered = options.waitForOverview
|
||||
? once(win.OverviewView, win.EVENTS.OVERVIEW_RENDERED)
|
||||
: Promise.resolve();
|
||||
|
||||
yield stateChanged;
|
||||
yield overviewRendered;
|
||||
|
|
|
@ -34,11 +34,13 @@ let JsFlameGraphView = Heritage.extend(DetailsSubview, {
|
|||
/**
|
||||
* Unbinds events.
|
||||
*/
|
||||
destroy: function () {
|
||||
destroy: Task.async(function* () {
|
||||
DetailsSubview.destroy.call(this);
|
||||
|
||||
this.graph.off("selecting", this._onRangeChangeInGraph);
|
||||
},
|
||||
|
||||
yield this.graph.destroy();
|
||||
}),
|
||||
|
||||
/**
|
||||
* Method for handling all the set up for rendering a new flamegraph.
|
||||
|
|
|
@ -33,11 +33,13 @@ let MemoryFlameGraphView = Heritage.extend(DetailsSubview, {
|
|||
/**
|
||||
* Unbinds events.
|
||||
*/
|
||||
destroy: function () {
|
||||
destroy: Task.async(function* () {
|
||||
DetailsSubview.destroy.call(this);
|
||||
|
||||
this.graph.off("selecting", this._onRangeChangeInGraph);
|
||||
},
|
||||
|
||||
yield this.graph.destroy();
|
||||
}),
|
||||
|
||||
/**
|
||||
* Method for handling all the set up for rendering a new flamegraph.
|
||||
|
|
|
@ -54,15 +54,15 @@ let OverviewView = {
|
|||
/**
|
||||
* Unbinds events.
|
||||
*/
|
||||
destroy: function () {
|
||||
destroy: Task.async(function*() {
|
||||
if (this.markersOverview) {
|
||||
this.markersOverview.destroy();
|
||||
yield this.markersOverview.destroy();
|
||||
}
|
||||
if (this.memoryOverview) {
|
||||
this.memoryOverview.destroy();
|
||||
yield this.memoryOverview.destroy();
|
||||
}
|
||||
if (this.framerateGraph) {
|
||||
this.framerateGraph.destroy();
|
||||
yield this.framerateGraph.destroy();
|
||||
}
|
||||
|
||||
PerformanceController.off(EVENTS.PREF_CHANGED, this._onPrefChanged);
|
||||
|
@ -71,7 +71,7 @@ let OverviewView = {
|
|||
PerformanceController.off(EVENTS.RECORDING_WILL_STOP, this._onRecordingWillStop);
|
||||
PerformanceController.off(EVENTS.RECORDING_STOPPED, this._onRecordingStopped);
|
||||
PerformanceController.off(EVENTS.RECORDING_SELECTED, this._onRecordingSelected);
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* Disabled in the event we're using a Timeline mock, so we'll have no
|
||||
|
|
|
@ -26,7 +26,7 @@ function* performTest() {
|
|||
|
||||
testGraph(host, graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ function* performTest() {
|
|||
yield graph.ready();
|
||||
testGraph(host, graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ function* performTest() {
|
|||
|
||||
testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ function* performTest() {
|
|||
|
||||
testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ function* performTest() {
|
|||
|
||||
testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ function* performTest() {
|
|||
|
||||
testGraph(host, graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ function* performTest() {
|
|||
testDataAndRegions(graph);
|
||||
testHighlights(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ function* performTest() {
|
|||
yield testSelection(graph);
|
||||
yield testCursor(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ function* performTest() {
|
|||
|
||||
testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ function* performTest() {
|
|||
|
||||
testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ function* performTest() {
|
|||
|
||||
testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ function* performTest() {
|
|||
|
||||
testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ function* performTest() {
|
|||
|
||||
testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ function* performTest() {
|
|||
|
||||
testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ function* performTest() {
|
|||
|
||||
yield testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ function* performTest() {
|
|||
|
||||
yield testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ function* performTest() {
|
|||
|
||||
yield testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ function* performTest() {
|
|||
|
||||
yield testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ function* performTest() {
|
|||
|
||||
yield testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,5 +48,5 @@ function* testGraph (parent, options) {
|
|||
is(graph._avgGutterLine.hidden, options.avg === false,
|
||||
`The avg gutter should ${options.avg === false ? "not " : ""}be shown`);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ function* performTest() {
|
|||
|
||||
is(refreshCount, 2, "The graph should've been refreshed 2 times.");
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ function* performTest() {
|
|||
is(refreshCount, 0, "The graph shouldn't have been refreshed at all.");
|
||||
is(refreshCancelledCount, 2, "The graph should've had 2 refresh attempts.");
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ function* performTest() {
|
|||
|
||||
testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ function* performTest() {
|
|||
yield graph.once("ready");
|
||||
yield testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ function* performTest() {
|
|||
|
||||
testGraphs(graph1, graph2);
|
||||
|
||||
graph1.destroy();
|
||||
graph2.destroy();
|
||||
yield graph1.destroy();
|
||||
yield graph2.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ function* performTest() {
|
|||
yield graph.ready();
|
||||
testGraph(host, graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ function* performTest() {
|
|||
|
||||
yield testGraph(graph);
|
||||
|
||||
graph.destroy();
|
||||
yield graph.destroy();
|
||||
host.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ const OVERVIEW_ROW_HEIGHT = 11; // px
|
|||
const OVERVIEW_SELECTION_LINE_COLOR = "#666";
|
||||
const OVERVIEW_CLIPHEAD_LINE_COLOR = "#555";
|
||||
|
||||
const FIND_OPTIMAL_TICK_INTERVAL_MAX_ITERS = 100;
|
||||
const OVERVIEW_HEADER_TICKS_MULTIPLE = 100; // ms
|
||||
const OVERVIEW_HEADER_TICKS_SPACING_MIN = 75; // px
|
||||
const OVERVIEW_HEADER_TEXT_FONT_SIZE = 9; // px
|
||||
|
@ -199,9 +200,18 @@ MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
|
|||
_findOptimalTickInterval: function(dataScale) {
|
||||
let timingStep = OVERVIEW_HEADER_TICKS_MULTIPLE;
|
||||
let spacingMin = OVERVIEW_HEADER_TICKS_SPACING_MIN * this._pixelRatio;
|
||||
let maxIters = FIND_OPTIMAL_TICK_INTERVAL_MAX_ITERS;
|
||||
let numIters = 0;
|
||||
|
||||
if (dataScale > spacingMin) {
|
||||
return dataScale;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
let scaledStep = dataScale * timingStep;
|
||||
if (++numIters > maxIters) {
|
||||
return scaledStep;
|
||||
}
|
||||
if (scaledStep < spacingMin) {
|
||||
timingStep <<= 1;
|
||||
continue;
|
||||
|
|
|
@ -27,6 +27,7 @@ const WATERFALL_SIDEBAR_WIDTH = 150; // px
|
|||
const WATERFALL_IMMEDIATE_DRAW_MARKERS_COUNT = 30;
|
||||
const WATERFALL_FLUSH_OUTSTANDING_MARKERS_DELAY = 75; // ms
|
||||
|
||||
const FIND_OPTIMAL_TICK_INTERVAL_MAX_ITERS = 100;
|
||||
const WATERFALL_HEADER_TICKS_MULTIPLE = 5; // ms
|
||||
const WATERFALL_HEADER_TICKS_SPACING_MIN = 50; // px
|
||||
const WATERFALL_HEADER_TEXT_PADDING = 3; // px
|
||||
|
@ -575,9 +576,18 @@ Waterfall.prototype = {
|
|||
*/
|
||||
_findOptimalTickInterval: function({ ticksMultiple, ticksSpacingMin, dataScale }) {
|
||||
let timingStep = ticksMultiple;
|
||||
let maxIters = FIND_OPTIMAL_TICK_INTERVAL_MAX_ITERS;
|
||||
let numIters = 0;
|
||||
|
||||
if (dataScale > ticksSpacingMin) {
|
||||
return dataScale;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
let scaledStep = dataScale * timingStep;
|
||||
if (++numIters > maxIters) {
|
||||
return scaledStep;
|
||||
}
|
||||
if (scaledStep < ticksSpacingMin) {
|
||||
timingStep <<= 1;
|
||||
continue;
|
||||
|
|
|
@ -26,6 +26,7 @@ const GRAPH_WHEEL_ZOOM_SENSITIVITY = 0.00035;
|
|||
const GRAPH_WHEEL_SCROLL_SENSITIVITY = 0.5;
|
||||
const GRAPH_MIN_SELECTION_WIDTH = 0.001; // ms
|
||||
|
||||
const FIND_OPTIMAL_TICK_INTERVAL_MAX_ITERS = 100;
|
||||
const TIMELINE_TICKS_MULTIPLE = 5; // ms
|
||||
const TIMELINE_TICKS_SPACING_MIN = 75; // px
|
||||
|
||||
|
@ -180,7 +181,9 @@ FlameGraph.prototype = {
|
|||
/**
|
||||
* Destroys this graph.
|
||||
*/
|
||||
destroy: function() {
|
||||
destroy: Task.async(function*() {
|
||||
yield this.ready();
|
||||
|
||||
this._window.removeEventListener("mousemove", this._onMouseMove);
|
||||
this._window.removeEventListener("mousedown", this._onMouseDown);
|
||||
this._window.removeEventListener("mouseup", this._onMouseUp);
|
||||
|
@ -200,7 +203,7 @@ FlameGraph.prototype = {
|
|||
this._data = null;
|
||||
|
||||
this.emit("destroyed");
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* Rendering options. Subclasses should override these.
|
||||
|
@ -789,12 +792,17 @@ FlameGraph.prototype = {
|
|||
_findOptimalTickInterval: function(dataScale) {
|
||||
let timingStep = TIMELINE_TICKS_MULTIPLE;
|
||||
let spacingMin = TIMELINE_TICKS_SPACING_MIN * this._pixelRatio;
|
||||
let maxIters = FIND_OPTIMAL_TICK_INTERVAL_MAX_ITERS;
|
||||
let numIters = 0;
|
||||
|
||||
if (dataScale > spacingMin) {
|
||||
return dataScale;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (++numIters > maxIters) {
|
||||
return scaledStep;
|
||||
}
|
||||
let scaledStep = dataScale * timingStep;
|
||||
if (scaledStep < spacingMin) {
|
||||
timingStep <<= 1;
|
||||
|
|
|
@ -229,7 +229,9 @@ AbstractCanvasGraph.prototype = {
|
|||
/**
|
||||
* Destroys this graph.
|
||||
*/
|
||||
destroy: function() {
|
||||
destroy: Task.async(function *() {
|
||||
yield this.ready();
|
||||
|
||||
this._window.removeEventListener("mousemove", this._onMouseMove);
|
||||
this._window.removeEventListener("mousedown", this._onMouseDown);
|
||||
this._window.removeEventListener("mouseup", this._onMouseUp);
|
||||
|
@ -259,7 +261,7 @@ AbstractCanvasGraph.prototype = {
|
|||
gCachedStripePattern.clear();
|
||||
|
||||
this.emit("destroyed");
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* Rendering options. Subclasses should override these.
|
||||
|
|
|
@ -9,6 +9,9 @@ const TEST_COLOR = "#123ABC";
|
|||
const COLOR_SELECTOR = "span[data-color]";
|
||||
|
||||
add_task(function* () {
|
||||
// Test is slow on Linux EC2 instances - Bug 1137765
|
||||
requestLongerTimeout(2);
|
||||
|
||||
const TEST_DOC = '<html> \
|
||||
<body> \
|
||||
<div style="color: ' + TEST_COLOR + '; \
|
||||
|
|
|
@ -387,9 +387,7 @@ PreviewController.prototype = {
|
|||
this.onTabPaint(r);
|
||||
}
|
||||
}
|
||||
let preview = this.preview;
|
||||
if (preview.visible)
|
||||
preview.invalidate();
|
||||
this.preview.invalidate();
|
||||
break;
|
||||
case "TabAttrModified":
|
||||
this.updateTitleAndTooltip();
|
||||
|
|
|
@ -85,8 +85,7 @@ body {
|
|||
}
|
||||
|
||||
@media (min-resolution: 2dppx) {
|
||||
#element-picker::before,
|
||||
#toggle-all::before {
|
||||
#element-picker::before {
|
||||
background-image: url("chrome://browser/skin/devtools/command-pick@2x.png");
|
||||
background-size: 64px;
|
||||
}
|
||||
|
|
|
@ -280,7 +280,6 @@ WindowNamedPropertiesHandler::Create(JSContext* aCx,
|
|||
options.setClass(&WindowNamedPropertiesClass.mBase);
|
||||
return js::NewProxyObject(aCx, WindowNamedPropertiesHandler::getInstance(),
|
||||
JS::NullHandleValue, aProto,
|
||||
js::GetGlobalForObjectCrossCompartment(aProto),
|
||||
options);
|
||||
}
|
||||
|
||||
|
|
|
@ -2379,31 +2379,6 @@ nsDOMWindowUtils::IsInModalState(bool *retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetParent(JS::Handle<JS::Value> aObject,
|
||||
JSContext* aCx,
|
||||
JS::MutableHandle<JS::Value> aParent)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
// First argument must be an object.
|
||||
if (aObject.isPrimitive()) {
|
||||
return NS_ERROR_XPC_BAD_CONVERT_JS;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> parent(aCx, JS_GetParent(&aObject.toObject()));
|
||||
|
||||
// Outerize if necessary.
|
||||
if (parent) {
|
||||
if (js::ObjectOp outerize = js::GetObjectClass(parent)->ext.outerObject) {
|
||||
parent = outerize(aCx, parent);
|
||||
}
|
||||
}
|
||||
|
||||
aParent.setObject(*parent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetOuterWindowID(uint64_t *aWindowID)
|
||||
{
|
||||
|
|
|
@ -1057,13 +1057,15 @@ const nsChromeOuterWindowProxy
|
|||
nsChromeOuterWindowProxy::singleton;
|
||||
|
||||
static JSObject*
|
||||
NewOuterWindowProxy(JSContext *cx, JS::Handle<JSObject*> parent, bool isChrome)
|
||||
NewOuterWindowProxy(JSContext *cx, JS::Handle<JSObject*> global, bool isChrome)
|
||||
{
|
||||
JSAutoCompartment ac(cx, parent);
|
||||
JSAutoCompartment ac(cx, global);
|
||||
MOZ_ASSERT(js::GetGlobalForObjectCrossCompartment(global) == global);
|
||||
|
||||
js::WrapperOptions options;
|
||||
options.setClass(&OuterWindowProxyClass);
|
||||
options.setSingleton(true);
|
||||
JSObject *obj = js::Wrapper::New(cx, parent, parent,
|
||||
JSObject *obj = js::Wrapper::New(cx, global,
|
||||
isChrome ? &nsChromeOuterWindowProxy::singleton
|
||||
: &nsOuterWindowProxy::singleton,
|
||||
options);
|
||||
|
@ -2597,21 +2599,10 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
|||
|
||||
SetWrapper(outerObject);
|
||||
|
||||
{
|
||||
JSAutoCompartment ac(cx, outerObject);
|
||||
MOZ_ASSERT(js::GetObjectParent(outerObject) == newInnerGlobal);
|
||||
|
||||
JS_SetParent(cx, outerObject, newInnerGlobal);
|
||||
|
||||
// Inform the nsJSContext, which is the canonical holder of the outer.
|
||||
mContext->SetWindowProxy(outerObject);
|
||||
|
||||
NS_ASSERTION(!JS_IsExceptionPending(cx),
|
||||
"We might overwrite a pending exception!");
|
||||
XPCWrappedNativeScope* scope = xpc::ObjectScope(outerObject);
|
||||
if (scope->mWaiverWrapperMap) {
|
||||
scope->mWaiverWrapperMap->Reparent(cx, newInnerGlobal);
|
||||
}
|
||||
}
|
||||
// Inform the nsJSContext, which is the canonical holder of the outer.
|
||||
mContext->SetWindowProxy(outerObject);
|
||||
}
|
||||
|
||||
// Enter the new global's compartment.
|
||||
|
@ -9188,7 +9179,7 @@ nsGlobalWindow::ShowModalDialog(const nsAString& aUrl, nsIVariant* aArgument,
|
|||
(aUrl, aArgument, aOptions, aError), aError,
|
||||
nullptr);
|
||||
|
||||
if (!IsShowModalDialogEnabled()) {
|
||||
if (!IsShowModalDialogEnabled() || XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
aError.Throw(NS_ERROR_NOT_AVAILABLE);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -407,7 +407,7 @@ InterfaceObjectToString(JSContext* cx, unsigned argc, JS::Value *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
if (!args.thisv().isObject()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr,
|
||||
JSMSG_CANT_CONVERT_TO, "null", "object");
|
||||
return false;
|
||||
}
|
||||
|
@ -1813,7 +1813,7 @@ ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> newobj(aCx, JS_CloneObject(aCx, aObj, proto, newParent));
|
||||
JS::Rooted<JSObject*> newobj(aCx, JS_CloneObject(aCx, aObj, proto));
|
||||
if (!newobj) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -2802,7 +2802,7 @@ public:
|
|||
options.setClass(aClass);
|
||||
JS::Rooted<JS::Value> proxyPrivateVal(aCx, JS::PrivateValue(aNative));
|
||||
aReflector.set(js::NewProxyObject(aCx, aHandler, proxyPrivateVal, aProto,
|
||||
/* parent= */nullptr, options));
|
||||
options));
|
||||
if (aReflector) {
|
||||
mNative = aNative;
|
||||
mReflector = aReflector;
|
||||
|
|
|
@ -202,7 +202,7 @@ DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::
|
|||
return JS_ReportErrorFlagsAndNumber(cx,
|
||||
JSREPORT_WARNING | JSREPORT_STRICT |
|
||||
JSREPORT_STRICT_MODE_ERROR,
|
||||
js_GetErrorMessage, nullptr,
|
||||
js::GetErrorMessage, nullptr,
|
||||
JSMSG_GETTER_ONLY);
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::
|
|||
}
|
||||
|
||||
bool dummy;
|
||||
return js_DefineOwnProperty(cx, expando, id, desc, &dummy);
|
||||
return js::DefineOwnProperty(cx, expando, id, desc, &dummy);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -223,7 +223,7 @@ StructuredCloneWriteCallback(JSContext* aCx,
|
|||
|
||||
if (JS_GetClass(aObj) == IDBObjectStore::DummyPropClass()) {
|
||||
MOZ_ASSERT(!cloneWriteInfo->mOffsetToKeyProp);
|
||||
cloneWriteInfo->mOffsetToKeyProp = js_GetSCOffset(aWriter);
|
||||
cloneWriteInfo->mOffsetToKeyProp = js::GetSCOffset(aWriter);
|
||||
|
||||
uint64_t value = 0;
|
||||
// Omit endian swap
|
||||
|
|
|
@ -50,7 +50,7 @@ interface nsITranslationNodeList;
|
|||
interface nsIJSRAIIHelper;
|
||||
interface nsIContentPermissionRequest;
|
||||
|
||||
[scriptable, uuid(d0461871-31bd-4da1-b22d-24595c27295c)]
|
||||
[scriptable, uuid(6eaf87a1-b252-4c4e-a2fc-318120680335)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
|
@ -1247,14 +1247,6 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
in AString aPseudoElement,
|
||||
in AString aPropertyName);
|
||||
|
||||
/**
|
||||
* Returns the parent of obj.
|
||||
*
|
||||
* @param obj The JavaScript object whose parent is to be gotten.
|
||||
* @return the parent.
|
||||
*/
|
||||
[implicit_jscontext] jsval getParent(in jsval obj);
|
||||
|
||||
/**
|
||||
* Get the id of the outer window of this window. This will never throw.
|
||||
*/
|
||||
|
|
|
@ -196,8 +196,10 @@ SharedDecoderProxy::Drain()
|
|||
{
|
||||
if (mManager->mActiveProxy == this) {
|
||||
return mManager->mDecoder->Drain();
|
||||
} else {
|
||||
mCallback->DrainComplete();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -234,6 +234,10 @@ WMFVideoMFTManager::Init()
|
|||
HRESULT
|
||||
WMFVideoMFTManager::Input(mp4_demuxer::MP4Sample* aSample)
|
||||
{
|
||||
if (!mDecoder) {
|
||||
// This can happen during shutdown.
|
||||
return E_FAIL;
|
||||
}
|
||||
if (mStreamType != VP8 && mStreamType != VP9) {
|
||||
// We must prepare samples in AVC Annex B.
|
||||
if (!mp4_demuxer::AnnexB::ConvertSampleToAnnexB(aSample)) {
|
||||
|
|
|
@ -1008,7 +1008,7 @@ TrackBuffer::RangeRemoval(int64_t aStart, int64_t aEnd)
|
|||
for (size_t i = 0; i < decoders.Length(); ++i) {
|
||||
nsRefPtr<dom::TimeRanges> buffered = new dom::TimeRanges();
|
||||
decoders[i]->GetBuffered(buffered);
|
||||
if (buffered->GetEndTime() < aEnd) {
|
||||
if (int64_t(buffered->GetEndTime() * USECS_PER_S) < aEnd) {
|
||||
// Can be fully removed.
|
||||
MSE_DEBUG("remove all bufferedEnd=%f time=%f, size=%lld",
|
||||
buffered->GetEndTime(), time,
|
||||
|
@ -1027,7 +1027,7 @@ TrackBuffer::RangeRemoval(int64_t aStart, int64_t aEnd)
|
|||
} else {
|
||||
// Only trimming existing buffers.
|
||||
for (size_t i = 0; i < decoders.Length(); ++i) {
|
||||
if (aStart <= buffered->GetStartTime()) {
|
||||
if (aStart <= int64_t(buffered->GetStartTime() * USECS_PER_S)) {
|
||||
// It will be entirely emptied, can clear all data.
|
||||
decoders[i]->GetResource()->EvictAll();
|
||||
} else {
|
||||
|
|
|
@ -1724,7 +1724,7 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::
|
|||
return true;
|
||||
}
|
||||
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
|
||||
JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
|
||||
JS_GetClass(obj)->name,
|
||||
hint == JSTYPE_VOID
|
||||
? "primitive type"
|
||||
|
|
|
@ -800,7 +800,7 @@ JSObject *GetOrCreateObjectProperty(JSContext *cx, JS::Handle<JSObject*> aObject
|
|||
return &val.toObject();
|
||||
}
|
||||
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr,
|
||||
JSMSG_UNEXPECTED_TYPE, aProperty, "not an object");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ bool DefineOSFileConstants(JSContext *cx, JS::Handle<JSObject*> global)
|
|||
// |gInitialized == true| but |gPaths == nullptr|. We cannot
|
||||
// |MOZ_ASSERT| this, as this would kill precompile_cache.js,
|
||||
// so we simply return an error.
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr,
|
||||
JSMSG_CANT_OPEN, "OSFileConstants", "initialization has failed");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop spec
|
|||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
|
||||
[test_bug653364.html]
|
||||
[test_bug861217.html]
|
||||
[test_bug1077002.html]
|
||||
run-if = e10s
|
||||
[test_clientRects.html]
|
||||
[test_clipboard_events.html]
|
||||
skip-if = e10s || buildapp == 'b2g' # b2g(clipboard undefined) b2g-debug(clipboard undefined) b2g-desktop(clipboard undefined)
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1077002
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1077002</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1077002">Mozilla Bug 1077002</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<iframe id="frame" style="height:100px; width:100px; border:0"></iframe>
|
||||
<div id="status" style="display: none"></div>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7">
|
||||
|
||||
/** Test for Bug 1077002 **/
|
||||
|
||||
try {
|
||||
// NB: This test runs in e10s only. In e10s showModalDialog should only
|
||||
// ever throw NS_ERROR_NOT_AVAILABLE.
|
||||
window.showModalDialog("http://example.org");
|
||||
} catch (e) {
|
||||
is(e.name, "NS_ERROR_NOT_AVAILABLE", "throw the correct error message");
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -457,7 +457,7 @@ ServiceWorkerGlobalScope::Clients()
|
|||
bool
|
||||
GetterOnlyJSNative(JSContext* aCx, unsigned aArgc, JS::Value* aVp)
|
||||
{
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, nullptr, JSMSG_GETTER_ONLY);
|
||||
JS_ReportErrorNumber(aCx, js::GetErrorMessage, nullptr, JSMSG_GETTER_ONLY);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class Logging
|
|||
obj = shared->objects_.find(id);
|
||||
if (obj) {
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
objDesc = js_ObjectClassName(cx, obj);
|
||||
objDesc = js::ObjectClassName(cx, obj);
|
||||
} else {
|
||||
objDesc = "<dead object>";
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ WrapperAnswer::RecvDefineProperty(const ObjectId &objId, const JSIDVariant &idVa
|
|||
return fail(cx, rs);
|
||||
|
||||
bool ignored;
|
||||
if (!js_DefineOwnProperty(cx, obj, id, desc, &ignored))
|
||||
if (!js::DefineOwnProperty(cx, obj, id, desc, &ignored))
|
||||
return fail(cx, rs);
|
||||
|
||||
return ok(rs);
|
||||
|
@ -513,7 +513,7 @@ WrapperAnswer::RecvObjectClassIs(const ObjectId &objId, const uint32_t &classVal
|
|||
|
||||
LOG("%s.objectClassIs()", ReceiverObj(objId));
|
||||
|
||||
*result = js_ObjectClassIs(cx, obj, (js::ESClassValue)classValue);
|
||||
*result = js::ObjectClassIs(cx, obj, (js::ESClassValue)classValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -533,7 +533,7 @@ WrapperAnswer::RecvClassName(const ObjectId &objId, nsString *name)
|
|||
|
||||
LOG("%s.className()", ReceiverObj(objId));
|
||||
|
||||
*name = NS_ConvertASCIItoUTF16(js_ObjectClassName(cx, obj));
|
||||
*name = NS_ConvertASCIItoUTF16(js::ObjectClassName(cx, obj));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1020,7 +1020,6 @@ WrapperOwner::fromRemoteObjectVariant(JSContext *cx, RemoteObject objVar)
|
|||
&CPOWProxyHandler::singleton,
|
||||
v,
|
||||
nullptr,
|
||||
junkScope,
|
||||
options);
|
||||
if (!obj)
|
||||
return nullptr;
|
||||
|
|
|
@ -581,7 +581,7 @@ class MOZ_STACK_CLASS ProxyOptions {
|
|||
|
||||
JS_FRIEND_API(JSObject *)
|
||||
NewProxyObject(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv,
|
||||
JSObject *proto, JSObject *parent, const ProxyOptions &options = ProxyOptions());
|
||||
JSObject *proto, const ProxyOptions &options = ProxyOptions());
|
||||
|
||||
JSObject *
|
||||
RenewProxyObject(JSContext *cx, JSObject *obj, BaseProxyHandler *handler, Value priv);
|
||||
|
@ -674,9 +674,9 @@ inline void assertEnteredPolicy(JSContext *cx, JSObject *obj, jsid id,
|
|||
{}
|
||||
#endif
|
||||
|
||||
extern JS_FRIEND_API(JSObject *)
|
||||
InitProxyClass(JSContext *cx, JS::HandleObject obj);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
extern JS_FRIEND_API(JSObject *)
|
||||
js_InitProxyClass(JSContext *cx, JS::HandleObject obj);
|
||||
|
||||
#endif /* js_Proxy_h */
|
||||
|
|
|
@ -73,7 +73,7 @@ CloneModule(JSContext *cx, MutableHandle<AsmJSModuleObject*> moduleObj)
|
|||
static bool
|
||||
LinkFail(JSContext *cx, const char *str)
|
||||
{
|
||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, js_GetErrorMessage,
|
||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, GetErrorMessage,
|
||||
nullptr, JSMSG_USE_ASM_LINK_FAIL, str);
|
||||
return false;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ ValidateByteLength(JSContext *cx, HandleValue globalVal)
|
|||
RootedFunction fun(cx, &v.toObject().as<JSFunction>());
|
||||
|
||||
RootedValue boundTarget(cx, ObjectValue(*fun->getBoundFunctionTarget()));
|
||||
if (!IsNativeFunction(boundTarget, js_fun_call))
|
||||
if (!IsNativeFunction(boundTarget, fun_call))
|
||||
return LinkFail(cx, "bound target of byteLength must be Function.prototype.call");
|
||||
|
||||
RootedValue boundThis(cx, fun->getBoundFunctionThis());
|
||||
|
@ -736,7 +736,7 @@ CallAsmJS(JSContext *cx, unsigned argc, Value *vp)
|
|||
// since these can technically pop out anywhere and the full fix may
|
||||
// actually OOM when trying to allocate the PROT_NONE memory.
|
||||
if (module.hasDetachedHeap()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1235,7 +1235,7 @@ js::IsAsmJSModuleLoadedFromCache(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
JSFunction *fun;
|
||||
if (!args.hasDefined(0) || !IsMaybeWrappedNativeFunction(args[0], LinkAsmJS, &fun)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_USE_ASM_TYPE_FAIL,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_USE_ASM_TYPE_FAIL,
|
||||
"argument passed to isAsmJSModuleLoadedFromCache is not a "
|
||||
"validated asm.js module");
|
||||
return false;
|
||||
|
|
|
@ -65,7 +65,7 @@ AllocateExecutableMemory(ExclusiveContext *cx, size_t bytes)
|
|||
#endif
|
||||
void *p = AllocateExecutableMemory(nullptr, bytes, permissions, "asm-js-code", AsmJSPageSize);
|
||||
if (!p)
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return (uint8_t *)p;
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ static void
|
|||
AsmJSReportOverRecursed()
|
||||
{
|
||||
JSContext *cx = JSRuntime::innermostAsmJSActivation()->cx();
|
||||
js_ReportOverRecursed(cx);
|
||||
ReportOverRecursed(cx);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -463,14 +463,14 @@ OnDetached()
|
|||
{
|
||||
// See hasDetachedHeap comment in LinkAsmJS.
|
||||
JSContext *cx = JSRuntime::innermostAsmJSActivation()->cx();
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
static void
|
||||
OnOutOfBounds()
|
||||
{
|
||||
JSContext *cx = JSRuntime::innermostAsmJSActivation()->cx();
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -1481,7 +1481,7 @@ class MOZ_STACK_CLASS ModuleCompiler
|
|||
errorString_.get());
|
||||
}
|
||||
if (errorOverRecursed_)
|
||||
js_ReportOverRecursed(cx_);
|
||||
ReportOverRecursed(cx_);
|
||||
}
|
||||
|
||||
bool init() {
|
||||
|
|
|
@ -154,7 +154,7 @@ const Class AtomicsObject::class_ = {
|
|||
static bool
|
||||
ReportBadArrayType(JSContext *cx)
|
||||
{
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ATOMICS_BAD_ARRAY);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ATOMICS_BAD_ARRAY);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1080,7 +1080,7 @@ js::FutexRuntime::wait(JSContext *cx, double timeout_ms, AtomicsObject::FutexWai
|
|||
// See explanation below.
|
||||
|
||||
if (state_ == WaitingInterrupted) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ATOMICS_WAIT_NOT_ALLOWED);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ATOMICS_WAIT_NOT_ALLOWED);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1089,7 +1089,7 @@ js::FutexRuntime::wait(JSContext *cx, double timeout_ms, AtomicsObject::FutexWai
|
|||
// Reject the timeout if it is not exactly representable. 2e50 ms = 2e53 us = 6e39 years.
|
||||
|
||||
if (timed && timeout_ms > 2e50) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ATOMICS_TOO_LONG);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ATOMICS_TOO_LONG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1262,7 +1262,7 @@ AtomicsObject::initClass(JSContext *cx, Handle<GlobalObject *> global)
|
|||
}
|
||||
|
||||
JSObject *
|
||||
js_InitAtomicsClass(JSContext *cx, HandleObject obj)
|
||||
js::InitAtomicsClass(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
MOZ_ASSERT(obj->is<GlobalObject>());
|
||||
Rooted<GlobalObject *> global(cx, &obj->as<GlobalObject>());
|
||||
|
|
|
@ -123,9 +123,9 @@ public:
|
|||
#endif
|
||||
};
|
||||
|
||||
JSObject *
|
||||
InitAtomicsClass(JSContext *cx, HandleObject obj);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
JSObject *
|
||||
js_InitAtomicsClass(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
#endif /* builtin_AtomicsObject_h */
|
||||
|
|
|
@ -234,7 +234,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame
|
|||
|
||||
Rooted<GlobalObject*> scopeObjGlobal(cx, &scopeobj->global());
|
||||
if (!GlobalObject::isRuntimeCodeGenEnabled(cx, scopeObjGlobal)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ js::DirectEvalStringFromIon(JSContext *cx,
|
|||
|
||||
Rooted<GlobalObject*> scopeObjGlobal(cx, &scopeobj->global());
|
||||
if (!GlobalObject::isRuntimeCodeGenEnabled(cx, scopeObjGlobal)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -769,14 +769,14 @@ js::intl_availableCollations(JSContext *cx, unsigned argc, Value *vp)
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
UEnumeration *values = ucol_getKeywordValuesForLocale("co", locale.ptr(), false, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
ScopedICUObject<UEnumeration> toClose(values, uenum_close);
|
||||
|
||||
uint32_t count = uenum_count(values, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@ js::intl_availableCollations(JSContext *cx, unsigned argc, Value *vp)
|
|||
for (uint32_t i = 0; i < count; i++) {
|
||||
const char *collation = uenum_next(values, nullptr, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -938,7 +938,7 @@ NewUCollator(JSContext *cx, HandleObject collator)
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
UCollator *coll = ucol_open(icuLocale(locale.ptr()), &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -950,7 +950,7 @@ NewUCollator(JSContext *cx, HandleObject collator)
|
|||
ucol_setAttribute(coll, UCOL_CASE_FIRST, uCaseFirst, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
ucol_close(coll);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1266,7 +1266,7 @@ js::intl_numberingSystem(JSContext *cx, unsigned argc, Value *vp)
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
NumberingSystem *numbers = NumberingSystem::createInstance(ulocale, status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
const char *name = numbers->getName();
|
||||
|
@ -1397,7 +1397,7 @@ NewUNumberFormat(JSContext *cx, HandleObject numberFormat)
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
UNumberFormat *nf = unum_open(uStyle, nullptr, 0, icuLocale(locale.ptr()), nullptr, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
ScopedICUObject<UNumberFormat> toClose(nf, unum_close);
|
||||
|
@ -1405,7 +1405,7 @@ NewUNumberFormat(JSContext *cx, HandleObject numberFormat)
|
|||
if (uCurrency) {
|
||||
unum_setTextAttribute(nf, UNUM_CURRENCY_CODE, uCurrency, 3, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1444,7 +1444,7 @@ intl_FormatNumber(JSContext *cx, UNumberFormat *nf, double x, MutableHandleValue
|
|||
unum_formatDouble(nf, x, Char16ToUChar(chars.begin()), size, nullptr, &status);
|
||||
}
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1743,7 +1743,7 @@ js::intl_availableCalendars(JSContext *cx, unsigned argc, Value *vp)
|
|||
UCalendar *cal = ucal_open(nullptr, 0, locale.ptr(), UCAL_DEFAULT, &status);
|
||||
const char *calendar = ucal_getType(cal, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
ucal_close(cal);
|
||||
|
@ -1757,21 +1757,21 @@ js::intl_availableCalendars(JSContext *cx, unsigned argc, Value *vp)
|
|||
// Now get the calendars that "would make a difference", i.e., not the default.
|
||||
UEnumeration *values = ucal_getKeywordValuesForLocale("ca", locale.ptr(), false, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
ScopedICUObject<UEnumeration> toClose(values, uenum_close);
|
||||
|
||||
uint32_t count = uenum_count(values, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (; count > 0; count--) {
|
||||
calendar = uenum_next(values, nullptr, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1813,7 +1813,7 @@ js::intl_patternForSkeleton(JSContext *cx, unsigned argc, Value *vp)
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
UDateTimePatternGenerator *gen = udatpg_open(icuLocale(locale.ptr()), &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
ScopedICUObject<UDateTimePatternGenerator> toClose(gen, udatpg_close);
|
||||
|
@ -1821,7 +1821,7 @@ js::intl_patternForSkeleton(JSContext *cx, unsigned argc, Value *vp)
|
|||
int32_t size = udatpg_getBestPattern(gen, Char16ToUChar(skeletonChars.start().get()),
|
||||
skeletonLen, nullptr, 0, &status);
|
||||
if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
ScopedJSFreePtr<UChar> pattern(cx->pod_malloc<UChar>(size + 1));
|
||||
|
@ -1832,7 +1832,7 @@ js::intl_patternForSkeleton(JSContext *cx, unsigned argc, Value *vp)
|
|||
udatpg_getBestPattern(gen, Char16ToUChar(skeletonChars.start().get()),
|
||||
skeletonLen, pattern, size, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1912,7 +1912,7 @@ NewUDateFormat(JSContext *cx, HandleObject dateTimeFormat)
|
|||
udat_open(UDAT_PATTERN, UDAT_PATTERN, icuLocale(locale.ptr()), uTimeZone, uTimeZoneLength,
|
||||
uPattern, uPatternLength, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1930,7 +1930,7 @@ static bool
|
|||
intl_FormatDateTime(JSContext *cx, UDateFormat *df, double x, MutableHandleValue result)
|
||||
{
|
||||
if (!IsFinite(x)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1947,7 +1947,7 @@ intl_FormatDateTime(JSContext *cx, UDateFormat *df, double x, MutableHandleValue
|
|||
udat_format(df, x, Char16ToUChar(chars.begin()), size, nullptr, &status);
|
||||
}
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2032,7 +2032,7 @@ static const JSFunctionSpec intl_static_methods[] = {
|
|||
* Spec: ECMAScript Internationalization API Specification, 8.0, 8.1
|
||||
*/
|
||||
JSObject *
|
||||
js_InitIntlClass(JSContext *cx, HandleObject obj)
|
||||
js::InitIntlClass(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
MOZ_ASSERT(obj->is<GlobalObject>());
|
||||
Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
* ECMAScript Internationalization API Specification.
|
||||
*/
|
||||
|
||||
namespace js {
|
||||
|
||||
/**
|
||||
* Initializes the Intl Object and its standard built-in properties.
|
||||
* Spec: ECMAScript Internationalization API Specification, 8.0, 8.1
|
||||
*/
|
||||
extern JSObject *
|
||||
js_InitIntlClass(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
namespace js {
|
||||
InitIntlClass(JSContext *cx, HandleObject obj);
|
||||
|
||||
/*
|
||||
* The following functions are for use by self-hosted code.
|
||||
|
|
|
@ -1189,7 +1189,7 @@ MapObject::set(JSContext *cx, HandleObject obj, HandleValue k, HandleValue v)
|
|||
|
||||
RelocatableValue rval(v);
|
||||
if (!map->put(key, rval)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
WriteBarrierPost(cx->runtime(), map, key.get());
|
||||
|
@ -1206,7 +1206,7 @@ MapObject::create(JSContext *cx)
|
|||
ValueMap *map = cx->new_<ValueMap>(cx->runtime());
|
||||
if (!map || !map->init()) {
|
||||
js_delete(map);
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1261,7 +1261,7 @@ MapObject::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||
if (done)
|
||||
break;
|
||||
if (!pairVal.isObject()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_INVALID_MAP_ITERABLE, "Map");
|
||||
return false;
|
||||
}
|
||||
|
@ -1284,7 +1284,7 @@ MapObject::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
RelocatableValue rval(val);
|
||||
if (!map->put(hkey, rval)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
WriteBarrierPost(cx->runtime(), map, key);
|
||||
|
@ -1441,7 +1441,7 @@ MapObject::set_impl(JSContext *cx, CallArgs args)
|
|||
ARG0_KEY(cx, args, key);
|
||||
RelocatableValue rval(args.get(1));
|
||||
if (!map.put(key, rval)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
WriteBarrierPost(cx->runtime(), &map, key.get());
|
||||
|
@ -1474,7 +1474,7 @@ MapObject::delete_impl(JSContext *cx, CallArgs args)
|
|||
ARG0_KEY(cx, args, key);
|
||||
bool found;
|
||||
if (!map.remove(key, &found)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
args.rval().setBoolean(found);
|
||||
|
@ -1565,14 +1565,14 @@ MapObject::clear(JSContext *cx, HandleObject obj)
|
|||
MOZ_ASSERT(MapObject::is(obj));
|
||||
ValueMap &map = extract(obj);
|
||||
if (!map.clear()) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
JSObject *
|
||||
js_InitMapClass(JSContext *cx, HandleObject obj)
|
||||
js::InitMapClass(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
return MapObject::initClass(cx, obj);
|
||||
}
|
||||
|
@ -1828,7 +1828,7 @@ SetObject::add(JSContext *cx, HandleObject obj, HandleValue k)
|
|||
return false;
|
||||
|
||||
if (!set->put(key)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
WriteBarrierPost(cx->runtime(), set, key.get());
|
||||
|
@ -1845,7 +1845,7 @@ SetObject::create(JSContext *cx)
|
|||
ValueSet *set = cx->new_<ValueSet>(cx->runtime());
|
||||
if (!set || !set->init()) {
|
||||
js_delete(set);
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
obj->setPrivate(set);
|
||||
|
@ -1913,7 +1913,7 @@ SetObject::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||
if (!key.setValue(cx, keyVal))
|
||||
return false;
|
||||
if (!set->put(key)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
WriteBarrierPost(cx->runtime(), set, keyVal);
|
||||
|
@ -1994,7 +1994,7 @@ SetObject::add_impl(JSContext *cx, CallArgs args)
|
|||
ValueSet &set = extract(args);
|
||||
ARG0_KEY(cx, args, key);
|
||||
if (!set.put(key)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
WriteBarrierPost(cx->runtime(), &set, key.get());
|
||||
|
@ -2018,7 +2018,7 @@ SetObject::delete_impl(JSContext *cx, CallArgs args)
|
|||
ARG0_KEY(cx, args, key);
|
||||
bool found;
|
||||
if (!set.remove(key, &found)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
args.rval().setBoolean(found);
|
||||
|
@ -2075,7 +2075,7 @@ SetObject::clear_impl(JSContext *cx, CallArgs args)
|
|||
{
|
||||
Rooted<SetObject*> setobj(cx, &args.thisv().toObject().as<SetObject>());
|
||||
if (!setobj->getData()->clear()) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
args.rval().setUndefined();
|
||||
|
@ -2090,7 +2090,7 @@ SetObject::clear(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
JSObject *
|
||||
js_InitSetClass(JSContext *cx, HandleObject obj)
|
||||
js::InitSetClass(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
return SetObject::initClass(cx, obj);
|
||||
}
|
||||
|
|
|
@ -180,12 +180,12 @@ class SetObject : public NativeObject {
|
|||
extern bool
|
||||
InitSelfHostingCollectionIteratorFunctions(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
extern JSObject *
|
||||
InitMapClass(JSContext *cx, HandleObject obj);
|
||||
|
||||
extern JSObject *
|
||||
InitSetClass(JSContext *cx, HandleObject obj);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
extern JSObject *
|
||||
js_InitMapClass(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
extern JSObject *
|
||||
js_InitSetClass(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
#endif /* builtin_MapObject_h */
|
||||
|
|
|
@ -235,7 +235,7 @@ js::ObjectToSource(JSContext *cx, HandleObject obj)
|
|||
? !IsIdentifier(JSID_TO_ATOM(id))
|
||||
: JSID_TO_INT(id) < 0)
|
||||
{
|
||||
idstr = js_QuoteString(cx, idstr, char16_t('\''));
|
||||
idstr = QuoteString(cx, idstr, char16_t('\''));
|
||||
if (!idstr)
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -419,21 +419,21 @@ obj_setPrototypeOf(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
|
||||
if (args.length() < 2) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
"Object.setPrototypeOf", "1", "");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Step 1-2. */
|
||||
if (args[0].isNullOrUndefined()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
|
||||
args[0].isNull() ? "null" : "undefined", "object");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Step 3. */
|
||||
if (!args[1].isObjectOrNull()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
|
||||
"Object.setPrototypeOf", "an object or null", InformalValueTypeName(args[1]));
|
||||
return false;
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ obj_setPrototypeOf(JSContext *cx, unsigned argc, Value *vp)
|
|||
args[0], NullPtr()));
|
||||
if (!bytes)
|
||||
return false;
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
|
||||
bytes.get());
|
||||
return false;
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ obj_watch(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
|
||||
if (args.length() <= 1) {
|
||||
js_ReportMissingArg(cx, args.calleev(), 1);
|
||||
ReportMissingArg(cx, args.calleev(), 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -667,7 +667,7 @@ js::obj_create(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
// Step 1.
|
||||
if (args.length() == 0) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
"Object.create", "0", "s");
|
||||
return false;
|
||||
}
|
||||
|
@ -677,7 +677,7 @@ js::obj_create(JSContext *cx, unsigned argc, Value *vp)
|
|||
char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr());
|
||||
if (!bytes)
|
||||
return false;
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
|
||||
bytes, "not an object or null");
|
||||
js_free(bytes);
|
||||
return false;
|
||||
|
@ -855,7 +855,7 @@ obj_defineProperties(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
/* Step 2. */
|
||||
if (args.length() < 2) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
"Object.defineProperties", "0", "s");
|
||||
return false;
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ obj_preventExtensions(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
// Step 4.
|
||||
if (!status) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ ProtoSetter(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
|
||||
if (!success) {
|
||||
js_ReportValueError(cx, JSMSG_SETPROTOTYPEOF_FAIL, JSDVG_IGNORE_STACK, thisv, js::NullPtr());
|
||||
ReportValueError(cx, JSMSG_SETPROTOTYPEOF_FAIL, JSDVG_IGNORE_STACK, thisv, js::NullPtr());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ CompileRegExpObject(JSContext *cx, RegExpObjectBuilder &builder, CallArgs args,
|
|||
RootedObject sourceObj(cx, &sourceValue.toObject());
|
||||
|
||||
if (args.hasDefined(1)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NEWREGEXP_FLAGGED);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NEWREGEXP_FLAGGED);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@ static const JSPropertySpec regexp_static_props[] = {
|
|||
};
|
||||
|
||||
JSObject *
|
||||
js_InitRegExpClass(JSContext *cx, HandleObject obj)
|
||||
js::InitRegExpClass(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
MOZ_ASSERT(obj->isNative());
|
||||
|
||||
|
|
|
@ -9,12 +9,6 @@
|
|||
|
||||
#include "vm/RegExpObject.h"
|
||||
|
||||
JSObject *
|
||||
js_InitRegExpClass(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
bool
|
||||
regexp_flags(JSContext *cx, unsigned argc, JS::Value *vp);
|
||||
|
||||
/*
|
||||
* The following builtin natives are extern'd for pointer comparison in
|
||||
* other parts of the engine.
|
||||
|
@ -22,6 +16,12 @@ regexp_flags(JSContext *cx, unsigned argc, JS::Value *vp);
|
|||
|
||||
namespace js {
|
||||
|
||||
bool
|
||||
regexp_flags(JSContext *cx, unsigned argc, JS::Value *vp);
|
||||
|
||||
JSObject *
|
||||
InitRegExpClass(JSContext *cx, HandleObject obj);
|
||||
|
||||
// Whether RegExp statics should be updated with the input and results of a
|
||||
// regular expression execution.
|
||||
enum RegExpStaticsUpdate { UpdateRegExpStatics, DontUpdateRegExpStatics };
|
||||
|
|
|
@ -74,7 +74,7 @@ js::ToSimdConstant(JSContext *cx, HandleValue v, jit::SimdConstant *out)
|
|||
{
|
||||
typedef typename V::Elem Elem;
|
||||
if (!IsVectorObject<V>(v)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SIMD_NOT_A_VECTOR);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SIMD_NOT_A_VECTOR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ static bool GetSimdLane(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (!IsVectorObject<SimdType>(args.thisv())) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
|
||||
SimdTypeDescr::class_.name, laneNames[lane],
|
||||
InformalValueTypeName(args.thisv()));
|
||||
return false;
|
||||
|
@ -138,7 +138,7 @@ static bool SignMask(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (!args.thisv().isObject() || !args.thisv().toObject().is<TypedObject>()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
|
||||
SimdTypeDescr::class_.name, "signMask",
|
||||
InformalValueTypeName(args.thisv()));
|
||||
return false;
|
||||
|
@ -147,7 +147,7 @@ static bool SignMask(JSContext *cx, unsigned argc, Value *vp)
|
|||
TypedObject &typedObj = args.thisv().toObject().as<TypedObject>();
|
||||
TypeDescr &descr = typedObj.typeDescr();
|
||||
if (descr.kind() != type::Simd || descr.as<SimdTypeDescr>().type() != SimdType::type) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
|
||||
SimdTypeDescr::class_.name, "signMask",
|
||||
InformalValueTypeName(args.thisv()));
|
||||
return false;
|
||||
|
@ -486,7 +486,7 @@ SIMDObject::initClass(JSContext *cx, Handle<GlobalObject *> global)
|
|||
}
|
||||
|
||||
JSObject *
|
||||
js_InitSIMDClass(JSContext *cx, HandleObject obj)
|
||||
js::InitSIMDClass(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
MOZ_ASSERT(obj->is<GlobalObject>());
|
||||
Rooted<GlobalObject *> global(cx, &obj->as<GlobalObject>());
|
||||
|
@ -644,7 +644,7 @@ struct ShiftRightLogical {
|
|||
static inline bool
|
||||
ErrorBadArgs(JSContext *cx)
|
||||
{
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_BAD_ARGS);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_BAD_ARGS);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1037,7 +1037,7 @@ TypedArrayFromArgs(JSContext *cx, const CallArgs &args,
|
|||
(uint32_t(*byteStart) + NumElem * sizeof(VElem)) > AnyTypedArrayByteLength(typedArray))
|
||||
{
|
||||
// Keep in sync with AsmJS OnOutOfBounds function.
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -349,9 +349,9 @@ simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp);
|
|||
INT32X4_FUNCTION_LIST(DECLARE_SIMD_INT32x4_FUNCTION)
|
||||
#undef DECLARE_SIMD_INT32x4_FUNCTION
|
||||
|
||||
JSObject *
|
||||
InitSIMDClass(JSContext *cx, HandleObject obj);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
JSObject *
|
||||
js_InitSIMDClass(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
#endif /* builtin_SIMD_h */
|
||||
|
|
|
@ -103,7 +103,7 @@ SymbolObject::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||
// yet, so just throw a TypeError.
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.isConstructing()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_CONSTRUCTOR, "Symbol");
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_CONSTRUCTOR, "Symbol");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -159,8 +159,8 @@ SymbolObject::keyFor(JSContext *cx, unsigned argc, Value *vp)
|
|||
// step 1
|
||||
HandleValue arg = args.get(0);
|
||||
if (!arg.isSymbol()) {
|
||||
js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK,
|
||||
arg, js::NullPtr(), "not a symbol", nullptr);
|
||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK,
|
||||
arg, js::NullPtr(), "not a symbol", nullptr);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ SymbolObject::valueOf(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
JSObject *
|
||||
js_InitSymbolClass(JSContext *cx, HandleObject obj)
|
||||
js::InitSymbolClass(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
return SymbolObject::initClass(cx, obj);
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@ class SymbolObject : public NativeObject
|
|||
static const JSFunctionSpec staticMethods[];
|
||||
};
|
||||
|
||||
extern JSObject *
|
||||
InitSymbolClass(JSContext *cx, HandleObject obj);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
extern JSObject *
|
||||
js_InitSymbolClass(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
#endif /* builtin_SymbolObject_h */
|
||||
|
|
|
@ -747,7 +747,7 @@ NondeterministicGetWeakMapKeys(JSContext *cx, unsigned argc, jsval *vp)
|
|||
return false;
|
||||
}
|
||||
if (!args[0].isObject()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
|
||||
"nondeterministicGetWeakMapKeys", "WeakMap",
|
||||
InformalValueTypeName(args[0]));
|
||||
return false;
|
||||
|
@ -757,7 +757,7 @@ NondeterministicGetWeakMapKeys(JSContext *cx, unsigned argc, jsval *vp)
|
|||
if (!JS_NondeterministicGetWeakMapKeys(cx, mapObj, &arr))
|
||||
return false;
|
||||
if (!arr) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
|
||||
"nondeterministicGetWeakMapKeys", "WeakMap",
|
||||
args[0].toObject().getClass()->name);
|
||||
return false;
|
||||
|
@ -971,9 +971,9 @@ SaveStack(JSContext *cx, unsigned argc, jsval *vp)
|
|||
if (!ToNumber(cx, args[0], &d))
|
||||
return false;
|
||||
if (d < 0) {
|
||||
js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
||||
JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
|
||||
"not a valid maximum frame count", NULL);
|
||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
||||
JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
|
||||
"not a valid maximum frame count", NULL);
|
||||
return false;
|
||||
}
|
||||
maxFrameCount = d;
|
||||
|
@ -982,9 +982,9 @@ SaveStack(JSContext *cx, unsigned argc, jsval *vp)
|
|||
JSCompartment *targetCompartment = cx->compartment();
|
||||
if (args.length() >= 2) {
|
||||
if (!args[1].isObject()) {
|
||||
js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
||||
JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
|
||||
"not an object", NULL);
|
||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
||||
JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
|
||||
"not an object", NULL);
|
||||
return false;
|
||||
}
|
||||
RootedObject obj(cx, UncheckedUnwrap(&args[1].toObject()));
|
||||
|
@ -2108,7 +2108,7 @@ FindPath(JSContext *cx, unsigned argc, jsval *vp)
|
|||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (argc < 2) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
|
||||
"findPath", "1", "");
|
||||
return false;
|
||||
}
|
||||
|
@ -2117,16 +2117,16 @@ FindPath(JSContext *cx, unsigned argc, jsval *vp)
|
|||
// test is all about object identity, and ToString doesn't preserve that.
|
||||
// Non-GCThing endpoints don't make much sense.
|
||||
if (!args[0].isObject() && !args[0].isString() && !args[0].isSymbol()) {
|
||||
js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
||||
JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
|
||||
"not an object, string, or symbol", NULL);
|
||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
||||
JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
|
||||
"not an object, string, or symbol", NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!args[1].isObject() && !args[1].isString() && !args[1].isSymbol()) {
|
||||
js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
||||
JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
|
||||
"not an object, string, or symbol", NULL);
|
||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
||||
JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
|
||||
"not an object, string, or symbol", NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ static const JSFunctionSpec TypedObjectMethods[] = {
|
|||
static void
|
||||
ReportCannotConvertTo(JSContext *cx, HandleValue fromValue, const char *toType)
|
||||
{
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
|
||||
InformalValueTypeName(fromValue), toType);
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ GetPrototype(JSContext *cx, HandleObject obj)
|
|||
return nullptr;
|
||||
}
|
||||
if (!prototypeVal.isObject()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_INVALID_PROTOTYPE);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ ScalarTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
|
|||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() < 1) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
args.callee().getClass()->name, "0", "s");
|
||||
return false;
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ js::ReferenceTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
|
|||
Rooted<ReferenceTypeDescr *> descr(cx, &args.callee().as<ReferenceTypeDescr>());
|
||||
|
||||
if (args.length() < 1) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_MORE_ARGS_NEEDED,
|
||||
descr->typeName(), "0", "s");
|
||||
return false;
|
||||
|
@ -644,7 +644,7 @@ ArrayMetaTypeDescr::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
if (!args.isConstructing()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_NOT_FUNCTION, "ArrayType");
|
||||
return false;
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ ArrayMetaTypeDescr::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
// Expect two arguments. The first is a type object, the second is a length.
|
||||
if (args.length() < 2) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
"ArrayType", "1", "");
|
||||
return false;
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ ArrayMetaTypeDescr::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||
// Compute the byte size.
|
||||
CheckedInt32 size = CheckedInt32(elementType->size()) * length;
|
||||
if (!size.isValid()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_TYPEDOBJECT_TOO_BIG);
|
||||
return false;
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ StructMetaTypeDescr::create(JSContext *cx,
|
|||
return nullptr;
|
||||
|
||||
if (!stringBuffer.append("new StructType({")) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -818,11 +818,11 @@ StructMetaTypeDescr::create(JSContext *cx,
|
|||
// Collect field name and type object
|
||||
RootedValue fieldName(cx, IdToValue(id));
|
||||
if (!fieldNames.append(fieldName)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
if (!fieldTypeObjs.append(ObjectValue(*fieldType))) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -835,19 +835,19 @@ StructMetaTypeDescr::create(JSContext *cx,
|
|||
|
||||
// Append "f:Type" to the string repr
|
||||
if (i > 0 && !stringBuffer.append(", ")) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
if (!stringBuffer.append(JSID_TO_ATOM(id))) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
if (!stringBuffer.append(": ")) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
if (!stringBuffer.append(&fieldType->stringRepr())) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -855,13 +855,13 @@ StructMetaTypeDescr::create(JSContext *cx,
|
|||
// the field's alignment.
|
||||
CheckedInt32 offset = roundUpToAlignment(sizeSoFar, fieldType->alignment());
|
||||
if (!offset.isValid()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_TYPEDOBJECT_TOO_BIG);
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(offset.value() >= 0);
|
||||
if (!fieldOffsets.append(Int32Value(offset.value()))) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -876,7 +876,7 @@ StructMetaTypeDescr::create(JSContext *cx,
|
|||
// Add space for this field to the total struct size.
|
||||
sizeSoFar = offset + fieldType->size();
|
||||
if (!sizeSoFar.isValid()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_TYPEDOBJECT_TOO_BIG);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -891,7 +891,7 @@ StructMetaTypeDescr::create(JSContext *cx,
|
|||
|
||||
// Complete string representation.
|
||||
if (!stringBuffer.append("})")) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
RootedAtom stringRepr(cx, stringBuffer.finishAtom());
|
||||
|
@ -901,7 +901,7 @@ StructMetaTypeDescr::create(JSContext *cx,
|
|||
// Adjust the total size to be a multiple of the final alignment.
|
||||
CheckedInt32 totalSize = roundUpToAlignment(sizeSoFar, alignment);
|
||||
if (!totalSize.isValid()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_TYPEDOBJECT_TOO_BIG);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1002,7 +1002,7 @@ StructMetaTypeDescr::construct(JSContext *cx, unsigned int argc, Value *vp)
|
|||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
if (!args.isConstructing()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_NOT_FUNCTION, "StructType");
|
||||
return false;
|
||||
}
|
||||
|
@ -1017,7 +1017,7 @@ StructMetaTypeDescr::construct(JSContext *cx, unsigned int argc, Value *vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_TYPEDOBJECT_STRUCTTYPE_BAD_ARGS);
|
||||
return false;
|
||||
}
|
||||
|
@ -1333,25 +1333,13 @@ GlobalObject::initTypedObjectModule(JSContext *cx, Handle<GlobalObject*> global)
|
|||
}
|
||||
|
||||
JSObject *
|
||||
js_InitTypedObjectModuleObject(JSContext *cx, HandleObject obj)
|
||||
js::InitTypedObjectModuleObject(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
MOZ_ASSERT(obj->is<GlobalObject>());
|
||||
Rooted<GlobalObject *> global(cx, &obj->as<GlobalObject>());
|
||||
return global->getOrCreateTypedObjectModule(cx);
|
||||
}
|
||||
|
||||
JSObject *
|
||||
js_InitTypedObjectDummy(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
/*
|
||||
* This function is entered into the jsprototypes.h table
|
||||
* as the initializer for `TypedObject`. It should not
|
||||
* be executed via the `standard_class_atoms` mechanism.
|
||||
*/
|
||||
|
||||
MOZ_CRASH("shouldn't be initializing TypedObject via the JSProtoKey initializer mechanism");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Typed objects
|
||||
*/
|
||||
|
@ -1633,7 +1621,7 @@ ReportTypedObjTypeError(JSContext *cx,
|
|||
if (!typeReprStr)
|
||||
return false;
|
||||
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
errorNumber, typeReprStr);
|
||||
|
||||
JS_free(cx, (void *) typeReprStr);
|
||||
|
@ -1700,7 +1688,7 @@ TypedObject::obj_lookupProperty(JSContext *cx, HandleObject obj, HandleId id,
|
|||
case type::Array:
|
||||
{
|
||||
uint32_t index;
|
||||
if (js_IdIsIndex(id, &index))
|
||||
if (IdIsIndex(id, &index))
|
||||
return obj_lookupElement(cx, obj, index, objp, propp);
|
||||
|
||||
if (JSID_IS_ATOM(id, cx->names().length)) {
|
||||
|
@ -1758,7 +1746,7 @@ ReportPropertyError(JSContext *cx,
|
|||
if (!propName)
|
||||
return false;
|
||||
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
errorNumber, propName);
|
||||
|
||||
JS_free(cx, propName);
|
||||
|
@ -1790,7 +1778,7 @@ TypedObject::obj_hasProperty(JSContext *cx, HandleObject obj, HandleId id, bool
|
|||
}
|
||||
uint32_t index;
|
||||
// Elements are not inherited from the prototype.
|
||||
if (js_IdIsIndex(id, &index)) {
|
||||
if (IdIsIndex(id, &index)) {
|
||||
*foundp = (index < uint32_t(typedObj->length()));
|
||||
return true;
|
||||
}
|
||||
|
@ -1822,7 +1810,7 @@ TypedObject::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject recei
|
|||
|
||||
// Dispatch elements to obj_getElement:
|
||||
uint32_t index;
|
||||
if (js_IdIsIndex(id, &index))
|
||||
if (IdIsIndex(id, &index))
|
||||
return obj_getElement(cx, obj, receiver, index, vp);
|
||||
|
||||
// Handle everything else here:
|
||||
|
@ -1839,7 +1827,7 @@ TypedObject::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject recei
|
|||
if (JSID_IS_ATOM(id, cx->names().length)) {
|
||||
if (!typedObj->isAttached()) {
|
||||
JS_ReportErrorNumber(
|
||||
cx, js_GetErrorMessage,
|
||||
cx, GetErrorMessage,
|
||||
nullptr, JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);
|
||||
return false;
|
||||
}
|
||||
|
@ -1934,7 +1922,7 @@ TypedObject::obj_setProperty(JSContext *cx, HandleObject obj, HandleObject recei
|
|||
case type::Array: {
|
||||
if (JSID_IS_ATOM(id, cx->names().length)) {
|
||||
if (obj == receiver) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage,
|
||||
nullptr, JSMSG_CANT_REDEFINE_ARRAY_LENGTH);
|
||||
return false;
|
||||
}
|
||||
|
@ -1942,12 +1930,12 @@ TypedObject::obj_setProperty(JSContext *cx, HandleObject obj, HandleObject recei
|
|||
}
|
||||
|
||||
uint32_t index;
|
||||
if (js_IdIsIndex(id, &index)) {
|
||||
if (IdIsIndex(id, &index)) {
|
||||
if (obj != receiver)
|
||||
return SetPropertyByDefining(cx, obj, receiver, id, vp, strict, false);
|
||||
|
||||
if (index >= uint32_t(typedObj->length())) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage,
|
||||
nullptr, JSMSG_TYPEDOBJECT_BINARYARRAY_BAD_INDEX);
|
||||
return false;
|
||||
}
|
||||
|
@ -1986,7 +1974,7 @@ TypedObject::obj_getOwnPropertyDescriptor(JSContext *cx, HandleObject obj, Handl
|
|||
{
|
||||
Rooted<TypedObject *> typedObj(cx, &obj->as<TypedObject>());
|
||||
if (!typedObj->isAttached()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2000,7 +1988,7 @@ TypedObject::obj_getOwnPropertyDescriptor(JSContext *cx, HandleObject obj, Handl
|
|||
case type::Array:
|
||||
{
|
||||
uint32_t index;
|
||||
if (js_IdIsIndex(id, &index)) {
|
||||
if (IdIsIndex(id, &index)) {
|
||||
if (!obj_getArrayElement(cx, typedObj, descr, index, desc.value()))
|
||||
return false;
|
||||
desc.setAttributes(JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
@ -2052,7 +2040,7 @@ IsOwnId(JSContext *cx, HandleObject obj, HandleId id)
|
|||
return false;
|
||||
|
||||
case type::Array:
|
||||
return js_IdIsIndex(id, &index) || JSID_IS_ATOM(id, cx->names().length);
|
||||
return IdIsIndex(id, &index) || JSID_IS_ATOM(id, cx->names().length);
|
||||
|
||||
case type::Struct:
|
||||
size_t index;
|
||||
|
@ -2274,7 +2262,7 @@ LazyArrayBufferTable::addBuffer(JSContext *cx, InlineTransparentTypedObject *obj
|
|||
{
|
||||
MOZ_ASSERT(!map.has(obj));
|
||||
if (!map.put(obj, buffer)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2428,7 +2416,7 @@ TypedObject::construct(JSContext *cx, unsigned int argc, Value *vp)
|
|||
buffer = &args[0].toObject().as<ArrayBufferObject>();
|
||||
|
||||
if (callee->opaque() || buffer->isNeutered()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage,
|
||||
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
|
||||
return false;
|
||||
}
|
||||
|
@ -2436,7 +2424,7 @@ TypedObject::construct(JSContext *cx, unsigned int argc, Value *vp)
|
|||
int32_t offset;
|
||||
if (args.length() >= 2 && !args[1].isUndefined()) {
|
||||
if (!args[1].isInt32()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage,
|
||||
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
|
||||
return false;
|
||||
}
|
||||
|
@ -2447,7 +2435,7 @@ TypedObject::construct(JSContext *cx, unsigned int argc, Value *vp)
|
|||
}
|
||||
|
||||
if (args.length() >= 3 && !args[2].isUndefined()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage,
|
||||
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
|
||||
return false;
|
||||
}
|
||||
|
@ -2455,7 +2443,7 @@ TypedObject::construct(JSContext *cx, unsigned int argc, Value *vp)
|
|||
if (!CheckOffset(offset, callee->size(), callee->alignment(),
|
||||
buffer->byteLength()))
|
||||
{
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage,
|
||||
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
|
||||
return false;
|
||||
}
|
||||
|
@ -2486,7 +2474,7 @@ TypedObject::construct(JSContext *cx, unsigned int argc, Value *vp)
|
|||
}
|
||||
|
||||
// Something bogus.
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage,
|
||||
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
* Currently, all "globals" related to typed objects are packaged
|
||||
* within a single "module" object `TypedObject`. This module has its
|
||||
* own js::Class and when that class is initialized, we also create
|
||||
* and define all other values (in `js_InitTypedObjectModuleClass()`).
|
||||
* and define all other values (in `js::InitTypedObjectModuleClass()`).
|
||||
*
|
||||
* - Type objects, meta type objects, and type representations:
|
||||
*
|
||||
|
@ -1042,10 +1042,10 @@ class LazyArrayBufferTable
|
|||
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
|
||||
};
|
||||
|
||||
} // namespace js
|
||||
|
||||
JSObject *
|
||||
js_InitTypedObjectModuleObject(JSContext *cx, JS::HandleObject obj);
|
||||
InitTypedObjectModuleObject(JSContext *cx, JS::HandleObject obj);
|
||||
|
||||
} // namespace js
|
||||
|
||||
template <>
|
||||
inline bool
|
||||
|
|
|
@ -86,7 +86,7 @@ WeakSetObject::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
if (!args.isConstructing()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_FUNCTION, "WeakSet");
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_FUNCTION, "WeakSet");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ WeakSetObject::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||
char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, NullPtr());
|
||||
if (!bytes)
|
||||
return false;
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ WeakSetObject::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
|
||||
JSObject *
|
||||
js_InitWeakSetClass(JSContext *cx, HandleObject obj)
|
||||
js::InitWeakSetClass(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
return WeakSetObject::initClass(cx, obj);
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ class WeakSetObject : public NativeObject
|
|||
static bool construct(JSContext *cx, unsigned argc, Value *vp);
|
||||
};
|
||||
|
||||
extern JSObject *
|
||||
InitWeakSetClass(JSContext *cx, HandleObject obj);
|
||||
|
||||
} // namespace js
|
||||
|
||||
extern JSObject *
|
||||
js_InitWeakSetClass(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
#endif /* builtin_WeakSetObject_h */
|
||||
|
|
|
@ -89,7 +89,7 @@ GetDeflatedUTF8StringLength(JSContext *maybecx, const CharT *chars,
|
|||
if (maybecx) {
|
||||
js::gc::AutoSuppressGC suppress(maybecx);
|
||||
JS_snprintf(buffer, 10, "0x%x", c);
|
||||
JS_ReportErrorFlagsAndNumber(maybecx, JSREPORT_ERROR, js_GetErrorMessage,
|
||||
JS_ReportErrorFlagsAndNumber(maybecx, JSREPORT_ERROR, GetErrorMessage,
|
||||
nullptr, JSMSG_BAD_SURROGATE_CHAR, buffer);
|
||||
}
|
||||
return (size_t) -1;
|
||||
|
@ -151,7 +151,7 @@ DeflateStringToUTF8Buffer(JSContext *maybecx, const CharT *src, size_t srclen,
|
|||
*dst++ = (char) v;
|
||||
utf8Len = 1;
|
||||
} else {
|
||||
utf8Len = js_OneUcs4ToUtf8Char(utf8buf, v);
|
||||
utf8Len = js::OneUcs4ToUtf8Char(utf8buf, v);
|
||||
if (utf8Len > dstlen)
|
||||
goto bufferTooSmall;
|
||||
for (i = 0; i < utf8Len; i++)
|
||||
|
@ -173,7 +173,7 @@ bufferTooSmall:
|
|||
*dstlenp = (origDstlen - dstlen);
|
||||
if (maybecx) {
|
||||
js::gc::AutoSuppressGC suppress(maybecx);
|
||||
JS_ReportErrorNumber(maybecx, js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(maybecx, GetErrorMessage, nullptr,
|
||||
JSMSG_BUFFER_TOO_SMALL);
|
||||
}
|
||||
return false;
|
||||
|
@ -749,8 +749,8 @@ static const JSPropertySpec sFunctionProps[] = {
|
|||
};
|
||||
|
||||
static const JSFunctionSpec sFunctionInstanceFunctions[] = {
|
||||
JS_FN("call", js_fun_call, 1, CDATAFN_FLAGS),
|
||||
JS_FN("apply", js_fun_apply, 2, CDATAFN_FLAGS),
|
||||
JS_FN("call", js::fun_call, 1, CDATAFN_FLAGS),
|
||||
JS_FN("apply", js::fun_apply, 2, CDATAFN_FLAGS),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ CheckLength(ExclusiveContext *cx, SourceBufferHolder &srcBuf)
|
|||
// is using size_t internally already.
|
||||
if (srcBuf.length() > UINT32_MAX) {
|
||||
if (cx->isJSContext())
|
||||
JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, nullptr,
|
||||
JS_ReportErrorNumber(cx->asJSContext(), GetErrorMessage, nullptr,
|
||||
JSMSG_SOURCE_TOO_LONG);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ EmitCheck(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t delta)
|
|||
|
||||
jsbytecode dummy = 0;
|
||||
if (!bce->code().appendN(dummy, delta)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return -1;
|
||||
}
|
||||
return offset;
|
||||
|
@ -2818,7 +2818,7 @@ EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||
intmap_bitlen = JS_BIT(16);
|
||||
intmap = cx->pod_malloc<jsbitmap>(JS_BIT(16) / JS_BITMAP_NBITS);
|
||||
if (!intmap) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -6579,6 +6579,15 @@ EmitPropertyList(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn,
|
|||
continue;
|
||||
}
|
||||
|
||||
bool extraPop = false;
|
||||
if (type == ClassBody && propdef->as<ClassMethod>().isStatic()) {
|
||||
extraPop = true;
|
||||
if (Emit1(cx, bce, JSOP_DUP2) < 0)
|
||||
return false;
|
||||
if (Emit1(cx, bce, JSOP_POP) < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Emit an index for t[2] for later consumption by JSOP_INITELEM. */
|
||||
ParseNode *key = propdef->pn_left;
|
||||
bool isIndex = false;
|
||||
|
@ -6652,6 +6661,11 @@ EmitPropertyList(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn,
|
|||
if (!EmitIndex32(cx, op, index, bce))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (extraPop) {
|
||||
if (Emit1(cx, bce, JSOP_POP) < 0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -7467,7 +7481,7 @@ AllocSrcNote(ExclusiveContext *cx, SrcNotesVector ¬es)
|
|||
|
||||
jssrcnote dummy = 0;
|
||||
if (!notes.append(dummy)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return -1;
|
||||
}
|
||||
return notes.length() - 1;
|
||||
|
@ -7601,7 +7615,7 @@ SetSrcNoteOffset(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned index, uns
|
|||
!(sn = notes.insert(sn, dummy)) ||
|
||||
!(sn = notes.insert(sn, dummy)))
|
||||
{
|
||||
js_ReportOutOfMemory(cx);
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -349,7 +349,8 @@ class FullParseHandler
|
|||
return true;
|
||||
}
|
||||
|
||||
bool addClassMethodDefinition(ParseNode *methodList, ParseNode *key, ParseNode *fn, JSOp op)
|
||||
bool addClassMethodDefinition(ParseNode *methodList, ParseNode *key, ParseNode *fn, JSOp op,
|
||||
bool isStatic)
|
||||
{
|
||||
MOZ_ASSERT(methodList->isKind(PNK_CLASSMETHODLIST));
|
||||
MOZ_ASSERT(key->isKind(PNK_NUMBER) ||
|
||||
|
@ -357,8 +358,7 @@ class FullParseHandler
|
|||
key->isKind(PNK_STRING) ||
|
||||
key->isKind(PNK_COMPUTED_NAME));
|
||||
|
||||
// For now, there's no such thing as static methods.
|
||||
ParseNode *classMethod = new_<ClassMethod>(key, fn, op, false);
|
||||
ParseNode *classMethod = new_<ClassMethod>(key, fn, op, isStatic);
|
||||
if (!classMethod)
|
||||
return false;
|
||||
methodList->append(classMethod);
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче