Merge mozilla-central into services-central
1
.hgtags
@ -86,3 +86,4 @@ b6627f28b7ec17e1b46a594df0f780d3a40847e4 FIREFOX_AURORA_13_BASE
|
||||
9697eadafa13b4e9233b39aaeecfeac79503cb54 FIREFOX_AURORA_16_BASE
|
||||
9697eadafa13b4e9233b39aaeecfeac79503cb54 FIREFOX_AURORA_16_BASE
|
||||
6fdf9985acfe6f939da584b2559464ab22264fe7 FIREFOX_AURORA_16_BASE
|
||||
fd72dbbd692012224145be1bf13df1d7675fd277 FIREFOX_AURORA_17_BASE
|
||||
|
@ -12,9 +12,6 @@ Cu.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
var EXPORTED_SYMBOLS = ['Utils', 'Logger'];
|
||||
|
||||
var gAccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
|
||||
getService(Ci.nsIAccessibleRetrieval);
|
||||
|
||||
var Utils = {
|
||||
_buildAppMap: {
|
||||
'{3c2e2abc-06d4-11e1-ac3b-374f68613e61}': 'b2g',
|
||||
@ -23,6 +20,15 @@ var Utils = {
|
||||
'{a23983c0-fd0e-11dc-95ff-0800200c9a66}': 'mobile/xul'
|
||||
},
|
||||
|
||||
get AccRetrieval() {
|
||||
if (!this._AccRetrieval) {
|
||||
this._AccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
|
||||
getService(Ci.nsIAccessibleRetrieval);
|
||||
}
|
||||
|
||||
return this._AccRetrieval;
|
||||
},
|
||||
|
||||
get MozBuildApp() {
|
||||
if (!this._buildApp)
|
||||
this._buildApp = this._buildAppMap[Services.appinfo.ID];
|
||||
@ -72,7 +78,7 @@ var Utils = {
|
||||
},
|
||||
|
||||
getAllDocuments: function getAllDocuments(aWindow) {
|
||||
let doc = gAccRetrieval.
|
||||
let doc = this.AccRetrieval.
|
||||
getAccessibleFor(this.getCurrentContentDoc(aWindow)).
|
||||
QueryInterface(Ci.nsIAccessibleDocument);
|
||||
let docs = [];
|
||||
@ -106,7 +112,7 @@ var Utils = {
|
||||
|
||||
getVirtualCursor: function getVirtualCursor(aDocument) {
|
||||
let doc = (aDocument instanceof Ci.nsIAccessible) ? aDocument :
|
||||
gAccRetrieval.getAccessibleFor(aDocument);
|
||||
this.AccRetrieval.getAccessibleFor(aDocument);
|
||||
|
||||
while (doc) {
|
||||
try {
|
||||
@ -170,7 +176,7 @@ var Utils = {
|
||||
if (!main)
|
||||
continue;
|
||||
|
||||
let mainAcc = gAccRetrieval.getAccessibleFor(main);
|
||||
let mainAcc = this.AccRetrieval.getAccessibleFor(main);
|
||||
if (!mainAcc)
|
||||
continue;
|
||||
|
||||
@ -237,7 +243,7 @@ var Logger = {
|
||||
accessibleToString: function accessibleToString(aAccessible) {
|
||||
let str = '[ defunct ]';
|
||||
try {
|
||||
str = '[ ' + gAccRetrieval.getStringRole(aAccessible.role) +
|
||||
str = '[ ' + Utils.AccRetrieval.getStringRole(aAccessible.role) +
|
||||
' | ' + aAccessible.name + ' ]';
|
||||
} catch (x) {
|
||||
}
|
||||
@ -246,12 +252,12 @@ var Logger = {
|
||||
},
|
||||
|
||||
eventToString: function eventToString(aEvent) {
|
||||
let str = gAccRetrieval.getStringEventType(aEvent.eventType);
|
||||
let str = Utils.AccRetrieval.getStringEventType(aEvent.eventType);
|
||||
if (aEvent.eventType == Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE) {
|
||||
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
|
||||
let stateStrings = (event.isExtraState()) ?
|
||||
gAccRetrieval.getStringStates(0, event.state) :
|
||||
gAccRetrieval.getStringStates(event.state, 0);
|
||||
Utils.AccRetrieval.getStringStates(0, event.state) :
|
||||
Utils.AccRetrieval.getStringStates(event.state, 0);
|
||||
str += ' (' + stateStrings.item(0) + ')';
|
||||
}
|
||||
|
||||
@ -261,7 +267,7 @@ var Logger = {
|
||||
statesToString: function statesToString(aAccessible) {
|
||||
let [state, extState] = Utils.getStates(aAccessible);
|
||||
let stringArray = [];
|
||||
let stateStrings = gAccRetrieval.getStringStates(state, extState);
|
||||
let stateStrings = Utils.AccRetrieval.getStringStates(state, extState);
|
||||
for (var i=0; i < stateStrings.length; i++)
|
||||
stringArray.push(stateStrings.item(i));
|
||||
return stringArray.join(' ');
|
||||
|
@ -17,11 +17,11 @@ var gStringBundle = Cc['@mozilla.org/intl/stringbundle;1'].
|
||||
getService(Ci.nsIStringBundleService).
|
||||
createBundle('chrome://global/locale/AccessFu.properties');
|
||||
|
||||
var gAccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
|
||||
getService(Ci.nsIAccessibleRetrieval);
|
||||
|
||||
var EXPORTED_SYMBOLS = ['UtteranceGenerator'];
|
||||
|
||||
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
|
||||
|
||||
/**
|
||||
* Generates speech utterances from objects, actions and state changes.
|
||||
* An utterance is an array of strings.
|
||||
@ -66,7 +66,7 @@ var UtteranceGenerator = {
|
||||
* {@link verbosityRoleMap}.
|
||||
*/
|
||||
genForObject: function genForObject(aAccessible) {
|
||||
let roleString = gAccRetrieval.getStringRole(aAccessible.role);
|
||||
let roleString = Utils.AccRetrieval.getStringRole(aAccessible.role);
|
||||
|
||||
let func = this.objectUtteranceFunctions[roleString] ||
|
||||
this.objectUtteranceFunctions.defaultFunc;
|
||||
|
@ -14,9 +14,6 @@ var EXPORTED_SYMBOLS = ['VirtualCursorController'];
|
||||
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
|
||||
var gAccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
|
||||
getService(Ci.nsIAccessibleRetrieval);
|
||||
|
||||
function BaseTraversalRule(aRoles, aMatchFunc) {
|
||||
this._matchRoles = aRoles;
|
||||
this._matchFunc = aMatchFunc;
|
||||
@ -349,7 +346,7 @@ var VirtualCursorController = {
|
||||
} catch (x) {
|
||||
this.moveCursorToObject(
|
||||
virtualCursor,
|
||||
gAccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
|
||||
Utils.AccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -364,7 +361,7 @@ var VirtualCursorController = {
|
||||
} catch (x) {
|
||||
this.moveCursorToObject(
|
||||
virtualCursor,
|
||||
gAccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
|
||||
Utils.AccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -380,7 +377,7 @@ var VirtualCursorController = {
|
||||
// (via ARIA roles, etc.), so we need to generate a click.
|
||||
// Could possibly be made simpler in the future. Maybe core
|
||||
// engine could expose nsCoreUtiles::DispatchMouseEvent()?
|
||||
let docAcc = gAccRetrieval.getAccessibleFor(this.chromeWin.document);
|
||||
let docAcc = Utils.AccRetrieval.getAccessibleFor(this.chromeWin.document);
|
||||
let docX = {}, docY = {}, docW = {}, docH = {};
|
||||
docAcc.getBounds(docX, docY, docW, docH);
|
||||
|
||||
|
@ -525,3 +525,6 @@ pref("dom.ipc.processPrelauch.delayMs", 1000);
|
||||
|
||||
// Ignore the "dialog=1" feature in window.open.
|
||||
pref("dom.disable_window_open_dialog_feature", true);
|
||||
|
||||
// Screen reader support
|
||||
pref("accessibility.accessfu.activate", 2);
|
||||
|
@ -18,6 +18,7 @@ Cu.import('resource://gre/modules/AlarmService.jsm');
|
||||
Cu.import('resource://gre/modules/ActivitiesService.jsm');
|
||||
Cu.import('resource://gre/modules/PermissionPromptHelper.jsm');
|
||||
Cu.import('resource://gre/modules/ObjectWrapper.jsm');
|
||||
Cu.import("resource://gre/modules/accessibility/AccessFu.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'env',
|
||||
'@mozilla.org/process/environment;1',
|
||||
@ -48,7 +49,7 @@ XPCOMUtils.defineLazyGetter(this, 'DebuggerServer', function() {
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager);
|
||||
.getService(Ci.nsIMessageListenerManager);
|
||||
});
|
||||
|
||||
function getContentWindow() {
|
||||
@ -149,6 +150,7 @@ var shell = {
|
||||
|
||||
CustomEventManager.init();
|
||||
WebappsHelper.init();
|
||||
AccessFu.attach(window);
|
||||
|
||||
// XXX could factor out into a settings->pref map. Not worth it yet.
|
||||
SettingsListener.observe("debug.fps.enabled", false, function(value) {
|
||||
|
@ -14,7 +14,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageSender);
|
||||
});
|
||||
|
||||
function log(aMsg) {
|
||||
|
@ -14,7 +14,7 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
const messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Ci.nsIChromeFrameMessageManager);
|
||||
.getService(Ci.nsIMessageBroadcaster);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -70,19 +70,19 @@ MozKeyboard.prototype = {
|
||||
},
|
||||
|
||||
setSelectedOption: function mozKeyboardSetSelectedOption(index) {
|
||||
messageManager.sendAsyncMessage("Forms:Select:Choice", {
|
||||
messageManager.broadcastAsyncMessage("Forms:Select:Choice", {
|
||||
"index": index
|
||||
});
|
||||
},
|
||||
|
||||
setValue: function mozKeyboardSetValue(value) {
|
||||
messageManager.sendAsyncMessage("Forms:Input:Value", {
|
||||
messageManager.broadcastAsyncMessage("Forms:Input:Value", {
|
||||
"value": value
|
||||
});
|
||||
},
|
||||
|
||||
setSelectedOptions: function mozKeyboardSetSelectedOptions(indexes) {
|
||||
messageManager.sendAsyncMessage("Forms:Select:Choice", {
|
||||
messageManager.broadcastAsyncMessage("Forms:Select:Choice", {
|
||||
"indexes": indexes || []
|
||||
});
|
||||
},
|
||||
|
@ -5,7 +5,7 @@
|
||||
MOZ_APP_BASENAME=B2G
|
||||
MOZ_APP_VENDOR=Mozilla
|
||||
|
||||
MOZ_APP_VERSION=17.0a1
|
||||
MOZ_APP_VERSION=18.0a1
|
||||
MOZ_APP_UA_NAME=Firefox
|
||||
|
||||
MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial
|
||||
|
@ -172,9 +172,9 @@ let SocialChatBar = {
|
||||
docElem.getAttribute("chromehidden").indexOf("extrachrome") >= 0;
|
||||
return Social.uiVisible && !chromeless;
|
||||
},
|
||||
newChat: function(aProvider, aURL, aCallback) {
|
||||
openChat: function(aProvider, aURL, aCallback, aMode) {
|
||||
if (this.canShow)
|
||||
this.chatbar.newChat(aProvider, aURL, aCallback);
|
||||
this.chatbar.openChat(aProvider, aURL, aCallback, aMode);
|
||||
},
|
||||
update: function() {
|
||||
if (!this.canShow)
|
||||
@ -293,6 +293,12 @@ let SocialFlyout = {
|
||||
}
|
||||
|
||||
let SocialShareButton = {
|
||||
// promptImages and promptMessages being null means we are yet to get the
|
||||
// message back from the provider with the images and icons (or that we got
|
||||
// the response but determined it was invalid.)
|
||||
promptImages: null,
|
||||
promptMessages: null,
|
||||
|
||||
// Called once, after window load, when the Social.provider object is initialized
|
||||
init: function SSB_init() {
|
||||
this.updateButtonHiddenState();
|
||||
@ -311,6 +317,61 @@ let SocialShareButton = {
|
||||
} else {
|
||||
profileRow.hidden = true;
|
||||
}
|
||||
// XXX - this shouldn't be done as part of updateProfileInfo, but instead
|
||||
// whenever we notice the provider has changed - but the concept of
|
||||
// "provider changed" will only exist once bug 774520 lands.
|
||||
this.promptImages = null;
|
||||
this.promptMessages = null;
|
||||
// get the recommend-prompt info.
|
||||
let port = Social.provider._getWorkerPort();
|
||||
if (port) {
|
||||
port.onmessage = function(evt) {
|
||||
if (evt.data.topic == "social.user-recommend-prompt-response") {
|
||||
port.close();
|
||||
this.acceptRecommendInfo(evt.data.data);
|
||||
this.updateButtonHiddenState();
|
||||
this.updateShareState();
|
||||
}
|
||||
}.bind(this);
|
||||
port.postMessage({topic: "social.user-recommend-prompt"});
|
||||
}
|
||||
},
|
||||
|
||||
acceptRecommendInfo: function SSB_acceptRecommendInfo(data) {
|
||||
// Accept *and validate* the user-recommend-prompt-response message.
|
||||
let promptImages = {};
|
||||
let promptMessages = {};
|
||||
function reportError(reason) {
|
||||
Cu.reportError("Invalid recommend data from provider: " + reason + ": sharing is disabled for this provider");
|
||||
return false;
|
||||
}
|
||||
if (!data ||
|
||||
!data.images || typeof data.images != "object" ||
|
||||
!data.messages || typeof data.messages != "object") {
|
||||
return reportError("data is missing valid 'images' or 'messages' elements");
|
||||
}
|
||||
for (let sub of ["share", "unshare"]) {
|
||||
let url = data.images[sub];
|
||||
if (!url || typeof url != "string" || url.length == 0) {
|
||||
return reportError('images["' + sub + '"] is missing or not a non-empty string');
|
||||
}
|
||||
// resolve potentially relative URLs then check the scheme is acceptable.
|
||||
url = Services.io.newURI(Social.provider.origin, null, null).resolve(url);
|
||||
let uri = Services.io.newURI(url, null, null);
|
||||
if (!uri.schemeIs("http") && !uri.schemeIs("https") && !uri.schemeIs("data")) {
|
||||
return reportError('images["' + sub + '"] does not have a valid scheme');
|
||||
}
|
||||
promptImages[sub] = url;
|
||||
}
|
||||
for (let sub of ["shareTooltip", "unshareTooltip", "sharedLabel", "unsharedLabel"]) {
|
||||
if (typeof data.messages[sub] != "string" || data.messages[sub].length == 0) {
|
||||
return reportError('messages["' + sub + '"] is not a valid string');
|
||||
}
|
||||
promptMessages[sub] = data.messages[sub];
|
||||
}
|
||||
this.promptImages = promptImages;
|
||||
this.promptMessages = promptMessages;
|
||||
return true;
|
||||
},
|
||||
|
||||
get shareButton() {
|
||||
@ -327,7 +388,7 @@ let SocialShareButton = {
|
||||
updateButtonHiddenState: function SSB_updateButtonHiddenState() {
|
||||
let shareButton = this.shareButton;
|
||||
if (shareButton)
|
||||
shareButton.hidden = !Social.uiVisible;
|
||||
shareButton.hidden = !Social.uiVisible || this.promptImages == null;
|
||||
},
|
||||
|
||||
onClick: function SSB_onClick(aEvent) {
|
||||
@ -370,23 +431,33 @@ let SocialShareButton = {
|
||||
// Provide a11y-friendly notification of share.
|
||||
let status = document.getElementById("share-button-status");
|
||||
if (status) {
|
||||
// XXX - this should also be capable of reflecting that the page was
|
||||
// unshared (ie, it needs to manage three-states: (1) nothing done, (2)
|
||||
// shared, (3) shared then unshared)
|
||||
// Note that we *do* have an appropriate string from the provider for
|
||||
// this (promptMessages['unsharedLabel'] but currently lack a way of
|
||||
// tracking this state)
|
||||
let statusString = currentPageShared ?
|
||||
gNavigatorBundle.getString("social.pageShared.label") : "";
|
||||
this.promptMessages['sharedLabel'] : "";
|
||||
status.setAttribute("value", statusString);
|
||||
}
|
||||
|
||||
// Update the share button, if present
|
||||
let shareButton = this.shareButton;
|
||||
if (!shareButton)
|
||||
if (!shareButton || shareButton.hidden)
|
||||
return;
|
||||
|
||||
let imageURL;
|
||||
if (currentPageShared) {
|
||||
shareButton.setAttribute("shared", "true");
|
||||
shareButton.setAttribute("tooltiptext", gNavigatorBundle.getString("social.shareButton.sharedtooltip"));
|
||||
shareButton.setAttribute("tooltiptext", this.promptMessages['unshareTooltip']);
|
||||
imageURL = this.promptImages["unshare"]
|
||||
} else {
|
||||
shareButton.removeAttribute("shared");
|
||||
shareButton.setAttribute("tooltiptext", gNavigatorBundle.getString("social.shareButton.tooltip"));
|
||||
shareButton.setAttribute("tooltiptext", this.promptMessages['shareTooltip']);
|
||||
imageURL = this.promptImages["share"]
|
||||
}
|
||||
shareButton.style.backgroundImage = 'url("' + encodeURI(imageURL) + '")';
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -64,6 +64,16 @@ tabbrowser {
|
||||
display: block; /* position:fixed already does this (bug 579776), but let's be explicit */
|
||||
}
|
||||
|
||||
.tabbrowser-tabs[movingtab] > .tabbrowser-tab[selected] {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
pointer-events: none; /* avoid blocking dragover events on scroll buttons */
|
||||
}
|
||||
|
||||
.tabbrowser-tabs[movingtab] > .tabbrowser-tab[fadein]:not([selected]) {
|
||||
transition: transform 200ms ease-out;
|
||||
}
|
||||
|
||||
#alltabs-popup {
|
||||
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-alltabs-popup");
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ const gSessionHistoryObserver = {
|
||||
fwdCommand.setAttribute("disabled", "true");
|
||||
|
||||
// Hide session restore button on about:home
|
||||
window.messageManager.sendAsyncMessage("Browser:HideSessionRestoreButton");
|
||||
window.messageManager.broadcastAsyncMessage("Browser:HideSessionRestoreButton");
|
||||
|
||||
if (gURLBar) {
|
||||
// Clear undo history of the URL bar
|
||||
|
@ -135,6 +135,7 @@
|
||||
<field name="selectedChat"/>
|
||||
|
||||
<field name="menuitemMap">new WeakMap()</field>
|
||||
<field name="chatboxForURL">new Map();</field>
|
||||
|
||||
<property name="firstCollapsedChild">
|
||||
<getter><![CDATA[
|
||||
@ -240,6 +241,7 @@
|
||||
}
|
||||
this.removeChild(aChatbox);
|
||||
this.resize();
|
||||
this.chatboxForURL.delete(aChatbox.getAttribute('src'));
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
@ -248,18 +250,36 @@
|
||||
while (this.firstChild) {
|
||||
this.removeChild(this.firstChild);
|
||||
}
|
||||
this.chatboxForURL = new Map();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="newChat">
|
||||
<method name="openChat">
|
||||
<parameter name="aProvider"/>
|
||||
<parameter name="aURL"/>
|
||||
<parameter name="aCallback"/>
|
||||
<parameter name="aMode"/>
|
||||
<body><![CDATA[
|
||||
let cb = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "chatbox");
|
||||
let cb = this.chatboxForURL.get(aURL);
|
||||
if (cb) {
|
||||
cb = cb.get();
|
||||
if (cb.parentNode) {
|
||||
// ensure this chatbox is visible
|
||||
if (this.selectedChat != cb)
|
||||
this.selectedChat = cb;
|
||||
if (cb.collapsed)
|
||||
this.showChat(cb);
|
||||
return;
|
||||
}
|
||||
this.chatboxForURL.delete(aURL);
|
||||
}
|
||||
cb = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "chatbox");
|
||||
if (aMode == "minimized")
|
||||
cb.minimized = true;
|
||||
this.selectedChat = cb;
|
||||
this.appendChild(cb);
|
||||
this.insertBefore(cb, this.firstChild);
|
||||
cb.init(aProvider, aURL, aCallback);
|
||||
this.chatboxForURL.set(aURL, Cu.getWeakReference(cb));
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
@ -3127,6 +3127,127 @@
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_animateTabMove">
|
||||
<parameter name="event"/>
|
||||
<body><![CDATA[
|
||||
let draggedTab = event.dataTransfer.mozGetDataAt(TAB_DROP_TYPE, 0);
|
||||
|
||||
if (this.getAttribute("movingtab") != "true") {
|
||||
this.setAttribute("movingtab", "true");
|
||||
this.selectedItem = draggedTab;
|
||||
}
|
||||
|
||||
if (!("animLastScreenX" in draggedTab._dragData))
|
||||
draggedTab._dragData.animLastScreenX = draggedTab._dragData.screenX;
|
||||
|
||||
let screenX = event.screenX;
|
||||
if (screenX == draggedTab._dragData.animLastScreenX)
|
||||
return;
|
||||
|
||||
let draggingRight = screenX > draggedTab._dragData.animLastScreenX;
|
||||
draggedTab._dragData.animLastScreenX = screenX;
|
||||
|
||||
let rtl = (window.getComputedStyle(this).direction == "rtl");
|
||||
let pinned = draggedTab.pinned;
|
||||
let numPinned = this.tabbrowser._numPinnedTabs;
|
||||
let tabs = this.tabbrowser.visibleTabs
|
||||
.slice(pinned ? 0 : numPinned,
|
||||
pinned ? numPinned : undefined);
|
||||
if (rtl)
|
||||
tabs.reverse();
|
||||
let tabWidth = draggedTab.getBoundingClientRect().width;
|
||||
|
||||
// Move the dragged tab based on the mouse position.
|
||||
|
||||
let leftTab = tabs[0];
|
||||
let rightTab = tabs[tabs.length - 1];
|
||||
let tabScreenX = draggedTab.boxObject.screenX;
|
||||
let translateX = screenX - draggedTab._dragData.screenX;
|
||||
if (!pinned)
|
||||
translateX += this.mTabstrip.scrollPosition - draggedTab._dragData.scrollX;
|
||||
let leftBound = leftTab.boxObject.screenX - tabScreenX;
|
||||
let rightBound = (rightTab.boxObject.screenX + rightTab.boxObject.width) -
|
||||
(tabScreenX + tabWidth);
|
||||
translateX = Math.max(translateX, leftBound);
|
||||
translateX = Math.min(translateX, rightBound);
|
||||
draggedTab.style.transform = "translateX(" + translateX + "px)";
|
||||
|
||||
// Determine what tab we're dragging over.
|
||||
// * Point of reference is the center of the dragged tab. If that
|
||||
// point touches a background tab, the dragged tab would take that
|
||||
// tab's position when dropped.
|
||||
// * We're doing a binary search in order to reduce the amount of
|
||||
// tabs we need to check.
|
||||
|
||||
let tabCenter = tabScreenX + translateX + tabWidth / 2;
|
||||
let newIndex = -1;
|
||||
let oldIndex = "animDropIndex" in draggedTab._dragData ?
|
||||
draggedTab._dragData.animDropIndex : draggedTab._tPos;
|
||||
let low = 0;
|
||||
let high = tabs.length - 1;
|
||||
while (low <= high) {
|
||||
let mid = Math.floor((low + high) / 2);
|
||||
if (tabs[mid] == draggedTab &&
|
||||
++mid > high)
|
||||
break;
|
||||
let boxObject = tabs[mid].boxObject;
|
||||
let screenX = boxObject.screenX + getTabShift(tabs[mid], oldIndex);
|
||||
if (screenX > tabCenter) {
|
||||
high = mid - 1;
|
||||
} else if (screenX + boxObject.width < tabCenter) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
newIndex = tabs[mid]._tPos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newIndex >= oldIndex)
|
||||
newIndex++;
|
||||
if (newIndex < 0 || newIndex == oldIndex)
|
||||
return;
|
||||
draggedTab._dragData.animDropIndex = newIndex;
|
||||
|
||||
// Shift background tabs to leave a gap where the dragged tab
|
||||
// would currently be dropped.
|
||||
|
||||
for (let tab of tabs) {
|
||||
if (tab != draggedTab) {
|
||||
let shift = getTabShift(tab, newIndex);
|
||||
tab.style.transform = shift ? "translateX(" + shift + "px)" : "";
|
||||
}
|
||||
}
|
||||
|
||||
function getTabShift(tab, dropIndex) {
|
||||
if (tab._tPos < draggedTab._tPos && tab._tPos >= dropIndex)
|
||||
return rtl ? -tabWidth : tabWidth;
|
||||
if (tab._tPos > draggedTab._tPos && tab._tPos < dropIndex)
|
||||
return rtl ? tabWidth : -tabWidth;
|
||||
return 0;
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_finishAnimateTabMove">
|
||||
<parameter name="event"/>
|
||||
<body><![CDATA[
|
||||
if (this.getAttribute("movingtab") != "true")
|
||||
return;
|
||||
|
||||
let draggedTab = event.dataTransfer.mozGetDataAt(TAB_DROP_TYPE, 0);
|
||||
if ("animDropIndex" in draggedTab._dragData) {
|
||||
let newIndex = draggedTab._dragData.animDropIndex;
|
||||
if (newIndex > draggedTab._tPos)
|
||||
newIndex--;
|
||||
this.tabbrowser.moveTabTo(draggedTab, newIndex);
|
||||
}
|
||||
|
||||
for (let tab of this.tabbrowser.visibleTabs)
|
||||
tab.style.transform = "";
|
||||
|
||||
this.removeAttribute("movingtab");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="handleEvent">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
@ -3258,17 +3379,14 @@
|
||||
var sourceNode = dt.mozGetDataAt(TAB_DROP_TYPE, 0);
|
||||
if (sourceNode instanceof XULElement &&
|
||||
sourceNode.localName == "tab" &&
|
||||
(sourceNode.parentNode == this ||
|
||||
(sourceNode.ownerDocument.defaultView instanceof ChromeWindow &&
|
||||
sourceNode.ownerDocument.documentElement.getAttribute("windowtype") == "navigator:browser"))) {
|
||||
if (sourceNode.parentNode == this &&
|
||||
(event.screenX >= sourceNode.boxObject.screenX &&
|
||||
event.screenX <= (sourceNode.boxObject.screenX +
|
||||
sourceNode.boxObject.width))) {
|
||||
return dt.effectAllowed = "none";
|
||||
}
|
||||
|
||||
return dt.effectAllowed = "copyMove";
|
||||
sourceNode.ownerDocument.defaultView instanceof ChromeWindow &&
|
||||
sourceNode.ownerDocument.documentElement.getAttribute("windowtype") == "navigator:browser" &&
|
||||
sourceNode.ownerDocument.defaultView.gBrowser.tabContainer == sourceNode.parentNode) {
|
||||
#ifdef XP_MACOSX
|
||||
return dt.effectAllowed = event.altKey ? "copy" : "move";
|
||||
#else
|
||||
return dt.effectAllowed = event.ctrlKey ? "copy" : "move";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -3280,20 +3398,6 @@
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_continueScroll">
|
||||
<parameter name="event"/>
|
||||
<body><![CDATA[
|
||||
// Workaround for bug 481904: Dragging a tab stops scrolling at
|
||||
// the tab's position when dragging to the first/last tab and back.
|
||||
var t = this.selectedItem;
|
||||
if (event.screenX >= t.boxObject.screenX &&
|
||||
event.screenX <= t.boxObject.screenX + t.boxObject.width &&
|
||||
event.screenY >= t.boxObject.screenY &&
|
||||
event.screenY <= t.boxObject.screenY + t.boxObject.height)
|
||||
this.mTabstrip.ensureElementIsVisible(t);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_handleNewTab">
|
||||
<parameter name="tab"/>
|
||||
<body><![CDATA[
|
||||
@ -3454,29 +3558,26 @@
|
||||
|
||||
// Create a canvas to which we capture the current tab.
|
||||
let canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
||||
canvas.mozOpaque = true;
|
||||
|
||||
// We want drag images to be about 1/6th of the available screen width.
|
||||
const widthFactor = 0.1739; // 1:5.75 inverse
|
||||
canvas.width = Math.ceil(screen.availWidth * widthFactor);
|
||||
|
||||
// Maintain a 16:9 aspect ratio for drag images.
|
||||
const aspectRatio = 0.5625; // 16:9 inverse
|
||||
canvas.height = Math.round(canvas.width * aspectRatio);
|
||||
|
||||
let browser = tab.linkedBrowser;
|
||||
canvas.mozOpaque = true;
|
||||
canvas.width = 160;
|
||||
canvas.height = 90;
|
||||
PageThumbs.captureToCanvas(browser.contentWindow, canvas);
|
||||
dt.setDragImage(canvas, 0, 0);
|
||||
|
||||
// _dragOffsetX/Y give the coordinates that the mouse should be
|
||||
// _dragData.offsetX/Y give the coordinates that the mouse should be
|
||||
// positioned relative to the corner of the new window created upon
|
||||
// dragend such that the mouse appears to have the same position
|
||||
// relative to the corner of the dragged tab.
|
||||
function clientX(ele) ele.getBoundingClientRect().left;
|
||||
let tabOffsetX = clientX(tab) -
|
||||
clientX(this.children[0].pinned ? this.children[0] : this);
|
||||
tab._dragOffsetX = event.screenX - window.screenX - tabOffsetX;
|
||||
tab._dragOffsetY = event.screenY - window.screenY;
|
||||
tab._dragData = {
|
||||
offsetX: event.screenX - window.screenX - tabOffsetX,
|
||||
offsetY: event.screenY - window.screenY,
|
||||
scrollX: this.mTabstrip.scrollPosition,
|
||||
screenX: event.screenX
|
||||
};
|
||||
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
@ -3487,7 +3588,6 @@
|
||||
var ind = this._tabDropIndicator;
|
||||
if (effects == "" || effects == "none") {
|
||||
ind.collapsed = true;
|
||||
this._continueScroll(event);
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
@ -3514,6 +3614,15 @@
|
||||
tabStrip.scrollByPixels((ltr ? 1 : -1) * pixelsToScroll);
|
||||
}
|
||||
|
||||
if (effects == "move" &&
|
||||
this == event.dataTransfer.mozGetDataAt(TAB_DROP_TYPE, 0).parentNode) {
|
||||
ind.collapsed = true;
|
||||
this._animateTabMove(event);
|
||||
return;
|
||||
}
|
||||
|
||||
this._finishAnimateTabMove(event);
|
||||
|
||||
if (effects == "link") {
|
||||
let tab = this._getDragTargetTab(event);
|
||||
if (tab) {
|
||||
@ -3581,31 +3690,15 @@
|
||||
|
||||
this._tabDropIndicator.collapsed = true;
|
||||
event.stopPropagation();
|
||||
|
||||
if (draggedTab && (dropEffect == "copy" ||
|
||||
draggedTab.parentNode == this)) {
|
||||
if (draggedTab && dropEffect == "copy") {
|
||||
// copy the dropped tab (wherever it's from)
|
||||
let newIndex = this._getDropIndex(event);
|
||||
if (dropEffect == "copy") {
|
||||
// copy the dropped tab (wherever it's from)
|
||||
let newTab = this.tabbrowser.duplicateTab(draggedTab);
|
||||
this.tabbrowser.moveTabTo(newTab, newIndex);
|
||||
if (draggedTab.parentNode != this || event.shiftKey)
|
||||
this.selectedItem = newTab;
|
||||
} else {
|
||||
// move the dropped tab
|
||||
if (newIndex > draggedTab._tPos)
|
||||
newIndex--;
|
||||
|
||||
if (draggedTab.pinned) {
|
||||
if (newIndex >= this.tabbrowser._numPinnedTabs)
|
||||
this.tabbrowser.unpinTab(draggedTab);
|
||||
} else {
|
||||
if (newIndex <= this.tabbrowser._numPinnedTabs - 1)
|
||||
this.tabbrowser.pinTab(draggedTab);
|
||||
}
|
||||
|
||||
this.tabbrowser.moveTabTo(draggedTab, newIndex);
|
||||
}
|
||||
let newTab = this.tabbrowser.duplicateTab(draggedTab);
|
||||
this.tabbrowser.moveTabTo(newTab, newIndex);
|
||||
if (draggedTab.parentNode != this || event.shiftKey)
|
||||
this.selectedItem = newTab;
|
||||
} else if (draggedTab && draggedTab.parentNode == this) {
|
||||
this._finishAnimateTabMove(event);
|
||||
} else if (draggedTab) {
|
||||
// swap the dropped tab with a new one we create and then close
|
||||
// it in the other window (making it seem to have moved between
|
||||
@ -3618,6 +3711,9 @@
|
||||
// make sure it has a docshell
|
||||
newBrowser.docShell;
|
||||
|
||||
let numPinned = this.tabbrowser._numPinnedTabs;
|
||||
if (newIndex < numPinned || draggedTab.pinned && newIndex == numPinned)
|
||||
this.tabbrowser.pinTab(newTab);
|
||||
this.tabbrowser.moveTabTo(newTab, newIndex);
|
||||
|
||||
this.tabbrowser.swapBrowsersAndCloseOther(newTab, draggedTab);
|
||||
@ -3660,11 +3756,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
// these offsets are only used in dragend, but we need to free them here
|
||||
// as well
|
||||
if (draggedTab) {
|
||||
delete draggedTab._dragOffsetX;
|
||||
delete draggedTab._dragOffsetY;
|
||||
delete draggedTab._dragData;
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
@ -3673,10 +3766,14 @@
|
||||
// isn't dispatched when the tab is moved within the tabstrip,
|
||||
// see bug 460801.
|
||||
|
||||
// * mozUserCancelled = the user pressed ESC to cancel the drag
|
||||
this._finishAnimateTabMove(event);
|
||||
|
||||
var dt = event.dataTransfer;
|
||||
if (dt.mozUserCancelled || dt.dropEffect != "none")
|
||||
var draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0);
|
||||
if (dt.mozUserCancelled || dt.dropEffect != "none") {
|
||||
delete draggedTab._dragData;
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable detach within the browser toolbox
|
||||
var eX = event.screenX;
|
||||
@ -3692,7 +3789,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0);
|
||||
// screen.availLeft et. al. only check the screen that this window is on,
|
||||
// but we want to look at the screen the tab is being dropped onto.
|
||||
var sX = {}, sY = {}, sWidth = {}, sHeight = {};
|
||||
@ -3703,13 +3799,12 @@
|
||||
// ensure new window entirely within screen
|
||||
var winWidth = Math.min(window.outerWidth, sWidth.value);
|
||||
var winHeight = Math.min(window.outerHeight, sHeight.value);
|
||||
var left = Math.min(Math.max(eX - draggedTab._dragOffsetX, sX.value),
|
||||
var left = Math.min(Math.max(eX - draggedTab._dragData.offsetX, sX.value),
|
||||
sX.value + sWidth.value - winWidth);
|
||||
var top = Math.min(Math.max(eY - draggedTab._dragOffsetY, sY.value),
|
||||
var top = Math.min(Math.max(eY - draggedTab._dragData.offsetY, sY.value),
|
||||
sY.value + sHeight.value - winHeight);
|
||||
|
||||
delete draggedTab._dragOffsetX;
|
||||
delete draggedTab._dragOffsetY;
|
||||
delete draggedTab._dragData;
|
||||
|
||||
if (this.tabbrowser.tabs.length == 1) {
|
||||
// resize _before_ move to ensure the window fits the new screen. if
|
||||
@ -3741,7 +3836,6 @@
|
||||
return;
|
||||
|
||||
this._tabDropIndicator.collapsed = true;
|
||||
this._continueScroll(event);
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
</handlers>
|
||||
|
@ -268,6 +268,7 @@ _BROWSER_FILES = \
|
||||
browser_social_isVisible.js \
|
||||
browser_social_chatwindow.js \
|
||||
social_panel.html \
|
||||
social_share_image.png \
|
||||
social_sidebar.html \
|
||||
social_chat.html \
|
||||
social_flyout.html \
|
||||
|
@ -55,7 +55,7 @@ var tests = {
|
||||
break;
|
||||
}
|
||||
}
|
||||
port.postMessage({topic: "test-init"});
|
||||
port.postMessage({topic: "test-init", data: { id: 1 }});
|
||||
},
|
||||
testManyChats: function(next) {
|
||||
// open enough chats to overflow the window, then check
|
||||
@ -87,8 +87,26 @@ var tests = {
|
||||
}
|
||||
let num = numToOpen;
|
||||
while (num-- > 0) {
|
||||
port.postMessage({topic: "test-chatbox-open"});
|
||||
port.postMessage({topic: "test-chatbox-open", data: { id: num }});
|
||||
}
|
||||
},
|
||||
testWorkerChatWindow: function(next) {
|
||||
let port = Social.provider.port;
|
||||
ok(port, "provider has a port");
|
||||
port.onmessage = function (e) {
|
||||
let topic = e.data.topic;
|
||||
switch (topic) {
|
||||
case "got-chatbox-message":
|
||||
ok(true, "got a chat window opened");
|
||||
let chats = document.getElementById("pinnedchats");
|
||||
while (chats.selectedChat) {
|
||||
chats.selectedChat.close();
|
||||
}
|
||||
ok(!chats.selectedChat, "chats are all closed");
|
||||
next();
|
||||
break;
|
||||
}
|
||||
}
|
||||
port.postMessage({topic: "test-worker-chat" });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@ var tests = {
|
||||
ok(true, "panel hidden");
|
||||
next();
|
||||
}
|
||||
break;
|
||||
case "got-sidebar-message":
|
||||
// The sidebar message will always come first, since it loads by default
|
||||
ok(true, "got sidebar message");
|
||||
@ -82,50 +83,5 @@ var tests = {
|
||||
});
|
||||
}, "social:ambient-notification-changed", false);
|
||||
}
|
||||
},
|
||||
|
||||
testServiceWindow: function(next) {
|
||||
// our test provider was initialized in the test above, we just
|
||||
// initiate our specific test now.
|
||||
let port = Social.provider.port;
|
||||
ok(port, "provider has a port");
|
||||
port.postMessage({topic: "test-service-window"});
|
||||
port.onmessage = function (e) {
|
||||
let topic = e.data.topic;
|
||||
switch (topic) {
|
||||
case "got-service-window-message":
|
||||
// The sidebar message will always come first, since it loads by default
|
||||
ok(true, "got service window message");
|
||||
// the service window URL should not be stored in history.
|
||||
ensureSocialUrlNotRemembered(e.data.location);
|
||||
port.postMessage({topic: "test-close-service-window"});
|
||||
break;
|
||||
case "got-service-window-closed-message":
|
||||
ok(true, "got service window closed message");
|
||||
next();
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
testServiceWindowTwice: function(next) {
|
||||
let port = Social.provider.port;
|
||||
port.postMessage({topic: "test-service-window-twice"});
|
||||
Social.provider.port.onmessage = function (e) {
|
||||
let topic = e.data.topic;
|
||||
switch (topic) {
|
||||
case "test-service-window-twice-result":
|
||||
is(e.data.result, "ok", "only one window should open when name is reused");
|
||||
break;
|
||||
case "got-service-window-message":
|
||||
ok(true, "got service window message");
|
||||
port.postMessage({topic: "test-close-service-window"});
|
||||
break;
|
||||
case "got-service-window-closed-message":
|
||||
ok(true, "got service window closed message");
|
||||
next();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,11 +48,12 @@ function testInitial(finishcb) {
|
||||
|
||||
let okButton = document.getElementById("editSharePopupOkButton");
|
||||
let undoButton = document.getElementById("editSharePopupUndoButton");
|
||||
let shareStatusLabel = document.getElementById("share-button-status");
|
||||
|
||||
// ensure the worker initialization and handshakes are all done and we
|
||||
// have a profile.
|
||||
waitForCondition(function() Social.provider.profile, function() {
|
||||
is(shareButton.hidden, false, "share button should be visible");
|
||||
// have a profile and the worker has responsed to the recommend-prompt msg.
|
||||
waitForCondition(function() Social.provider.profile && SocialShareButton.promptImages != null, function() {
|
||||
is(shareButton.hasAttribute("shared"), false, "Share button should not have 'shared' attribute before share button is clicked");
|
||||
// check dom values
|
||||
let profile = Social.provider.profile;
|
||||
let portrait = document.getElementById("socialUserPortrait").getAttribute("src");
|
||||
@ -61,14 +62,24 @@ function testInitial(finishcb) {
|
||||
is(displayName.label, profile.displayName, "display name is set");
|
||||
ok(!document.getElementById("editSharePopupHeader").hidden, "user profile is visible");
|
||||
|
||||
// Check the strings from our worker actually ended up on the button.
|
||||
is(shareButton.getAttribute("tooltiptext"), "Share this page", "check tooltip text is correct");
|
||||
is(shareStatusLabel.getAttribute("value"), "", "check status label text is blank");
|
||||
// Check the relative URL was resolved correctly (note this image has offsets of zero...)
|
||||
is(shareButton.style.backgroundImage, 'url("https://example.com/browser/browser/base/content/test/social_share_image.png")', "check image url is correct");
|
||||
|
||||
// Test clicking the share button
|
||||
shareButton.addEventListener("click", function listener() {
|
||||
shareButton.removeEventListener("click", listener);
|
||||
is(shareButton.hasAttribute("shared"), true, "Share button should have 'shared' attribute after share button is clicked");
|
||||
is(shareButton.getAttribute("tooltiptext"), "Unshare this page", "check tooltip text is correct");
|
||||
is(shareStatusLabel.getAttribute("value"), "This page has been shared", "check status label text is correct");
|
||||
// Check the URL and offsets were applied correctly
|
||||
is(shareButton.style.backgroundImage, 'url("https://example.com/browser/browser/base/content/test/social_share_image.png")', "check image url is correct");
|
||||
executeSoon(testSecondClick.bind(window, testPopupOKButton));
|
||||
});
|
||||
EventUtils.synthesizeMouseAtCenter(shareButton, {});
|
||||
}, "provider didn't provide a profile");
|
||||
}, "provider didn't provide user-recommend-prompt response");
|
||||
}
|
||||
|
||||
function testSecondClick(nextTest) {
|
||||
|
@ -134,6 +134,15 @@ function runSocialTestWithProvider(manifest, callback) {
|
||||
Services.prefs.setBoolPref("social.enabled", true);
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
// if one test happens to fail, it is likely finishSocialTest will not
|
||||
// be called, causing most future social tests to also fail as they
|
||||
// attempt to add a provider which already exists - so work
|
||||
// around that by also attempting to remove the test provider.
|
||||
try {
|
||||
SocialService.removeProvider(provider.origin, finish);
|
||||
} catch (ex) {
|
||||
;
|
||||
}
|
||||
Social.provider = oldProvider;
|
||||
Services.prefs.clearUserPref("social.enabled");
|
||||
});
|
||||
|
BIN
browser/base/content/test/social_share_image.png
Normal file
After Width: | Height: | Size: 934 B |
@ -2,7 +2,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script>
|
||||
var win;
|
||||
var testwindow;
|
||||
function pingWorker() {
|
||||
var port = navigator.mozSocial.getWorker().port;
|
||||
port.onmessage = function(e) {
|
||||
@ -12,32 +12,19 @@
|
||||
navigator.mozSocial.openPanel("social_flyout.html");
|
||||
break;
|
||||
case "test-chatbox-open":
|
||||
navigator.mozSocial.openChatWindow("social_chat.html", function(chatwin) {
|
||||
port.postMessage({topic: "chatbox-opened", result: chatwin ? "ok" : "failed"});
|
||||
var url = "social_chat.html";
|
||||
var data = e.data.data;
|
||||
if (data && data.id) {
|
||||
url = url + "?id="+data.id;
|
||||
}
|
||||
navigator.mozSocial.openChatWindow(url, function(chatwin) {
|
||||
port.postMessage({topic: "chatbox-opened",
|
||||
result: chatwin ? "ok" : "failed"});
|
||||
});
|
||||
break;
|
||||
case "test-service-window":
|
||||
win = navigator.mozSocial.openServiceWindow("social_window.html", "test-service-window", "width=300,height=300");
|
||||
break;
|
||||
case "test-service-window-twice":
|
||||
win = navigator.mozSocial.openServiceWindow("social_window.html", "test-service-window", "width=300,height=300");
|
||||
var win2 = navigator.mozSocial.openServiceWindow("social_window.html", "test-service-window", "");
|
||||
var result;
|
||||
if (win == win2)
|
||||
result = "ok";
|
||||
else
|
||||
result = "not ok: " + win2 + " != " + win;
|
||||
port.postMessage({topic: "test-service-window-twice-result", result: result});
|
||||
break;
|
||||
case "test-close-service-window":
|
||||
win.addEventListener("unload", function watchClose() {
|
||||
win.removeEventListener("unload", watchClose);
|
||||
port.postMessage({topic: "service-window-closed-message", result: "ok"});
|
||||
}, false)
|
||||
win.close();
|
||||
break;
|
||||
case "test-isVisible":
|
||||
port.postMessage({topic: "test-isVisible-response", result: navigator.mozSocial.isVisible});
|
||||
port.postMessage({topic: "test-isVisible-response",
|
||||
result: navigator.mozSocial.isVisible});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
let testPort, sidebarPort;
|
||||
let testPort, sidebarPort, apiPort;
|
||||
|
||||
onconnect = function(e) {
|
||||
let port = e.ports[0];
|
||||
@ -46,7 +46,7 @@ onconnect = function(e) {
|
||||
testPort.postMessage({topic:"got-social-panel-visibility", result: event.data.result });
|
||||
break;
|
||||
case "test-chatbox-open":
|
||||
sidebarPort.postMessage({topic:"test-chatbox-open"});
|
||||
sidebarPort.postMessage( event.data );
|
||||
break;
|
||||
case "chatbox-message":
|
||||
testPort.postMessage({topic:"got-chatbox-message", result: event.data.result});
|
||||
@ -63,8 +63,12 @@ onconnect = function(e) {
|
||||
case "flyout-visibility":
|
||||
testPort.postMessage({topic:"got-flyout-visibility", result: event.data.result});
|
||||
break;
|
||||
case "test-worker-chat":
|
||||
apiPort.postMessage({topic: "social.request-chat", data: "https://example.com/browser/browser/base/content/test/social_chat.html" });
|
||||
break;
|
||||
case "social.initialize":
|
||||
// This is the workerAPI port, respond and set up a notification icon.
|
||||
apiPort = port;
|
||||
port.postMessage({topic: "social.initialize-response"});
|
||||
let profile = {
|
||||
portrait: "https://example.com/portrait.jpg",
|
||||
@ -87,6 +91,25 @@ onconnect = function(e) {
|
||||
case "test-isVisible-response":
|
||||
testPort.postMessage({topic: "got-isVisible-response", result: event.data.result});
|
||||
break;
|
||||
case "social.user-recommend-prompt":
|
||||
port.postMessage({
|
||||
topic: "social.user-recommend-prompt-response",
|
||||
data: {
|
||||
images: {
|
||||
// this one is relative to test we handle relative ones.
|
||||
share: "browser/browser/base/content/test/social_share_image.png",
|
||||
// absolute to check we handle them too.
|
||||
unshare: "https://example.com/browser/browser/base/content/test/social_share_image.png"
|
||||
},
|
||||
messages: {
|
||||
shareTooltip: "Share this page",
|
||||
unshareTooltip: "Unshare this page",
|
||||
sharedLabel: "This page has been shared",
|
||||
unsharedLabel: "This page is no longer shared",
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
17.0a1
|
||||
18.0a1
|
||||
|
@ -372,10 +372,6 @@ fullscreen.entered=%S is now fullscreen.
|
||||
# LOCALIZATION NOTE (fullscreen.rememberDecision): displayed when we enter HTML5 fullscreen mode, %S is the domain name of the focused website (e.g. mozilla.com).
|
||||
fullscreen.rememberDecision=Remember decision for %S
|
||||
|
||||
social.shareButton.tooltip=Share this
|
||||
social.shareButton.sharedtooltip=You shared this
|
||||
social.pageShared.label=Page shared
|
||||
|
||||
# LOCALIZATION NOTE (social.toggle.label): %1$S is the name of the social provider, %2$S is brandShortName (e.g. Firefox)
|
||||
social.toggle.label=%1$S for %2$S
|
||||
social.toggle.accesskey=f
|
||||
|
@ -1373,15 +1373,8 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
||||
/* social recommending panel */
|
||||
|
||||
#share-button {
|
||||
list-style-image: url(chrome://browser/skin/share-button.png);
|
||||
}
|
||||
|
||||
#share-button:not([shared]):not([disabled]):hover {
|
||||
list-style-image: url(chrome://browser/skin/share-button-active.png);
|
||||
}
|
||||
|
||||
#share-button[shared] {
|
||||
list-style-image: url(chrome://browser/skin/share-button-shared.png);
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
#socialUserPortrait {
|
||||
@ -2813,7 +2806,6 @@ stack[anonid=browserStack][responsivemode] {
|
||||
box-shadow: inset 0 2px 5px rgba(0,0,0,0.6), 0 1px rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
/* toolbarbutton-icon */
|
||||
.chatbar-button > .toolbarbutton-text,
|
||||
.chatbar-button > .toolbarbutton-menu-dropmarker {
|
||||
display: none;
|
||||
@ -2821,24 +2813,24 @@ stack[anonid=browserStack][responsivemode] {
|
||||
|
||||
.chatbar-innerbox {
|
||||
background: transparent;
|
||||
margin: -200px -1px 0 -1px;
|
||||
margin: -285px -1px 0 -1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
chatbar > chatbox {
|
||||
height: 200px;
|
||||
width: 200px;
|
||||
chatbar {
|
||||
-moz-margin-end: 20px;
|
||||
}
|
||||
|
||||
chatbox {
|
||||
height: 285px;
|
||||
width: 260px;
|
||||
-moz-margin-start: 4px;
|
||||
background-color: white;
|
||||
border: 1px solid gray;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
chatbar > chatbox[minimized="true"] {
|
||||
width: 100px;
|
||||
chatbox[minimized="true"] {
|
||||
width: 160px;
|
||||
height: 20px;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
chatbar > chatbox + chatbox {
|
||||
-moz-margin-start: -1px;
|
||||
}
|
||||
|
@ -39,9 +39,6 @@ browser.jar:
|
||||
skin/classic/browser/Secure.png
|
||||
skin/classic/browser/Security-broken.png
|
||||
skin/classic/browser/setDesktopBackground.css
|
||||
skin/classic/browser/share-button.png
|
||||
skin/classic/browser/share-button-active.png
|
||||
skin/classic/browser/share-button-shared.png
|
||||
skin/classic/browser/Toolbar.png
|
||||
skin/classic/browser/Toolbar-small.png
|
||||
skin/classic/browser/urlbar-arrow.png
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB |
@ -1245,15 +1245,8 @@ window[tabsontop="false"] richlistitem[type~="action"][actiontype="switchtab"][s
|
||||
/* social recommending panel */
|
||||
|
||||
#share-button {
|
||||
list-style-image: url(chrome://browser/skin/share-button.png);
|
||||
}
|
||||
|
||||
#share-button:not([shared]):not([disabled]):hover {
|
||||
list-style-image: url(chrome://browser/skin/share-button-active.png);
|
||||
}
|
||||
|
||||
#share-button[shared] {
|
||||
list-style-image: url(chrome://browser/skin/share-button-shared.png);
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
#socialUserPortrait {
|
||||
@ -3502,7 +3495,6 @@ stack[anonid=browserStack][responsivemode] {
|
||||
box-shadow: inset 0 2px 5px rgba(0,0,0,0.6), 0 1px rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
/* toolbarbutton-icon */
|
||||
.chatbar-button > .toolbarbutton-text,
|
||||
.chatbar-button > .toolbarbutton-menu-dropmarker {
|
||||
display: none;
|
||||
@ -3510,25 +3502,24 @@ stack[anonid=browserStack][responsivemode] {
|
||||
|
||||
.chatbar-innerbox {
|
||||
background: transparent;
|
||||
margin: -200px -1px 0 -1px;
|
||||
margin: -285px -1px 0 -1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
chatbar > chatbox {
|
||||
height: 200px;
|
||||
width: 200px;
|
||||
chatbar {
|
||||
-moz-margin-end: 20px;
|
||||
}
|
||||
|
||||
chatbox {
|
||||
height: 285px;
|
||||
width: 260px;
|
||||
-moz-margin-start: 4px;
|
||||
background-color: white;
|
||||
border: 1px solid #404040;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
chatbar > chatbox[minimized="true"] {
|
||||
width: 100px;
|
||||
chatbox[minimized="true"] {
|
||||
width: 160px;
|
||||
height: 20px;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
chatbar > chatbox + chatbox {
|
||||
-moz-margin-start: -1px;
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,6 @@ browser.jar:
|
||||
skin/classic/browser/newtab/controls.png (newtab/controls.png)
|
||||
skin/classic/browser/newtab/noise.png (newtab/noise.png)
|
||||
skin/classic/browser/setDesktopBackground.css
|
||||
skin/classic/browser/share-button.png
|
||||
skin/classic/browser/share-button-active.png
|
||||
skin/classic/browser/share-button-shared.png
|
||||
skin/classic/browser/monitor.png
|
||||
skin/classic/browser/monitor_16-10.png
|
||||
skin/classic/browser/places/allBookmarks.png (places/allBookmarks.png)
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB |
@ -1636,15 +1636,8 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
||||
/* social recommending panel */
|
||||
|
||||
#share-button {
|
||||
list-style-image: url(chrome://browser/skin/share-button.png);
|
||||
}
|
||||
|
||||
#share-button:not([shared]):not([disabled]):hover {
|
||||
list-style-image: url(chrome://browser/skin/share-button-active.png);
|
||||
}
|
||||
|
||||
#share-button[shared] {
|
||||
list-style-image: url(chrome://browser/skin/share-button-shared.png);
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
#socialUserPortrait {
|
||||
@ -3525,7 +3518,6 @@ stack[anonid=browserStack][responsivemode] {
|
||||
box-shadow: inset 0 2px 5px rgba(0,0,0,0.6), 0 1px rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
/* toolbarbutton-icon */
|
||||
.chatbar-button > .toolbarbutton-text,
|
||||
.chatbar-button > .toolbarbutton-menu-dropmarker {
|
||||
display: none;
|
||||
@ -3533,25 +3525,24 @@ stack[anonid=browserStack][responsivemode] {
|
||||
|
||||
.chatbar-innerbox {
|
||||
background: transparent;
|
||||
margin: -200px -1px 0 -1px;
|
||||
margin: -285px -1px 0 -1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
chatbar > chatbox {
|
||||
height: 200px;
|
||||
width: 200px;
|
||||
chatbar {
|
||||
-moz-margin-end: 20px;
|
||||
}
|
||||
|
||||
chatbox {
|
||||
height: 285px;
|
||||
width: 260px;
|
||||
-moz-margin-start: 4px;
|
||||
background-color: white;
|
||||
border: 1px solid gray;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
chatbar > chatbox[minimized="true"] {
|
||||
width: 100px;
|
||||
chatbox[minimized="true"] {
|
||||
width: 160px;
|
||||
height: 20px;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
chatbar > chatbox + chatbox {
|
||||
-moz-margin-start: -1px;
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,6 @@ browser.jar:
|
||||
skin/classic/browser/searchbar.css (searchbar.css)
|
||||
skin/classic/browser/searchbar-dropdown-arrow.png
|
||||
skin/classic/browser/setDesktopBackground.css
|
||||
skin/classic/browser/share-button.png
|
||||
skin/classic/browser/share-button-active.png
|
||||
skin/classic/browser/share-button-shared.png
|
||||
skin/classic/browser/menu-back.png (menu-back.png)
|
||||
skin/classic/browser/menu-forward.png (menu-forward.png)
|
||||
skin/classic/browser/monitor.png
|
||||
@ -254,9 +251,6 @@ browser.jar:
|
||||
skin/classic/aero/browser/searchbar.css (searchbar.css)
|
||||
skin/classic/aero/browser/searchbar-dropdown-arrow.png (searchbar-dropdown-arrow-aero.png)
|
||||
skin/classic/aero/browser/setDesktopBackground.css
|
||||
skin/classic/aero/browser/share-button.png
|
||||
skin/classic/aero/browser/share-button-active.png
|
||||
skin/classic/aero/browser/share-button-shared.png
|
||||
skin/classic/aero/browser/menu-back.png (menu-back-aero.png)
|
||||
skin/classic/aero/browser/menu-forward.png (menu-forward-aero.png)
|
||||
skin/classic/aero/browser/monitor.png
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB |
@ -70,6 +70,8 @@ def build_one_stage(env, stage_dir, is_stage_one):
|
||||
build_one_stage_aux(stage_dir, is_stage_one)
|
||||
with_env(env, f)
|
||||
|
||||
isDarwin = platform.system() == "Darwin"
|
||||
|
||||
def build_one_stage_aux(stage_dir, is_stage_one):
|
||||
os.mkdir(stage_dir)
|
||||
|
||||
@ -80,12 +82,11 @@ def build_one_stage_aux(stage_dir, is_stage_one):
|
||||
"--disable-assertions",
|
||||
"--prefix=%s" % inst_dir,
|
||||
"--with-gcc-toolchain=/tools/gcc-4.5-0moz3"]
|
||||
if is_stage_one:
|
||||
if is_stage_one and not isDarwin:
|
||||
configure_opts.append("--with-optimize-option=-O0")
|
||||
|
||||
build_package(llvm_source_dir, build_dir, configure_opts)
|
||||
|
||||
isDarwin = platform.system() == "Darwin"
|
||||
if isDarwin:
|
||||
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
|
||||
|
||||
|
@ -10,4 +10,4 @@
|
||||
# hardcoded milestones in the tree from these two files.
|
||||
#--------------------------------------------------------
|
||||
|
||||
17.0a1
|
||||
18.0a1
|
||||
|
@ -81,7 +81,7 @@ XPIDLSRCS = \
|
||||
nsIFrameLoader.idl \
|
||||
nsIXMLHttpRequest.idl \
|
||||
nsIContentSecurityPolicy.idl \
|
||||
nsIFrameMessageManager.idl \
|
||||
nsIMessageManager.idl \
|
||||
nsIWebSocket.idl \
|
||||
nsIEventSource.idl \
|
||||
$(NULL)
|
||||
|
@ -8,7 +8,7 @@
|
||||
interface nsIDocShell;
|
||||
interface nsIURI;
|
||||
interface nsIFrame;
|
||||
interface nsIChromeFrameMessageManager;
|
||||
interface nsIMessageSender;
|
||||
interface nsIVariant;
|
||||
interface nsIDOMElement;
|
||||
|
||||
@ -108,7 +108,7 @@ interface nsIContentViewManager : nsISupports
|
||||
readonly attribute nsIContentView rootContentView;
|
||||
};
|
||||
|
||||
[scriptable, uuid(fc338eea-47dc-475e-add7-a3933fcfa07c)]
|
||||
[scriptable, uuid(f234c232-bb17-4450-b324-bf1ef5ccfd34)]
|
||||
interface nsIFrameLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -177,7 +177,7 @@ interface nsIFrameLoader : nsISupports
|
||||
void activateFrameEvent(in AString aType, in boolean capture);
|
||||
|
||||
// Note, when frameloaders are swapped, also messageManagers are swapped.
|
||||
readonly attribute nsIChromeFrameMessageManager messageManager;
|
||||
readonly attribute nsIMessageSender messageManager;
|
||||
|
||||
/**
|
||||
* @see nsIDOMWindowUtils sendKeyEvent.
|
||||
|
@ -1,120 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDocShell;
|
||||
interface nsIContent;
|
||||
|
||||
[scriptable, function, uuid(938fcb95-3d63-46be-aa72-94d08fd3b418)]
|
||||
interface nsIFrameMessageListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* This is for JS only.
|
||||
* receiveMessage is called with one parameter, which has the following
|
||||
* properties:
|
||||
* {
|
||||
* target: %the target of the message. Either an element owning
|
||||
* the message manager, or message manager itself if no
|
||||
* element owns it%
|
||||
* name: %message name%,
|
||||
* sync: %true or false%.
|
||||
* json: %structured clone of the sent message data%,
|
||||
* json: %same as .data, deprecated%,
|
||||
* objects: %array of handles or null, always null if sync is false%
|
||||
* }
|
||||
* @note objects property isn't implemented yet.
|
||||
*
|
||||
* if the message is synchronous, possible return value is sent back
|
||||
* as JSON (will be changed to use structured clones).
|
||||
*
|
||||
* When the listener is called, 'this' value is the target of the message.
|
||||
*/
|
||||
void receiveMessage();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(9be42627-a5db-456f-8de2-9097da45a8c3)]
|
||||
interface nsIFrameMessageManager : nsISupports
|
||||
{
|
||||
void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
|
||||
void removeMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
|
||||
[implicit_jscontext,optional_argc]
|
||||
void sendAsyncMessage([optional] in AString messageName, [optional] in jsval obj);
|
||||
[notxpcom] boolean markForCC();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(28a36ac7-2868-4fa0-ae24-be957d7dce10)]
|
||||
interface nsISyncMessageSender : nsIFrameMessageManager
|
||||
{
|
||||
/**
|
||||
* Returns an array of JSON objects.
|
||||
*/
|
||||
[implicit_jscontext,optional_argc]
|
||||
jsval sendSyncMessage([optional] in AString messageName, [optional] in jsval obj);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a83f4393-e3cf-44da-8867-1f9174c2c595)]
|
||||
interface nsIContentFrameMessageManager : nsISyncMessageSender
|
||||
{
|
||||
/**
|
||||
* The current top level window in the frame or null.
|
||||
*/
|
||||
readonly attribute nsIDOMWindow content;
|
||||
|
||||
/**
|
||||
* The top level docshell or null.
|
||||
*/
|
||||
readonly attribute nsIDocShell docShell;
|
||||
|
||||
/**
|
||||
* Print a string to stdout.
|
||||
*/
|
||||
void dump(in DOMString aStr);
|
||||
|
||||
/**
|
||||
* If leak detection is enabled, print a note to the leak log that this
|
||||
* process will intentionally crash.
|
||||
*/
|
||||
void privateNoteIntentionalCrash();
|
||||
|
||||
/**
|
||||
* Ascii base64 data to binary data and vice versa
|
||||
*/
|
||||
DOMString atob(in DOMString aAsciiString);
|
||||
DOMString btoa(in DOMString aBase64Data);
|
||||
};
|
||||
|
||||
[uuid(f0936c56-e92c-4927-a85b-e289c3d4a01c)]
|
||||
interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
|
||||
{
|
||||
[notxpcom] nsIContent getOwnerContent();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(09f79e8c-101b-432b-a494-02f9b5e111c0)]
|
||||
interface nsITreeItemFrameMessageManager : nsIFrameMessageManager
|
||||
{
|
||||
readonly attribute unsigned long childCount;
|
||||
nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a51597f0-d669-4260-83e6-1d426a8ac802)]
|
||||
interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager
|
||||
{
|
||||
/**
|
||||
* Load a script in the (remote) frame. aURL must be the absolute URL.
|
||||
* data: URLs are also supported. For example data:,dump("foo\n");
|
||||
* If aAllowDelayedLoad is true, script will be loaded when the
|
||||
* remote frame becomes available. Otherwise the script will be loaded
|
||||
* only if the frame is already available.
|
||||
*/
|
||||
void loadFrameScript(in AString aURL, in boolean aAllowDelayedLoad);
|
||||
|
||||
/**
|
||||
* Removes aURL from the list of scripts which support delayed load.
|
||||
*/
|
||||
void removeDelayedFrameScript(in AString aURL);
|
||||
};
|
||||
|
330
content/base/public/nsIMessageManager.idl
Normal file
@ -0,0 +1,330 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDocShell;
|
||||
interface nsIContent;
|
||||
|
||||
/**
|
||||
* Message managers provide a way for chrome-privileged JS code to
|
||||
* communicate with each other, even across process boundaries.
|
||||
*
|
||||
* Message managers are separated into "parent side" and "child side".
|
||||
* These don't always correspond to process boundaries, but can. For
|
||||
* each child-side message manager, there is always exactly one
|
||||
* corresponding parent-side message manager that it sends messages
|
||||
* to. However, for each parent-side message manager, there may be
|
||||
* either one or many child-side managers it can message.
|
||||
*
|
||||
* Message managers that always have exactly one "other side" are of
|
||||
* type nsIMessageSender. Parent-side message managers that have many
|
||||
* "other sides" are of type nsIMessageBroadcaster.
|
||||
*
|
||||
* Child-side message managers can send synchronous messages to their
|
||||
* parent side, but not the other way around.
|
||||
*
|
||||
* There are two realms of message manager hierarchies. One realm
|
||||
* approximately corresponds to DOM elements, the other corresponds to
|
||||
* process boundaries.
|
||||
*
|
||||
* Message managers corresponding to DOM elements
|
||||
* ==============================================
|
||||
*
|
||||
* In this realm of message managers, there are
|
||||
* - "frame message managers" which correspond to frame elements
|
||||
* - "window message managers" which correspond to top-level chrome
|
||||
* windows
|
||||
* - the "global message manager", on the parent side. See below.
|
||||
*
|
||||
* The DOM-realm message managers can communicate in the ways shown by
|
||||
* the following diagram. The parent side and child side can
|
||||
* correspond to process boundaries, but don't always.
|
||||
*
|
||||
* Parent side Child side
|
||||
* ------------- ------------
|
||||
* global MMg
|
||||
* |
|
||||
* +-->window MMw1
|
||||
* | |
|
||||
* | +-->frame MMp1_1<------------>frame MMc1_1
|
||||
* | |
|
||||
* | +-->frame MMp1_2<------------>frame MMc1_2
|
||||
* | ...
|
||||
* |
|
||||
* +-->window MMw2
|
||||
* ...
|
||||
*
|
||||
* For example: a message sent from MMc1_1, from the child side, is
|
||||
* sent only to MMp1_1 on the parent side. However, note that all
|
||||
* message managers in the hierarchy above MMp1_1, in this diagram
|
||||
* MMw1 and MMg, will also notify their message listeners when the
|
||||
* message arrives.
|
||||
|
||||
* For example: a message broadcast through the global MMg on the
|
||||
* parent side would be broadcast to MMw1, which would transitively
|
||||
* broadcast it to MMp1_1, MM1p_2". The message would next be
|
||||
* broadcast to MMw2, and so on down the hierarchy.
|
||||
*
|
||||
* ***** PERFORMANCE AND SECURITY WARNING *****
|
||||
* Messages broadcast through the global MM and window MMs can result
|
||||
* in messages being dispatched across many OS processes, and to many
|
||||
* processes with different permissions. Great care should be taken
|
||||
* when broadcasting.
|
||||
*
|
||||
* Interfaces
|
||||
* ----------
|
||||
*
|
||||
* The global MMg and window MMw's are message broadcasters implementing
|
||||
* nsIMessageBroadcaster while the frame MMp's are simple message senders
|
||||
* (nsIMessageSender). Their counterparts in the content processes are
|
||||
* message senders implementing nsIContentFrameMessageManager.
|
||||
*
|
||||
* nsIMessageListenerManager
|
||||
* / \
|
||||
* nsIMessageSender nsIMessageBroadcaster
|
||||
* |
|
||||
* nsISyncMessageSender (content process/in-process only)
|
||||
* |
|
||||
* nsIContentFrameMessageManager (content process/in-process only)
|
||||
* |
|
||||
* nsIInProcessContentFrameMessageManager (in-process only)
|
||||
*
|
||||
*
|
||||
* Message managers in the chrome process can also be QI'ed to nsIFrameScriptLoader.
|
||||
*
|
||||
*
|
||||
* Message managers corresponding to process boundaries
|
||||
* ====================================================
|
||||
*
|
||||
* The second realm of message managers is the "process message
|
||||
* managers". With one exception, these always correspond to process
|
||||
* boundaries. The picture looks like
|
||||
*
|
||||
* Parent process Child processes
|
||||
* ---------------- -----------------
|
||||
* global PPMM
|
||||
* |
|
||||
* +<----> child PPMM
|
||||
* |
|
||||
* +-->parent PMM1<------------------>child process CMM1
|
||||
* |
|
||||
* +-->parent PMM2<------------------>child process PMM2
|
||||
* ...
|
||||
*
|
||||
* For example: the parent-process PMM1 sends messages directly to
|
||||
* only the child-process CMM1.
|
||||
*
|
||||
* For example: CMM1 sends messages directly to PMM1. The global PPMM
|
||||
* will also notify their message listeners when the message arrives.
|
||||
*
|
||||
* For example: messages sent through the global PPMM will be
|
||||
* dispatched to the listeners of the same-process, "child PPMM".
|
||||
* They will also be broadcast to PPM1, PPM2, etc.
|
||||
*
|
||||
* ***** PERFORMANCE AND SECURITY WARNING *****
|
||||
* Messages broadcast through the global PPMM can result in messages
|
||||
* being dispatched across many OS processes, and to many processes
|
||||
* with different permissions. Great care should be taken when
|
||||
* broadcasting.
|
||||
*
|
||||
* Requests sent to parent-process message listeners should usually
|
||||
* have replies scoped to the requesting CPMM. The following pattern
|
||||
* is common
|
||||
*
|
||||
* const ParentProcessListener = {
|
||||
* receiveMessage: function(aMessage) {
|
||||
* let childMM = aMessage.target.QueryInterface(Ci.nsIMessageSender);
|
||||
* switch (aMessage.name) {
|
||||
* case "Foo:Request":
|
||||
* // service request
|
||||
* childMM.sendAsyncMessage("Foo:Response", { data });
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
*/
|
||||
|
||||
[scriptable, function, uuid(2b44eb57-a9c6-4773-9a1e-fe0818739a4c)]
|
||||
interface nsIMessageListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* This is for JS only.
|
||||
* receiveMessage is called with one parameter, which has the following
|
||||
* properties:
|
||||
* {
|
||||
* target: %the target of the message. Either an element owning
|
||||
* the message manager, or message manager itself if no
|
||||
* element owns it%
|
||||
* name: %message name%,
|
||||
* sync: %true or false%.
|
||||
* data: %structured clone of the sent message data%,
|
||||
* json: %same as .data, deprecated%,
|
||||
* objects: %array of handles or null, always null if sync is false%
|
||||
* }
|
||||
* @note objects property isn't implemented yet.
|
||||
*
|
||||
* Each listener is invoked with its own copy of the message
|
||||
* parameter.
|
||||
*
|
||||
* When the listener is called, 'this' value is the target of the message.
|
||||
*
|
||||
* If the message is synchronous, the possible return value is
|
||||
* returned as JSON (will be changed to use structured clones).
|
||||
* When there are multiple listeners to sync messages, each
|
||||
* listener's return value is sent back as an array. |undefined|
|
||||
* return values show up as undefined values in the array.
|
||||
*/
|
||||
void receiveMessage();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(9c37a142-3de3-4902-a1a4-133f37d5980a)]
|
||||
interface nsIMessageListenerManager : nsISupports
|
||||
{
|
||||
/**
|
||||
* Register |listener| to receive |messageName|. All listener
|
||||
* callbacks for a particular message are invoked when that message
|
||||
* is received.
|
||||
*
|
||||
* The message manager holds a strong ref to |listener|.
|
||||
*
|
||||
* If the same listener registers twice for the same message, the
|
||||
* second registration is ignored.
|
||||
*/
|
||||
void addMessageListener(in AString messageName,
|
||||
in nsIMessageListener listener);
|
||||
|
||||
/**
|
||||
* No longer invoke |listener| when |messageName| is received, after
|
||||
* the first time removeMessageListener() is called.
|
||||
*/
|
||||
void removeMessageListener(in AString messageName,
|
||||
in nsIMessageListener listener);
|
||||
|
||||
[notxpcom] boolean markForCC();
|
||||
};
|
||||
|
||||
/**
|
||||
* Message "senders" have a single "other side" to which messages are
|
||||
* sent. For example, a child-process message manager will send
|
||||
* messages that are only delivered to its one parent-process message
|
||||
* manager.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(7f23767d-0f39-40c1-a22d-d3ab8a481f9d)]
|
||||
interface nsIMessageSender : nsIMessageListenerManager
|
||||
{
|
||||
/**
|
||||
* Send |messageName| and |obj| to the "other side" of this message
|
||||
* manager. This invokes listeners who registered for
|
||||
* |messageName|.
|
||||
*
|
||||
* See nsIMessageListener::receiveMessage() for the format of the
|
||||
* data delivered to listeners.
|
||||
*/
|
||||
[implicit_jscontext, optional_argc]
|
||||
void sendAsyncMessage([optional] in AString messageName,
|
||||
[optional] in jsval obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Message "broadcasters" don't have a single "other side" that they
|
||||
* send messages to, but rather a set of subordinate message managers.
|
||||
* For example, broadcasting a message through a window message
|
||||
* manager will broadcast the message to all frame message managers
|
||||
* within its window.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(d36346b9-5d3b-497d-9c28-ffbc3e4f6d0d)]
|
||||
interface nsIMessageBroadcaster : nsIMessageListenerManager
|
||||
{
|
||||
/**
|
||||
* Like |sendAsyncMessage()|, but also broadcasts this message to
|
||||
* all "child" message managers of this message manager. See long
|
||||
* comment above for details.
|
||||
*
|
||||
* WARNING: broadcasting messages can be very expensive and leak
|
||||
* sensitive data. Use with extreme caution.
|
||||
*/
|
||||
[implicit_jscontext, optional_argc]
|
||||
void broadcastAsyncMessage([optional] in AString messageName,
|
||||
[optional] in jsval obj);
|
||||
|
||||
/**
|
||||
* Number of subordinate message managers.
|
||||
*/
|
||||
readonly attribute unsigned long childCount;
|
||||
|
||||
/**
|
||||
* Return a single subordinate message manager.
|
||||
*/
|
||||
nsIMessageListenerManager getChildAt(in unsigned long aIndex);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(83be5862-2996-4685-ae7d-ae25bd795d50)]
|
||||
interface nsISyncMessageSender : nsIMessageSender
|
||||
{
|
||||
/**
|
||||
* Like |sendAsyncMessage()|, except blocks the sender until all
|
||||
* listeners of the message have been invoked. Returns an array
|
||||
* containing return values from each listener invoked.
|
||||
*/
|
||||
[implicit_jscontext, optional_argc]
|
||||
jsval sendSyncMessage([optional] in AString messageName,
|
||||
[optional] in jsval obj);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(894ff2d4-39a3-4df8-9d76-8ee329975488)]
|
||||
interface nsIContentFrameMessageManager : nsISyncMessageSender
|
||||
{
|
||||
/**
|
||||
* The current top level window in the frame or null.
|
||||
*/
|
||||
readonly attribute nsIDOMWindow content;
|
||||
|
||||
/**
|
||||
* The top level docshell or null.
|
||||
*/
|
||||
readonly attribute nsIDocShell docShell;
|
||||
|
||||
/**
|
||||
* Print a string to stdout.
|
||||
*/
|
||||
void dump(in DOMString aStr);
|
||||
|
||||
/**
|
||||
* If leak detection is enabled, print a note to the leak log that this
|
||||
* process will intentionally crash.
|
||||
*/
|
||||
void privateNoteIntentionalCrash();
|
||||
|
||||
/**
|
||||
* Ascii base64 data to binary data and vice versa
|
||||
*/
|
||||
DOMString atob(in DOMString aAsciiString);
|
||||
DOMString btoa(in DOMString aBase64Data);
|
||||
};
|
||||
|
||||
[uuid(a2325927-9c0c-437d-9215-749c79235031)]
|
||||
interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
|
||||
{
|
||||
[notxpcom] nsIContent getOwnerContent();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a54acd34-4141-46f5-b71b-e2ca32879b08)]
|
||||
interface nsIFrameScriptLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
* Load a script in the (remote) frame. aURL must be the absolute URL.
|
||||
* data: URLs are also supported. For example data:,dump("foo\n");
|
||||
* If aAllowDelayedLoad is true, script will be loaded when the
|
||||
* remote frame becomes available. Otherwise the script will be loaded
|
||||
* only if the frame is already available.
|
||||
*/
|
||||
void loadFrameScript(in AString aURL, in boolean aAllowDelayedLoad);
|
||||
|
||||
/**
|
||||
* Removes aURL from the list of scripts which support delayed load.
|
||||
*/
|
||||
void removeDelayedFrameScript(in AString aURL);
|
||||
};
|
@ -21,7 +21,7 @@ MessageWakeupService.prototype =
|
||||
get messageManager() {
|
||||
if (!this._messageManager)
|
||||
this._messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"].
|
||||
getService(Ci.nsIFrameMessageManager);
|
||||
getService(Ci.nsIMessageListenerManager);
|
||||
return this._messageManager;
|
||||
},
|
||||
|
||||
@ -39,7 +39,7 @@ MessageWakeupService.prototype =
|
||||
let data = this.messagesData[aMessage.name];
|
||||
// TODO: When bug 593407 is ready, stop doing the wrappedJSObject hack
|
||||
// and use this line instead:
|
||||
// QueryInterface(Ci.nsIFrameMessageListener);
|
||||
// QueryInterface(Ci.nsIMessageListener);
|
||||
let service = Cc[data.cid][data.method](Ci[data.iid]).
|
||||
wrappedJSObject;
|
||||
|
||||
|
@ -92,7 +92,7 @@ MarkUserDataHandler(void* aNode, nsIAtom* aKey, void* aValue, void* aData)
|
||||
static void
|
||||
MarkMessageManagers()
|
||||
{
|
||||
nsCOMPtr<nsIChromeFrameMessageManager> globalMM =
|
||||
nsCOMPtr<nsIMessageBroadcaster> globalMM =
|
||||
do_GetService("@mozilla.org/globalmessagemanager;1");
|
||||
if (!globalMM) {
|
||||
return;
|
||||
@ -102,20 +102,22 @@ MarkMessageManagers()
|
||||
uint32_t childCount = 0;
|
||||
globalMM->GetChildCount(&childCount);
|
||||
for (uint32_t i = 0; i < childCount; ++i) {
|
||||
nsCOMPtr<nsITreeItemFrameMessageManager> windowMM;
|
||||
globalMM->GetChildAt(i, getter_AddRefs(windowMM));
|
||||
if (!windowMM) {
|
||||
nsCOMPtr<nsIMessageListenerManager> childMM;
|
||||
globalMM->GetChildAt(i, getter_AddRefs(childMM));
|
||||
if (!childMM) {
|
||||
continue;
|
||||
}
|
||||
nsCOMPtr<nsIMessageBroadcaster> windowMM = do_QueryInterface(childMM);
|
||||
windowMM->MarkForCC();
|
||||
uint32_t tabChildCount = 0;
|
||||
windowMM->GetChildCount(&tabChildCount);
|
||||
for (uint32_t j = 0; j < tabChildCount; ++j) {
|
||||
nsCOMPtr<nsITreeItemFrameMessageManager> tabMM;
|
||||
windowMM->GetChildAt(j, getter_AddRefs(tabMM));
|
||||
if (!tabMM) {
|
||||
nsCOMPtr<nsIMessageListenerManager> childMM;
|
||||
windowMM->GetChildAt(j, getter_AddRefs(childMM));
|
||||
if (!childMM) {
|
||||
continue;
|
||||
}
|
||||
nsCOMPtr<nsIMessageSender> tabMM = do_QueryInterface(childMM);
|
||||
tabMM->MarkForCC();
|
||||
//XXX hack warning, but works, since we know that
|
||||
// callback data is frameloader.
|
||||
|
@ -2244,7 +2244,7 @@ bool SendAsyncMessageToChild(void* aCallbackData,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetMessageManager(nsIChromeFrameMessageManager** aManager)
|
||||
nsFrameLoader::GetMessageManager(nsIMessageSender** aManager)
|
||||
{
|
||||
EnsureMessageManager();
|
||||
if (mMessageManager) {
|
||||
@ -2336,13 +2336,13 @@ nsFrameLoader::EnsureMessageManager()
|
||||
|
||||
nsCOMPtr<nsIDOMChromeWindow> chromeWindow =
|
||||
do_QueryInterface(GetOwnerDoc()->GetWindow());
|
||||
nsCOMPtr<nsIChromeFrameMessageManager> parentManager;
|
||||
nsCOMPtr<nsIMessageBroadcaster> parentManager;
|
||||
if (chromeWindow) {
|
||||
chromeWindow->GetMessageManager(getter_AddRefs(parentManager));
|
||||
}
|
||||
|
||||
if (ShouldUseRemoteProcess()) {
|
||||
mMessageManager = new nsFrameMessageManager(true,
|
||||
mMessageManager = new nsFrameMessageManager(true, /* aChrome */
|
||||
nullptr,
|
||||
SendAsyncMessageToChild,
|
||||
LoadScript,
|
||||
@ -2350,7 +2350,7 @@ nsFrameLoader::EnsureMessageManager()
|
||||
static_cast<nsFrameMessageManager*>(parentManager.get()),
|
||||
cx);
|
||||
} else {
|
||||
mMessageManager = new nsFrameMessageManager(true,
|
||||
mMessageManager = new nsFrameMessageManager(true, /* aChrome */
|
||||
nullptr,
|
||||
SendAsyncMessageToChild,
|
||||
LoadScript,
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -64,7 +65,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsFrameMessageManager)
|
||||
tmp->mListeners.Clear();
|
||||
for (int32_t i = tmp->mChildManagers.Count(); i > 0; --i) {
|
||||
for (PRInt32 i = tmp->mChildManagers.Count(); i > 0; --i) {
|
||||
static_cast<nsFrameMessageManager*>(tmp->mChildManagers[i - 1])->
|
||||
Disconnect(false);
|
||||
}
|
||||
@ -74,30 +75,48 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIFrameMessageManager,
|
||||
(mChrome ?
|
||||
static_cast<nsIFrameMessageManager*>(
|
||||
static_cast<nsIChromeFrameMessageManager*>(this)) :
|
||||
static_cast<nsIFrameMessageManager*>(
|
||||
static_cast<nsIContentFrameMessageManager*>(this))))
|
||||
|
||||
/* nsFrameMessageManager implements nsIMessageSender and nsIMessageBroadcaster,
|
||||
* both of which descend from nsIMessageListenerManager. QI'ing to
|
||||
* nsIMessageListenerManager is therefore ambiguous and needs explicit casts
|
||||
* depending on which child interface applies. */
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIMessageListenerManager,
|
||||
(mIsBroadcaster ?
|
||||
static_cast<nsIMessageListenerManager*>(
|
||||
static_cast<nsIMessageBroadcaster*>(this)) :
|
||||
static_cast<nsIMessageListenerManager*>(
|
||||
static_cast<nsIMessageSender*>(this))))
|
||||
|
||||
/* Message managers in child process implement nsIMessageSender and
|
||||
nsISyncMessageSender. Message managers in the chrome process are
|
||||
either broadcasters (if they have subordinate/child message
|
||||
managers) or they're simple message senders. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISyncMessageSender, !mChrome)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIMessageSender, !mChrome || !mIsBroadcaster)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIMessageBroadcaster, mChrome && mIsBroadcaster)
|
||||
|
||||
/* nsIContentFrameMessageManager is accessible only in TabChildGlobal. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIContentFrameMessageManager,
|
||||
!mChrome && !mIsProcessManager)
|
||||
/* Message managers in child process support nsISyncMessageSender. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISyncMessageSender, !mChrome)
|
||||
/* Message managers in chrome process support nsITreeItemFrameMessageManager. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsITreeItemFrameMessageManager, mChrome)
|
||||
/* Process message manager doesn't support nsIChromeFrameMessageManager. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIChromeFrameMessageManager,
|
||||
|
||||
/* Frame message managers (non-process message managers) support nsIFrameScriptLoader. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIFrameScriptLoader,
|
||||
mChrome && !mIsProcessManager)
|
||||
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(ChromeMessageBroadcaster,
|
||||
mChrome && mIsBroadcaster)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(ChromeMessageSender,
|
||||
mChrome && !mIsBroadcaster)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameMessageManager)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameMessageManager)
|
||||
|
||||
// nsIMessageListenerManager
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::AddMessageListener(const nsAString& aMessage,
|
||||
nsIFrameMessageListener* aListener)
|
||||
nsIMessageListener* aListener)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> message = do_GetAtom(aMessage);
|
||||
uint32_t len = mListeners.Length();
|
||||
@ -116,7 +135,7 @@ nsFrameMessageManager::AddMessageListener(const nsAString& aMessage,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::RemoveMessageListener(const nsAString& aMessage,
|
||||
nsIFrameMessageListener* aListener)
|
||||
nsIMessageListener* aListener)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> message = do_GetAtom(aMessage);
|
||||
uint32_t len = mListeners.Length();
|
||||
@ -130,6 +149,8 @@ nsFrameMessageManager::RemoveMessageListener(const nsAString& aMessage,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIFrameScriptLoader
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
|
||||
bool aAllowDelayedLoad)
|
||||
@ -152,7 +173,7 @@ nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
|
||||
NS_ENSURE_TRUE(mLoadScriptCallback(mCallbackData, aURL), NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < mChildManagers.Count(); ++i) {
|
||||
for (PRInt32 i = 0; i < mChildManagers.Count(); ++i) {
|
||||
nsRefPtr<nsFrameMessageManager> mm =
|
||||
static_cast<nsFrameMessageManager*>(mChildManagers[i]);
|
||||
if (mm) {
|
||||
@ -208,6 +229,9 @@ GetParamsForMessage(JSContext* aCx,
|
||||
return WriteStructuredClone(aCx, val, aBuffer, aClosure);
|
||||
}
|
||||
|
||||
|
||||
// nsISyncMessageSender
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
@ -257,26 +281,30 @@ nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrameMessageManager::SendAsyncMessageInternal(const nsAString& aMessage,
|
||||
const StructuredCloneData& aData)
|
||||
nsFrameMessageManager::DispatchAsyncMessageInternal(const nsAString& aMessage,
|
||||
const StructuredCloneData& aData,
|
||||
ShouldBroadcast aBroadcast)
|
||||
{
|
||||
if (mAsyncCallback) {
|
||||
NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED);
|
||||
mAsyncCallback(mCallbackData, aMessage, aData);
|
||||
}
|
||||
int32_t len = mChildManagers.Count();
|
||||
for (int32_t i = 0; i < len; ++i) {
|
||||
static_cast<nsFrameMessageManager*>(mChildManagers[i])->
|
||||
SendAsyncMessageInternal(aMessage, aData);
|
||||
if (aBroadcast == BROADCAST) {
|
||||
PRInt32 len = mChildManagers.Count();
|
||||
for (PRInt32 i = 0; i < len; ++i) {
|
||||
static_cast<nsFrameMessageManager*>(mChildManagers[i])->
|
||||
DispatchAsyncMessageInternal(aMessage, aData, aBroadcast);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc)
|
||||
nsresult
|
||||
nsFrameMessageManager::DispatchAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc,
|
||||
ShouldBroadcast aBroadcast)
|
||||
{
|
||||
StructuredCloneData data;
|
||||
JSAutoStructuredCloneBuffer buffer;
|
||||
@ -289,9 +317,54 @@ nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
|
||||
data.mData = buffer.data();
|
||||
data.mDataLength = buffer.nbytes();
|
||||
|
||||
return SendAsyncMessageInternal(aMessageName, data);
|
||||
return DispatchAsyncMessageInternal(aMessageName, data, aBroadcast);
|
||||
}
|
||||
|
||||
|
||||
// nsIMessageSender
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc)
|
||||
{
|
||||
return DispatchAsyncMessage(aMessageName, aObject, aCx, aArgc, DONT_BROADCAST);
|
||||
}
|
||||
|
||||
|
||||
// nsIMessageBroadcaster
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::BroadcastAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc)
|
||||
{
|
||||
return DispatchAsyncMessage(aMessageName, aObject, aCx, aArgc, BROADCAST);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetChildCount(uint32_t* aChildCount)
|
||||
{
|
||||
*aChildCount = static_cast<uint32_t>(mChildManagers.Count());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetChildAt(uint32_t aIndex,
|
||||
nsIMessageListenerManager** aMM)
|
||||
{
|
||||
*aMM = nullptr;
|
||||
nsCOMPtr<nsIMessageListenerManager> mm =
|
||||
do_QueryInterface(mChildManagers.SafeObjectAt(static_cast<uint32_t>(aIndex)));
|
||||
mm.swap(*aMM);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsIContentFrameMessageManager
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::Dump(const nsAString& aStr)
|
||||
{
|
||||
@ -328,24 +401,6 @@ nsFrameMessageManager::GetDocShell(nsIDocShell** aDocShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetChildCount(uint32_t* aChildCount)
|
||||
{
|
||||
*aChildCount = static_cast<uint32_t>(mChildManagers.Count());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetChildAt(uint32_t aIndex,
|
||||
nsITreeItemFrameMessageManager** aMM)
|
||||
{
|
||||
*aMM = nullptr;
|
||||
nsCOMPtr<nsITreeItemFrameMessageManager> mm =
|
||||
do_QueryInterface(mChildManagers.SafeObjectAt(static_cast<uint32_t>(aIndex)));
|
||||
mm.swap(*aMM);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::Btoa(const nsAString& aBinaryData,
|
||||
nsAString& aAsciiBase64String)
|
||||
@ -360,6 +415,7 @@ nsFrameMessageManager::Atob(const nsAString& aAsciiString,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
class MMListenerRemover
|
||||
{
|
||||
public:
|
||||
@ -383,6 +439,9 @@ public:
|
||||
nsRefPtr<nsFrameMessageManager> mMM;
|
||||
};
|
||||
|
||||
|
||||
// nsIMessageListener
|
||||
|
||||
nsresult
|
||||
nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
||||
const nsAString& aMessage,
|
||||
@ -591,17 +650,19 @@ nsFrameMessageManager::Disconnect(bool aRemoveFromParent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewGlobalMessageManager(nsIChromeFrameMessageManager** aResult)
|
||||
NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsChromeProcess(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(true,
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(true /* aChrome */,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
true);
|
||||
true /* aGlobal */,
|
||||
false /* aProcessManager */,
|
||||
true /* aBroadcaster */);
|
||||
NS_ENSURE_TRUE(mm, NS_ERROR_OUT_OF_MEMORY);
|
||||
return CallQueryInterface(mm, aResult);
|
||||
}
|
||||
@ -827,17 +888,13 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
||||
mGlobal->GetJSObject(&global);
|
||||
if (global) {
|
||||
JSAutoCompartment ac(mCx, global);
|
||||
uint32_t oldopts = JS_GetOptions(mCx);
|
||||
JS_SetOptions(mCx, oldopts | JSOPTION_NO_SCRIPT_RVAL);
|
||||
|
||||
JSScript* script =
|
||||
JS_CompileUCScriptForPrincipals(mCx, nullptr,
|
||||
nsJSPrincipals::get(mPrincipal),
|
||||
static_cast<const jschar*>(dataString.get()),
|
||||
dataString.Length(),
|
||||
url.get(), 1);
|
||||
|
||||
JS_SetOptions(mCx, oldopts);
|
||||
JS::CompileOptions options(mCx);
|
||||
options.setNoScriptRval(true)
|
||||
.setFileAndLine(url.get(), 1)
|
||||
.setPrincipals(nsJSPrincipals::get(mPrincipal));
|
||||
JS::RootedObject empty(mCx, NULL);
|
||||
JSScript* script = JS::Compile(mCx, empty, options,
|
||||
dataString.get(), dataString.Length());
|
||||
|
||||
if (script) {
|
||||
nsCAutoString scheme;
|
||||
@ -1138,20 +1195,21 @@ bool SendAsyncMessageToSameProcessParent(void* aCallbackData,
|
||||
|
||||
// This creates the global parent process message manager.
|
||||
nsresult
|
||||
NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult)
|
||||
NS_NewParentProcessMessageManager(nsIMessageBroadcaster** aResult)
|
||||
{
|
||||
NS_ASSERTION(!nsFrameMessageManager::sParentProcessManager,
|
||||
"Re-creating sParentProcessManager");
|
||||
NS_ENSURE_TRUE(IsChromeProcess(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsRefPtr<nsFrameMessageManager> mm = new nsFrameMessageManager(true,
|
||||
nsRefPtr<nsFrameMessageManager> mm = new nsFrameMessageManager(true /* aChrome */,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
false,
|
||||
true);
|
||||
false, /* aGlobal */
|
||||
true /* aProcessManager */,
|
||||
true /* aBroadcaster */);
|
||||
NS_ENSURE_TRUE(mm, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsFrameMessageManager::sParentProcessManager = mm;
|
||||
nsFrameMessageManager::NewProcessMessageManager(nullptr); // Create same process message manager.
|
||||
@ -1162,11 +1220,11 @@ nsFrameMessageManager*
|
||||
nsFrameMessageManager::NewProcessMessageManager(mozilla::dom::ContentParent* aProcess)
|
||||
{
|
||||
if (!nsFrameMessageManager::sParentProcessManager) {
|
||||
nsCOMPtr<nsIFrameMessageManager> dummy;
|
||||
nsCOMPtr<nsIMessageBroadcaster> dummy;
|
||||
NS_NewParentProcessMessageManager(getter_AddRefs(dummy));
|
||||
}
|
||||
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(true,
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(true /* aChrome */,
|
||||
nullptr,
|
||||
aProcess ? SendAsyncMessageToChildProcess
|
||||
: SendAsyncMessageToSameProcessChild,
|
||||
@ -1175,8 +1233,8 @@ nsFrameMessageManager::NewProcessMessageManager(mozilla::dom::ContentParent* aPr
|
||||
: static_cast<void*>(&nsFrameMessageManager::sChildProcessManager),
|
||||
nsFrameMessageManager::sParentProcessManager,
|
||||
nullptr,
|
||||
false,
|
||||
true);
|
||||
false, /* aGlobal */
|
||||
true /* aProcessManager */);
|
||||
if (!aProcess) {
|
||||
sSameProcessParentManager = mm;
|
||||
}
|
||||
@ -1189,7 +1247,7 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
|
||||
NS_ASSERTION(!nsFrameMessageManager::sChildProcessManager,
|
||||
"Re-creating sChildProcessManager");
|
||||
bool isChrome = IsChromeProcess();
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(false,
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(false /* aChrome */,
|
||||
isChrome ? SendSyncMessageToSameProcessParent
|
||||
: SendSyncMessageToParentProcess,
|
||||
isChrome ? SendAsyncMessageToSameProcessParent
|
||||
@ -1198,8 +1256,8 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
|
||||
&nsFrameMessageManager::sChildProcessManager,
|
||||
nullptr,
|
||||
nullptr,
|
||||
false,
|
||||
true);
|
||||
false /* aGlobal */,
|
||||
true /* aProcessManager */);
|
||||
NS_ENSURE_TRUE(mm, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsFrameMessageManager::sChildProcessManager = mm;
|
||||
return CallQueryInterface(mm, aResult);
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef nsFrameMessageManager_h__
|
||||
#define nsFrameMessageManager_h__
|
||||
|
||||
#include "nsIFrameMessageManager.h"
|
||||
#include "nsIMessageManager.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
@ -35,7 +35,7 @@ struct JSObject;
|
||||
|
||||
struct nsMessageListenerInfo
|
||||
{
|
||||
nsCOMPtr<nsIFrameMessageListener> mListener;
|
||||
nsCOMPtr<nsIMessageListener> mListener;
|
||||
nsCOMPtr<nsIAtom> mMessage;
|
||||
};
|
||||
|
||||
@ -49,7 +49,8 @@ typedef bool (*nsAsyncMessageCallback)(void* aCallbackData,
|
||||
const mozilla::dom::StructuredCloneData& aData);
|
||||
|
||||
class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager,
|
||||
public nsIChromeFrameMessageManager
|
||||
public nsIMessageBroadcaster,
|
||||
public nsIFrameScriptLoader
|
||||
{
|
||||
typedef mozilla::dom::StructuredCloneData StructuredCloneData;
|
||||
public:
|
||||
@ -61,10 +62,17 @@ public:
|
||||
nsFrameMessageManager* aParentManager,
|
||||
JSContext* aContext,
|
||||
bool aGlobal = false,
|
||||
bool aProcessManager = false)
|
||||
: mChrome(aChrome), mGlobal(aGlobal), mIsProcessManager(aProcessManager),
|
||||
mHandlingMessage(false), mDisconnected(false), mParentManager(aParentManager),
|
||||
mSyncCallback(aSyncCallback), mAsyncCallback(aAsyncCallback),
|
||||
bool aProcessManager = false,
|
||||
bool aBroadcaster = false)
|
||||
: mChrome(aChrome),
|
||||
mGlobal(aGlobal),
|
||||
mIsProcessManager(aProcessManager),
|
||||
mIsBroadcaster(aBroadcaster),
|
||||
mHandlingMessage(false),
|
||||
mDisconnected(false),
|
||||
mParentManager(aParentManager),
|
||||
mSyncCallback(aSyncCallback),
|
||||
mAsyncCallback(aAsyncCallback),
|
||||
mLoadScriptCallback(aLoadScriptCallback),
|
||||
mCallbackData(aCallbackData),
|
||||
mContext(aContext)
|
||||
@ -105,11 +113,12 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameMessageManager,
|
||||
nsIContentFrameMessageManager)
|
||||
NS_DECL_NSIFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSIMESSAGELISTENERMANAGER
|
||||
NS_DECL_NSIMESSAGESENDER
|
||||
NS_DECL_NSIMESSAGEBROADCASTER
|
||||
NS_DECL_NSISYNCMESSAGESENDER
|
||||
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSICHROMEFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSITREEITEMFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSIFRAMESCRIPTLOADER
|
||||
|
||||
static nsFrameMessageManager*
|
||||
NewProcessMessageManager(mozilla::dom::ContentParent* aProcess);
|
||||
@ -130,8 +139,15 @@ public:
|
||||
void Disconnect(bool aRemoveFromParent = true);
|
||||
void SetCallbackData(void* aData, bool aLoadScripts = true);
|
||||
void* GetCallbackData() { return mCallbackData; }
|
||||
nsresult SendAsyncMessageInternal(const nsAString& aMessage,
|
||||
const StructuredCloneData& aData);
|
||||
enum ShouldBroadcast { BROADCAST, DONT_BROADCAST };
|
||||
nsresult DispatchAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
PRUint8 aArgc,
|
||||
ShouldBroadcast aBroadcast);
|
||||
nsresult DispatchAsyncMessageInternal(const nsAString& aMessage,
|
||||
const StructuredCloneData& aData,
|
||||
ShouldBroadcast aBroadcast);
|
||||
JSContext* GetJSContext() { return mContext; }
|
||||
void SetJSContext(JSContext* aCx) { mContext = aCx; }
|
||||
void RemoveFromParent();
|
||||
@ -157,9 +173,10 @@ protected:
|
||||
friend class MMListenerRemover;
|
||||
nsTArray<nsMessageListenerInfo> mListeners;
|
||||
nsCOMArray<nsIContentFrameMessageManager> mChildManagers;
|
||||
bool mChrome;
|
||||
bool mGlobal;
|
||||
bool mIsProcessManager;
|
||||
bool mChrome; // true if we're in the chrome process
|
||||
bool mGlobal; // true if
|
||||
bool mIsProcessManager; // true if the message manager belongs to the process realm
|
||||
bool mIsBroadcaster; // true if the message manager is a broadcaster
|
||||
bool mHandlingMessage;
|
||||
bool mDisconnected;
|
||||
nsFrameMessageManager* mParentManager;
|
||||
|
@ -445,6 +445,7 @@ GK_ATOM(inherits, "inherits")
|
||||
GK_ATOM(inheritstyle, "inheritstyle")
|
||||
GK_ATOM(initial_scale, "initial-scale")
|
||||
GK_ATOM(input, "input")
|
||||
GK_ATOM(inputmode, "inputmode")
|
||||
GK_ATOM(ins, "ins")
|
||||
GK_ATOM(insertafter, "insertafter")
|
||||
GK_ATOM(insertbefore, "insertbefore")
|
||||
|
@ -126,7 +126,7 @@ nsInProcessTabChildGlobal::Init()
|
||||
InitTabChildGlobal();
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
|
||||
"Couldn't initialize nsInProcessTabChildGlobal");
|
||||
mMessageManager = new nsFrameMessageManager(false,
|
||||
mMessageManager = new nsFrameMessageManager(false, /* aChrome */
|
||||
SendSyncMessageToParent,
|
||||
SendAsyncMessageToParent,
|
||||
nullptr,
|
||||
@ -160,7 +160,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsInProcessTabChildGlobal,
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsInProcessTabChildGlobal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMessageListenerManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInProcessContentFrameMessageManager)
|
||||
|
@ -33,7 +33,8 @@ public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
|
||||
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
|
@ -13,9 +13,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549682
|
||||
<script type="application/javascript"><![CDATA[
|
||||
var didRunAsync = false;
|
||||
var didRunLocal = false;
|
||||
var global = Components.classes["@mozilla.org/globalmessagemanager;1"].getService(Components.interfaces.nsIChromeFrameMessageManager);
|
||||
var ppm = Components.classes["@mozilla.org/parentprocessmessagemanager;1"].getService(Components.interfaces.nsIFrameMessageManager);
|
||||
var cpm = Components.classes["@mozilla.org/childprocessmessagemanager;1"].getService(Components.interfaces.nsISyncMessageSender);
|
||||
var global = Components.classes["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsIMessageBroadcaster);
|
||||
var ppm = Components.classes["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsIMessageBroadcaster);
|
||||
var cpm = Components.classes["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsISyncMessageSender);
|
||||
|
||||
var asyncPPML = false;
|
||||
function ppmASL(m) {
|
||||
@ -36,7 +39,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549682
|
||||
asyncCPML = true;
|
||||
}
|
||||
cpm.addMessageListener("childprocessmessage", cpmASL);
|
||||
ppm.sendAsyncMessage("childprocessmessage", "");
|
||||
ppm.broadcastAsyncMessage("childprocessmessage", "");
|
||||
|
||||
function checkPMMMessages() {
|
||||
opener.wrappedJSObject.ok(asyncPPML, "should have handled async message");
|
||||
|
@ -30,8 +30,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=616841
|
||||
function recvContentReady(m) {
|
||||
for (var i = 0; i < toCompare.length; ++i) {
|
||||
var pair = toCompare[i];
|
||||
messageManager.sendAsyncMessage("cmp",
|
||||
{ i: i, a: pair[0], b: pair[1] });
|
||||
messageManager.broadcastAsyncMessage("cmp",
|
||||
{ i: i, a: pair[0], b: pair[1] });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,6 +322,8 @@ nsIMEStateManager::SetIMEState(const IMEState &aState,
|
||||
aContent->Tag() == nsGkAtoms::textarea)) {
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type,
|
||||
context.mHTMLInputType);
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::inputmode,
|
||||
context.mHTMLInputInputmode);
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::moz_action_hint,
|
||||
context.mActionHint);
|
||||
|
||||
|
@ -147,6 +147,28 @@ static const nsAttrValue::EnumTable kInputAutocompleteTable[] = {
|
||||
// Default autocomplete value is "".
|
||||
static const nsAttrValue::EnumTable* kInputDefaultAutocomplete = &kInputAutocompleteTable[0];
|
||||
|
||||
static const uint8_t NS_INPUT_INPUTMODE_AUTO = 0;
|
||||
static const uint8_t NS_INPUT_INPUTMODE_NUMERIC = 1;
|
||||
static const uint8_t NS_INPUT_INPUTMODE_DIGIT = 2;
|
||||
static const uint8_t NS_INPUT_INPUTMODE_UPPERCASE = 3;
|
||||
static const uint8_t NS_INPUT_INPUTMODE_LOWERCASE = 4;
|
||||
static const uint8_t NS_INPUT_INPUTMODE_TITLECASE = 5;
|
||||
static const uint8_t NS_INPUT_INPUTMODE_AUTOCAPITALIZED = 6;
|
||||
|
||||
static const nsAttrValue::EnumTable kInputInputmodeTable[] = {
|
||||
{ "auto", NS_INPUT_INPUTMODE_AUTO },
|
||||
{ "numeric", NS_INPUT_INPUTMODE_NUMERIC },
|
||||
{ "digit", NS_INPUT_INPUTMODE_DIGIT },
|
||||
{ "uppercase", NS_INPUT_INPUTMODE_UPPERCASE },
|
||||
{ "lowercase", NS_INPUT_INPUTMODE_LOWERCASE },
|
||||
{ "titlecase", NS_INPUT_INPUTMODE_TITLECASE },
|
||||
{ "autocapitalized", NS_INPUT_INPUTMODE_AUTOCAPITALIZED },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
// Default inputmode value is "auto".
|
||||
static const nsAttrValue::EnumTable* kInputDefaultInputmode = &kInputInputmodeTable[0];
|
||||
|
||||
const double nsHTMLInputElement::kDefaultStepBase = 0;
|
||||
const double nsHTMLInputElement::kStepAny = 0;
|
||||
|
||||
@ -866,6 +888,8 @@ NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLInputElement, FormMethod, formmethod,
|
||||
kFormDefaultMethod->tag)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLInputElement, FormNoValidate, formnovalidate)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLInputElement, FormTarget, formtarget)
|
||||
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLInputElement, Inputmode, inputmode,
|
||||
kInputDefaultInputmode->tag)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLInputElement, Multiple, multiple)
|
||||
NS_IMPL_NON_NEGATIVE_INT_ATTR(nsHTMLInputElement, MaxLength, maxlength)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLInputElement, Name, name)
|
||||
@ -2741,6 +2765,9 @@ nsHTMLInputElement::ParseAttribute(int32_t aNamespaceID,
|
||||
if (aAttribute == nsGkAtoms::autocomplete) {
|
||||
return aResult.ParseEnumValue(aValue, kInputAutocompleteTable, false);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::inputmode) {
|
||||
return aResult.ParseEnumValue(aValue, kInputInputmodeTable, false);
|
||||
}
|
||||
if (ParseImageAttribute(aAttribute, aValue, aResult)) {
|
||||
// We have to call |ParseImageAttribute| unconditionally since we
|
||||
// don't know if we're going to have a type="image" attribute yet,
|
||||
|
@ -3429,7 +3429,7 @@ nsHTMLMediaElement::CopyInnerTo(nsGenericElement* aDest)
|
||||
nsresult nsHTMLMediaElement::GetBuffered(nsIDOMTimeRanges** aBuffered)
|
||||
{
|
||||
nsRefPtr<nsTimeRanges> ranges = new nsTimeRanges();
|
||||
if (mReadyState >= nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA && mDecoder) {
|
||||
if (mReadyState > nsIDOMHTMLMediaElement::HAVE_NOTHING && mDecoder) {
|
||||
// If GetBuffered fails we ignore the error result and just return the
|
||||
// time ranges we found up till the error.
|
||||
mDecoder->GetBuffered(ranges);
|
||||
|
@ -110,6 +110,15 @@ reflectUnsignedInt({
|
||||
|
||||
// .indeterminate doesn't reflect a content attribute.
|
||||
|
||||
// .inputmode
|
||||
reflectLimitedEnumerated({
|
||||
element: document.createElement("input"),
|
||||
attribute: "inputmode",
|
||||
validValues: [ "numeric", "digit", "uppercase", "lowercase", "titlecase", "autocapitalized", "auto" ],
|
||||
invalidValues: [ "", "foo", "tulip" ],
|
||||
defaultValue: "auto"
|
||||
});
|
||||
|
||||
// TODO: list (HTMLElement)
|
||||
|
||||
// .max
|
||||
|
@ -190,7 +190,6 @@
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsITimedChannel.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#include "nsIFrameMessageManager.h"
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsISecurityUITelemetry.h"
|
||||
|
@ -12,10 +12,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
const EXPORTED_SYMBOLS = [];
|
||||
|
||||
@ -194,7 +193,7 @@ let Activities = {
|
||||
|
||||
// We have no matching activity registered, let's fire an error.
|
||||
if (aResults.options.length === 0) {
|
||||
ppmm.sendAsyncMessage("Activity:FireError", {
|
||||
ppmm.broadcastAsyncMessage("Activity:FireError", {
|
||||
"id": aMsg.id,
|
||||
"error": "NO_PROVIDER"
|
||||
});
|
||||
@ -206,7 +205,7 @@ let Activities = {
|
||||
|
||||
// The user has cancelled the choice, fire an error.
|
||||
if (aChoice === -1) {
|
||||
ppmm.sendAsyncMessage("Activity:FireError", {
|
||||
ppmm.broadcastAsyncMessage("Activity:FireError", {
|
||||
"id": aMsg.id,
|
||||
"error": "USER_ABORT"
|
||||
});
|
||||
@ -231,7 +230,7 @@ let Activities = {
|
||||
Services.io.newURI(result.manifest, null, null));
|
||||
|
||||
if (!result.description.returnValue) {
|
||||
ppmm.sendAsyncMessage("Activity:FireSuccess", {
|
||||
ppmm.broadcastAsyncMessage("Activity:FireSuccess", {
|
||||
"id": aMsg.id,
|
||||
"result": null
|
||||
});
|
||||
@ -266,7 +265,7 @@ let Activities = {
|
||||
},
|
||||
|
||||
receiveMessage: function activities_receiveMessage(aMessage) {
|
||||
let mm = aMessage.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
let mm = aMessage.target;
|
||||
let msg = aMessage.json;
|
||||
switch(aMessage.name) {
|
||||
case "Activity:Start":
|
||||
@ -274,10 +273,10 @@ let Activities = {
|
||||
break;
|
||||
|
||||
case "Activity:PostResult":
|
||||
ppmm.sendAsyncMessage("Activity:FireSuccess", msg);
|
||||
ppmm.broadcastAsyncMessage("Activity:FireSuccess", msg);
|
||||
break;
|
||||
case "Activity:PostError":
|
||||
ppmm.sendAsyncMessage("Activity:FireError", msg);
|
||||
ppmm.broadcastAsyncMessage("Activity:FireError", msg);
|
||||
break;
|
||||
|
||||
case "Activities:Register":
|
||||
|
@ -12,11 +12,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager)
|
||||
.QueryInterface(Ci.nsISyncMessageSender);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsISyncMessageSender");
|
||||
|
||||
function debug(aMsg) {
|
||||
//dump("-- ActivityProxy " + Date.now() + " : " + aMsg + "\n");
|
||||
|
@ -10,11 +10,9 @@ const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager)
|
||||
.QueryInterface(Ci.nsISyncMessageSender);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsISyncMessageSender");
|
||||
|
||||
function debug(aMsg) {
|
||||
//dump("-- ActivityRequestHandler.js " + Date.now() + " : " + aMsg + "\n");
|
||||
|
@ -20,9 +20,9 @@ Cu.import("resource://gre/modules/AlarmDB.jsm");
|
||||
|
||||
let EXPORTED_SYMBOLS = ["AlarmService"];
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "messenger", function() {
|
||||
return Cc["@mozilla.org/system-message-internal;1"].getService(Ci.nsISystemMessagesInternal);
|
||||
@ -75,7 +75,7 @@ let AlarmService = {
|
||||
receiveMessage: function receiveMessage(aMessage) {
|
||||
debug("receiveMessage(): " + aMessage.name);
|
||||
|
||||
let mm = aMessage.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
let mm = aMessage.target.QueryInterface(Ci.nsIMessageSender);
|
||||
let json = aMessage.json;
|
||||
switch (aMessage.name) {
|
||||
case "AlarmsManager:GetAll":
|
||||
|
@ -26,8 +26,7 @@ function AppsService()
|
||||
Cu.import("resource://gre/modules/Webapps.jsm");
|
||||
} else {
|
||||
this.cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager)
|
||||
.QueryInterface(Ci.nsISyncMessageSender);
|
||||
.getService(Ci.nsISyncMessageSender);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,9 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageSender");
|
||||
|
||||
function convertAppsArray(aApps, aWindow) {
|
||||
let apps = Cu.createArrayIn(aWindow);
|
||||
|
@ -23,14 +23,13 @@ XPCOMUtils.defineLazyGetter(this, "NetUtil", function() {
|
||||
return NetUtil;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIFrameMessageManager");
|
||||
"nsIMessageSender");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "msgmgr", function() {
|
||||
return Cc["@mozilla.org/system-message-internal;1"]
|
||||
@ -243,7 +242,7 @@ let DOMApplicationRegistry = {
|
||||
if (msg.hasPrivileges)
|
||||
this.getAll(msg);
|
||||
else
|
||||
ppmm.sendAsyncMessage("Webapps:GetAll:Return:KO", msg);
|
||||
ppmm.broadcastAsyncMessage("Webapps:GetAll:Return:KO", msg);
|
||||
break;
|
||||
case "Webapps:InstallPackage":
|
||||
this.installPackage(msg);
|
||||
@ -307,7 +306,7 @@ let DOMApplicationRegistry = {
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:KO", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:Install:Return:KO", aData);
|
||||
},
|
||||
|
||||
confirmInstall: function(aData, aFromSync, aProfileDir, aOfflineCacheObserver) {
|
||||
@ -365,7 +364,7 @@ let DOMApplicationRegistry = {
|
||||
|
||||
if (!aFromSync)
|
||||
this._saveApps((function() {
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:Install:Return:OK", aData);
|
||||
Services.obs.notifyObservers(this, "webapps-sync-install", appNote);
|
||||
}).bind(this));
|
||||
|
||||
@ -492,7 +491,7 @@ let DOMApplicationRegistry = {
|
||||
try {
|
||||
dir.remove(true);
|
||||
} catch (e) { }
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:KO",
|
||||
ppmm.broadcastAsyncMessage("Webapps:Install:Return:KO",
|
||||
{ oid: aData.oid,
|
||||
requestID: aData.requestID,
|
||||
error: aError });
|
||||
@ -584,13 +583,13 @@ let DOMApplicationRegistry = {
|
||||
delete this.webapps[id];
|
||||
|
||||
this._saveApps((function() {
|
||||
ppmm.sendAsyncMessage("Webapps:Uninstall:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:Uninstall:Return:OK", aData);
|
||||
Services.obs.notifyObservers(this, "webapps-sync-uninstall", appNote);
|
||||
}).bind(this));
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
ppmm.sendAsyncMessage("Webapps:Uninstall:Return:KO", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:Uninstall:Return:KO", aData);
|
||||
}
|
||||
},
|
||||
|
||||
@ -608,7 +607,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
ppmm.sendAsyncMessage("Webapps:GetSelf:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:GetSelf:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -627,7 +626,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
ppmm.sendAsyncMessage("Webapps:GetInstalled:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:GetInstalled:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -645,7 +644,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
ppmm.sendAsyncMessage("Webapps:GetNotInstalled:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:GetNotInstalled:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -665,7 +664,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
ppmm.sendAsyncMessage("Webapps:GetAll:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:GetAll:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -783,7 +782,7 @@ let DOMApplicationRegistry = {
|
||||
dir.remove(true);
|
||||
} catch (e) {
|
||||
}
|
||||
ppmm.sendAsyncMessage("Webapps:Uninstall:Return:OK", { origin: origin });
|
||||
ppmm.broadcastAsyncMessage("Webapps:Uninstall:Return:OK", { origin: origin });
|
||||
} else {
|
||||
if (this.webapps[record.id]) {
|
||||
this.webapps[record.id] = record.value;
|
||||
@ -791,7 +790,7 @@ let DOMApplicationRegistry = {
|
||||
} else {
|
||||
let data = { app: record.value };
|
||||
this.confirmInstall(data, true);
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:OK", data);
|
||||
ppmm.broadcastAsyncMessage("Webapps:Install:Return:OK", data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -893,7 +892,7 @@ AppcacheObserver.prototype = {
|
||||
let setStatus = function appObs_setStatus(aStatus) {
|
||||
mustSave = (app.status != aStatus);
|
||||
app.status = aStatus;
|
||||
ppmm.sendAsyncMessage("Webapps:OfflineCache", { manifest: app.manifestURL, status: aStatus });
|
||||
ppmm.broadcastAsyncMessage("Webapps:OfflineCache", { manifest: app.manifestURL, status: aStatus });
|
||||
}
|
||||
|
||||
switch (aState) {
|
||||
|
@ -15,9 +15,9 @@ let EXPORTED_SYMBOLS = ["DOMRequestIpcHelper"];
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
||||
function DOMRequestIpcHelper() {
|
||||
}
|
||||
|
@ -461,7 +461,7 @@
|
||||
#include "nsIDOMMozTouchEvent.h"
|
||||
|
||||
#include "nsIEventListenerService.h"
|
||||
#include "nsIFrameMessageManager.h"
|
||||
#include "nsIMessageManager.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsHTMLSelectElement.h"
|
||||
#include "nsHTMLLegendElement.h"
|
||||
@ -640,6 +640,8 @@ DOMCI_DATA_NO_CLASS(Crypto)
|
||||
DOMCI_DATA_NO_CLASS(CRMFObject)
|
||||
DOMCI_DATA_NO_CLASS(SmartCardEvent)
|
||||
DOMCI_DATA_NO_CLASS(ContentFrameMessageManager)
|
||||
DOMCI_DATA_NO_CLASS(ChromeMessageBroadcaster)
|
||||
DOMCI_DATA_NO_CLASS(ChromeMessageSender)
|
||||
|
||||
DOMCI_DATA_NO_CLASS(DOMPrototype)
|
||||
DOMCI_DATA_NO_CLASS(DOMConstructor)
|
||||
@ -1595,8 +1597,13 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(AnimationEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(ContentFrameMessageManager, nsEventTargetSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS | nsIXPCScriptable::IS_GLOBAL_OBJECT)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager, nsEventTargetSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::IS_GLOBAL_OBJECT)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeMessageBroadcaster, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeMessageSender, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(FormData, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
@ -4305,13 +4312,26 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentFrameMessageManager, nsIContentFrameMessageManager)
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentFrameMessageManager, nsISupports)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIFrameMessageManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageSender)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsISyncMessageSender)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIContentFrameMessageManager)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ChromeMessageBroadcaster, nsISupports)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIFrameScriptLoader)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageBroadcaster)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ChromeMessageSender, nsISupports)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIFrameScriptLoader)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageSender)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(FormData, nsIDOMFormData)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMFormData)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
@ -7197,7 +7217,8 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
// method on an interface that would let us just call into the
|
||||
// window code directly...
|
||||
|
||||
if (!ObjectIsNativeWrapper(cx, obj)) {
|
||||
if (!ObjectIsNativeWrapper(cx, obj) ||
|
||||
xpc::WrapperFactory::XrayWrapperNotShadowing(obj, id)) {
|
||||
nsCOMPtr<nsIDocShellTreeNode> dsn(do_QueryInterface(win->GetDocShell()));
|
||||
|
||||
int32_t count = 0;
|
||||
@ -9221,7 +9242,8 @@ nsHTMLDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
if (!ObjectIsNativeWrapper(cx, obj)) {
|
||||
if (!ObjectIsNativeWrapper(cx, obj) ||
|
||||
xpc::WrapperFactory::XrayWrapperNotShadowing(obj, id)) {
|
||||
nsCOMPtr<nsISupports> result;
|
||||
nsWrapperCache *cache;
|
||||
nsresult rv = ResolveImpl(cx, wrapper, id, getter_AddRefs(result),
|
||||
@ -9313,23 +9335,20 @@ nsHTMLDocumentSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *obj, jsid id,
|
||||
jsval *vp, bool *_retval)
|
||||
{
|
||||
// For native wrappers, do not get random names on document
|
||||
if (!ObjectIsNativeWrapper(cx, obj)) {
|
||||
nsCOMPtr<nsISupports> result;
|
||||
nsCOMPtr<nsISupports> result;
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
nsWrapperCache *cache;
|
||||
nsresult rv = ResolveImpl(cx, wrapper, id, getter_AddRefs(result), &cache);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsWrapperCache *cache;
|
||||
nsresult rv = ResolveImpl(cx, wrapper, id, getter_AddRefs(result), &cache);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (result) {
|
||||
rv = WrapNative(cx, obj, result, cache, true, vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_SUCCESS_I_DID_SOMETHING;
|
||||
}
|
||||
return rv;
|
||||
if (result) {
|
||||
rv = WrapNative(cx, obj, result, cache, true, vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_SUCCESS_I_DID_SOMETHING;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -9371,7 +9390,8 @@ nsHTMLFormElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
|
||||
{
|
||||
// For native wrappers, do not resolve random names on form
|
||||
if ((!(JSRESOLVE_ASSIGNING & flags)) && JSID_IS_STRING(id) &&
|
||||
!ObjectIsNativeWrapper(cx, obj)) {
|
||||
(!ObjectIsNativeWrapper(cx, obj) ||
|
||||
xpc::WrapperFactory::XrayWrapperNotShadowing(obj, id))) {
|
||||
nsCOMPtr<nsIForm> form(do_QueryWrappedNative(wrapper, obj));
|
||||
nsCOMPtr<nsISupports> result;
|
||||
nsWrapperCache *cache;
|
||||
@ -9402,18 +9422,16 @@ nsHTMLFormElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
|
||||
if (JSID_IS_STRING(id)) {
|
||||
// For native wrappers, do not get random names on form
|
||||
if (!ObjectIsNativeWrapper(cx, obj)) {
|
||||
nsCOMPtr<nsISupports> result;
|
||||
nsWrapperCache *cache;
|
||||
nsCOMPtr<nsISupports> result;
|
||||
nsWrapperCache *cache;
|
||||
|
||||
FindNamedItem(form, id, getter_AddRefs(result), &cache);
|
||||
FindNamedItem(form, id, getter_AddRefs(result), &cache);
|
||||
|
||||
if (result) {
|
||||
// Wrap result, result can be either an element or a list of
|
||||
// elements
|
||||
nsresult rv = WrapNative(cx, obj, result, cache, true, vp);
|
||||
return NS_FAILED(rv) ? rv : NS_SUCCESS_I_DID_SOMETHING;
|
||||
}
|
||||
if (result) {
|
||||
// Wrap result, result can be either an element or a list of
|
||||
// elements
|
||||
nsresult rv = WrapNative(cx, obj, result, cache, true, vp);
|
||||
return NS_FAILED(rv) ? rv : NS_SUCCESS_I_DID_SOMETHING;
|
||||
}
|
||||
} else {
|
||||
int32_t n = GetArrayIndexFromId(cx, id);
|
||||
|
@ -132,6 +132,11 @@ public:
|
||||
* dealing with document.domain, it's possible to end up in a scriptable
|
||||
* helper with a wrapper, even though we should be treating the lookup as a
|
||||
* transparent one.
|
||||
*
|
||||
* Note: So ObjectIsNativeWrapper(cx, obj) check usually means "through xray
|
||||
* wrapper this part is not visible" while combined with
|
||||
* || xpc::WrapperFactory::XrayWrapperNotShadowing(obj) it means "through
|
||||
* xray wrapper it is visible only if it does not hide any native property."
|
||||
*/
|
||||
static bool ObjectIsNativeWrapper(JSContext* cx, JSObject* obj);
|
||||
|
||||
|
@ -475,6 +475,8 @@ DOMCI_CLASS(TransitionEvent)
|
||||
DOMCI_CLASS(AnimationEvent)
|
||||
|
||||
DOMCI_CLASS(ContentFrameMessageManager)
|
||||
DOMCI_CLASS(ChromeMessageBroadcaster)
|
||||
DOMCI_CLASS(ChromeMessageSender)
|
||||
|
||||
DOMCI_CLASS(FormData)
|
||||
|
||||
|
@ -10957,7 +10957,7 @@ nsGlobalChromeWindow::NotifyDefaultButtonLoaded(nsIDOMElement* aDefaultButton)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalChromeWindow::GetMessageManager(nsIChromeFrameMessageManager** aManager)
|
||||
nsGlobalChromeWindow::GetMessageManager(nsIMessageBroadcaster** aManager)
|
||||
{
|
||||
FORWARD_TO_INNER_CHROME(GetMessageManager, (aManager), NS_ERROR_FAILURE);
|
||||
if (!mMessageManager) {
|
||||
@ -10965,16 +10965,19 @@ nsGlobalChromeWindow::GetMessageManager(nsIChromeFrameMessageManager** aManager)
|
||||
NS_ENSURE_STATE(scx);
|
||||
JSContext* cx = scx->GetNativeContext();
|
||||
NS_ENSURE_STATE(cx);
|
||||
nsCOMPtr<nsIChromeFrameMessageManager> globalMM =
|
||||
nsCOMPtr<nsIMessageBroadcaster> globalMM =
|
||||
do_GetService("@mozilla.org/globalmessagemanager;1");
|
||||
mMessageManager =
|
||||
new nsFrameMessageManager(true,
|
||||
new nsFrameMessageManager(true, /* aChrome */
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
static_cast<nsFrameMessageManager*>(globalMM.get()),
|
||||
cx);
|
||||
cx,
|
||||
false, /* aGlobal */
|
||||
false, /* aProcessManager */
|
||||
true /* aBroadcaster */);
|
||||
NS_ENSURE_TRUE(mMessageManager, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
CallQueryInterface(mMessageManager, aManager);
|
||||
|
@ -1135,7 +1135,7 @@ public:
|
||||
nsGlobalWindow)
|
||||
|
||||
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
||||
nsCOMPtr<nsIChromeFrameMessageManager> mMessageManager;
|
||||
nsCOMPtr<nsIMessageBroadcaster> mMessageManager;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1293,15 +1293,13 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
|
||||
|
||||
++mExecuteDepth;
|
||||
|
||||
ok = ::JS_EvaluateUCScriptForPrincipalsVersion(mContext,
|
||||
aScopeObject,
|
||||
nsJSPrincipals::get(principal),
|
||||
static_cast<const jschar*>(PromiseFlatString(aScript).get()),
|
||||
aScript.Length(),
|
||||
aURL,
|
||||
aLineNo,
|
||||
&val,
|
||||
JSVersion(aVersion));
|
||||
JS::CompileOptions options(mContext);
|
||||
options.setFileAndLine(aURL, aLineNo)
|
||||
.setVersion(JSVersion(aVersion))
|
||||
.setPrincipals(nsJSPrincipals::get(principal));
|
||||
JS::RootedObject rootedScope(mContext, aScopeObject);
|
||||
ok = JS::Evaluate(mContext, rootedScope, options, PromiseFlatString(aScript).get(),
|
||||
aScript.Length(), &val);
|
||||
|
||||
--mExecuteDepth;
|
||||
|
||||
@ -1490,11 +1488,15 @@ nsJSContext::EvaluateString(const nsAString& aScript,
|
||||
XPCAutoRequest ar(mContext);
|
||||
JSAutoCompartment ac(mContext, aScopeObject);
|
||||
|
||||
ok = JS_EvaluateUCScriptForPrincipalsVersionOrigin(
|
||||
mContext, aScopeObject,
|
||||
nsJSPrincipals::get(principal), nsJSPrincipals::get(aOriginPrincipal),
|
||||
static_cast<const jschar*>(PromiseFlatString(aScript).get()),
|
||||
aScript.Length(), aURL, aLineNo, vp, JSVersion(aVersion));
|
||||
JS::RootedObject rootedScope(mContext, aScopeObject);
|
||||
JS::CompileOptions options(mContext);
|
||||
options.setFileAndLine(aURL, aLineNo)
|
||||
.setPrincipals(nsJSPrincipals::get(principal))
|
||||
.setOriginPrincipals(nsJSPrincipals::get(aOriginPrincipal))
|
||||
.setVersion(JSVersion(aVersion));
|
||||
ok = JS::Evaluate(mContext, rootedScope, options,
|
||||
PromiseFlatString(aScript).get(),
|
||||
aScript.Length(), vp);
|
||||
|
||||
if (!ok) {
|
||||
// Tell XPConnect about any pending exceptions. This is needed
|
||||
@ -1751,17 +1753,16 @@ nsJSContext::CompileEventHandler(nsIAtom *aName,
|
||||
#endif
|
||||
|
||||
// Event handlers are always shared, and must be bound before use.
|
||||
// Therefore we never bother compiling with principals.
|
||||
// (that probably means we should avoid JS_CompileUCFunctionForPrincipals!)
|
||||
// Therefore we don't bother compiling with principals.
|
||||
XPCAutoRequest ar(mContext);
|
||||
|
||||
JSFunction* fun =
|
||||
::JS_CompileUCFunctionForPrincipalsVersion(mContext,
|
||||
nullptr, nullptr,
|
||||
nsAtomCString(aName).get(), aArgCount, aArgNames,
|
||||
(jschar*)PromiseFlatString(aBody).get(),
|
||||
aBody.Length(),
|
||||
aURL, aLineNo, JSVersion(aVersion));
|
||||
JS::CompileOptions options(mContext);
|
||||
options.setVersion(JSVersion(aVersion))
|
||||
.setFileAndLine(aURL, aLineNo);
|
||||
JS::RootedObject empty(mContext, NULL);
|
||||
JSFunction* fun = JS::CompileFunction(mContext, empty, options, nsAtomCString(aName).get(),
|
||||
aArgCount, aArgNames,
|
||||
PromiseFlatString(aBody).get(), aBody.Length());
|
||||
|
||||
if (!fun) {
|
||||
ReportPendingException();
|
||||
@ -1814,20 +1815,18 @@ nsJSContext::CompileFunction(JSObject* aTarget,
|
||||
}
|
||||
}
|
||||
|
||||
JSObject *target = aTarget;
|
||||
JS::RootedObject target(mContext, aShared ? NULL : aTarget);
|
||||
|
||||
XPCAutoRequest ar(mContext);
|
||||
|
||||
JSFunction* fun =
|
||||
::JS_CompileUCFunctionForPrincipalsVersion(mContext,
|
||||
aShared ? nullptr : target,
|
||||
nsJSPrincipals::get(principal),
|
||||
PromiseFlatCString(aName).get(),
|
||||
aArgCount, aArgArray,
|
||||
static_cast<const jschar*>(PromiseFlatString(aBody).get()),
|
||||
aBody.Length(),
|
||||
aURL, aLineNo,
|
||||
JSVersion(aVersion));
|
||||
JS::CompileOptions options(mContext);
|
||||
options.setPrincipals(nsJSPrincipals::get(principal))
|
||||
.setVersion(JSVersion(aVersion))
|
||||
.setFileAndLine(aURL, aLineNo);
|
||||
JSFunction* fun = JS::CompileFunction(mContext, target,
|
||||
options, PromiseFlatCString(aName).get(),
|
||||
aArgCount, aArgArray,
|
||||
PromiseFlatString(aBody).get(), aBody.Length());
|
||||
|
||||
if (!fun)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -30,7 +30,7 @@ const ContentPanning = {
|
||||
let target = evt.target;
|
||||
let view = target.ownerDocument ? target.ownerDocument.defaultView
|
||||
: target;
|
||||
view.removeEventListener('click', this, false, true);
|
||||
view.removeEventListener('click', this, true, true);
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -83,7 +83,7 @@ const ContentPanning = {
|
||||
let target = this.target;
|
||||
let view = target.ownerDocument ? target.ownerDocument.defaultView
|
||||
: target;
|
||||
view.addEventListener('click', this, false, true);
|
||||
view.addEventListener('click', this, true, true);
|
||||
}
|
||||
|
||||
if (this.panning)
|
||||
|
@ -19,9 +19,9 @@ XPCOMUtils.defineLazyGetter(Services, "DOMRequest", function() {
|
||||
return Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci.nsIDOMRequestService);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageSender");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "mRIL", function () {
|
||||
return Cc["@mozilla.org/telephony/system-worker-manager;1"].getService(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIRadioInterfaceLayer);
|
||||
|
@ -17,9 +17,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ContactDB.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
||||
let myGlobal = this;
|
||||
|
||||
@ -54,7 +54,7 @@ let DOMContactManager = {
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
if (DEBUG) debug("Fallback DOMContactManager::receiveMessage " + aMessage.name);
|
||||
let mm = aMessage.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
let mm = aMessage.target;
|
||||
let msg = aMessage.data;
|
||||
|
||||
/*
|
||||
|
@ -309,12 +309,10 @@ DeviceStorageRequestParent::StatFileEvent::CancelableRun()
|
||||
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
uint64_t diskUsage = DeviceStorageFile::DirectoryDiskUsage(mFile->mFile);
|
||||
int64_t freeSpace = 0;
|
||||
int64_t freeSpace;
|
||||
nsresult rv = mFile->mFile->GetDiskSpaceAvailable(&freeSpace);
|
||||
if (NS_FAILED(rv)) {
|
||||
r = new PostErrorEvent(mParent, POST_ERROR_EVENT_UNKNOWN);
|
||||
NS_DispatchToMainThread(r);
|
||||
return NS_OK;
|
||||
freeSpace = 0;
|
||||
}
|
||||
|
||||
r = new PostStatResultEvent(mParent, diskUsage, freeSpace);
|
||||
|
@ -100,7 +100,7 @@
|
||||
|
||||
let spObserver =
|
||||
comp.classes["@mozilla.org/special-powers-observer;1"]
|
||||
.getService(comp.interfaces.nsIFrameMessageListener);
|
||||
.getService(comp.interfaces.nsIMessageListener);
|
||||
|
||||
mm.addMessageListener("SPPrefService", spObserver);
|
||||
mm.addMessageListener("SPProcessCrashService", spObserver);
|
||||
|
@ -491,6 +491,15 @@ nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType)
|
||||
f->Normalize();
|
||||
}
|
||||
}
|
||||
|
||||
if (aType.Equals(NS_LITERAL_STRING("testing-other"))) {
|
||||
dirService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
|
||||
if (f) {
|
||||
f->AppendRelativeNativePath(NS_LITERAL_CSTRING("device-storage-testing-other"));
|
||||
f->Create(nsIFile::DIRECTORY_TYPE, 0777);
|
||||
f->Normalize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
|
@ -21,6 +21,7 @@ MOCHITEST_FILES = \
|
||||
test_lastModificationFilter.html \
|
||||
test_stat.html \
|
||||
test_watch.html \
|
||||
test_watchOther.html \
|
||||
devicestorage_common.js \
|
||||
$(NULL)
|
||||
|
||||
|
@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=717103
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
@ -49,24 +49,17 @@ function onChange(e) {
|
||||
}
|
||||
}
|
||||
|
||||
function makeFile() {
|
||||
request = storage.addNamed(createRandomBlob(), gFileName);
|
||||
ok(request, "Should have a non-null request");
|
||||
|
||||
request.onsuccess = addSuccess;
|
||||
request.onerror = addError;
|
||||
}
|
||||
|
||||
var storage = navigator.getDeviceStorage("testing");
|
||||
ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
|
||||
ok(storage, "Should have storage");
|
||||
storage.addEventListener("change", onChange);
|
||||
|
||||
// since addEventListener is async, we have to wait until
|
||||
// it's definitely done before we make the file.
|
||||
setTimeout(makeFile,100);
|
||||
request = storage.addNamed(createRandomBlob(), gFileName);
|
||||
ok(request, "Should have a non-null request");
|
||||
|
||||
request.onsuccess = addSuccess;
|
||||
request.onerror = addError;
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
74
dom/devicestorage/test/test_watchOther.html
Normal file
@ -0,0 +1,74 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html> <!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=717103
|
||||
-->
|
||||
<head>
|
||||
<title>Test for the device storage API </title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="devicestorage_common.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=717103">Mozilla Bug 717103</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
devicestorage_setup();
|
||||
|
||||
var gFileName = randomFilename(20);
|
||||
|
||||
function addSuccess(e) {
|
||||
}
|
||||
|
||||
function addError(e) {
|
||||
ok(false, "addError was called : " + e.target.error.name);
|
||||
devicestorage_cleanup();
|
||||
}
|
||||
|
||||
function onChange(e) {
|
||||
|
||||
dump("we saw: " + e.path + " " + e.reason + "\n");
|
||||
|
||||
if (e.path == gFileName) {
|
||||
ok(true, "we saw the file get created");
|
||||
storage.removeEventListener("change", onChange);
|
||||
devicestorage_cleanup();
|
||||
}
|
||||
else {
|
||||
// we may see other file changes during the test, and
|
||||
// that is completely ok
|
||||
}
|
||||
}
|
||||
|
||||
function onChangeFail(e) {
|
||||
dump("onChangeFail: " + e.path + " " + e.reason + "\n");
|
||||
ok(false, "We should never see any changes");
|
||||
}
|
||||
|
||||
var storage = navigator.getDeviceStorage("testing");
|
||||
ok(storage, "Should have storage");
|
||||
storage.addEventListener("change", onChange);
|
||||
|
||||
var storageOther = navigator.getDeviceStorage("testing-other");
|
||||
ok(storageOther, "Should have storage");
|
||||
storageOther.addEventListener("change", onChangeFail);
|
||||
|
||||
request = storage.addNamed(createRandomBlob(), gFileName);
|
||||
ok(request, "Should have a non-null request");
|
||||
|
||||
request.onsuccess = addSuccess;
|
||||
request.onerror = addError;
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -116,7 +116,7 @@ RPWatchContext.prototype = {
|
||||
};
|
||||
|
||||
let DOMIdentity = {
|
||||
// nsIFrameMessageListener
|
||||
// nsIMessageListener
|
||||
receiveMessage: function DOMIdentity_receiveMessage(aMessage) {
|
||||
let msg = aMessage.json;
|
||||
|
||||
@ -200,7 +200,7 @@ let DOMIdentity = {
|
||||
: "removeMessageListener"];
|
||||
|
||||
for (let message of this.messages) {
|
||||
func(message, this);
|
||||
func.call(aWindow.messageManager, message, this);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -420,7 +420,7 @@ function nsDOMIdentityInternal() {
|
||||
}
|
||||
nsDOMIdentityInternal.prototype = {
|
||||
|
||||
// nsIFrameMessageListener
|
||||
// nsIMessageListener
|
||||
receiveMessage: function nsDOMIdentityInternal_receiveMessage(aMessage) {
|
||||
let msg = aMessage.json;
|
||||
// Is this message intended for this window?
|
||||
@ -515,7 +515,7 @@ nsDOMIdentityInternal.prototype = {
|
||||
classID: Components.ID("{8bcac6a3-56a4-43a4-a44c-cdf42763002f}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI(
|
||||
[Ci.nsIDOMGlobalPropertyInitializer, Ci.nsIFrameMessageListener]
|
||||
[Ci.nsIDOMGlobalPropertyInitializer, Ci.nsIMessageListener]
|
||||
),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({
|
||||
|
@ -114,7 +114,7 @@
|
||||
|
||||
let spObserver =
|
||||
comp.classes["@mozilla.org/special-powers-observer;1"]
|
||||
.getService(comp.interfaces.nsIFrameMessageListener);
|
||||
.getService(comp.interfaces.nsIMessageListener);
|
||||
|
||||
mm.addMessageListener("SPPrefService", spObserver);
|
||||
mm.addMessageListener("SPProcessCrashService", spObserver);
|
||||
|
@ -8,9 +8,9 @@
|
||||
interface nsIBrowserDOMWindow;
|
||||
interface nsIDOMElement;
|
||||
interface nsIDOMEvent;
|
||||
interface nsIChromeFrameMessageManager;
|
||||
interface nsIMessageBroadcaster;
|
||||
|
||||
[scriptable, uuid(7cfbc355-cbf9-4408-8e4c-a3c603ff1428)]
|
||||
[scriptable, uuid(6ff5df67-22da-4379-bf57-da775dad19f8)]
|
||||
interface nsIDOMChromeWindow : nsISupports
|
||||
{
|
||||
const unsigned short STATE_MAXIMIZED = 1;
|
||||
@ -43,7 +43,7 @@ interface nsIDOMChromeWindow : nsISupports
|
||||
*/
|
||||
void notifyDefaultButtonLoaded(in nsIDOMElement defaultButton);
|
||||
|
||||
readonly attribute nsIChromeFrameMessageManager messageManager;
|
||||
readonly attribute nsIMessageBroadcaster messageManager;
|
||||
|
||||
/**
|
||||
* On some operating systems, we must allow the window manager to
|
||||
|
@ -20,7 +20,7 @@ interface nsIDOMValidityState;
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/
|
||||
*/
|
||||
|
||||
[scriptable, uuid(c12471c8-155f-4368-9e8b-13a231e85f3b)]
|
||||
[scriptable, uuid(83984fd0-b0b2-11e1-afa6-0800200c9a66)]
|
||||
interface nsIDOMHTMLInputElement : nsIDOMHTMLElement
|
||||
{
|
||||
attribute DOMString accept;
|
||||
@ -43,6 +43,8 @@ interface nsIDOMHTMLInputElement : nsIDOMHTMLElement
|
||||
attribute unsigned long height;
|
||||
attribute boolean indeterminate;
|
||||
|
||||
attribute DOMString inputmode;
|
||||
|
||||
readonly attribute nsIDOMHTMLElement list;
|
||||
attribute DOMString max;
|
||||
attribute long maxLength;
|
||||
|
@ -161,6 +161,7 @@ parent:
|
||||
SetInputContext(int32_t IMEEnabled,
|
||||
int32_t IMEOpen,
|
||||
nsString type,
|
||||
nsString inputmode,
|
||||
nsString actionHint,
|
||||
int32_t cause,
|
||||
int32_t focusChange);
|
||||
|
@ -1372,7 +1372,7 @@ void
|
||||
TabChildGlobal::Init()
|
||||
{
|
||||
NS_ASSERTION(!mMessageManager, "Re-initializing?!?");
|
||||
mMessageManager = new nsFrameMessageManager(false,
|
||||
mMessageManager = new nsFrameMessageManager(false, /* aChrome */
|
||||
SendSyncMessageToParent,
|
||||
SendAsyncMessageToParent,
|
||||
nullptr,
|
||||
@ -1394,7 +1394,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(TabChildGlobal,
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChildGlobal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMessageListenerManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptContextPrincipal)
|
||||
|
@ -72,7 +72,8 @@ public:
|
||||
void Init();
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
|
||||
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
|
||||
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
|
@ -684,6 +684,7 @@ bool
|
||||
TabParent::RecvSetInputContext(const int32_t& aIMEEnabled,
|
||||
const int32_t& aIMEOpen,
|
||||
const nsString& aType,
|
||||
const nsString& aInputmode,
|
||||
const nsString& aActionHint,
|
||||
const int32_t& aCause,
|
||||
const int32_t& aFocusChange)
|
||||
@ -701,6 +702,7 @@ TabParent::RecvSetInputContext(const int32_t& aIMEEnabled,
|
||||
context.mIMEState.mEnabled = static_cast<IMEState::Enabled>(aIMEEnabled);
|
||||
context.mIMEState.mOpen = static_cast<IMEState::Open>(aIMEOpen);
|
||||
context.mHTMLInputType.Assign(aType);
|
||||
context.mHTMLInputInputmode.Assign(aInputmode);
|
||||
context.mActionHint.Assign(aActionHint);
|
||||
InputContextAction action(
|
||||
static_cast<InputContextAction::Cause>(aCause),
|
||||
|
@ -98,6 +98,7 @@ public:
|
||||
virtual bool RecvSetInputContext(const int32_t& aIMEEnabled,
|
||||
const int32_t& aIMEOpen,
|
||||
const nsString& aType,
|
||||
const nsString& aInputmode,
|
||||
const nsString& aActionHint,
|
||||
const int32_t& aCause,
|
||||
const int32_t& aFocusChange);
|
||||
|
@ -97,17 +97,16 @@
|
||||
// 1. Test that loading a script works, and that accessing process level mm and
|
||||
// global mm works.
|
||||
var ppm = Components.classes["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsIFrameMessageManager);
|
||||
.getService(Components.interfaces.nsIMessageBroadcaster);
|
||||
var gm = Components.classes["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsIChromeFrameMessageManager);
|
||||
.getService(Components.interfaces.nsIMessageBroadcaster);
|
||||
var cpm = Components.classes["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsISyncMessageSender);
|
||||
.getService(Components.interfaces.nsISyncMessageSender);
|
||||
|
||||
var tppm = ppm.QueryInterface(Components.interfaces.nsITreeItemFrameMessageManager);
|
||||
if (tppm.childCount != 2) {
|
||||
if (ppm.childCount != 2) {
|
||||
alert("Should have two child processes!");
|
||||
}
|
||||
var childprocessmm = tppm.getChildAt(1); // 0 is the in-process child process mm
|
||||
var childprocessmm = ppm.getChildAt(1); // 0 is the in-process child process mm
|
||||
|
||||
childprocessmm.addMessageListener("ppm-sync",
|
||||
function(m) {
|
||||
@ -161,7 +160,7 @@
|
||||
receiveMessage: function(m) {
|
||||
var s = (m.json.message == "linkclick-received") &&
|
||||
(this.foobarObjectVar) ? "PASS" : "FAIL";
|
||||
messageManager.sendAsyncMessage("chrome-message", { ok : s } );
|
||||
messageManager.broadcastAsyncMessage("chrome-message", { ok : s } );
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -197,7 +196,7 @@
|
||||
function messageSpeed() {
|
||||
speedTestCount = 0;
|
||||
messageManager.addMessageListener("speed-test", speedHandler);
|
||||
messageManager.sendAsyncMessage("speed-test-start");
|
||||
messageManager.broadcastAsyncMessage("speed-test-start");
|
||||
}
|
||||
|
||||
function speedHandler() {
|
||||
@ -217,7 +216,7 @@
|
||||
if (++addRemoveTestCount == 1) {
|
||||
alert("Expected echo message");
|
||||
messageManager.removeMessageListener("async-echo", echoListener);
|
||||
messageManager.sendAsyncMessage("async-echo");
|
||||
messageManager.broadcastAsyncMessage("async-echo");
|
||||
return;
|
||||
}
|
||||
alert("Unexpected echo message");
|
||||
@ -226,7 +225,7 @@
|
||||
function listenerAddRemove() {
|
||||
addRemoveTestCount = 0;
|
||||
messageManager.addMessageListener("async-echo", echoListener);
|
||||
messageManager.sendAsyncMessage("async-echo");
|
||||
messageManager.broadcastAsyncMessage("async-echo");
|
||||
}
|
||||
|
||||
var MozAfterPaintCount = 0;
|
||||
@ -286,8 +285,10 @@
|
||||
</toolbar>
|
||||
<toolbar><label value="Load a script (URL) to content process:"/>
|
||||
<textbox flex="1" id="script"/><button
|
||||
label="send" oncommand="document.getElementById('page').QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.
|
||||
messageManager.loadFrameScript(this.previousSibling.value, false);"/>
|
||||
label="send" oncommand="document.getElementById('page')
|
||||
.QueryInterface(Components.interfaces.nsIFrameLoaderOwner)
|
||||
.frameLoader.messageManager
|
||||
.loadFrameScript(this.previousSibling.value, false);"/>
|
||||
</toolbar>
|
||||
<toolbar>
|
||||
<label value="Eval script in chrome context"/>
|
||||
|
@ -49,9 +49,10 @@
|
||||
}
|
||||
Services.obs.addObserver(crashObserver, 'ipc:content-shutdown', false);
|
||||
|
||||
document.getElementById('thebrowser').
|
||||
QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.
|
||||
messageManager.loadFrameScript('chrome://mochitests/content/chrome/dom/ipc/tests/process_error_contentscript.js', true);
|
||||
document.getElementById('thebrowser')
|
||||
.QueryInterface(Components.interfaces.nsIFrameLoaderOwner)
|
||||
.frameLoader.messageManager
|
||||
.loadFrameScript('chrome://mochitests/content/chrome/dom/ipc/tests/process_error_contentscript.js', true);
|
||||
]]></script>
|
||||
|
||||
</window>
|
||||
|
@ -12,9 +12,9 @@ const Cr = Components.results;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
// Limit the number of pending messages for a given page.
|
||||
let kMaxPendingMessages;
|
||||
@ -42,9 +42,9 @@ function SystemMessageInternal() {
|
||||
SystemMessageInternal.prototype = {
|
||||
sendMessage: function sendMessage(aType, aMessage, aPageURI, aManifestURI) {
|
||||
debug("Broadcasting " + aType + " " + JSON.stringify(aMessage));
|
||||
ppmm.sendAsyncMessage("SystemMessageManager:Message" , { type: aType,
|
||||
msg: aMessage,
|
||||
manifest: aManifestURI.spec });
|
||||
ppmm.broadcastAsyncMessage("SystemMessageManager:Message" , { type: aType,
|
||||
msg: aMessage,
|
||||
manifest: aManifestURI.spec });
|
||||
|
||||
// Queue the message for pages that registered an handler for this type.
|
||||
this._pages.forEach(function sendMess_openPage(aPage) {
|
||||
|
@ -13,11 +13,9 @@ Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager)
|
||||
.QueryInterface(Ci.nsISyncMessageSender);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsISyncMessageSender");
|
||||
|
||||
// Limit the number of pending messages for a given type.
|
||||
let kMaxPendingMessages;
|
||||
|
@ -34,9 +34,9 @@ let EXPORTED_SYMBOLS = ["PermissionPromptHelper"];
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
||||
var permissionManager = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
|
||||
var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
|
||||
@ -77,7 +77,7 @@ let PermissionPromptHelper = {
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
debug("PermissionPromptHelper::receiveMessage " + aMessage.name);
|
||||
let mm = aMessage.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
let mm = aMessage.target;
|
||||
let msg = aMessage.data;
|
||||
|
||||
let result;
|
||||
|
0
dom/plugins/ipc/PluginModuleParent.cpp
Normal file → Executable file
@ -17,9 +17,9 @@ let EXPORTED_SYMBOLS = ["SettingsChangeNotifier"];
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
|
||||
let SettingsChangeNotifier = {
|
||||
@ -41,7 +41,7 @@ let SettingsChangeNotifier = {
|
||||
let msg = aMessage.json;
|
||||
switch (aMessage.name) {
|
||||
case "Settings:Changed":
|
||||
ppmm.sendAsyncMessage("Settings:Change:Return:OK", { key: msg.key, value: msg.value });
|
||||
ppmm.broadcastAsyncMessage("Settings:Change:Return:OK", { key: msg.key, value: msg.value });
|
||||
Services.obs.notifyObservers(this, "mozsettings-changed", JSON.stringify({
|
||||
key: msg.key,
|
||||
value: msg.value
|
||||
|