Browse files

Merge the last PGO-green inbound changeset to m-c.

  • Loading branch information...
2 parents 8cde394 + bd5a26f commit 52804d48c057d68c843d7b41d6ee635643499e54 @rvandermeulen rvandermeulen committed Aug 27, 2012
Showing with 1,365 additions and 778 deletions.
  1. +1 −1 b2g/chrome/content/shell.js
  2. +2 −1 b2g/components/ContentHandler.js
  3. +4 −4 b2g/components/MozKeyboard.js
  4. +76 −5 browser/base/content/browser-social.js
  5. +1 −1 browser/base/content/browser.js
  6. +1 −0 browser/base/content/test/Makefile.in
  7. +15 −4 browser/base/content/test/browser_social_shareButton.js
  8. +9 −0 browser/base/content/test/head.js
  9. BIN browser/base/content/test/social_share_image.png
  10. +19 −0 browser/base/content/test/social_worker.js
  11. +0 −4 browser/locales/en-US/chrome/browser/browser.properties
  12. +2 −9 browser/themes/gnomestripe/browser.css
  13. +0 −3 browser/themes/gnomestripe/jar.mn
  14. BIN browser/themes/gnomestripe/share-button-active.png
  15. BIN browser/themes/gnomestripe/share-button-shared.png
  16. BIN browser/themes/gnomestripe/share-button.png
  17. +2 −9 browser/themes/pinstripe/browser.css
  18. +0 −3 browser/themes/pinstripe/jar.mn
  19. BIN browser/themes/pinstripe/share-button-active.png
  20. BIN browser/themes/pinstripe/share-button-shared.png
  21. BIN browser/themes/pinstripe/share-button.png
  22. +2 −9 browser/themes/winstripe/browser.css
  23. +0 −6 browser/themes/winstripe/jar.mn
  24. BIN browser/themes/winstripe/share-button-active.png
  25. BIN browser/themes/winstripe/share-button-shared.png
  26. BIN browser/themes/winstripe/share-button.png
  27. +3 −2 build/unix/build-clang/build-clang.py
  28. +1 −1 content/base/public/Makefile.in
  29. +3 −3 content/base/public/nsIFrameLoader.idl
  30. +0 −120 content/base/public/nsIFrameMessageManager.idl
  31. +330 −0 content/base/public/nsIMessageManager.idl
  32. +2 −2 content/base/src/messageWakeupService.js
  33. +9 −7 content/base/src/nsCCUncollectableMarker.cpp
  34. +4 −4 content/base/src/nsFrameLoader.cpp
  35. +129 −71 content/base/src/nsFrameMessageManager.cpp
  36. +32 −15 content/base/src/nsFrameMessageManager.h
  37. +3 −2 content/base/src/nsInProcessTabChildGlobal.cpp
  38. +2 −1 content/base/src/nsInProcessTabChildGlobal.h
  39. +7 −4 content/base/test/chrome/file_bug549682.xul
  40. +2 −2 content/base/test/chrome/file_bug616841.xul
  41. +1 −1 content/html/content/src/nsHTMLMediaElement.cpp
  42. +0 −1 docshell/base/nsDocShell.cpp
  43. +9 −10 dom/activities/src/ActivitiesService.jsm
  44. +3 −5 dom/activities/src/ActivityProxy.js
  45. +3 −5 dom/activities/src/ActivityRequestHandler.js
  46. +4 −4 dom/alarm/AlarmService.jsm
  47. +1 −2 dom/apps/src/AppsService.js
  48. +3 −3 dom/apps/src/Webapps.js
  49. +17 −18 dom/apps/src/Webapps.jsm
  50. +3 −3 dom/base/DOMRequestHelper.jsm
  51. +49 −31 dom/base/nsDOMClassInfo.cpp
  52. +5 −0 dom/base/nsDOMClassInfo.h
  53. +2 −0 dom/base/nsDOMClassInfoClasses.h
  54. +7 −4 dom/base/nsGlobalWindow.cpp
  55. +1 −1 dom/base/nsGlobalWindow.h
  56. +33 −34 dom/base/nsJSEnvironment.cpp
  57. +3 −3 dom/contacts/ContactManager.js
  58. +4 −4 dom/contacts/fallback/ContactService.jsm
  59. +1 −1 dom/devicestorage/ipc/test_ipc.html
  60. +2 −2 dom/identity/DOMIdentity.jsm
  61. +2 −2 dom/identity/nsDOMIdentity.js
  62. +1 −1 dom/indexedDB/ipc/test_ipc.html
  63. +3 −3 dom/interfaces/base/nsIDOMChromeWindow.idl
  64. +3 −2 dom/ipc/TabChild.cpp
  65. +2 −1 dom/ipc/TabChild.h
  66. +13 −12 dom/ipc/test.xul
  67. +4 −3 dom/ipc/tests/process_error.xul
  68. +6 −6 dom/messages/SystemMessageInternal.js
  69. +3 −5 dom/messages/SystemMessageManager.js
  70. +4 −4 dom/permission/PermissionPromptHelper.jsm
  71. +4 −4 dom/settings/SettingsChangeNotifier.jsm
  72. +3 −3 dom/settings/SettingsManager.js
  73. +3 −4 dom/system/gonk/RILContentHelper.js
  74. +20 −21 dom/system/gonk/RadioInterfaceLayer.js
  75. +0 −3 dom/tests/mochitest/general/test_interfaces.html
  76. +3 −2 dom/wifi/WifiWorker.js
  77. +6 −5 dom/workers/ScriptLoader.cpp
  78. +6 −7 dom/workers/WorkerPrivate.cpp
  79. +2 −2 extensions/cookie/test/unit_ipc/test_parent.js
  80. +5 −3 extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
  81. +0 −111 js/src/jsreops.tbl
  82. +6 −7 js/xpconnect/src/XPCComponents.cpp
  83. +2 −1 js/xpconnect/src/XPCJSRuntime.cpp
  84. +1 −0 js/xpconnect/src/xpcprivate.h
  85. +2 −0 js/xpconnect/tests/chrome/Makefile.in
  86. +50 −0 js/xpconnect/tests/chrome/test_bug738244.xul
  87. +50 −0 js/xpconnect/tests/chrome/test_mozMatchesSelector.xul
  88. +2 −0 js/xpconnect/tests/mochitest/Makefile.in
  89. +10 −0 js/xpconnect/tests/mochitest/file_bug738244.html
  90. +1 −0 js/xpconnect/tests/mochitest/file_mozMatchesSelector.html
  91. +8 −0 js/xpconnect/wrappers/WrapperFactory.cpp
  92. +3 −0 js/xpconnect/wrappers/WrapperFactory.h
  93. +232 −75 js/xpconnect/wrappers/XrayWrapper.cpp
  94. +27 −0 js/xpconnect/wrappers/XrayWrapper.h
  95. +1 −1 layout/base/nsPresContext.cpp
  96. +6 −6 layout/build/nsLayoutModule.cpp
  97. +12 −12 layout/ipc/test-ipcbrowser-chrome.js
  98. +1 −1 layout/svg/base/src/nsSVGUtils.cpp
  99. +1 −1 layout/tools/reftest/reftest.js
  100. +2 −1 mobile/xul/chrome/content/CapturePickerUI.js
  101. +12 −11 mobile/xul/chrome/content/WebappsUI.js
  102. +2 −2 mobile/xul/chrome/content/bindings/browser.xml
  103. +1 −1 mobile/xul/components/LoginManager.js
  104. +3 −5 netwerk/protocol/app/AppProtocolHandler.js
  105. +7 −7 testing/marionette/marionette-actors.js
  106. +2 −2 testing/mochitest/specialpowers/components/SpecialPowersObserver.js
  107. +1 −1 toolkit/components/contentprefs/nsContentPrefService.js
  108. +2 −2 toolkit/components/contentprefs/tests/unit_ipc/test_contentPrefs_parentipc.js
  109. +2 −2 toolkit/components/satchel/nsFormHistory.js
  110. +2 −2 toolkit/mozapps/extensions/ChromeManifestParser.jsm
  111. +2 −2 toolkit/mozapps/extensions/XPIProvider.jsm
  112. +1 −1 toolkit/mozapps/extensions/addonManager.js
  113. +3 −3 toolkit/themes/pinstripe/global/media/videocontrols.css
  114. BIN toolkit/themes/pinstripe/global/media/volumeThumb.png
  115. +3 −3 toolkit/themes/winstripe/global/media/videocontrols.css
  116. BIN toolkit/themes/winstripe/global/media/volumeThumb.png
View
2 b2g/chrome/content/shell.js
@@ -49,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() {
View
3 b2g/components/ContentHandler.js
@@ -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) {
View
8 b2g/components/MozKeyboard.js
@@ -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 || []
});
},
View
81 browser/base/content/browser-social.js
@@ -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) + '")';
}
};
View
2 browser/base/content/browser.js
@@ -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
View
1 browser/base/content/test/Makefile.in
@@ -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 \
View
19 browser/base/content/test/browser_social_shareButton.js
@@ -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) {
View
9 browser/base/content/test/head.js
@@ -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");
});
View
BIN browser/base/content/test/social_share_image.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
19 browser/base/content/test/social_worker.js
@@ -91,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;
}
}
}
View
4 browser/locales/en-US/chrome/browser/browser.properties
@@ -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
View
11 browser/themes/gnomestripe/browser.css
@@ -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 {
View
3 browser/themes/gnomestripe/jar.mn
@@ -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
View
BIN browser/themes/gnomestripe/share-button-active.png
Deleted file not rendered
View
BIN browser/themes/gnomestripe/share-button-shared.png
Deleted file not rendered
View
BIN browser/themes/gnomestripe/share-button.png
Deleted file not rendered
View
11 browser/themes/pinstripe/browser.css
@@ -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 {
View
3 browser/themes/pinstripe/jar.mn
@@ -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)
View
BIN browser/themes/pinstripe/share-button-active.png
Deleted file not rendered
View
BIN browser/themes/pinstripe/share-button-shared.png
Deleted file not rendered
View
BIN browser/themes/pinstripe/share-button.png
Deleted file not rendered
View
11 browser/themes/winstripe/browser.css
@@ -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 {
View
6 browser/themes/winstripe/jar.mn
@@ -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
View
BIN browser/themes/winstripe/share-button-active.png
Deleted file not rendered
View
BIN browser/themes/winstripe/share-button-shared.png
Deleted file not rendered
View
BIN browser/themes/winstripe/share-button.png
Deleted file not rendered
View
5 build/unix/build-clang/build-clang.py
@@ -70,6 +70,8 @@ def f():
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'
View
2 content/base/public/Makefile.in
@@ -81,7 +81,7 @@ XPIDLSRCS = \
nsIFrameLoader.idl \
nsIXMLHttpRequest.idl \
nsIContentSecurityPolicy.idl \
- nsIFrameMessageManager.idl \
+ nsIMessageManager.idl \
nsIWebSocket.idl \
nsIEventSource.idl \
$(NULL)
View
6 content/base/public/nsIFrameLoader.idl
@@ -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.
View
120 content/base/public/nsIFrameMessageManager.idl
@@ -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);
-};
-
View
330 content/base/public/nsIMessageManager.idl
@@ -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);
+};
View
4 content/base/src/messageWakeupService.js
@@ -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;
View
16 content/base/src/nsCCUncollectableMarker.cpp
@@ -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.
View
8 content/base/src/nsFrameLoader.cpp
@@ -2244,7 +2244,7 @@ bool SendAsyncMessageToChild(void* aCallbackData,
}
NS_IMETHODIMP
-nsFrameLoader::GetMessageManager(nsIChromeFrameMessageManager** aManager)
+nsFrameLoader::GetMessageManager(nsIMessageSender** aManager)
{
EnsureMessageManager();
if (mMessageManager) {
@@ -2336,21 +2336,21 @@ 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,
mRemoteBrowserShown ? this : nullptr,
static_cast<nsFrameMessageManager*>(parentManager.get()),
cx);
} else {
- mMessageManager = new nsFrameMessageManager(true,
+ mMessageManager = new nsFrameMessageManager(true, /* aChrome */
nullptr,
SendAsyncMessageToChild,
LoadScript,
View
200 content/base/src/nsFrameMessageManager.cpp
@@ -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)
{
@@ -329,24 +402,6 @@ nsFrameMessageManager::GetDocShell(nsIDocShell** aDocShell)
}
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 @@ class MMListenerRemover
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);
View
47 content/base/src/nsFrameMessageManager.h
@@ -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 @@ class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager,
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 @@ class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager,
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 @@ class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager,
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 @@ class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager,
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;
View
5 content/base/src/nsInProcessTabChildGlobal.cpp
@@ -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)
View
3 content/base/src/nsInProcessTabChildGlobal.h
@@ -33,7 +33,8 @@ class nsInProcessTabChildGlobal : public nsDOMEventTargetHelper,
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,
View
11 content/base/test/chrome/file_bug549682.xul
@@ -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");
View
4 content/base/test/chrome/file_bug616841.xul
@@ -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] });
}
}
View
2 content/html/content/src/nsHTMLMediaElement.cpp
@@ -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);
View
1 docshell/base/nsDocShell.cpp
@@ -190,7 +190,6 @@
#include "nsDOMNavigationTiming.h"
#include "nsITimedChannel.h"
#include "mozilla/StartupTimeline.h"
-#include "nsIFrameMessageManager.h"
#include "mozilla/Telemetry.h"
#include "nsISecurityUITelemetry.h"
View
19 dom/activities/src/ActivitiesService.jsm
@@ -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,18 +265,18 @@ 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":
this.startActivity(msg);
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":
View
8 dom/activities/src/ActivityProxy.js
@@ -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");
View
8 dom/activities/src/ActivityRequestHandler.js
@@ -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");
View
8 dom/alarm/AlarmService.jsm
@@ -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":
View
3 dom/apps/src/AppsService.js
@@ -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);