Merge latest green fx-team changeset and mozilla-central

This commit is contained in:
Ed Morley 2013-07-11 10:12:37 +01:00
commit bbef1fe93c
331 changed files with 6529 additions and 5505 deletions

View File

@ -39,6 +39,8 @@ this.EXPORTED_SYMBOLS = ['UtteranceGenerator', 'BrailleGenerator'];
this.OutputGenerator = {
defaultOutputOrder: OUTPUT_DESC_LAST,
/**
* Generates output for a PivotContext.
* @param {PivotContext} aContext object that generates and caches
@ -383,8 +385,6 @@ this.OutputGenerator = {
this.UtteranceGenerator = {
__proto__: OutputGenerator,
defaultOutputOrder: OUTPUT_DESC_FIRST,
gActionMap: {
jump: 'jumpAction',
press: 'pressAction',
@ -595,10 +595,10 @@ this.UtteranceGenerator = {
_getListUtterance: function _getListUtterance(aAccessible, aRoleStr, aFlags, aItemCount) {
let desc = [];
let roleStr = this._getLocalizedRole(aRoleStr);
if (roleStr)
if (roleStr) {
desc.push(roleStr);
desc.push
(gStringBundle.formatStringFromName('listItemCount', [aItemCount], 1));
}
desc.push(this._getPluralFormString('listItemCount', aItemCount));
let utterance = [desc.join(' ')];
this._addName(utterance, aAccessible, aFlags);
@ -612,8 +612,6 @@ this.UtteranceGenerator = {
this.BrailleGenerator = {
__proto__: OutputGenerator,
defaultOutputOrder: OUTPUT_DESC_LAST,
genForContext: function genForContext(aContext) {
let output = OutputGenerator.genForContext.apply(this, arguments);

View File

@ -72,9 +72,9 @@
"main"]]
}, {
accOrElmOrID: "complementary",
expectedUtterance: [["list 1 items", "complementary", "First item",
expectedUtterance: [["list 1 item", "complementary", "First item",
"A complementary"], ["A complementary", "First item",
"complementary", "list 1 items"]],
"complementary", "list 1 item"]],
// XXX: The '*' should probably come before all of the context
// utterance.
expectedBraille: [["complementary", "*", "A complementary"], ["*",

View File

@ -39,8 +39,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
}, {
accOrElmOrID: "list",
expected: [
["list 1 items", "First item", "1.", "list one"],
["1.", "list one", "First item", "list 1 items"]
["list 1 item", "First item", "1.", "list one"],
["1.", "list one", "First item", "list 1 item"]
]
}, {
accOrElmOrID: "dlist",
@ -51,8 +51,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
}, {
accOrElmOrID: "li_one",
expected: [
["list 1 items", "First item", "1.", "list one"],
["1.", "list one", "First item", "list 1 items"]
["list 1 item", "First item", "1.", "list one"],
["1.", "list one", "First item", "list 1 item"]
]
}, {
accOrElmOrID: "cell",
@ -71,8 +71,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
accOrElmOrID: "list",
oldAccOrElmOrID: "li_one",
expected: [
["list 1 items", "First item", "1.", "list one"],
["1.", "list one", "First item", "list 1 items"]
["list 1 item", "First item", "1.", "list one"],
["1.", "list one", "First item", "list 1 item"]
]
}, {
// Test pivot to "apples" link from the table cell.

View File

@ -648,6 +648,8 @@ pref("dom.disable_window_open_dialog_feature", true);
// Screen reader support
pref("accessibility.accessfu.activate", 2);
// Setting for an utterance order (0 - description first, 1 - description last).
pref("accessibility.accessfu.utterance", 1);
// Whether to skip images with empty alt text
pref("accessibility.accessfu.skip_empty_images", true);

View File

@ -12,39 +12,39 @@ include $(DEPTH)/config/autoconf.mk
MOCHITEST_FILES = \
head_plain.js \
test_feed_discovery.html \
feed_discovery.html \
test_bug395533.html \
bug395533-data.txt \
ctxmenu-image.png \
video.ogg \
test_offlineNotification.html \
offlineChild.html \
offlineChild.cacheManifest \
offlineChild.cacheManifest^headers^ \
offlineChild2.html \
offlineChild2.cacheManifest \
offlineChild2.cacheManifest^headers^ \
offlineEvent.html \
offlineEvent.cacheManifest \
offlineEvent.cacheManifest^headers^ \
test_bug364677.html \
bug364677-data.xml \
bug364677-data.xml^headers^ \
test_offline_gzip.html \
gZipOfflineChild.html \
gZipOfflineChild.html^headers^ \
bug395533-data.txt \
ctxmenu-image.png \
feed_discovery.html \
gZipOfflineChild.cacheManifest \
gZipOfflineChild.cacheManifest^headers^ \
gZipOfflineChild.html \
gZipOfflineChild.html^headers^ \
offlineChild.cacheManifest \
offlineChild.cacheManifest^headers^ \
offlineChild.html \
offlineChild2.cacheManifest \
offlineChild2.cacheManifest^headers^ \
offlineChild2.html \
offlineEvent.cacheManifest \
offlineEvent.cacheManifest^headers^ \
offlineEvent.html \
test_bug364677.html \
test_bug395533.html \
test_feed_discovery.html \
test_offline_gzip.html \
test_offlineNotification.html \
video.ogg \
$(NULL)
# test_contextmenu.html is disabled on Linux due to bug 513558
ifndef MOZ_WIDGET_GTK
MOCHITEST_FILES += \
audio.ogg \
test_contextmenu.html \
subtst_contextmenu.html \
privateBrowsingMode.js \
subtst_contextmenu.html \
test_contextmenu.html \
$(NULL)
endif
@ -62,14 +62,24 @@ endif
MOCHITEST_BROWSER_FILES = \
head.js \
browser_typeAheadFind.js \
browser_keywordSearch.js \
browser_keywordSearch_postData.js \
POSTSearchEngine.xml \
print_postdata.sjs \
alltabslistener.html \
app_bug575561.html \
app_subframe_bug575561.html \
authenticate.sjs \
blockNoPlugins.xml \
blockPluginHard.xml \
blockPluginVulnerableNoUpdate.xml \
blockPluginVulnerableUpdatable.xml \
browser_aboutHealthReport.js \
browser_aboutHome.js \
browser_aboutSyncProgress.js \
browser_addKeywordSearch.js \
browser_addon_bar_aomlistener.js \
browser_addon_bar_close_button.js \
browser_addon_bar_shortcut.js \
browser_alltabslistener.js \
browser_blob-channelname.js \
browser_bug304198.js \
title_test.svg \
browser_bug329212.js \
browser_bug356571.js \
browser_bug380960.js \
@ -82,7 +92,6 @@ MOCHITEST_BROWSER_FILES = \
browser_bug416661.js \
browser_bug417483.js \
browser_bug419612.js \
browser_identity_UI.js \
browser_bug422590.js \
browser_bug424101.js \
browser_bug427559.js \
@ -94,8 +103,8 @@ MOCHITEST_BROWSER_FILES = \
browser_bug460146.js \
browser_bug462673.js \
browser_bug477014.js \
browser_bug479408.js \
browser_bug479408_sample.html \
browser_bug479408.js \
browser_bug481560.js \
browser_bug484315.js \
browser_bug491431.js \
@ -118,7 +127,6 @@ MOCHITEST_BROWSER_FILES = \
browser_bug563588.js \
browser_bug565575.js \
browser_bug567306.js \
browser_zbug569342.js \
browser_bug575561.js \
browser_bug575830.js \
browser_bug577121.js \
@ -148,105 +156,134 @@ MOCHITEST_BROWSER_FILES = \
browser_bug647886.js \
browser_bug655584.js \
browser_bug664672.js \
browser_bug678392.js \
browser_bug676619.js \
browser_bug678392-1.html \
browser_bug678392-2.html \
browser_bug678392.js \
browser_bug710878.js \
browser_bug719271.js \
browser_bug724239.js \
browser_bug734076.js \
browser_bug735471.js \
browser_bug743421.js \
browser_bug744745.js \
browser_bug749738.js \
browser_bug752516.js \
browser_bug763468_perwindowpb.js \
browser_bug767836_perwindowpb.js \
browser_bug771331.js \
browser_bug783614.js \
browser_bug787619.js \
browser_bug797677.js \
browser_bug812562.js \
browser_bug816527.js \
browser_bug817947.js \
browser_bug818118.js \
browser_bug820497.js \
browser_bug822367.js \
browser_bug832435.js \
browser_bug839103.js \
browser_bug882977.js \
browser_canonizeURL.js \
browser_customize.js \
browser_findbarClose.js \
browser_homeDrop.js \
browser_keywordBookmarklets.js \
browser_clearplugindata_noage.html \
browser_clearplugindata.html \
browser_clearplugindata.js \
browser_contentAreaClick.js \
browser_contextSearchTabPosition.js \
browser_CTP_drag_drop.js \
browser_ctrlTab.js \
browser_customize_popupNotification.js \
browser_customize.js \
browser_disablechrome.js \
browser_discovery.js \
browser_duplicateIDs.js \
browser_findbarClose.js \
browser_fullscreen-window-open.js \
file_fullscreen-window-open.html \
browser_gestureSupport.js \
browser_getshortcutoruri.js \
browser_hide_removing.js \
browser_overflowScroll.js \
browser_homeDrop.js \
browser_identity_UI.js \
browser_keywordBookmarklets.js \
browser_keywordSearch_postData.js \
browser_keywordSearch.js \
browser_lastAccessedTab.js \
browser_locationBarCommand.js \
browser_locationBarExternalLoad.js \
browser_middleMouse_inherit.js \
browser_minimize.js \
browser_offlineQuotaNotification.js \
browser_overflowScroll.js \
browser_page_style_menu.js \
browser_pageInfo_plugins.js \
browser_pageInfo.js \
browser_pinnedTabs.js \
browser_plainTextLinks.js \
browser_pluginCrashCommentAndURL.js \
browser_pluginnotification.js \
browser_plugins_added_dynamically.js \
browser_CTP_drag_drop.js \
browser_pluginplaypreview.js \
browser_pluginplaypreview2.js \
browser_plugins_added_dynamically.js \
browser_popupUI.js \
browser_private_browsing_window.js \
browser_private_no_prompt.js \
browser_relatedTabs.js \
browser_removeTabsToTheEnd.js \
browser_sanitize-passwordDisabledHosts.js \
browser_sanitize-sitepermissions.js \
browser_sanitize-timespans.js \
browser_tabopen_reflows.js \
browser_clearplugindata.js \
browser_clearplugindata.html \
browser_clearplugindata_noage.html \
browser_popupUI.js \
browser_sanitizeDialog.js \
browser_save_link-perwindowpb.js \
browser_save_private_link_perwindowpb.js \
browser_save_video.js \
browser_tabMatchesInAwesomebar_perwindowpb.js \
browser_tab_drag_drop_perwindow.js \
bug564387.html \
bug564387_video1.ogv \
bug564387_video1.ogv^headers^ \
bug792517.html \
bug792517-2.html \
bug792517.sjs \
test_bug839103.html \
bug839103.css \
browser_scope.js \
browser_selectTabAtIndex.js \
browser_tab_drag_drop_perwindow.js \
browser_tab_dragdrop.js \
browser_tab_dragdrop2.js \
browser_tab_dragdrop2_frame1.xul \
browser_tab_dragdrop2.js \
browser_tabDrop.js \
browser_tabfocus.js \
browser_tabMatchesInAwesomebar_perwindowpb.js \
browser_tabopen_reflows.js \
browser_tabs_isActive.js \
browser_tabs_owner.js \
browser_typeAheadFind.js \
browser_unloaddialogs.js \
browser_urlbar_search_healthreport.js \
browser_urlbarAutoFillTrimURLs.js \
browser_urlbarCopying.js \
browser_urlbarEnter.js \
browser_urlbarRevert.js \
browser_URLBarSetURI.js \
browser_urlbarStop.js \
browser_urlbarTrimURLs.js \
browser_urlbar_search_healthreport.js \
browser_urlHighlight.js \
browser_utilityOverlay.js \
browser_visibleFindSelection.js \
browser_visibleTabs.js \
browser_visibleTabs_contextMenu.js \
browser_visibleTabs_bookmarkAllPages.js \
browser_visibleTabs_bookmarkAllTabs.js \
browser_visibleTabs_contextMenu.js \
browser_visibleTabs_tabPreview.js \
browser_visibleTabs.js \
browser_wyciwyg_urlbarCopying.js \
browser_zbug569342.js \
bug564387_video1.ogv \
bug564387_video1.ogv^headers^ \
bug564387.html \
bug592338.html \
bug792517-2.html \
bug792517.html \
bug792517.sjs \
bug839103.css \
disablechrome.html \
discovery.html \
domplate_test.js \
download_page.html \
dummy_page.html \
feed_tab.html \
file_bug550565_favicon.ico \
file_bug550565_popup.html \
file_bug822367_1.html \
file_bug822367_1.js \
file_bug822367_2.html \
@ -256,78 +293,42 @@ MOCHITEST_BROWSER_FILES = \
file_bug822367_4B.html \
file_bug822367_5.html \
file_bug822367_6.html \
file_fullscreen-window-open.html \
healthreport_testRemoteCommands.html \
moz.png \
video.ogg \
test_bug435035.html \
test_bug462673.html \
offlineQuotaNotification.cacheManifest \
offlineQuotaNotification.html \
page_style_sample.html \
plugin_unknown.html \
plugin_test.html \
plugin_test2.html \
plugin_test3.html \
plugin_add_dynamically.html \
plugin_alternate_content.html \
plugin_both.html \
plugin_both2.html \
plugin_add_dynamically.html \
plugin_clickToPlayAllow.html \
plugin_clickToPlayDeny.html \
plugin_bug744745.html \
plugin_bug749455.html \
plugin_bug752516.html \
plugin_bug787619.html \
plugin_bug797677.html \
plugin_bug820497.html \
plugin_clickToPlayAllow.html \
plugin_clickToPlayDeny.html \
plugin_hidden_to_visible.html \
plugin_test.html \
plugin_test2.html \
plugin_test3.html \
plugin_two_types.html \
alltabslistener.html \
zoom_test.html \
dummy_page.html \
file_bug550565_popup.html \
file_bug550565_favicon.ico \
browser_aboutHome.js \
app_bug575561.html \
app_subframe_bug575561.html \
browser_contentAreaClick.js \
browser_addon_bar_close_button.js \
browser_addon_bar_shortcut.js \
browser_addon_bar_aomlistener.js \
test_bug628179.html \
browser_wyciwyg_urlbarCopying.js \
test_wyciwyg_copying.html \
authenticate.sjs \
browser_minimize.js \
browser_aboutSyncProgress.js \
browser_middleMouse_inherit.js \
redirect_bug623155.sjs \
browser_tabDrop.js \
browser_lastAccessedTab.js \
browser_bug734076.js \
browser_bug744745.js \
browser_bug787619.js \
browser_bug812562.js \
browser_bug818118.js \
browser_bug820497.js \
blockPluginVulnerableUpdatable.xml \
blockPluginVulnerableNoUpdate.xml \
blockNoPlugins.xml \
blockPluginHard.xml \
browser_utilityOverlay.js \
browser_bug676619.js \
download_page.html \
browser_URLBarSetURI.js \
browser_pageInfo_plugins.js \
browser_pageInfo.js \
feed_tab.html \
browser_pluginCrashCommentAndURL.js \
plugin_unknown.html \
pluginCrashCommentAndURL.html \
browser_private_no_prompt.js \
browser_blob-channelname.js \
browser_aboutHealthReport.js \
healthreport_testRemoteCommands.html \
browser_offlineQuotaNotification.js \
offlineQuotaNotification.html \
offlineQuotaNotification.cacheManifest \
browser_addKeywordSearch.js \
POSTSearchEngine.xml \
print_postdata.sjs \
redirect_bug623155.sjs \
test_bug435035.html \
test_bug462673.html \
test_bug628179.html \
test_bug839103.html \
test_wyciwyg_copying.html \
title_test.svg \
video.ogg \
zoom_test.html \
$(NULL)
# Disable tests on Windows due to frequent failures (bugs 825739, 841341)

View File

@ -0,0 +1,40 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.startup.homepage");
Services.prefs.clearUserPref("browser.startup.page");
win.close();
});
let homepage = "about:home";
Services.prefs.setCharPref("browser.startup.homepage", homepage);
Services.prefs.setIntPref("browser.startup.page", 1);
let win = OpenBrowserWindow();
whenDelayedStartupFinished(win, function() {
let browser = win.gBrowser.selectedBrowser;
if (browser.contentDocument.readyState == "complete" &&
browser.currentURI.spec == homepage) {
checkIdentityMode(win);
return;
}
browser.addEventListener("load", function onLoad() {
if (browser.currentURI.spec != homepage)
return;
browser.removeEventListener("load", onLoad, true);
checkIdentityMode(win);
}, true);
});
}
function checkIdentityMode(win) {
let identityMode = win.document.getElementById("identity-box").className;
is(identityMode, "unknownIdentity", "Identity should be chromeUI but is currently " +
"shown as unknownIdentity for new windows.");
finish();
}

View File

@ -10,9 +10,9 @@ function test() {
testWindow = OpenBrowserWindow();
whenDelayedStartupFinished(testWindow, function () {
let selectedBrowser = testWindow.gBrowser.selectedBrowser;
selectedBrowser.addEventListener("pageshow", function() {
selectedBrowser.removeEventListener("pageshow", arguments.callee, true);
ok(true, "pageshow listener called");
selectedBrowser.addEventListener("load", function onLoad() {
selectedBrowser.removeEventListener("load", onLoad, true);
ok(true, "load listener called");
waitForFocus(onFocus, testWindow.content);
}, true);
testWindow.gBrowser.loadURI("data:text/html,<h1>A Page</h1>");

View File

@ -2,6 +2,7 @@
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --with-google-api-keyfile=/builds/gapi.data
. $topsrcdir/build/unix/mozconfig.linux32

View File

@ -2,6 +2,7 @@
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --with-google-api-keyfile=/builds/gapi.data
. $topsrcdir/build/unix/mozconfig.linux

View File

@ -7,6 +7,7 @@ ac_add_options --enable-application=browser
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --with-google-api-keyfile=/builds/gapi.data
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

View File

@ -5,6 +5,7 @@
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc
ac_add_options --with-google-api-keyfile=/e/builds/gapi.data
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1

View File

@ -23,37 +23,29 @@
</xul:vbox>
</content>
<implementation implements="nsIDOMEventListener">
<implementation>
<constructor>
<![CDATA[
window.addEventListener('MozContextUIShow', this);
window.addEventListener('MozContextUIDismiss', this);
window.addEventListener('MozAppbarDismissing', this);
this.setAttribute("isSlidOut", true);
]]>
</constructor>
<destructor>
<![CDATA[
window.removeEventListener('MozContextUIShow', this);
window.removeEventListener('MozContextUIDismiss', this);
window.removeEventListener('MozAppbarDismissing', this);
]]>
</destructor>
<property name="isVisible" readonly="true">
<getter>
<![CDATA[
return this.hasAttribute("visible");
]]>
</getter>
</property>
<method name="_onAfterSlideOut">
<body>
<![CDATA[
this.removeAttribute("isSlidingOut");
this.setAttribute("isSlidOut", true);
this.removeAttribute("visible");
this.removeEventListener("transitionend", this._onAfterSlideOut);
DialogUI.popPopup(this);
]]>
</body>
</method>
<method name="_onAfterSlideIn">
<body>
<![CDATA[
this.removeAttribute("isSlidingIn");
this.setAttribute("isSlidIn", true);
this.removeEventListener("transitionend", this._onAfterSlideIn);
]]>
</body>
</method>
@ -61,11 +53,19 @@
<method name="hide">
<body>
<![CDATA[
if (!this.isVisible)
if (this.hasAttribute("isSlidingOut")
|| this.hasAttribute("isSlidOut")) {
return;
}
if (this.hasAttribute("isSlidingIn")) {
this._onAfterSlideIn();
}
this.addEventListener("transitionend", this._onAfterSlideOut);
this.classList.remove("flyoutpanel-slide-in");
this.setAttribute("isSlidingOut", true);
this.removeAttribute("isSlidIn");
]]>
</body>
</method>
@ -73,30 +73,23 @@
<method name="show">
<body>
<![CDATA[
if (this.isVisible)
if (this.hasAttribute("isSlidingIn")
|| this.hasAttribute("isSlidIn")) {
return;
}
if (this.hasAttribute("isSlidingOut")) {
this._onAfterSlideOut();
}
let event = document.createEvent("Events");
event.initEvent("MozFlyoutPanelShowing", true, false);
this.dispatchEvent(event);
this.setAttribute("visible", "true");
this.classList.add("flyoutpanel-slide-in");
DialogUI.pushPopup(this, this);
]]>
</body>
</method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body>
<![CDATA[
switch (aEvent.type) {
case 'MozContextUIShow':
case 'MozAppbarDismissing':
case 'MozContextUIDismiss':
this.hide();
break;
}
this.setAttribute("isSlidingIn", true);
this.setAttribute("visible", true);
this.removeAttribute("isSlidOut");
]]>
</body>
</method>

View File

@ -121,7 +121,6 @@ let ScriptContexts = {};
["DownloadsPanelView", "chrome://browser/content/downloads.js"],
["DownloadsView", "chrome://browser/content/downloads.js"],
["Downloads", "chrome://browser/content/downloads.js"],
["PreferencesPanelView", "chrome://browser/content/preferences.js"],
["BookmarksStartView", "chrome://browser/content/bookmarks.js"],
["HistoryView", "chrome://browser/content/history.js"],
["HistoryStartView", "chrome://browser/content/history.js"],
@ -137,9 +136,8 @@ let ScriptContexts = {};
["ItemPinHelper", "chrome://browser/content/helperui/ItemPinHelper.js"],
["NavButtonSlider", "chrome://browser/content/NavButtonSlider.js"],
["ContextUI", "chrome://browser/content/ContextUI.js"],
["FlyoutPanelsUI", "chrome://browser/content/flyouts/flyoutUI.js"],
#ifdef MOZ_SERVICES_SYNC
["Sync", "chrome://browser/content/sync.js"],
["SyncPairDevice", "chrome://browser/content/sync.js"],
["RemoteTabsView", "chrome://browser/content/RemoteTabs.js"],
["RemoteTabsPanelView", "chrome://browser/content/RemoteTabs.js"],
["RemoteTabsStartView", "chrome://browser/content/RemoteTabs.js"],

View File

@ -47,9 +47,6 @@ let Elements = {};
["progress", "progress-control"],
["progressContainer", "progress-container"],
["contentNavigator", "content-navigator"],
["aboutFlyout", "about-flyoutpanel"],
["prefsFlyout", "prefs-flyoutpanel"],
["syncFlyout", "sync-flyoutpanel"]
].forEach(function (aElementGlobal) {
let [name, id] = aElementGlobal;
XPCOMUtils.defineLazyGetter(Elements, name, function() {
@ -158,9 +155,6 @@ var BrowserUI = {
FormHelperUI.init();
FindHelperUI.init();
PdfJs.init();
#ifdef MOZ_SERVICES_SYNC
Sync.init();
#endif
} catch(ex) {
Util.dumpLn("Exception in delay load module:", ex.message);
}
@ -1322,11 +1316,13 @@ var BrowserUI = {
PanelUI.show("history-container");
break;
case "cmd_remoteTabs":
#ifdef MOZ_SERVICES_SYNC
if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
Sync.open();
FlyoutPanelsUI.show('SyncFlyout');
} else {
PanelUI.show("remotetabs-container");
}
#endif
break;
case "cmd_quit":
// Only close one window
@ -1349,8 +1345,7 @@ var BrowserUI = {
SanitizeUI.onSanitize();
break;
case "cmd_flyout_back":
FlyoutPanelsUI.hide();
MetroUtils.showSettingsFlyout();
FlyoutPanelsUI.onBackButton();
break;
case "cmd_panel":
PanelUI.toggle();
@ -1522,37 +1517,6 @@ var StartUI = {
}
};
var SyncPanelUI = {
init: function() {
// Run some setup code the first time the panel is shown.
Elements.syncFlyout.addEventListener("PopupChanged", function onShow(aEvent) {
if (aEvent.detail && aEvent.target === Elements.syncFlyout) {
Elements.syncFlyout.removeEventListener("PopupChanged", onShow, false);
Sync.init();
}
}, false);
}
};
var FlyoutPanelsUI = {
init: function() {
AboutPanelUI.init();
PreferencesPanelView.init();
SyncPanelUI.init();
// make sure to hide all flyouts when window is deactivated
window.addEventListener("deactivate", function(window) {
FlyoutPanelsUI.hide();
});
},
hide: function() {
Elements.aboutFlyout.hide();
Elements.prefsFlyout.hide();
Elements.syncFlyout.hide();
}
};
var PanelUI = {
get _panels() { return document.getElementById("panel-items"); },
get _switcher() { return document.getElementById("panel-view-switcher"); },
@ -1840,17 +1804,17 @@ var SettingsCharm = {
// Options
this.addEntry({
label: Strings.browser.GetStringFromName("optionsCharm"),
onselected: function() Elements.prefsFlyout.show()
onselected: function() FlyoutPanelsUI.show('PrefsFlyout')
});
// Sync
this.addEntry({
label: Strings.browser.GetStringFromName("syncCharm"),
onselected: function() Elements.syncFlyout.show()
onselected: function() FlyoutPanelsUI.show('SyncFlyout')
});
// About
this.addEntry({
label: Strings.browser.GetStringFromName("aboutCharm1"),
onselected: function() Elements.aboutFlyout.show()
onselected: function() FlyoutPanelsUI.show('AboutFlyout')
});
// Help
this.addEntry({

View File

@ -23,6 +23,8 @@
<!ENTITY % aboutPanelDTD SYSTEM "chrome://browser/locale/aboutPanel.dtd">
%aboutPanelDTD;
#ifdef MOZ_SERVICES_SYNC
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
%syncBrandDTD;
<!ENTITY % syncDTD SYSTEM "chrome://browser/locale/sync.dtd">
%syncDTD;
#endif
@ -47,8 +49,6 @@
<script type="application/javascript" src="chrome://browser/content/Util.js"/>
<script type="application/javascript" src="chrome://browser/content/input.js"/>
<script type="application/javascript;version=1.8" src="chrome://browser/content/appbar.js"/>
<script type="application/javascript" src="chrome://browser/content/aboutPanel.js"/>
<broadcasterset id="broadcasterset">
<broadcaster id="bcast_contentShowing" disabled="false"/>
<broadcaster id="bcast_urlbarState" mode="view"/>
@ -146,9 +146,11 @@
<key id="key_quit" key="q" modifiers="accel" command="cmd_quit"/>
<key id="key_addBoomkark" key="d" modifiers="accel" command="cmd_addBookmark"/>
<key id="key_console" key="j" modifiers="accel,shift" oncommand="PanelUI.show('console-container')"/>
<key id="key_options" key="o" modifiers="accel,shift" oncommand="Elements.prefsFlyout.show()"/>
<key id="key_options" key="s" modifiers="accel,shift" oncommand="Elements.syncFlyout.show()"/>
<key id="key_options" key="a" modifiers="accel,shift" oncommand="Elements.aboutFlyout.show()"/>
<key id="key_options" key="o" modifiers="accel,shift" oncommand="FlyoutPanelsUI.show('PrefsFlyout')" />
#ifdef MOZ_SERVICES_SYNC
<key id="key_options" key="s" modifiers="accel,shift" oncommand="FlyoutPanelsUI.show('SyncFlyout')" />
#endif
<key id="key_options" key="a" modifiers="accel,shift" oncommand="FlyoutPanelsUI.show('AboutFlyout')" />
<!-- manage tabs -->
<key id="key_newTab" key="t" modifiers="accel" command="cmd_newTab"/>
@ -422,39 +424,207 @@
class="text-link" value="&aboutHeader.policy.label;"/>
</flyoutpanel>
<flyoutpanel id="sync-flyoutpanel" headertext="&syncHeader.title;">
<description id="sync-description">&sync.setup.description;</description>
<description id="sync-accountinfo" collapsed="true"></description>
<description id="sync-lastsync" collapsed="true"></description>
<description id="sync-errordescription" collapsed="true"></description>
<setting id="sync-connect" type="control" collapsed="true">
<button label="&sync.setupbutton.label;" oncommand="Sync.tryConnect();" />
</setting>
<setting id="sync-connected" class="setting-group" type="control" collapsed="true">
<button id="sync-pairdevice" label="&sync.pair.button;" oncommand="SyncPairDevice.open();" />
</setting>
<setting id="sync-device" class="setting-subgroup" type="string" title="&sync.deviceName;" onchange="Sync.changeName(this);" collapsed="true"/>
<setting id="sync-disconnect" class="setting-subgroup" type="control" collapsed="true">
<button label="&sync.removebutton.label;" oncommand="Sync.onDisconnect();" />
</setting>
<vbox id="sync-disconnectwarnpanel" collapsed="true">
<description id="sync-disconnectwarntitle"></description>
<description id="sync-disconnectwarnmsg">&sync.removewarn.note;</description>
<hbox>
<spacer flex="1" />
<button label="&sync.setup.cancel;" oncommand="Sync.onCancelDisconnect();" />
<button label="&sync.setup.remove;" oncommand="Sync.disconnect();" />
</hbox>
</vbox>
<vbox id="sync-disconnectpanel">
<hbox>
<spacer flex="1" />
<cssthrobber id="sync-disconnectthrobber"/>
<label>&sync.removethrobber.label;</label>
#ifdef MOZ_SERVICES_SYNC
<flyoutpanel id="sync-flyoutpanel" headertext="&sync.flyout.title;">
<vbox id="sync-presetup-container" collapsed="true">
<description>&sync.flyout.presetup.description1;</description>
<separator />
<hbox onclick="FlyoutPanelsUI.SyncFlyout.startEasySetup();"
align="center"
class="text-link">
<image src="chrome://browser/skin/images/plus-34.png" />
<separator />
<label value="&sync.flyout.presetup.setup.label;"
class="text-link" />
<spacer flex="1" />
</hbox>
</vbox>
<vbox id="sync-setup-container" collapsed="true">
<description>&sync.flyout.setup.description1;</description>
<description>&sync.flyout.setup.description2;</description>
<separator />
<vbox flex="1" pack="center" align="start">
<textbox id="sync-setup-code1"
class="syncJPAKECode"
placeholder="...."
disabled="true" />
<textbox id="sync-setup-code2"
class="syncJPAKECode"
placeholder="...."
disabled="true" />
<hbox>
<textbox id="sync-setup-code3"
class="syncJPAKECode"
placeholder="...."
disabled="true" />
<vbox flex="1" pack="center" align="center">
<cssthrobber id='sync-setup-throbber'
flex='1'
class='syncThrobber'
collapsed='true'
disabled='true' />
</vbox>
</hbox>
</vbox>
<separator />
<description class="text-link"
flex="1"
onclick="FlyoutPanelsUI.SyncFlyout.abortEasySetup();
FlyoutPanelsUI.SyncFlyout.showManualSetup()">
&sync.flyout.setup.manual.label;
</description>
<separator />
<description>&sync.flyout.setup.description3;</description>
<description>&sync.flyout.setup.description4;</description>
<description class="syncInstructionText">
&sync.flyout.setup.description5;
</description>
<description class="syncInstructionText">
&sync.flyout.setup.description6;
</description>
</vbox>
<vbox id="sync-manualsetup-container" collapsed="true">
<description>&sync.flyout.manualsetup.description1;</description>
<separator/>
<textbox id="sync-manualsetup-account"
placeholder="&sync.flyout.manualsetup.account.placeholder;"
oninput="FlyoutPanelsUI.SyncFlyout.updateManualSetupConnectButtonState();"/>
<textbox id="sync-manualsetup-password"
placeholder="&sync.flyout.manualsetup.password.placeholder;"
type="password"
oninput="FlyoutPanelsUI.SyncFlyout.updateManualSetupConnectButtonState();"/>
<textbox id="sync-manualsetup-syncKey"
placeholder="&sync.flyout.manualsetup.recoveryKey.placeholder;"
oninput="FlyoutPanelsUI.SyncFlyout.updateManualSetupConnectButtonState();"/>
<description id="sync-manualsetup-failure"
class="syncErrorText"
collapsed="true" />
<separator />
<hbox>
<button id="sync-manualsetup-connect"
class="syncButton"
oncommand="FlyoutPanelsUI.SyncFlyout.manualSetupConnect();"
label="&sync.flyout.manualsetup.connect.label;"
disabled="true" />
<spacer flex="1" />
</hbox>
</vbox>
<vbox id="sync-setupsuccess-container" collapsed="true">
<description>&sync.flyout.setupsuccess.description1;</description>
<description>&sync.flyout.setupsuccess.description2;</description>
</vbox>
<vbox id="sync-setupfailure-container" collapsed="true">
<description>&sync.flyout.setupfailure.description;</description>
<hbox>
<button class="syncButton"
oncommand="FlyoutPanelsUI.SyncFlyout.onCancelButton();"
label="&sync.flyout.setupfailure.cancelButton;" />
<button class="syncButton"
oncommand="FlyoutPanelsUI.SyncFlyout.onTryAgainButton();"
label="&sync.flyout.setupfailure.tryAgainButton;" />
</hbox>
</vbox>
<vbox id="sync-connected-container" collapsed="true">
<description id="sync-connected-account"
class="syncHeader" />
<separator />
<hbox>
<vbox>
<description id="sync-connected-device"
class="syncHeader" />
<description id="sync-connected-lastSynced"
class="syncSecondaryText" />
</vbox>
<cssthrobber id="sync-connected-throbber"
class="syncThrobber"
collapsed="true" />
</hbox>
<label id="sync-disconnect-label"
class="text-link"
onclick="FlyoutPanelsUI.SyncFlyout.onDisconnectLink();">
&sync.flyout.connected.disconnect;
</label>
<separator />
<vbox id="sync-disconnect-warning" collapsed="true">
<description class="syncHeader">
&sync.flyout.connected.disconnectWarningHeader;
</description>
<description class="syncSecondaryText">
&sync.flyout.connected.disconnectWarning;
</description>
<hbox>
<separator />
<button label="&sync.flyout.connected.cancel;"
oncommand="FlyoutPanelsUI.SyncFlyout.onDisconnectCancel();" />
<button label="&sync.flyout.connected.disconnect;"
oncommand="FlyoutPanelsUI.SyncFlyout.onDisconnectButton();" />
</hbox>
<separator />
</vbox>
<hbox onclick="FlyoutPanelsUI.SyncFlyout.onPairDeviceLink();"
class="text-link">
<image src="chrome://browser/skin/images/plus-24.png" />
<separator />
<label>&sync.flyout.connected.pair;</label>
</hbox>
</vbox>
<vbox id="sync-pair-container" collapsed="true">
<description>&sync.flyout.pairNewDevice.description;</description>
<separator />
<hbox>
<vbox>
<textbox id="sync-pair-entry1"
class="syncJPAKECode"
maxlength="4"
oninput="FlyoutPanelsUI.SyncFlyout.updatePairButtonState();" />
<textbox id="sync-pair-entry2"
class="syncJPAKECode"
maxlength="4"
oninput="FlyoutPanelsUI.SyncFlyout.updatePairButtonState();" />
<textbox id="sync-pair-entry3"
class="syncJPAKECode"
maxlength="4"
oninput="FlyoutPanelsUI.SyncFlyout.updatePairButtonState();" />
</vbox>
<spacer flex="1" />
</hbox>
<description id="sync-pair-failure"
class="syncErrorText"
collapsed="true">
&sync.flyout.pairNewDevice.failure;
</description>
<hbox>
<button id="sync-pair-button"
label="&sync.flyout.pairNewDevice.pair;"
oncommand="FlyoutPanelsUI.SyncFlyout.onPairButton();"
disabled="true" />
<spacer flex="1" />
</hbox>
<description>&sync.flyout.pairNewDevice.note1;</description>
<description>&sync.flyout.pairNewDevice.note2;</description>
<description class="syncInstructionText">
&sync.flyout.pairNewDevice.note3;
</description>
<description class="syncInstructionText">
&sync.flyout.pairNewDevice.note4;
</description>
</vbox>
<vbox id="sync-pair-success-container" collapsed="true">
<description>&sync.flyout.pairSuccess.description1;</description>
<description>&sync.flyout.pairSuccess.description2;</description>
</vbox>
</flyoutpanel>
#endif
<flyoutpanel id="prefs-flyoutpanel" headertext="&optionsHeader.title;">
<settings id="prefs-startup" label="&optionsHeader.startup.title;"> <!-- note, this element has a custom margin-top -->
@ -504,7 +674,7 @@
</settings>
<settings id="prefs-dnt" label="&doNotTrack.title;">
<description>&doNotTrack.desc;</description>
<setting id="prefs-dnt-value" pref="privacy.donottrackheader.value" onpreferencechanged="PreferencesPanelView.onDNTPreferenceChanged()" type="radio" >
<setting id="prefs-dnt-value" pref="privacy.donottrackheader.value" onpreferencechanged="FlyoutPanelsUI.PrefsFlyout.onDNTPreferenceChanged();" type="radio" >
<radiogroup id="prefs-dnt-options">
<radio id="prefs-dnt-notrack" label="&doNotTrack.options.trackingNotOkay;" value="1"/>
<radio id="prefs-dnt-nopref" label="&doNotTrack.options.noPreference;" value="-1"/>
@ -514,91 +684,6 @@
</settings>
</flyoutpanel>
#ifdef MOZ_SERVICES_SYNC
<box id="syncsetup-container" class="perm-modal-block" hidden="true">
<dialog id="syncsetup-dialog" class="content-dialog" flex="1">
<vbox class="prompt-inner">
<hbox class="prompt-title">
<description>&sync.setup2.title;</description>
</hbox>
<vbox id="syncsetup-simple" class="syncsetup-page" flex="1">
<scrollbox id="sync-message" class="prompt-message" orient="vertical" flex="1">
<description class="syncsetup-desc" flex="1">&sync.setup.pair2;</description>
<description class="text-link" flex="1" onclick="Sync.openTutorial();">&sync.setup.tutorial;</description>
<separator/>
<vbox flex="1" pack="center" align="start">
<description id="syncsetup-code1" class="syncsetup-code">....</description>
<description id="syncsetup-code2" class="syncsetup-code">....</description>
<description id="syncsetup-code3" class="syncsetup-code">....</description>
</vbox>
<separator/>
<description class="text-link" flex="1" onclick="Sync.openManual();">&sync.fallback;</description>
<separator flex="1"/>
</scrollbox>
<hbox class="prompt-buttons">
<button oncommand="Sync.close();">&sync.setup.cancel;</button>
</hbox>
</vbox>
<vbox id="syncsetup-waiting" class="syncsetup-page" flex="1" hidden="true">
<progressmeter id="syncsetup-progressbar" mode="undetermined"/>
<vbox id="syncsetup-waiting-top" align="center" flex="1">
<description id="syncsetup-waiting-desc" class="syncsetup-desc" flex="1">&sync.setup.waiting2;</description>
<description id="syncsetup-waitingdownload-desc" class="syncsetup-desc" hidden="true" flex="1">&sync.setup.waitingdownload;</description>
</vbox>
<hbox class="prompt-buttons" pack="center" align="end">
<button id="syncsetup-waiting-cancel" oncommand="Sync.close();">&sync.setup.cancel;</button>
<button id="syncsetup-waiting-close" hidden="true" oncommand="Sync.close();">&sync.setup.close;</button>
</hbox>
</vbox>
<vbox id="syncsetup-fallback" class="syncsetup-page" flex="1" hidden="true">
<scrollbox class="prompt-message" orient="vertical" flex="1">
<description class="syncsetup-desc" flex="1">&sync.setup.manual;</description>
<separator/>
<textbox id="syncsetup-account" class="prompt-edit" placeholder="&sync.account;" oninput="Sync.canConnect();"/>
<textbox id="syncsetup-password" class="prompt-edit" placeholder="&sync.password;" type="password" oninput="Sync.canConnect();"/>
<textbox id="syncsetup-synckey" class="prompt-edit" placeholder="&sync.recoveryKey;" oninput="Sync.canConnect();"/>
<separator class="thin"/>
<checkbox id="syncsetup-usecustomserver" label="&sync.customServer;" oncommand="Sync.toggleCustomServer();"/>
<textbox id="syncsetup-customserver" class="prompt-edit" placeholder="&sync.serverURL;"/>
<separator flex="1"/>
</scrollbox>
<hbox class="prompt-buttons">
<button oncommand="Sync.close();">&sync.setup.cancel;</button>
<separator/>
<button id="syncsetup-button-connect" oncommand="Sync.close(); Sync.connect();">&sync.setup.connect2;</button>
</hbox>
</vbox>
</vbox>
</dialog>
</box>
<box id="syncpair-container" class="perm-modal-block" hidden="true">
<dialog id="syncpair-dialog" class="content-dialog" flex="1">
<vbox class="prompt-inner">
<hbox class="prompt-title">
<description>&sync.pair.title;</description>
</hbox>
<vbox id="syncpair-simple" class="syncsetup-page" flex="1">
<vbox id="sync-message" class="prompt-message" orient="vertical" flex="1">
<description class="syncsetup-desc" flex="1">&sync.pair.description;</description>
<description class="text-link" flex="1" onclick="SyncPairDevice.close(); Sync.openTutorial();">&sync.setup.tutorial;</description>
<separator/>
<vbox align="center" flex="1">
<textbox id="syncpair-code1" class="syncsetup-code" oninput="SyncPairDevice.onTextBoxInput(this);"/>
<textbox id="syncpair-code2" class="syncsetup-code" oninput="SyncPairDevice.onTextBoxInput(this);"/>
<textbox id="syncpair-code3" class="syncsetup-code" oninput="SyncPairDevice.onTextBoxInput(this);"/>
</vbox>
</vbox>
<hbox class="prompt-buttons" pack="center">
<button oncommand="SyncPairDevice.close();">&sync.setup.cancel;</button>
<button id="syncpair-connectbutton" disabled="true" oncommand="SyncPairDevice.connect();">&sync.setup.connect2;</button>
</hbox>
</vbox>
</vbox>
</dialog>
</box>
#endif
<!-- Chrome touch selection overlay -->
<!-- onclick addresses dom bug 835175 -->
<box onclick="false" class="selection-overlay-hidden" id="chrome-selection-overlay"/>

View File

@ -1,24 +1,41 @@
# 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/.
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/* 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/. */
'use strict';
// Services = object with smart getters for common XPCOM services
Components.utils.import("resource://gre/modules/Services.jsm");
var gAppUpdater;
var AboutPanelUI = {
get _aboutVersionLabel() {
return document.getElementById('about-version-label');
},
Cu.import("resource://gre/modules/Services.jsm");
let gAppUpdater;
let AboutFlyout = {
init: function() {
if (this._isInitialized) {
Cu.reportError("Attempted to initialize AboutFlyout more than once");
}
this._isInitialized = true;
let self = this;
this._elements = {};
[
['versionLabel', 'about-version-label'],
['aboutFlyout', 'about-flyoutpanel'],
].forEach(function(aElement) {
let [name, id] = aElement;
XPCOMUtils.defineLazyGetter(self._elements, name, function() {
return document.getElementById(id);
});
});
this._topmostElement = this._elements.aboutFlyout;
// Include the build ID if this is an "a#" (nightly or aurora) build
let version = Services.appinfo.version;
if (/a\d+$/.test(version)) {
let buildID = Services.appinfo.appBuildID;
let buildDate = buildID.slice(0,4) + "-" + buildID.slice(4,6) +
"-" + buildID.slice(6,8);
this._aboutVersionLabel.textContent +=" (" + buildDate + ")";
this._elements.versionLabel.textContent +=" (" + buildDate + ")";
}
window.addEventListener('MozFlyoutPanelShowing', this, false);
@ -594,4 +611,3 @@ appUpdater.prototype =
}
};
#endif

View File

@ -0,0 +1,93 @@
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/* 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/. */
'use strict';
let FlyoutPanelsUI = {
_isInitialized: false,
init: function() {
if (this._isInitialized) {
Cu.reportError("Attempted to initialize FlyoutPanelsUI more than once");
return;
}
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
this._isInitialized = true;
let scriptContexts = {};
let scripts =
[
['AboutFlyout', 'chrome://browser/content/flyouts/aboutFlyout.js'],
['PrefsFlyout', 'chrome://browser/content/flyouts/prefsFlyout.js'],
#ifdef MOZ_SERVICES_SYNC
['SyncFlyout', 'chrome://browser/content/flyouts/syncFlyout.js'],
#endif
];
scripts.forEach(function (aScript) {
let [name, script] = aScript;
XPCOMUtils.defineLazyGetter(FlyoutPanelsUI, name, function() {
let sandbox = {};
Services.scriptloader.loadSubScript(script, sandbox);
sandbox[name].init();
return sandbox[name];
});
});
},
show: function(aToShow) {
if (!this[aToShow]) {
throw("FlyoutPanelsUI asked to show '" + aToShow + "' which does not exist");
}
if (this._currentFlyout) {
if (this._currentFlyout == this[aToShow]) {
return;
} else {
this.hide();
}
}
this._currentFlyout = this[aToShow];
if (this._currentFlyout.show) {
this._currentFlyout._show();
} else {
this._currentFlyout._topmostElement.show();
}
DialogUI.pushPopup(this, this._currentFlyout._topmostElement);
},
onBackButton: function() {
if (this._currentFlyout._onBackButton) {
this._currentFlyout._onBackButton();
} else {
this.hide();
MetroUtils.showSettingsFlyout();
}
},
get isVisible() {
return this._currentFlyout ? true : false;
},
dispatchEvent: function(aEvent) {
if (this._currentFlyout) {
this._currentFlyout._topmostElement.dispatchEvent(aEvent);
}
},
hide: function() {
if (this._currentFlyout) {
if (this._currentFlyout._hide) {
this._currentFlyout._hide();
} else {
this._currentFlyout._topmostElement.hide();
}
DialogUI.popPopup(this);
delete this._currentFlyout;
}
}
};

View File

@ -0,0 +1,51 @@
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/* 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/. */
'use strict';
Components.utils.import("resource://gre/modules/Services.jsm");
let PrefsFlyout = {
_isInitialized: false,
_hasShown: false,
init: function pv_init() {
if (this._isInitialized) {
Cu.reportError("Attempting to re-initialize PreferencesPanelView");
return;
}
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
this._isInitialized = true;
let self = this;
this._elements = {};
[
['prefsFlyout', 'prefs-flyoutpanel'],
['dntNoPref', 'prefs-dnt-nopref'],
].forEach(function(aElement) {
let [name, id] = aElement;
XPCOMUtils.defineLazyGetter(self._elements, name, function() {
return document.getElementById(id);
});
});
this._topmostElement = this._elements.prefsFlyout;
},
_show: function() {
if (!this._hasShown) {
SanitizeUI.init();
this._hasShown = true;
}
this._elements.prefsFlyout.show();
},
onDNTPreferenceChanged: function onDNTPreferenceChanged() {
let selected = this._elements.dntNoPref.selected;
// When "tell sites nothing about my preferences" is selected, disable do not track.
Services.prefs.setBoolPref("privacy.donottrackheader.enabled", !selected);
}
};

View File

@ -0,0 +1,367 @@
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/* 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/. */
"use strict";
Components.utils.import("resource://gre/modules/Services.jsm");
let SyncFlyout = {
init: function() {
if (this._isInitialized) {
Cu.reportError("Attempted to initialize SyncFlyout more than once");
return;
}
this._isInitialized = true;
this._bundle = Services.strings.createBundle("chrome://browser/locale/sync.properties");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
let self = this;
this._elements = {};
[
['outer', 'sync-flyoutpanel'],
['preSetup', 'sync-presetup-container'],
['easySetup', 'sync-setup-container'],
['manualSetup', 'sync-manualsetup-container'],
['setupSuccess', 'sync-setupsuccess-container'],
['setupFailure', 'sync-setupfailure-container'],
['connected', 'sync-connected-container'],
['pairNewDevice', 'sync-pair-container'],
['pairSuccess', 'sync-pair-success-container'],
['setupCode1', 'sync-setup-code1'],
['setupCode2', 'sync-setup-code2'],
['setupCode3', 'sync-setup-code3'],
['setupThrobber', 'sync-setup-throbber'],
['account', 'sync-manualsetup-account'],
['password', 'sync-manualsetup-password'],
['syncKey', 'sync-manualsetup-syncKey'],
['manualSetupConnect', 'sync-manualsetup-connect'],
['manualSetupFailure', 'sync-manualsetup-failure'],
['connectedAccount', 'sync-connected-account'],
['deviceName', 'sync-connected-device'],
['lastSync', 'sync-connected-lastSynced'],
['connectedThrobber', 'sync-connected-throbber'],
['disconnectLink', 'sync-disconnect-label'],
['disconnectWarning', 'sync-disconnect-warning'],
['pairCode1', 'sync-pair-entry1'],
['pairCode2', 'sync-pair-entry2'],
['pairCode3', 'sync-pair-entry3'],
['pairButton', 'sync-pair-button'],
['pairFailureMessage', 'sync-pair-failure'],
].forEach(function (aContainer) {
let [name, id] = aContainer;
XPCOMUtils.defineLazyGetter(self._elements, name, function() {
return document.getElementById(id);
});
});
this._topmostElement = this._elements.outer;
let xps = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
if (xps.ready) {
this._onServiceReady();
} else {
Services.obs.addObserver(this._onServiceReady.bind(this),
"weave:service:ready",
false);
xps.ensureLoaded();
}
},
_hide: function() {
this._elements.outer.hide();
this.showInitialScreen();
},
_hideVisibleContainer: function() {
if (this._currentlyVisibleContainer) {
this._currentlyVisibleContainer.collapsed = true;
delete this._currentlyVisibleContainer;
delete this._onBackButton;
}
},
_onServiceReady: function(aEvent) {
if (aEvent) {
Services.obs.removeObserver(this._onServiceReady, "weave:service:ready");
}
this.showInitialScreen();
Services.obs.addObserver(this._onSyncStart.bind(this), "weave:service:sync:start", false);
Services.obs.addObserver(this._onSyncEnd.bind(this), "weave:ui:sync:finish", false);
Services.obs.addObserver(this._onSyncEnd.bind(this), "weave:ui:sync:error", false);
Weave.Service.scheduler.scheduleNextSync(10*1000);
},
_onSyncStart: function() {
this._isSyncing = true;
this._updateConnectedPage();
},
_onSyncEnd: function() {
this._isSyncing = false;
this._updateConnectedPage();
},
showInitialScreen: function() {
if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
this.showPreSetup();
} else {
this.showConnected();
}
},
abortEasySetup: function() {
if (this._setupJpake) {
this._setupJpake.abort();
}
this._cleanUpEasySetup();
},
_cleanUpEasySetup: function() {
this._elements.setupCode1.value = "";
this._elements.setupCode2.value = "";
this._elements.setupCode3.value = "";
delete this._setupJpake;
this._elements.setupThrobber.collapsed = true;
this._elements.setupThrobber.enabled = false;
},
_updateConnectedPage: function() {
// Show the day-of-week and time (HH:MM) of last sync
let lastSync = Weave.Svc.Prefs.get("lastSync");
let syncDate = '';
if (lastSync != null) {
syncDate = new Date(lastSync).toLocaleFormat("%A %I:%M %p");
}
let device = Weave.Service.clientsEngine.localName;
let account = Weave.Service.identity.account;
this._elements.deviceName.textContent =
this._bundle.formatStringFromName("sync.flyout.connected.device",
[device], 1);
this._elements.connectedAccount.textContent =
this._bundle.formatStringFromName("sync.flyout.connected.account",
[account], 1);
this._elements.lastSync.textContent =
this._bundle.formatStringFromName("sync.flyout.connected.lastSynced",
[syncDate], 1);
if (this._currentlyVisibleContainer == this._elements.connected
&& this._isSyncing) {
this._elements.connectedThrobber.collapsed = false;
this._elements.connectedThrobber.enabled = true;
} else {
this._elements.connectedThrobber.collapsed = true;
this._elements.connectedThrobber.enabled = false;
}
},
showConnected: function() {
// Reset state of the connected screen
this._elements.disconnectWarning.collapsed = true;
this._elements.disconnectLink.collapsed = false;
this._updateConnectedPage();
this._showContainer(this._elements.connected);
},
startEasySetup: function() {
let self = this;
this._showContainer(this._elements.easySetup);
// Set up our back button to do the appropriate action
this._onBackButton = function() {
self.abortEasySetup();
self.showInitialScreen();
};
this._setupJpake = new Weave.JPAKEClient({
displayPIN: function displayPIN(aPin) {
self._elements.setupCode1.value = aPin.slice(0, 4);
self._elements.setupCode2.value = aPin.slice(4, 8);
self._elements.setupCode3.value = aPin.slice(8);
},
onPairingStart: function onPairingStart() {
self._elements.setupThrobber.collapsed = false;
self._elements.setupThrobber.enabled = true;
},
onComplete: function onComplete(aCredentials) {
Weave.Service.identity.account = aCredentials.account;
Weave.Service.identity.basicPassword = aCredentials.password;
Weave.Service.identity.syncKey = aCredentials.synckey;
Weave.Service.serverURL = aCredentials.serverURL;
Weave.Service.persistLogin();
Weave.Service.scheduler.scheduleNextSync(0);
if (self._currentlyVisibleContainer == self._elements.easySetup) {
self.showSetupSuccess();
}
self._cleanUpEasySetup();
},
onAbort: function onAbort(aError) {
if (aError == "jpake.error.userabort") {
Services.obs.notifyObservers(null, "browser:sync:setup:userabort", "");
self._cleanUpEasySetup();
return;
} else if (aError == "jpake.error.network") {
Services.obs.notifyObservers(null, "browser:sync:setup:networkerror", "");
}
if (self._currentlyVisibleContainer == self._elements.easySetup) {
self.showSetupFailure();
self._cleanUpEasySetup();
}
}
});
this._setupJpake.receiveNoPIN();
},
_showContainer: function(aContainer) {
this._hideVisibleContainer();
this._currentlyVisibleContainer = aContainer;
this._currentlyVisibleContainer.collapsed = false;
},
showSetupSuccess: function() {
this._showContainer(this._elements.setupSuccess);
this._onBackButton = this.showInitialScreen;
},
showSetupFailure: function() {
this._showContainer(this._elements.setupFailure);
this._onBackButton = this.showInitialScreen;
},
showPreSetup: function() {
this._showContainer(this._elements.preSetup);
delete this._onBackButton;
},
showManualSetup: function() {
this._showContainer(this._elements.manualSetup);
this._onBackButton = this.showInitialScreen;
this._elements.account.value = Weave.Service.identity.account;
this._elements.password.value = Weave.Service.identity.basicPassword;
this._elements.syncKey.value =
Weave.Utils.hyphenatePassphrase(Weave.Service.identity.syncKey);
this.updateManualSetupConnectButtonState();
},
updateManualSetupConnectButtonState: function() {
this._elements.manualSetupConnect.disabled = !this._elements.account.value
|| !this._elements.password.value
|| !this._elements.syncKey.value;
},
manualSetupConnect: function() {
delete this._onBackButton;
this._elements.manualSetupConnect.disabled = true;
Weave.Service.identity.account = this._elements.account.value;
Weave.Service.identity.basicPassword = this._elements.password.value;
Weave.Service.identity.syncKey = Weave.Utils.normalizePassphrase(this._elements.syncKey.value);
if (Weave.Service.login()) {
Weave.Service.persistLogin();
if (this._currentlyVisibleContainer == this._elements.manualSetup) {
this.showSetupSuccess();
}
Weave.Service.scheduler.scheduleNextSync(0);
} else {
this._elements.manualSetupFailure.textContent = Weave.Utils.getErrorString(Weave.Status.login);
this._elements.manualSetupFailure.collapsed = false;
this.updateManualSetupConnectButtonState();
}
},
onDisconnectLink: function() {
this._elements.disconnectWarning.collapsed = false;
this._elements.disconnectLink.collapsed = true;
},
onDisconnectCancel: function() {
this._elements.disconnectWarning.collapsed = true;
this._elements.disconnectLink.collapsed = false;
},
onDisconnectButton: function() {
Weave.Service.startOver();
this.showInitialScreen();
},
onPairDeviceLink: function() {
// Reset state
this._elements.pairCode1.value = "";
this._elements.pairCode2.value = "";
this._elements.pairCode3.value = "";
this.updatePairButtonState();
this._elements.pairFailureMessage.collapsed = true;
this._elements.pairNewDevice.collapsed = false;
this._showContainer(this._elements.pairNewDevice);
this._onBackButton = this.showInitialScreen;
},
updatePairButtonState: function () {
this._elements.pairButton.disabled = !this._elements.pairCode1.value
|| !this._elements.pairCode2.value
|| !this._elements.pairCode3.value;
},
onCancelButton: function() {
this.showInitialContainer();
},
onTryAgainButton: function() {
this.startEasySetup();
},
onPairButton: function() {
this._elements.pairButton.disabled = true;
this._elements.pairFailureMessage.collapsed = true;
let self = this;
this._pairJpake = new Weave.JPAKEClient({
onPaired: function() {
self._pairJpake.sendAndComplete({
account: Weave.Service.identity.account,
password: Weave.Service.identity.basicPassword,
synckey: Weave.Service.identity.syncKey,
serverURL: Weave.Service.serverURL
});
},
onComplete: function() {
delete self._pairJpake;
Weave.Service.persistLogin();
if (self._currentlyVisibleContainer == self._elements.pairNewDevice) {
self._showContainer(self._elements.pairSuccess);
}
Weave.Service.scheduler.scheduleNextSync(Weave.Service.scheduler.activeInterval);
},
onAbort: function(error) {
delete self._pairJpake;
if (error == Weave.JPAKE_ERROR_USERABORT) {
return;
}
self._elements.pairFailureMessage.collapsed = false;
self.updatePairButtonState();
}
});
this._pairJpake.pairWithPIN(this._elements.pairCode1.value
+ this._elements.pairCode2.value
+ this._elements.pairCode3.value,
false);
},
};

View File

@ -1,22 +0,0 @@
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/* 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/. */
var PreferencesPanelView = {
init: function pv_init() {
// Run some setup code the first time the panel is shown.
Elements.prefsFlyout.addEventListener("PopupChanged", function onShow(aEvent) {
if (aEvent.detail && aEvent.target === Elements.prefsFlyout) {
Elements.prefsFlyout.removeEventListener("PopupChanged", onShow, false);
SanitizeUI.init();
}
}, false);
},
onDNTPreferenceChanged: function onDNTPreferenceChanged() {
let dntNoPref = document.getElementById("prefs-dnt-nopref");
// When "tell sites nothing about my preferences" is selected, disable do not track.
Services.prefs.setBoolPref("privacy.donottrackheader.enabled", !dntNoPref.selected);
}
};

View File

@ -1,755 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
let Sync = {
setupData: null,
_boundOnEngineSync: null, // Needed to unhook the observers in close().
_boundOnServiceSync: null,
jpake: null,
_bundle: null,
_loginError: false,
_progressBar: null,
_progressValue: 0,
_progressMax: null,
_disconnecting: false,
get _isSetup() {
if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
return false;
}
// check for issues related to failed logins that do not have anything to
// do with network, server, and other non-client issues. See the login
// failure status codes in sync service.
return (Weave.Status.login != Weave.LOGIN_FAILED_NO_USERNAME &&
Weave.Status.login != Weave.LOGIN_FAILED_NO_PASSWORD &&
Weave.Status.login != Weave.LOGIN_FAILED_NO_PASSPHRASE &&
Weave.Status.login != Weave.LOGIN_FAILED_INVALID_PASSPHRASE &&
Weave.Status.login != Weave.LOGIN_FAILED_LOGIN_REJECTED);
},
init: function init() {
if (this._bundle) {
return;
}
let service = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
if (service.ready) {
this._init();
Weave.Service.scheduler.scheduleNextSync(10*1000); // ten seconds after we startup
} else {
Services.obs.addObserver(this, "weave:service:ready", false);
service.ensureLoaded();
}
},
#ifdef XP_WIN
_securelySetupFromMetro: function() {
let metroUtils = Cc["@mozilla.org/windows-metroutils;1"].
createInstance(Ci.nsIWinMetroUtils);
var email = {}, password = {}, key = {};
try {
metroUtils.loadSyncInfo(email, password, key);
} catch (ex) {
return false;
}
let server = Weave.Service.serverURL;
let defaultPrefs = Services.prefs.getDefaultBranch(null);
if (server == defaultPrefs.getCharPref("services.sync.serverURL"))
server = "";
this.setupData = {
account: email.value,
password: password.value,
synckey: key.value,
serverURL: server
};
try {
metroUtils.clearSyncInfo();
} catch (ex) {
}
this.connect();
return true;
},
#endif
_init: function () {
this._bundle = Services.strings.createBundle("chrome://browser/locale/sync.properties");
this._addListeners();
this.setupData = { account: "", password: "" , synckey: "", serverURL: "" };
if (this._isSetup) {
this.loadSetupData();
}
// Update the state of the ui
this._updateUI();
this._boundOnEngineSync = this.onEngineSync.bind(this);
this._boundOnServiceSync = this.onServiceSync.bind(this);
this._progressBar = document.getElementById("syncsetup-progressbar");
#ifdef XP_WIN
if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
this._securelySetupFromMetro();
}
#endif
},
abortEasySetup: function abortEasySetup() {
document.getElementById("syncsetup-code1").value = "....";
document.getElementById("syncsetup-code2").value = "....";
document.getElementById("syncsetup-code3").value = "....";
if (!this.jpake)
return;
this.jpake.abort();
this.jpake = null;
},
_resetScrollPosition: function _resetScrollPosition() {
let scrollboxes = document.getElementsByClassName("syncsetup-scrollbox");
for (let i = 0; i < scrollboxes.length; i++) {
let sbo = scrollboxes[i].boxObject.QueryInterface(Ci.nsIScrollBoxObject);
try {
sbo.scrollTo(0, 0);
} catch(e) {}
}
},
open: function open() {
let container = document.getElementById("syncsetup-container");
if (!container.hidden)
return;
// Services.io.offline is lying to us, so we use the NetworkLinkService instead
let nls = Cc["@mozilla.org/network/network-link-service;1"].getService(Ci.nsINetworkLinkService);
if (!nls.isLinkUp) {
Services.obs.notifyObservers(null, "browser:sync:setup:networkerror", "");
Services.prompt.alert(window,
this._bundle.GetStringFromName("sync.setup.error.title"),
this._bundle.GetStringFromName("sync.setup.error.network"));
return;
}
// Clear up any previous JPAKE codes
this.abortEasySetup();
// Show the connect UI
container.hidden = false;
document.getElementById("syncsetup-simple").hidden = false;
document.getElementById("syncsetup-waiting").hidden = true;
document.getElementById("syncsetup-fallback").hidden = true;
DialogUI.pushDialog(this);
let self = this;
this.jpake = new Weave.JPAKEClient({
displayPIN: function displayPIN(aPin) {
document.getElementById("syncsetup-code1").value = aPin.slice(0, 4);
document.getElementById("syncsetup-code2").value = aPin.slice(4, 8);
document.getElementById("syncsetup-code3").value = aPin.slice(8);
},
onPairingStart: function onPairingStart() {
document.getElementById("syncsetup-simple").hidden = true;
document.getElementById("syncsetup-waiting").hidden = false;
},
onComplete: function onComplete(aCredentials) {
self.jpake = null;
self._progressBar.mode = "determined";
document.getElementById("syncsetup-waiting-desc").hidden = true;
document.getElementById("syncsetup-waiting-cancel").hidden = true;
document.getElementById("syncsetup-waitingdownload-desc").hidden = false;
document.getElementById("syncsetup-waiting-close").hidden = false;
Services.obs.addObserver(self._boundOnEngineSync, "weave:engine:sync:finish", false);
Services.obs.addObserver(self._boundOnEngineSync, "weave:engine:sync:error", false);
Services.obs.addObserver(self._boundOnServiceSync, "weave:service:sync:finish", false);
Services.obs.addObserver(self._boundOnServiceSync, "weave:service:sync:error", false);
Services.obs.addObserver(self._boundOnServiceSync, "weave:service:login:error", false);
self.setupData = aCredentials;
self.connect();
},
onAbort: function onAbort(aError) {
self.jpake = null;
if (aError == "jpake.error.userabort" || container.hidden) {
Services.obs.notifyObservers(null, "browser:sync:setup:userabort", "");
return;
}
// Automatically go to manual setup if we couldn't acquire a channel.
let brandShortName = Strings.brand.GetStringFromName("brandShortName");
let tryAgain = self._bundle.GetStringFromName("sync.setup.tryagain");
let manualSetup = self._bundle.GetStringFromName("sync.setup.manual");
let buttonFlags = Ci.nsIPrompt.BUTTON_POS_1_DEFAULT +
(Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
(Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_1) +
(Ci.nsIPrompt.BUTTON_TITLE_CANCEL * Ci.nsIPrompt.BUTTON_POS_2);
let button = Services.prompt.confirmEx(window,
self._bundle.GetStringFromName("sync.setup.error.title"),
self._bundle.formatStringFromName("sync.setup.error.nodata", [brandShortName], 1),
buttonFlags, tryAgain, manualSetup, null, "", {});
switch (button) {
case 0:
// we have to build a new JPAKEClient here rather than reuse the old one
container.hidden = true;
self.open();
break;
case 1:
self.openManual();
break;
case 2:
default:
self.close();
break;
}
}
});
this.jpake.receiveNoPIN();
},
openManual: function openManual() {
this.abortEasySetup();
// Reset the scroll since the previous page might have been scrolled
this._resetScrollPosition();
document.getElementById("syncsetup-simple").hidden = true;
document.getElementById("syncsetup-waiting").hidden = true;
document.getElementById("syncsetup-fallback").hidden = false;
// Push the current setup data into the UI
if (this.setupData && "account" in this.setupData) {
this._elements.account.value = this.setupData.account;
this._elements.password.value = this.setupData.password;
let pp = this.setupData.synckey;
if (Weave.Utils.isPassphrase(pp))
pp = Weave.Utils.hyphenatePassphrase(pp);
this._elements.synckey.value = pp;
if (this.setupData.serverURL && this.setupData.serverURL.length) {
this._elements.usecustomserver.checked = true;
this._elements.customserver.disabled = false;
this._elements.customserver.value = this.setupData.serverURL;
} else {
this._elements.usecustomserver.checked = false;
this._elements.customserver.disabled = true;
this._elements.customserver.value = "";
}
}
this.canConnect();
},
onEngineSync: function onEngineSync(subject, topic, data) {
// The Clients engine syncs first. At this point we don't necessarily know
// yet how many engines will be enabled, so we'll ignore the Clients engine
// and evaluate how many engines are enabled when the first "real" engine
// syncs.
if (data == 'clients') {
return;
}
if (this._progressMax == null) {
this._progressMax = Weave.Service.engineManager.getEnabled().length;
this._progressBar.max = this._progressMax;
}
this._progressValue += 1;
this._progressBar.setAttribute("value", this._progressValue);
},
onServiceSync: function onServiceSync() {
this.close();
},
close: function close() {
try {
Services.obs.removeObserver(this._boundOnEngineSync, "weave:engine:sync:finish");
Services.obs.removeObserver(this._boundOnEngineSync, "weave:engine:sync:error");
Services.obs.removeObserver(this._boundOnServiceSync, "weave:service:sync:finish");
Services.obs.removeObserver(this._boundOnServiceSync, "weave:service:sync:error");
Services.obs.removeObserver(this._boundOnServiceSync, "weave:service:login:error");
}
catch(e) {
// Observers weren't registered because we never got as far as onComplete.
}
if (this.jpake)
this.abortEasySetup();
// Reset the scroll since the previous page might have been scrolled
this._resetScrollPosition();
// Save current setup data
this.setupData = {
account: this._elements.account.value.trim(),
password: this._elements.password.value.trim(),
synckey: Weave.Utils.normalizePassphrase(this._elements.synckey.value.trim()),
serverURL: this._validateServer(this._elements.customserver.value.trim())
};
// Clear the UI so it's ready for next time
this._elements.account.value = "";
this._elements.password.value = "";
this._elements.synckey.value = "";
this._elements.usecustomserver.checked = false;
this._elements.customserver.disabled = true;
this._elements.customserver.value = "";
document.getElementById("syncsetup-waiting-desc").hidden = false;
document.getElementById("syncsetup-waiting-cancel").hidden = false;
document.getElementById("syncsetup-waitingdownload-desc").hidden = true;
document.getElementById("syncsetup-waiting-close").hidden = true;
this._progressMax = null;
this._progressValue = 0;
this._progressBar.max = 0;
this._progressBar.value = 0;
this._progressBar.mode = "undetermined";
// Close the connect UI
document.getElementById("syncsetup-container").hidden = true;
DialogUI.popDialog();
},
toggleCustomServer: function toggleCustomServer() {
let useCustomServer = this._elements.usecustomserver.checked;
this._elements.customserver.disabled = !useCustomServer;
if (!useCustomServer)
this._elements.customserver.value = "";
},
canConnect: function canConnect() {
let account = this._elements.account.value;
let password = this._elements.password.value;
let synckey = this._elements.synckey.value;
let disabled = !(account && password && synckey);
document.getElementById("syncsetup-button-connect").disabled = disabled;
},
tryConnect: function login() {
// If Sync is not configured, simply show the setup dialog
if (this._loginError || Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
this.open();
return;
}
// No setup data, do nothing
if (!this.setupData)
return;
if (this.setupData.serverURL && this.setupData.serverURL.length)
Weave.Service.serverURL = this.setupData.serverURL;
// We might still be in the middle of a sync from before Sync was disabled, so
// let's force the UI into a state that the Sync code feels comfortable
this.observe(null, "", "");
// Now try to re-connect. If successful, this will reset the UI into the
// correct state automatically.
Weave.Service.login(Weave.Service.identity.username, this.setupData.password, this.setupData.synckey);
},
connect: function connect(aSetupData) {
// Use setup data to pre-configure manual fields
if (aSetupData)
this.setupData = aSetupData;
// Cause the Sync system to reset internals if we seem to be switching accounts
if (this.setupData.account != Weave.Service.identity.account)
Weave.Service.startOver();
// Remove any leftover connection error string
this._elements.connect.removeAttribute("desc");
// Reset the custom server URL, if we have one
if (this.setupData.serverURL && this.setupData.serverURL.length)
Weave.Service.serverURL = this.setupData.serverURL;
// Sync will use the account value and munge it into a username, as needed
Weave.Service.identity.account = this.setupData.account;
Weave.Service.identity.basicPassword = this.setupData.password;
Weave.Service.identity.syncKey = this.setupData.synckey;
Weave.Service.persistLogin();
Weave.Svc.Obs.notify("weave:service:setup-complete");
this.sync();
},
// called when the user taps the disconnect button
onDisconnect: function onDisconnect() {
Weave.Service.logout();
let bundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
let brandName = bundle.GetStringFromName("brandShortName");
let warnStr = this._bundle.formatStringFromName("sync.disconnectPrompt", [brandName], 1);
this._elements.disconnectwarntitle.textContent = warnStr;
this._elements.disconnectwarnpanel.collapsed = false;
},
// called when the user taps the cancel button on
// the disconnect warning panel.
onCancelDisconnect: function onCancelDisconnect() {
this._elements.disconnectwarnpanel.collapsed = true;
this._updateUI();
Weave.Service.login();
},
// called when the user taps the remove button on
// the disconnect warning panel.
disconnect: function disconnect() {
this._elements.disconnectwarnpanel.collapsed = true;
this.setupData = null;
this._disconnecting = true;
this._updateUI();
Weave.Service.startOver();
},
sync: function sync() {
Weave.Service.scheduler.scheduleNextSync(0);
},
_addListeners: function _addListeners() {
let topics = ["weave:service:setup-complete",
"weave:service:sync:start", "weave:service:sync:finish",
"weave:service:sync:error", "weave:service:login:start",
"weave:service:login:finish", "weave:service:login:error",
"weave:ui:login:error",
"weave:service:start-over", "weave:service:start-over:finish",
"weave:service:logout:finish"];
// For each topic, add Sync the observer
topics.forEach(function(topic) {
Services.obs.addObserver(Sync, topic, false);
});
// Remove them on unload
addEventListener("unload", function() {
topics.forEach(function(topic) {
Services.obs.removeObserver(Sync, topic);
});
}, false);
},
get _elements() {
// Get all the setting nodes from the add-ons display
let elements = {};
let setupids = ["account", "password", "synckey", "usecustomserver", "customserver"];
setupids.forEach(function(id) {
elements[id] = document.getElementById("syncsetup-" + id);
});
let settingids = ["device", "connect", "connected", "disconnect", "lastsync", "pairdevice",
"errordescription", "accountinfo", "disconnectwarnpanel", "disconnectpanel",
"disconnectthrobber", "disconnectwarntitle", "description"];
settingids.forEach(function(id) {
elements[id] = document.getElementById("sync-" + id);
});
// Replace the getter with the collection of settings
delete this._elements;
return this._elements = elements;
},
_updateUI: function _updateUI() {
if (this._elements == null)
return;
let connect = this._elements.connect;
let connected = this._elements.connected;
let device = this._elements.device;
let disconnect = this._elements.disconnect;
let lastsync = this._elements.lastsync;
let pairdevice = this._elements.pairdevice;
let accountinfo = this._elements.accountinfo;
let description = this._elements.description;
let disconnectpanel = this._elements.disconnectpanel;
let disconnectthrobber = this._elements.disconnectthrobber;
// This gets updated when an error occurs
this._elements.errordescription.collapsed = true;
let isConfigured = (!this._loginError && this._isSetup);
// If we're in the process of disconnecting we are no longer configured.
if (this._disconnecting) {
isConfigured = false;
disconnectpanel.collapsed = false;
disconnectthrobber.enabled = true;
} else {
disconnectpanel.collapsed = true;
disconnectthrobber.enabled = false;
}
connect.collapsed = isConfigured;
connected.collapsed = !isConfigured;
lastsync.collapsed = !isConfigured;
device.collapsed = !isConfigured;
disconnect.collapsed = !isConfigured;
description.collapsed = isConfigured;
if (this._disconnecting) {
connect.collapsed = true;
}
// Set the device name text edit to configured name or the auto generated
// name if we aren't set up.
try {
device.value = Services.prefs.getCharPref("services.sync.client.name");
} catch(ex) {
device.value = Weave.Service.clientsEngine.localName || "";
}
// Account information header
accountinfo.collapsed = true;
try {
let account = Weave.Service.identity.account;
if (account != null && isConfigured) {
let accountStr = this._bundle.formatStringFromName("account.label", [account], 1);
accountinfo.textContent = accountStr;
accountinfo.collapsed = false;
}
} catch (ex) {}
// If we're already locked, a sync is in progress..
if (Weave.Service.locked && isConfigured) {
connect.firstChild.disabled = true;
}
// Show the day-of-week and time (HH:MM) of last sync
let lastSync = Weave.Svc.Prefs.get("lastSync");
lastsync.textContent = "";
if (lastSync != null) {
let syncDate = new Date(lastSync).toLocaleFormat("%A %I:%M %p");
let dateStr = this._bundle.formatStringFromName("lastSync2.label", [syncDate], 1);
lastsync.textContent = dateStr;
}
// Check the lock again on a timeout since it's set after observers notify
setTimeout(function(self) {
// Prevent certain actions when the service is locked
if (Weave.Service.locked) {
connect.firstChild.disabled = true;
} else {
connect.firstChild.disabled = false;
}
}, 100, this);
},
observe: function observe(aSubject, aTopic, aData) {
if (aTopic == "weave:service:ready") {
Services.obs.removeObserver(this, aTopic);
this._init();
return;
}
// Make sure we're online when connecting/syncing
Util.forceOnline();
if (aTopic == "weave:service:start-over") {
this._disconnecting = true;
} else if (aTopic == "weave:service:start-over:finish") {
this._disconnecting = false;
}
// Can't do anything before settings are loaded
if (this._elements == null)
return;
// Update the state of the ui
this._updateUI();
let errormsg = this._elements.errordescription;
let accountinfo = this._elements.accountinfo;
// Show what went wrong with login if necessary
if (aTopic == "weave:ui:login:error" || aTopic == "weave:service:login:error") {
this._loginError = true;
errormsg.textContent = Weave.Utils.getErrorString(Weave.Status.login);
errormsg.collapsed = false;
}
if (aTopic == "weave:service:login:finish") {
this._loginError = false;
// Init the setup data if we just logged in
if (!this.setupData)
this.loadSetupData();
}
// Check for a storage format update, update the user and load the Sync update page
if (aTopic =="weave:service:sync:error") {
errormsg.textContent = Weave.Utils.getErrorString(Weave.Status.sync);
errormsg.collapsed = false;
let clientOutdated = false, remoteOutdated = false;
if (Weave.Status.sync == Weave.VERSION_OUT_OF_DATE) {
clientOutdated = true;
} else if (Weave.Status.sync == Weave.DESKTOP_VERSION_OUT_OF_DATE) {
remoteOutdated = true;
} else if (Weave.Status.service == Weave.SYNC_FAILED_PARTIAL) {
// Some engines failed, check for per-engine compat
for (let [engine, reason] in Iterator(Weave.Status.engines)) {
clientOutdated = clientOutdated || reason == Weave.VERSION_OUT_OF_DATE;
remoteOutdated = remoteOutdated || reason == Weave.DESKTOP_VERSION_OUT_OF_DATE;
}
}
if (clientOutdated || remoteOutdated) {
let brand = Services.strings.createBundle("chrome://branding/locale/brand.properties");
let brandName = brand.GetStringFromName("brandShortName");
let type = clientOutdated ? "client" : "remote";
let message = this._bundle.GetStringFromName("sync.update." + type);
message = message.replace("#1", brandName);
message = message.replace("#2", Services.appinfo.version);
let title = this._bundle.GetStringFromName("sync.update.title")
let button = this._bundle.GetStringFromName("sync.update.learnmore")
let close = this._bundle.GetStringFromName("sync.update.close")
let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_IS_STRING;
let choice = Services.prompt.confirmEx(window, title, message, flags, button, close, null, null, {});
if (choice == 0)
Browser.addTab("https://services.mozilla.com/update/", true, Browser.selectedTab);
}
}
},
changeName: function changeName(aInput) {
// Make sure to update to a modified name, e.g., empty-string -> default
Weave.Service.clientsEngine.localName = aInput.value;
aInput.value = Weave.Service.clientsEngine.localName;
},
_validateServer: function _validateServer(aURL) {
let uri = Weave.Utils.makeURI(aURL);
if (!uri && aURL)
uri = Weave.Utils.makeURI("https://" + aURL);
if (!uri)
return "";
return uri.spec;
},
openTutorial: function _openTutorial() {
Sync.close();
let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter);
let url = formatter.formatURLPref("app.sync.tutorialURL");
BrowserUI.newTab(url, Browser.selectedTab);
},
loadSetupData: function _loadSetupData() {
this.setupData = {};
this.setupData.account = Weave.Service.identity.account || "";
this.setupData.password = Weave.Service.identity.basicPassword || "";
this.setupData.synckey = Weave.Service.identity.syncKey || "";
let serverURL = Weave.Service.serverURL;
let defaultPrefs = Services.prefs.getDefaultBranch(null);
if (serverURL == defaultPrefs.getCharPref("services.sync.serverURL"))
serverURL = "";
this.setupData.serverURL = serverURL;
}
};
const PIN_PART_LENGTH = 4;
let SyncPairDevice = {
jpake: null,
open: function open() {
this.code1.setAttribute("maxlength", PIN_PART_LENGTH);
this.code2.setAttribute("maxlength", PIN_PART_LENGTH);
this.code3.setAttribute("maxlength", PIN_PART_LENGTH);
this.nextFocusEl = {code1: this.code2,
code2: this.code3,
code3: this.connectbutton};
document.getElementById("syncpair-container").hidden = false;
DialogUI.pushDialog(this);
this.code1.focus();
// Kick off a sync. That way the server will have the most recent data from
// this computer and it will show up immediately on the new device.
Weave.SyncScheduler.scheduleNextSync(0);
},
close: function close() {
this.code1.value = this.code2.value = this.code3.value = "";
this.code1.disabled = this.code2.disabled = this.code3.disabled = false;
this.connectbutton.disabled = true;
if (this.jpake) {
this.jpake.abort();
this.jpake = null;
}
document.getElementById("syncpair-container").hidden = true;
DialogUI.popDialog();
},
onTextBoxInput: function onTextBoxInput(textbox) {
if (textbox && textbox.value.length == PIN_PART_LENGTH) {
let name = textbox.id.split("-")[1];
this.nextFocusEl[name].focus();
}
this.connectbutton.disabled =
!(this.code1.value.length == PIN_PART_LENGTH &&
this.code2.value.length == PIN_PART_LENGTH &&
this.code3.value.length == PIN_PART_LENGTH);
},
connect: function connect() {
let self = this;
let jpake = this.jpake = new Weave.JPAKEClient({
onPaired: function onPaired() {
let credentials = {account: Weave.Service.identity.account,
password: Weave.Service.identity.basicPassword,
synckey: Weave.Service.identity.syncKey,
serverURL: Weave.Service.serverURL};
jpake.sendAndComplete(credentials);
},
onComplete: function onComplete() {
self.jpake = null;
self.close();
// Schedule a Sync for soonish to fetch the data uploaded by the
// device with which we just paired.
Weave.SyncScheduler.scheduleNextSync(Weave.SyncScheduler.activeInterval);
},
onAbort: function onAbort(error) {
self.jpake = null;
// Aborted by user, ignore.
if (error == Weave.JPAKE_ERROR_USERABORT) {
return;
}
self.code1.value = self.code2.value = self.code3.value = "";
self.code1.disabled = self.code2.disabled = self.code3.disabled = false;
self.code1.focus();
}
});
this.code1.disabled = this.code2.disabled = this.code3.disabled = true;
this.connectbutton.disabled = true;
let pin = this.code1.value + this.code2.value + this.code3.value;
let expectDelay = false;
jpake.pairWithPIN(pin, expectDelay);
}
};
["code1", "code2", "code3", "connectbutton"].forEach(function (id) {
XPCOMUtils.defineLazyGetter(SyncPairDevice, id, function() {
return document.getElementById("syncpair-" + id);
});
});

View File

@ -28,6 +28,10 @@ chrome.jar:
content/bindings/cssthrobber.xml (content/bindings/cssthrobber.xml)
content/bindings/popup.xml (content/bindings/popup.xml)
* content/flyouts/flyoutUI.js (content/flyouts/flyoutUI.js)
* content/flyouts/aboutFlyout.js (content/flyouts/aboutFlyout.js)
content/flyouts/prefsFlyout.js (content/flyouts/prefsFlyout.js)
content/prompt/alert.xul (content/prompt/alert.xul)
content/prompt/confirm.xul (content/prompt/confirm.xul)
content/prompt/prompt.xul (content/prompt/prompt.xul)
@ -70,7 +74,6 @@ chrome.jar:
content/ContextCommands.js (content/ContextCommands.js)
content/commandUtil.js (content/commandUtil.js)
content/appbar.js (content/appbar.js)
* content/aboutPanel.js (content/aboutPanel.js)
content/shell.xul (content/jsshell/shell.xul)
content/shell.html (content/jsshell/shell.html)
content/browser.css (content/browser.css)
@ -80,7 +83,6 @@ chrome.jar:
content/input.js (content/input.js)
content/Util.js (content/Util.js)
content/bookmarks.js (content/bookmarks.js)
content/preferences.js (content/preferences.js)
content/exceptions.js (content/exceptions.js)
content/downloads.js (content/downloads.js)
content/history.js (content/history.js)
@ -90,7 +92,7 @@ chrome.jar:
content/AnimatedZoom.js (content/AnimatedZoom.js)
content/dbg-metro-actors.js (content/dbg-metro-actors.js)
#ifdef MOZ_SERVICES_SYNC
* content/sync.js (content/sync.js)
content/flyouts/syncFlyout.js (content/flyouts/syncFlyout.js)
content/RemoteTabs.js (content/RemoteTabs.js)
#endif
content/NavButtonSlider.js (content/NavButtonSlider.js)

View File

@ -37,12 +37,12 @@ gTests.push({
desc: "Test sanitizer UI",
run: function testSanitizeUI() {
// Show options flyout
let promise = waitForEvent(Elements.prefsFlyout, "PopupChanged", 2000);
Elements.prefsFlyout.show();
let promise = waitForEvent(FlyoutPanelsUI.PrefsFlyout._topmostElement, "PopupChanged", 2000);
FlyoutPanelsUI.show('PrefsFlyout');
yield promise;
// Make sure it's opened
yield waitForEvent(Elements.prefsFlyout, "transitionend", 1000);
yield waitForEvent(FlyoutPanelsUI.PrefsFlyout._topmostElement, "transitionend", 1000);
SanitizeHelper.setUp();
@ -90,8 +90,8 @@ gTests.push({
});
// hide options flyout
let promise = waitForEvent(Elements.prefsFlyout, "PopupChanged", 2000);
Elements.prefsFlyout.hide();
let promise = waitForEvent(FlyoutPanelsUI.PrefsFlyout._topmostElement, "PopupChanged", 2000);
FlyoutPanelsUI.hide();
yield promise;
}
});
@ -119,8 +119,8 @@ gTests.push({
let okTrack = document.getElementById("prefs-dnt-oktrack");
// Show options flyout
let promise = waitForEvent(Elements.prefsFlyout, "PopupChanged", 2000);
Elements.prefsFlyout.show();
let promise = waitForEvent(FlyoutPanelsUI.PrefsFlyout._topmostElement, "PopupChanged", 2000);
FlyoutPanelsUI.show('PrefsFlyout');
yield promise;
noPref.click();
@ -140,8 +140,8 @@ gTests.push({
checkDNTPrefs(true, 0);
// hide options flyout
let promise = waitForEvent(Elements.prefsFlyout, "PopupChanged", 2000);
Elements.prefsFlyout.hide();
let promise = waitForEvent(FlyoutPanelsUI.PrefsFlyout._topmostElement, "PopupChanged", 2000);
FlyoutPanelsUI.hide();
yield promise;
}
});

View File

@ -2,38 +2,57 @@
- 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/. -->
<!-- Flyout -->
<!ENTITY sync.flyout.title "&syncBrand.shortName.label;">
<!-- flyout header -->
<!ENTITY syncHeader.title "Sync">
<!-- not connected yet -->
<!ENTITY sync.setup.description "Access your bookmarks, passwords, and open tabs across your devices">
<!ENTITY sync.setupbutton.label "Set up Sync">
<!-- sync now button -->
<!ENTITY sync.syncNow2 "Sync now">
<!-- device name text edit -->
<!ENTITY sync.deviceName "This device">
<!-- remove this device button -->
<!ENTITY sync.removebutton.label "Remove this device">
<!ENTITY sync.removewarn.note "Your browser data on this device will remain intact, but you will no longer be able to sync with this account.">
<!ENTITY sync.removethrobber.label "Removing device">
<!-- Flyout when not connected -->
<!ENTITY sync.flyout.presetup.description1 "Access your bookmarks, passwords, and open tabs across your devices">
<!ENTITY sync.flyout.presetup.setup.label "Set Up &syncBrand.shortName.label;">
<!ENTITY sync.setup2.title "Set up Sync">
<!ENTITY sync.setup.pair2 "To activate, select &#x0022;Pair a device&#x0022; on your other device.">
<!ENTITY sync.fallback "Enter or edit account information…">
<!ENTITY sync.setup.manual "Enter your Sync account information">
<!ENTITY sync.account "Account Name">
<!ENTITY sync.password "Password">
<!ENTITY sync.recoveryKey "Recovery Key">
<!ENTITY sync.customServer "Use custom server">
<!ENTITY sync.serverURL "Server URL">
<!ENTITY sync.setup.connect2 "Add device">
<!ENTITY sync.setup.cancel "Cancel">
<!ENTITY sync.setup.remove "Remove">
<!ENTITY sync.setup.tutorial "Show me how">
<!ENTITY sync.setup.waiting2 "Waiting for other device…">
<!-- Flyout when setting up sync -->
<!ENTITY sync.flyout.setup.title "Set Up &syncBrand.shortName.label;">
<!ENTITY sync.flyout.setup.description1 "If you have a &syncBrand.shortName.label; account, select &quot;Pair a Device&quot; on your other device and enter this code.">
<!ENTITY sync.flyout.setup.description2 "If you don&apos;t have a &syncBrand.shortName.label; account, you can create one on your &brandShortName; desktop browser.">
<!ENTITY sync.flyout.setup.manual.label "I&apos;m not near my computer...">
<!ENTITY sync.flyout.setup.description3 "Note:">
<!ENTITY sync.flyout.setup.description4 "You can select &quot;Pair a Device&quot; through">
<!ENTITY sync.flyout.setup.description5 "[Desktop] Preferences -&gt; Sync">
<!ENTITY sync.flyout.setup.description6 "[Android] More &gt; Settings &gt; Sync">
<!ENTITY sync.pair.title "Pair a Device">
<!ENTITY sync.pair.button "Pair a device">
<!ENTITY sync.pair.description "To activate your new device, select &#x0022;Set up Sync&#x0022; on the device.">
<!ENTITY sync.setup.close "Close">
<!ENTITY sync.setup.waitingdownload "Your data is now being downloaded in the background. You can close this window at any time.">
<!-- Flyout when setting up manually -->
<!ENTITY sync.flyout.manualsetup.description1 "Please enter your &syncBrand.shortName.label; account information and the Recover Key generated by your computer">
<!ENTITY sync.flyout.manualsetup.account.placeholder "Account Name">
<!ENTITY sync.flyout.manualsetup.password.placeholder "Password">
<!ENTITY sync.flyout.manualsetup.recoveryKey.placeholder "Recovery Key">
<!ENTITY sync.flyout.manualsetup.connect.label "Connect">
<!-- Flyout when user has just connected -->
<!ENTITY sync.flyout.setupsuccess.description1 "You just connected &brandShortName; to &syncBrand.shortName.label; account">
<!ENTITY sync.flyout.setupsuccess.description2 "Your &syncBrand.shortName.label; data is now being downloaded in the background. Your synced tabs can be found on &brandShortName; Start Page">
<!-- Flyout when setup failed -->
<!ENTITY sync.flyout.setupfailure.description "&brandShortName; could not connect to your &syncBrand.shortName.label; account.">
<!ENTITY sync.flyout.setupfailure.cancelButton "Cancel">
<!ENTITY sync.flyout.setupfailure.tryAgainButton "Try Again">
<!-- Flyout when connected and functioning normally -->
<!ENTITY sync.flyout.connected.account "Account:">
<!ENTITY sync.flyout.connected.device "Your device:">
<!ENTITY sync.flyout.connected.disconnect "Disconnect">
<!ENTITY sync.flyout.connected.disconnectWarningHeader "Disconnect your device with &syncBrand.shortName.label;?">
<!ENTITY sync.flyout.connected.disconnectWarning "All your personal data on both this device and &syncBrand.shortName.label; account will remain intact.">
<!ENTITY sync.flyout.connected.cancel "Cancel">
<!ENTITY sync.flyout.connected.pair "Pair a Device">
<!-- Flyout when pairing a device -->
<!ENTITY sync.flyout.pairNewDevice.description "On the new device you want to pair with, select &quot;Set Up &syncBrand.shortName.label;&quot; and enter the code the device produces">
<!ENTITY sync.flyout.pairNewDevice.pair "Pair">
<!ENTITY sync.flyout.pairNewDevice.note1 "Note:">
<!ENTITY sync.flyout.pairNewDevice.note2 "You can access &syncBrand.shortName.label; to find code through">
<!ENTITY sync.flyout.pairNewDevice.note3 "[Desktop] Tools -&gt; Set Up Sync -&gt; I have an Account">
<!ENTITY sync.flyout.pairNewDevice.note4 "[Android] More &gt; Settings &gt; &syncBrand.shortName.label;">
<!ENTITY sync.flyout.pairNewDevice.failure "Please try again">
<!-- Flyout when a device has been successfully paired -->
<!ENTITY sync.flyout.pairSuccess.description1 "The new device has been successfully added.">
<!ENTITY sync.flyout.pairSuccess.description2 "Your &syncBrand.shortName.label; data is now being downloaded in the background. Your remote tabs can be found on &brandShortName; Start Page.">

View File

@ -7,28 +7,9 @@
# with Desktop. See /services/sync/modules/engines/clients.js locaName.
sync.defaultAccountApplication=Metro %S
sync.disconnectPrompt=Remove Windows 8 style %S from your Sync Account?
# %S is the date and time at which the last sync successfully completed
lastSync2.label=Last sync: %S
sync.flyout.connected.lastSynced=Last sync: %S
# %S is the username logged in
account.label=Account: %S
connecting.label=Connecting…
notificationDisconnect.label=Your Firefox Sync account has been removed
notificationDisconnect.button=Undo
# LOCALIZATION NOTE (sync.clientUpdate, sync.remoteUpdate):
# #1 is the "application name"
# #2 is the "version"
sync.update.client=#1 #2 is not compatible with the latest version of Firefox Sync. Please update to the latest version.
sync.update.remote=#1 #2 is not compatible with older versions of Firefox Sync. Please update Firefox on your other computer(s).
sync.update.title=Firefox Sync
sync.update.learnmore=Learn more
sync.update.close=Close
sync.setup.error.title=Cannot Setup Sync
sync.setup.error.network=No internet connection available
sync.setup.error.nodata=%S could not connect to Sync. Would you like to try again?
sync.setup.tryagain=Try again
sync.setup.manual=Manual setup
sync.flyout.connected.account=Account: %S
# %S is the name that the user has chosen for this device
sync.flyout.connected.device=Your device: %S

View File

@ -34,6 +34,7 @@
@AB_CD@.jar:
relativesrcdir browser/locales:
locale/browser/syncBrand.dtd (%chrome/browser/syncBrand.dtd)
locale/browser/region.properties (%chrome/browser-region/region.properties)
locale/browser/netError.dtd (%chrome/overrides/netError.dtd)
% override chrome://global/locale/netError.dtd chrome://browser/locale/netError.dtd

View File

@ -558,27 +558,92 @@ flyoutpanel > settings:first-child {
/* Sync flyout pane */
#sync-flyoutpanel {
width: 400px;
width: 346px;
font-size: @metro_font_normal@;
font-weight: 400;
}
#sync-disconnectpanel {
margin-top: 25px;
#sync-flyoutpanel button {
font-weight: 700;
}
#sync-disconnectwarntitle {
font-weight: bold;
#sync-flyoutpanel .syncHeader {
font-weight: 600;
}
#sync-disconnectthrobber .progressContainer {
width: 25px;
height: 25px;
margin-right: 10px;
#sync-flyoutpanel .syncSecondaryText {
font-weight: 100;
font-size: @metro_font_snormal@;
}
#sync-disconnectthrobber .progressBall {
#sync-flyoutpanel .syncInstructionText {
font-style: italic;
}
.syncThrobber .progressBall {
margin: 2px;
width: 22px;
height: 22px;
}
.syncThrobber .progressBallInner {
width: 5px;
height: 5px;
border-radius: 3px;
}
#sync-flyoutpanel .syncErrorText {
color: red;
}
#sync-flyoutpanel textbox {
margin: @metro_spacing_small@;
padding: @metro_spacing_xsmall@ @metro_spacing_snormal@;
background: @field_background_color@;
border: @metro_border_thick@ solid @field_mid_foreground_color@ !important;
color: @field_foreground_color@;
}
#sync-setup-throbber {
margin-top: 15px;
margin-left: 25px;
}
#sync-connected-device {
width: 200px;
}
#sync-manualsetup-failure {
width: 200px;
}
#sync-flyoutpanel .syncJPAKECode {
margin: @metro_spacing_small@;
padding: @metro_spacing_xsmall@ @metro_spacing_snormal@;
background: @field_background_color@;
border: @metro_border_thick@ solid @field_mid_foreground_color@ !important;
color: @field_foreground_color@;
display: block !important;
font-size: @metro_font_large@ !important;
font-weight: 600;
letter-spacing: 0.4em;
text-align: center;
width: 175px;
}
#sync-connected-device {
margin-bottom: 0px;
padding-bottom: 0px;
}
#sync-connected-lastSynced {
margin-top: 0px;
padding-top: 0px;
}
#sync-connected-throbber {
margin-top: 12px;
margin-left: 15px;
}
/* About flyout pane */
@ -711,6 +776,11 @@ setting[type="radio"] > vbox {
max-height: 25px;
}
#clearprivacythrobber {
max-width: 25px;
max-height: 25px;
}
#clearprivacythrobber .progressContainer {
width: 25px;
height: 25px;
@ -1023,37 +1093,6 @@ setting[type="radio"] > vbox {
font-size: @font_small@ !important;
}
/* Sync Setup ------------------------------------------------------------- */
.syncsetup-code {
display: block !important;
margin: @metro_spacing_small@;
padding: @metro_spacing_xsmall@ @metro_spacing_snormal@;
background: @field_background_color@;
border: @metro_border_thick@ solid @field_foreground_color@ !important;
color: @field_foreground_color@;
font-size: @metro_font_large@ !important;
letter-spacing: 0.2em;
text-align: left;
width: 250px;
-moz-box-flex: 1;
}
.syncsetup-label {
color: #fff;
}
#syncsetup-customserver {
-moz-margin-start: @margin_xnormal@;
}
#syncsetup-waiting {
padding: 2em 0 0 0;
}
#syncsetup-waiting-top {
padding: 1em;
}
/* content scrollbars */
.scroller {
opacity: 0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -86,6 +86,8 @@ chrome.jar:
skin/images/appbar-icons.png (images/appbar-icons.png)
skin/images/pinned-hdpi.png (images/pinned-hdpi.png)
skin/images/tile-selected-check-hdpi.png (images/tile-selected-check-hdpi.png)
skin/images/plus-34.png (images/plus-34.png)
skin/images/plus-24.png (images/plus-24.png)
skin/images/overlay-back.png (images/overlay-back.png)
skin/images/overlay-plus.png (images/overlay-plus.png)

View File

@ -11,6 +11,11 @@
background-repeat: no-repeat;
}
#urlbar[pageproxystate="valid"] > #identity-box.chromeUI:-moz-locale-dir(rtl),
#urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity:-moz-locale-dir(rtl) {
background-position: left;
}
#urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity {
color: hsl(92,100%,30%);
background-image: linear-gradient(hsla(92,81%,16%,0),
@ -19,38 +24,28 @@
hsla(92,81%,16%,0));
}
%ifdef MOZ_OFFICIAL_BRANDING
#urlbar[pageproxystate="valid"] > #identity-box.chromeUI {
%ifdef MOZ_OFFICIAL_BRANDING
color: rgb(229,115,0);
background-image: linear-gradient(rgba(229,114,0,0),
rgba(229,114,0,.5) 35%,
rgba(229,114,0,.5) 65%,
rgba(229,114,0,0));
}
%else
%if MOZ_UPDATE_CHANNEL == aurora
#urlbar[pageproxystate="valid"] > #identity-box.chromeUI {
color: hsl(214,90%,23%);
background-image: linear-gradient(hsla(208,99%,37%,0),
hsla(214,90%,23%,.5) 35%,
hsla(214,90%,23%,.5) 65%,
hsla(214,90%,23%,0));
}
%else
#urlbar[pageproxystate="valid"] > #identity-box.chromeUI {
color: hsl(211,33%,32%);
background-image: linear-gradient(hsla(211,33%,32%,0),
hsla(211,33%,32%,.5) 35%,
hsla(211,33%,32%,.5) 65%,
hsla(211,33%,32%,0));
}
%endif
%endif
#identity-box.chromeUI:-moz-locale-dir(rtl),
#identity-box.verifiedIdentity:-moz-locale-dir(rtl) {
background-position: left;
}
/* page proxy icon */

View File

@ -1474,8 +1474,20 @@ class Rule(object):
def getcommands(self, target, makefile):
assert isinstance(target, Target)
# Prerequisites are merged if the target contains multiple rules and is
# not a terminal (double colon) rule. See
# https://www.gnu.org/software/make/manual/make.html#Multiple-Targets.
prereqs = []
prereqs.extend(self.prerequisites)
return getcommandsforrule(self, target, makefile, self.prerequisites, stem=None)
if not self.doublecolon:
for rule in target.rules:
# The current rule comes first, which is already in prereqs so
# we don't need to add it again.
if rule != self:
prereqs.extend(rule.prerequisites)
return getcommandsforrule(self, target, makefile, prereqs, stem=None)
# TODO: $* in non-pattern rules?
class PatternRuleInstance(object):

View File

@ -0,0 +1,25 @@
# When a target is defined multiple times, the prerequisites should get
# merged.
default: foo bar baz
foo:
test "$<" = "foo.in1"
@echo TEST-PASS
foo: foo.in1
bar: bar.in1
test "$<" = "bar.in1"
test "$^" = "bar.in1 bar.in2"
@echo TEST-PASS
bar: bar.in2
baz: baz.in2
baz: baz.in1
test "$<" = "baz.in1"
test "$^" = "baz.in1 baz.in2"
@echo TEST-PASS
foo.in1 bar.in1 bar.in2 baz.in1 baz.in2:

View File

@ -3,10 +3,6 @@
# 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/.
llvm_revision = "183744"
##############################################
import os
import os.path
import shutil
@ -15,6 +11,7 @@ import platform
import sys
import json
import collections
import argparse
def check_run(args):
@ -29,9 +26,9 @@ def run_in(path, args):
os.chdir(d)
def patch(patch, plevel, srcdir):
def patch(patch, srcdir):
patch = os.path.realpath(patch)
check_run(['patch', '-d', srcdir, '-p%s' % plevel, '-i', patch, '--fuzz=0',
check_run(['patch', '-d', srcdir, '-p1', '-i', patch, '--fuzz=0',
'-s'])
@ -62,13 +59,13 @@ def svn_co(url, directory, revision):
check_run(["svn", "co", "-r", revision, url, directory])
def build_one_stage(env, stage_dir):
def build_one_stage(env, stage_dir, llvm_source_dir):
def f():
build_one_stage_aux(stage_dir)
build_one_stage_aux(stage_dir, llvm_source_dir)
with_env(env, f)
def build_tooltool_manifest():
def build_tooltool_manifest(llvm_revision):
basedir = os.path.split(os.path.realpath(sys.argv[0]))[0]
tooltool = basedir + '/tooltool.py'
setup = basedir + '/setup.sh'
@ -84,10 +81,25 @@ def build_tooltool_manifest():
assert data[2]['filename'] == 'clang.tar.bz2'
os.rename('clang.tar.bz2', data[2]['digest'])
isDarwin = platform.system() == "Darwin"
def get_platform():
p = platform.system()
if p == "Darwin":
return "macosx64"
elif p == "Linux":
if platform.processor() == "x86_64":
return "linux64"
else:
return "linux32"
else:
raise NotImplementedError("Not supported platform")
def build_one_stage_aux(stage_dir):
def is_darwin():
return platform.system() == "Darwin"
def build_one_stage_aux(stage_dir, llvm_source_dir):
os.mkdir(stage_dir)
build_dir = stage_dir + "/build"
@ -98,7 +110,7 @@ def build_one_stage_aux(stage_dir):
# with objects in compiler-rt that are compiled for arm. Since the arm
# support is only necessary for iOS (which we don't support), only enable
# arm support on Linux.
if not isDarwin:
if not is_darwin():
targets.append("arm")
configure_opts = ["--enable-optimized",
@ -106,63 +118,73 @@ def build_one_stage_aux(stage_dir):
"--disable-assertions",
"--prefix=%s" % inst_dir,
"--with-gcc-toolchain=/tools/gcc-4.7.2-0moz1"]
build_package(llvm_source_dir, build_dir, configure_opts,
[])
build_package(llvm_source_dir, build_dir, configure_opts, [])
# The directories end up in the debug info, so the easy way of getting
# a reproducible build is to run it in a know absolute directory.
# We use a directory in /builds/slave because the mozilla infrastructure
# cleans it up automatically.
base_dir = "/builds/slave/moz-toolchain"
if __name__ == "__main__":
# The directories end up in the debug info, so the easy way of getting
# a reproducible build is to run it in a know absolute directory.
# We use a directory in /builds/slave because the mozilla infrastructure
# cleans it up automatically.
base_dir = "/builds/slave/moz-toolchain"
source_dir = base_dir + "/src"
build_dir = base_dir + "/build"
source_dir = base_dir + "/src"
build_dir = base_dir + "/build"
llvm_source_dir = source_dir + "/llvm"
clang_source_dir = source_dir + "/clang"
compiler_rt_source_dir = source_dir + "/compiler-rt"
llvm_source_dir = source_dir + "/llvm"
clang_source_dir = source_dir + "/clang"
compiler_rt_source_dir = source_dir + "/compiler-rt"
if isDarwin:
if is_darwin():
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
if not os.path.exists(source_dir):
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', required=True,
type=argparse.FileType('r'),
help="Clang configuration file")
args = parser.parse_args()
config = json.load(args.config)
llvm_revision = config["llvm_revision"]
llvm_repo = config["llvm_repo"]
clang_repo = config["clang_repo"]
compiler_repo = config["compiler_repo"]
if not os.path.exists(source_dir):
os.makedirs(source_dir)
svn_co("http://llvm.org/svn/llvm-project/llvm/branches/release_33",
llvm_source_dir, llvm_revision)
svn_co("http://llvm.org/svn/llvm-project/cfe/branches/release_33",
clang_source_dir, llvm_revision)
svn_co("http://llvm.org/svn/llvm-project/compiler-rt/branches/release_33",
compiler_rt_source_dir, llvm_revision)
svn_co(llvm_repo, llvm_source_dir, llvm_revision)
svn_co(clang_repo, clang_source_dir, llvm_revision)
svn_co(compiler_repo, compiler_rt_source_dir, llvm_revision)
os.symlink("../../clang", llvm_source_dir + "/tools/clang")
os.symlink("../../compiler-rt", llvm_source_dir + "/projects/compiler-rt")
patch("llvm-debug-frame.patch", 1, llvm_source_dir)
if not isDarwin:
patch("no-sse-on-linux.patch", 0, clang_source_dir)
os.symlink("../../compiler-rt",
llvm_source_dir + "/projects/compiler-rt")
for p in config.get("patches", {}).get(get_platform(), []):
patch(p, source_dir)
if os.path.exists(build_dir):
if os.path.exists(build_dir):
shutil.rmtree(build_dir)
os.makedirs(build_dir)
os.makedirs(build_dir)
stage1_dir = build_dir + '/stage1'
stage1_inst_dir = stage1_dir + '/clang'
stage1_dir = build_dir + '/stage1'
stage1_inst_dir = stage1_dir + '/clang'
if isDarwin:
if is_darwin():
extra_cflags = ""
extra_cxxflags = ""
cc = "/usr/bin/clang"
cxx = "/usr/bin/clang++"
else:
else:
extra_cflags = "-static-libgcc"
extra_cxxflags = "-static-libgcc -static-libstdc++"
cc = "/usr/bin/gcc"
cxx = "/usr/bin/g++"
build_one_stage({"CC": cc, "CXX": cxx}, stage1_dir)
build_one_stage({"CC": cc, "CXX": cxx}, stage1_dir, llvm_source_dir)
stage2_dir = build_dir + '/stage2'
build_one_stage({"CC": stage1_inst_dir + "/bin/clang %s" % extra_cflags,
stage2_dir = build_dir + '/stage2'
build_one_stage(
{"CC": stage1_inst_dir + "/bin/clang %s" % extra_cflags,
"CXX": stage1_inst_dir + "/bin/clang++ %s" % extra_cxxflags},
stage2_dir)
stage2_dir, llvm_source_dir)
build_tar_package("tar", "clang.tar.bz2", stage2_dir, "clang")
build_tooltool_manifest()
build_tar_package("tar", "clang.tar.bz2", stage2_dir, "clang")
build_tooltool_manifest(llvm_revision)

View File

@ -0,0 +1,11 @@
{
"llvm_revision": "183744",
"llvm_repo": "http://llvm.org/svn/llvm-project/llvm/branches/release_33",
"clang_repo": "http://llvm.org/svn/llvm-project/cfe/branches/release_33",
"compiler_repo": "http://llvm.org/svn/llvm-project/compiler-rt/branches/release_33",
"patches": {
"macosx64": ["llvm-debug-frame.patch"],
"linux64": ["llvm-debug-frame.patch", "no-sse-on-linux.patch"],
"linux32": ["llvm-debug-frame.patch", "no-sse-on-linux.patch"]
}
}

View File

@ -1,7 +1,7 @@
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index d6d4510..c488d4a 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -172,6 +172,8 @@ bool AsmPrinter::doInitialization(Module &M) {
OutStreamer.EmitFileDirective(M.getModuleIdentifier());
}

View File

@ -1,7 +1,7 @@
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp (revision 181515)
+++ lib/Driver/Tools.cpp (working copy)
--- a/clang/lib/Driver/Tools.cpp (revision 181515)
+++ b/clang/lib/Driver/Tools.cpp (working copy)
@@ -1245,7 +1245,7 @@
// All x86 devices running Android have core2 as their common
// denominator. This makes a better choice than pentium4.

View File

@ -13,7 +13,6 @@ include $(DEPTH)/config/autoconf.mk
INTERNAL_TOOLS = 1
HOST_PROGRAM = elfhack
NO_DIST_INSTALL = 1
NO_PROFILE_GUIDED_OPTIMIZE = 1
VPATH += $(topsrcdir)/build

View File

@ -4,3 +4,4 @@
# 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/.
NO_DIST_INSTALL = True

View File

@ -23,6 +23,7 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
HOST_CSRCS \
HOST_LIBRARY_NAME \
MODULE \
NO_DIST_INSTALL \
PARALLEL_DIRS \
TEST_DIRS \
TIERS \

View File

@ -9189,8 +9189,10 @@ else
fi
# Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
if test -z "$HAVE_TOOLCHAIN_SUPPORT_SSSE3" || test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
if test -n "$INTEL_ARCHITECTURE"; then
if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSSE3" -o -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
fi
fi
if test -n "$MOZ_WEBRTC"; then

View File

@ -3436,7 +3436,7 @@ Element::SetBoolAttr(nsIAtom* aAttr, bool aValue)
float
Element::FontSizeInflation()
{
nsIFrame* frame = mPrimaryFrame;
nsIFrame* frame = GetPrimaryFrame();
if (!frame) {
return -1.0;
}

View File

@ -2066,7 +2066,7 @@ nsFrameLoader::TryRemoteBrowser()
rootChromeWin->GetBrowserDOMWindow(getter_AddRefs(browserDOMWin));
mRemoteBrowser->SetBrowserDOMWindow(browserDOMWin);
mChildHost = static_cast<ContentParent*>(mRemoteBrowser->Manager());
mChildHost = mRemoteBrowser->Manager();
}
return true;
}
@ -2240,10 +2240,10 @@ bool
nsFrameLoader::DoSendAsyncMessage(const nsAString& aMessage,
const StructuredCloneData& aData)
{
PBrowserParent* tabParent = GetRemoteBrowser();
TabParent* tabParent = mRemoteBrowser;
if (tabParent) {
ClonedMessageData data;
ContentParent* cp = static_cast<ContentParent*>(tabParent->Manager());
ContentParent* cp = tabParent->Manager();
if (!BuildClonedMessageDataForParent(cp, aData, data)) {
return false;
}

View File

@ -1080,21 +1080,29 @@ nsObjectLoadingContent::GetBaseURI(nsIURI **aResult)
// see an interface requestor even though WebIDL bindings don't expose
// that stuff.
class ObjectInterfaceRequestorShim MOZ_FINAL : public nsIInterfaceRequestor,
public nsIChannelEventSink
public nsIChannelEventSink,
public nsIStreamListener
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(ObjectInterfaceRequestorShim,
nsIInterfaceRequestor)
NS_DECL_NSIINTERFACEREQUESTOR
NS_FORWARD_NSICHANNELEVENTSINK(mContent->)
// nsRefPtr<nsObjectLoadingContent> fails due to ambiguous AddRef/Release,
// hence the ugly static cast :(
NS_FORWARD_NSICHANNELEVENTSINK(static_cast<nsObjectLoadingContent *>
(mContent.get())->)
NS_FORWARD_NSISTREAMLISTENER (static_cast<nsObjectLoadingContent *>
(mContent.get())->)
NS_FORWARD_NSIREQUESTOBSERVER (static_cast<nsObjectLoadingContent *>
(mContent.get())->)
ObjectInterfaceRequestorShim(nsIChannelEventSink* aContent)
ObjectInterfaceRequestorShim(nsIObjectLoadingContent* aContent)
: mContent(aContent)
{}
protected:
nsRefPtr<nsIChannelEventSink> mContent;
nsCOMPtr<nsIObjectLoadingContent> mContent;
};
NS_IMPL_CYCLE_COLLECTION_1(ObjectInterfaceRequestorShim, mContent)
@ -1102,6 +1110,8 @@ NS_IMPL_CYCLE_COLLECTION_1(ObjectInterfaceRequestorShim, mContent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ObjectInterfaceRequestorShim)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink)
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInterfaceRequestor)
NS_INTERFACE_MAP_END
@ -1302,7 +1312,7 @@ nsObjectLoadingContent::CheckProcessPolicy(int16_t *aContentPolicy)
*aContentPolicy = nsIContentPolicy::ACCEPT;
nsresult rv =
NS_CheckContentProcessPolicy(objectType,
mURI,
mURI ? mURI : mBaseURI,
doc->NodePrincipal(),
static_cast<nsIImageLoadingContent*>(this),
mContentType,
@ -2261,7 +2271,7 @@ nsObjectLoadingContent::OpenChannel()
}
// AsyncOpen can fail if a file does not exist.
rv = chan->AsyncOpen(this, nullptr);
rv = chan->AsyncOpen(shim, nullptr);
NS_ENSURE_SUCCESS(rv, rv);
LOG(("OBJLC [%p]: Channel opened", this));
mChannel = chan;

View File

@ -262,6 +262,12 @@ already_AddRefed<VideoPlaybackQuality>
HTMLVideoElement::GetVideoPlaybackQuality()
{
DOMHighResTimeStamp creationTime = 0;
uint64_t totalFrames = 0;
uint64_t droppedFrames = 0;
uint64_t corruptedFrames = 0;
double playbackJitter = 0.0;
if (sVideoStatsEnabled) {
nsPIDOMWindow* window = OwnerDoc()->GetInnerWindow();
if (window) {
nsPerformance* perf = window->GetPerformance();
@ -270,17 +276,14 @@ HTMLVideoElement::GetVideoPlaybackQuality()
}
}
uint64_t totalFrames = 0;
uint64_t droppedFrames = 0;
uint64_t corruptedFrames = 0;
double playbackJitter = 0.0;
if (mDecoder && sVideoStatsEnabled) {
if (mDecoder) {
MediaDecoder::FrameStatistics& stats = mDecoder->GetFrameStatistics();
totalFrames = stats.GetParsedFrames();
droppedFrames = totalFrames - stats.GetPresentedFrames();
corruptedFrames = totalFrames - stats.GetDecodedFrames();
playbackJitter = stats.GetPlaybackJitter();
}
}
nsRefPtr<VideoPlaybackQuality> playbackQuality =
new VideoPlaybackQuality(this, creationTime, totalFrames, droppedFrames,

View File

@ -355,6 +355,8 @@ MediaRecorder::NotifyError(nsresult aRv)
bool MediaRecorder::CheckPrincipal()
{
nsCOMPtr<nsIPrincipal> principal = mStream->GetPrincipal();
if (!GetOwner())
return false;
nsCOMPtr<nsIDocument> doc = GetOwner()->GetExtantDoc();
if (!doc || !principal)
return false;

View File

@ -140,6 +140,8 @@ MOCHITEST_FILES = \
test_texttrackcue.html \
test_timeupdate_small_files.html \
test_unseekable.html \
test_VideoPlaybackQuality.html \
test_VideoPlaybackQuality_disabled.html \
test_webvtt_disabled.html \
$(NULL)

View File

@ -0,0 +1,62 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test basic functionality of VideoPlaybackQuality</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
function test() {
var video = document.createElement("video");
ok(video.getVideoPlaybackQuality, "getVideoPlaybackQuality should be exposed with pref set");
var vpq = video.getVideoPlaybackQuality();
ok(vpq, "getVideoPlaybackQuality should return an object");
ok(vpq.creationTime <= performance.now(), "creationTime should be in the past");
is(vpq.totalVideoFrames, 0, "totalVideoFrames should be 0");
is(vpq.droppedVideoFrames, 0, "droppedVideoFrames should be 0");
is(vpq.corruptedVideoFrames, 0, "corruptedVideoFrames should be 0");
is(vpq.playbackJitter, 0, "playbackJitter should be 0");
var vpq2 = video.getVideoPlaybackQuality();
ok(vpq !== vpq2, "getVideoPlaybackQuality should return a new object");
ok(vpq.creationTime <= vpq2.creationTime, "VideoPlaybackQuality objects should have increasing creationTime");
var audio = document.createElement("audio");
ok(!audio.getVideoPlaybackQuality, "getVideoPlaybackQuality should not be available on Audio elements");
video.src = "seek.webm";
video.play();
video.addEventListener("ended", function () {
vpq = video.getVideoPlaybackQuality();
ok(vpq.creationTime <= performance.now(), "creationTime should be in the past");
ok(vpq.totalVideoFrames > 0, "totalVideoFrames should be > 0");
ok(vpq.droppedVideoFrames >= 0, "droppedVideoFrames should be >= 0");
ok(vpq.corruptedVideoFrames >= 0, "corruptedVideoFrames should be >= 0");
ok(vpq.playbackJitter >= 0, "playbackJitter should be >= 0");
SpecialPowers.pushPrefEnv({"set": [["media.video_stats.enabled", false]]}, function () {
vpq = video.getVideoPlaybackQuality();
is(vpq.creationTime, 0, "creationTime should be 0");
is(vpq.totalVideoFrames, 0, "totalVideoFrames should be 0");
is(vpq.droppedVideoFrames, 0, "droppedVideoFrames should be 0");
is(vpq.corruptedVideoFrames, 0, "corruptedVideoFrames should be 0");
is(vpq.playbackJitter, 0, "playbackJitter should be 0");
SimpleTest.finish();
});
});
}
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [["media.mediasource.enabled", true]]}, test);
});
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test basic functionality of VideoPlaybackQuality</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
function test() {
var video = document.createElement("video");
ok(!video.getVideoPlaybackQuality, "getVideoPlaybackQuality should be hidden behind a pref");
var accessThrows = false;
try {
video.getVideoPlaybackQuality();
} catch (e) {
accessThrows = true;
}
ok(accessThrows, "getVideoPlaybackQuality should be hidden behind a pref");
SimpleTest.finish();
}
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [["media.mediasource.enabled", false]]}, test);
});
</script>
</pre>
</body>
</html>

View File

@ -8350,9 +8350,10 @@ class CGBindingRoot(CGThing):
requiresPreferences = any(descriptorRequiresPreferences(d) for d in descriptors)
hasOwnedDescriptors = any(d.nativeOwnership == 'owned' for d in descriptors)
requiresContentUtils = any(d.interface.hasInterfaceObject() for d in descriptors)
def descriptorHasChromeOnlyMembers(desc):
return any(isChromeOnly(a) for a in desc.interface.members)
hasChromeOnlyMembers = any(descriptorHasChromeOnlyMembers(d) for d in descriptors)
def descriptorHasChromeOnly(desc):
return (any(isChromeOnly(a) for a in desc.interface.members) or
desc.interface.getExtendedAttribute("ChromeOnly") is not None)
hasChromeOnly = any(descriptorHasChromeOnly(d) for d in descriptors)
# XXXkhuey ugly hack but this is going away soon.
isEventTarget = webIDLFile.endswith("EventTarget.webidl")
hasWorkerStuff = len(config.getDescriptors(webIDLFile=webIDLFile,
@ -8469,7 +8470,7 @@ class CGBindingRoot(CGThing):
+ (['mozilla/dom/NonRefcountedDOMObject.h'] if hasOwnedDescriptors else [])
+ (['nsContentUtils.h'] if requiresContentUtils else [])
+ (['nsCxPusher.h'] if mainDictionaries else [])
+ (['AccessCheck.h'] if hasChromeOnlyMembers else [])
+ (['AccessCheck.h'] if hasChromeOnly else [])
+ (['xpcprivate.h'] if isEventTarget else []),
prefix,
curr,

View File

@ -739,7 +739,8 @@ ContactManager.prototype = {
requestID: requestID,
origin: principal.origin,
appID: principal.appId,
browserFlag: principal.isInBrowserElement
browserFlag: principal.isInBrowserElement,
windowID: this._window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID
});
},

View File

@ -58,7 +58,7 @@ AssertAppProcess(PBrowserParent* aActor,
if (!aValid) {
printf_stderr("Security problem: Content process does not have `%s'. It will be killed.\n", aCapability);
ContentParent* process = static_cast<ContentParent*>(aActor->Manager());
ContentParent* process = tab->Manager();
process->KillHard();
}
return aValid;

View File

@ -589,7 +589,7 @@ ContentChild::AllocPBrowserChild(const IPCTabContext& aContext,
// check that it's of a certain type for security purposes, because we
// believe whatever the parent process tells us.
nsRefPtr<TabChild> child = TabChild::Create(TabContext(aContext), aChromeFlags);
nsRefPtr<TabChild> child = TabChild::Create(this, TabContext(aContext), aChromeFlags);
// The ref here is released in DeallocPBrowserChild.
return child.forget().get();

View File

@ -53,6 +53,8 @@ class ContentChild : public PContentChild
public:
ContentChild();
virtual ~ContentChild();
nsrefcnt AddRef() { return 1; }
nsrefcnt Release() { return 1; }
struct AppInfo
{

View File

@ -422,7 +422,7 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
if (aContext.IsBrowserElement() || !aContext.HasOwnApp()) {
if (nsRefPtr<ContentParent> cp = GetNewOrUsed(aContext.IsBrowserElement())) {
nsRefPtr<TabParent> tp(new TabParent(aContext));
nsRefPtr<TabParent> tp(new TabParent(cp, aContext));
tp->SetOwnerElement(aFrameElement);
uint32_t chromeFlags = 0;
@ -498,7 +498,7 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
sAppContentParents->Put(manifestURL, p);
}
nsRefPtr<TabParent> tp = new TabParent(aContext);
nsRefPtr<TabParent> tp = new TabParent(p, aContext);
tp->SetOwnerElement(aFrameElement);
PBrowserParent* browser = p->SendPBrowserConstructor(
nsRefPtr<TabParent>(tp).forget().get(), // DeallocPBrowserParent() releases this ref.
@ -1640,7 +1640,7 @@ ContentParent::AllocPBrowserParent(const IPCTabContext& aContext,
return nullptr;
}
TabParent* parent = new TabParent(TabContext(aContext));
TabParent* parent = new TabParent(this, TabContext(aContext));
// We release this ref in DeallocPBrowserParent()
NS_ADDREF(parent);

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PBlob;
include InputStreamParams;
using mozilla::SerializedStructuredCloneBuffer;
@ -31,5 +32,38 @@ struct FileBlobConstructorParams
uint64_t modDate;
};
struct SlicedBlobConstructorParams
{
PBlob source;
uint64_t begin;
uint64_t end;
nsString contentType;
};
struct MysteryBlobConstructorParams
{
// Nothing is known about this type of blob.
};
union ChildBlobConstructorParams
{
NormalBlobConstructorParams;
FileBlobConstructorParams;
SlicedBlobConstructorParams;
MysteryBlobConstructorParams;
};
struct ParentBlobConstructorParams
{
ChildBlobConstructorParams blobParams;
OptionalInputStreamParams optionalInputStreamParams;
};
union BlobConstructorParams
{
ChildBlobConstructorParams;
ParentBlobConstructorParams;
};
} // namespace dom
} // namespace mozilla

View File

@ -18,7 +18,7 @@ include URIParams;
include "gfxMatrix.h";
include "FrameMetrics.h";
include "IPC/nsGUIEventIPC.h";
include "ipc/nsGUIEventIPC.h";
include "mozilla/dom/TabMessageUtils.h";
include "mozilla/dom/ScreenOrientation.h";
include "mozilla/dom/PermissionMessageUtils.h";

View File

@ -23,6 +23,7 @@ include protocol PTestShell;
include protocol PJavaScript;
include DOMTypes;
include InputStreamParams;
include PTabContext;
include URIParams;
include "mozilla/chrome/RegistryMessageUtils.h";
@ -45,9 +46,9 @@ using IPC::Principal;
using mozilla::null_t;
using mozilla::void_t;
using mozilla::dom::AudioChannelType;
using mozilla::dom::BlobConstructorParams;
using mozilla::dom::NativeThreadId;
using mozilla::hal::ProcessPriority;
using mozilla::layout::ScrollingBehavior;
using gfxIntSize;
namespace mozilla {
@ -123,100 +124,6 @@ union DeviceStorageParams
DeviceStorageAvailableParams;
};
struct SlicedBlobConstructorParams
{
PBlob source;
uint64_t begin;
uint64_t end;
nsString contentType;
};
struct MysteryBlobConstructorParams
{
// Nothing is known about this type of blob.
};
union ChildBlobConstructorParams
{
NormalBlobConstructorParams;
FileBlobConstructorParams;
SlicedBlobConstructorParams;
MysteryBlobConstructorParams;
};
struct ParentBlobConstructorParams
{
ChildBlobConstructorParams blobParams;
OptionalInputStreamParams optionalInputStreamParams;
};
union BlobConstructorParams
{
ChildBlobConstructorParams;
ParentBlobConstructorParams;
};
// An IPCTabContext which corresponds to a PBrowser opened by a child when it
// receives window.open().
//
// If isBrowserElement is false, this PopupIPCTabContext corresponds to an app
// frame, and the frame's app-id and app-frame-owner-app-id will be equal to the
// opener's values.
//
// If isBrowserElement is true, the frame's browserFrameOwnerAppId will be equal
// to the opener's app-id.
//
// It's an error to set isBrowserElement == false if opener is a browser
// element. Such a PopupIPCTabContext should be rejected by code which receives
// it.
struct PopupIPCTabContext
{
PBrowser opener;
bool isBrowserElement;
};
// An IPCTabContext which corresponds to an app frame.
struct AppFrameIPCTabContext
{
// The ID of the app this frame corresponds to. May be NO_APP_ID.
uint32_t ownAppId;
// The ID of the app containing this frame. May be NO_APP_ID.
uint32_t appFrameOwnerAppId;
};
// An IPCTabContext which corresponds to a browser frame.
struct BrowserFrameIPCTabContext
{
// The ID of the app which contains this browser frame. May be NO_APP_ID.
uint32_t browserFrameOwnerAppId;
};
// This is equivalent to AppFrameIPCTabContext with all fields set to NO_APP_ID.
struct VanillaFrameIPCTabContext
{};
// IPCTabContext is an analog to mozilla::dom::TabContext. Both specify an
// iframe/PBrowser's own and containing app-ids and tell you whether the
// iframe/PBrowser is a browser frame. But only IPCTabContext is allowed to
// travel over IPC.
//
// We need IPCTabContext (specifically, PopupIPCTabContext) to prevent a
// privilege escalation attack by a compromised child process. See the comment
// on AllocPBrowser for details.
union IPCTabAppBrowserContext
{
PopupIPCTabContext;
AppFrameIPCTabContext;
BrowserFrameIPCTabContext;
VanillaFrameIPCTabContext;
};
struct IPCTabContext {
IPCTabAppBrowserContext appBrowserContext;
ScrollingBehavior scrollingBehavior;
};
union PrefValue {
nsCString;
int32_t;

78
dom/ipc/PTabContext.ipdlh Normal file
View File

@ -0,0 +1,78 @@
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
/* 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 protocol PBrowser;
include "mozilla/layout/RenderFrameUtils.h";
using mozilla::layout::ScrollingBehavior;
namespace mozilla {
namespace dom {
// An IPCTabContext which corresponds to a PBrowser opened by a child when it
// receives window.open().
//
// If isBrowserElement is false, this PopupIPCTabContext corresponds to an app
// frame, and the frame's app-id and app-frame-owner-app-id will be equal to the
// opener's values.
//
// If isBrowserElement is true, the frame's browserFrameOwnerAppId will be equal
// to the opener's app-id.
//
// It's an error to set isBrowserElement == false if opener is a browser
// element. Such a PopupIPCTabContext should be rejected by code which receives
// it.
struct PopupIPCTabContext
{
PBrowser opener;
bool isBrowserElement;
};
// An IPCTabContext which corresponds to an app frame.
struct AppFrameIPCTabContext
{
// The ID of the app this frame corresponds to. May be NO_APP_ID.
uint32_t ownAppId;
// The ID of the app containing this frame. May be NO_APP_ID.
uint32_t appFrameOwnerAppId;
};
// An IPCTabContext which corresponds to a browser frame.
struct BrowserFrameIPCTabContext
{
// The ID of the app which contains this browser frame. May be NO_APP_ID.
uint32_t browserFrameOwnerAppId;
};
// This is equivalent to AppFrameIPCTabContext with all fields set to NO_APP_ID.
struct VanillaFrameIPCTabContext
{};
// IPCTabContext is an analog to mozilla::dom::TabContext. Both specify an
// iframe/PBrowser's own and containing app-ids and tell you whether the
// iframe/PBrowser is a browser frame. But only IPCTabContext is allowed to
// travel over IPC.
//
// We need IPCTabContext (specifically, PopupIPCTabContext) to prevent a
// privilege escalation attack by a compromised child process. See the comment
// on AllocPBrowser for details.
union IPCTabAppBrowserContext
{
PopupIPCTabContext;
AppFrameIPCTabContext;
BrowserFrameIPCTabContext;
VanillaFrameIPCTabContext;
};
struct IPCTabContext {
IPCTabAppBrowserContext appBrowserContext;
ScrollingBehavior scrollingBehavior;
};
}
}

View File

@ -223,7 +223,8 @@ TabChild::PreloadSlowThings()
{
MOZ_ASSERT(!sPreallocatedTab);
nsRefPtr<TabChild> tab(new TabChild(TabContext(), /* chromeFlags */ 0));
nsRefPtr<TabChild> tab(new TabChild(ContentChild::GetSingleton(),
TabContext(), /* chromeFlags */ 0));
if (!NS_SUCCEEDED(tab->Init()) ||
!tab->InitTabChildGlobal(DONT_LOAD_SCRIPTS)) {
return;
@ -251,7 +252,7 @@ TabChild::PreloadSlowThings()
}
/*static*/ already_AddRefed<TabChild>
TabChild::Create(const TabContext &aContext, uint32_t aChromeFlags)
TabChild::Create(ContentChild* aManager, const TabContext &aContext, uint32_t aChromeFlags)
{
if (sPreallocatedTab &&
sPreallocatedTab->mChromeFlags == aChromeFlags &&
@ -267,14 +268,16 @@ TabChild::Create(const TabContext &aContext, uint32_t aChromeFlags)
return child.forget();
}
nsRefPtr<TabChild> iframe = new TabChild(aContext, aChromeFlags);
nsRefPtr<TabChild> iframe = new TabChild(aManager,
aContext, aChromeFlags);
return NS_SUCCEEDED(iframe->Init()) ? iframe.forget() : nullptr;
}
TabChild::TabChild(const TabContext& aContext, uint32_t aChromeFlags)
TabChild::TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t aChromeFlags)
: TabContext(aContext)
, mRemoteFrame(nullptr)
, mManager(aManager)
, mTabChildGlobal(nullptr)
, mChromeFlags(aChromeFlags)
, mOuterRect(0, 0, 0, 0)
@ -976,7 +979,8 @@ TabChild::BrowserFrameProvideWindow(nsIDOMWindow* aOpener,
*aReturn = nullptr;
nsRefPtr<TabChild> newChild =
new TabChild(/* TabContext */ *this, /* chromeFlags */ 0);
new TabChild(ContentChild::GetSingleton(),
/* TabContext */ *this, /* chromeFlags */ 0);
if (!NS_SUCCEEDED(newChild->Init())) {
return NS_ERROR_ABORT;
}
@ -2332,7 +2336,7 @@ TabChild::DoSendSyncMessage(const nsAString& aMessage,
const StructuredCloneData& aData,
InfallibleTArray<nsString>* aJSONRetVal)
{
ContentChild* cc = static_cast<ContentChild*>(Manager());
ContentChild* cc = Manager();
ClonedMessageData data;
if (!BuildClonedMessageDataForChild(cc, aData, data)) {
return false;
@ -2344,7 +2348,7 @@ bool
TabChild::DoSendAsyncMessage(const nsAString& aMessage,
const StructuredCloneData& aData)
{
ContentChild* cc = static_cast<ContentChild*>(Manager());
ContentChild* cc = Manager();
ClonedMessageData data;
if (!BuildClonedMessageDataForChild(cc, aData, data)) {
return false;

View File

@ -44,6 +44,7 @@
#include "FrameMetrics.h"
#include "ProcessUtils.h"
#include "mozilla/dom/TabContext.h"
#include "mozilla/dom/ContentChild.h"
struct gfxMatrix;
class nsICachedFileDescriptorListener;
@ -164,7 +165,7 @@ public:
/** Return a TabChild with the given attributes. */
static already_AddRefed<TabChild>
Create(const TabContext& aContext, uint32_t aChromeFlags);
Create(ContentChild* aManager, const TabContext& aContext, uint32_t aChromeFlags);
virtual ~TabChild();
@ -326,6 +327,8 @@ public:
const nsAString& aPath,
nsICachedFileDescriptorListener* aCallback);
ContentChild* Manager() { return mManager; }
protected:
virtual PRenderFrameChild* AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
@ -349,7 +352,7 @@ private:
*
* |aIsBrowserElement| indicates whether we're a browser (but not an app).
*/
TabChild(const TabContext& aContext, uint32_t aChromeFlags);
TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t aChromeFlags);
nsresult Init();
@ -429,6 +432,7 @@ private:
nsCOMPtr<nsIURI> mLastURI;
FrameMetrics mLastMetrics;
RenderFrameChild* mRemoteFrame;
nsRefPtr<ContentChild> mManager;
nsRefPtr<TabChildGlobal> mTabChildGlobal;
uint32_t mChromeFlags;
nsIntRect mOuterRect;

View File

@ -186,7 +186,7 @@ TabParent *TabParent::mIMETabParent = nullptr;
NS_IMPL_ISUPPORTS3(TabParent, nsITabParent, nsIAuthPromptProvider, nsISecureBrowserUI)
TabParent::TabParent(const TabContext& aContext)
TabParent::TabParent(ContentParent* aManager, const TabContext& aContext)
: TabContext(aContext)
, mFrameElement(NULL)
, mIMESelectionAnchor(0)
@ -203,6 +203,7 @@ TabParent::TabParent(const TabContext& aContext)
, mDefaultScale(0)
, mShown(false)
, mUpdatedDimensions(false)
, mManager(aManager)
, mMarkedDestroying(false)
, mIsDestroyed(false)
, mAppPackageFileDescriptorSent(false)
@ -268,16 +269,14 @@ TabParent::Destroy()
}
mIsDestroyed = true;
ContentParent* cp = static_cast<ContentParent*>(Manager());
cp->NotifyTabDestroying(this);
Manager()->NotifyTabDestroying(this);
mMarkedDestroying = true;
}
bool
TabParent::Recv__delete__()
{
ContentParent* cp = static_cast<ContentParent*>(Manager());
cp->NotifyTabDestroyed(this, mMarkedDestroying);
Manager()->NotifyTabDestroyed(this, mMarkedDestroying);
return true;
}
@ -1175,7 +1174,7 @@ TabParent::RecvPIndexedDBConstructor(PIndexedDBParent* aActor,
return true;
}
ContentParent* contentParent = static_cast<ContentParent*>(Manager());
ContentParent* contentParent = Manager();
NS_ASSERTION(contentParent, "Null manager?!");
nsRefPtr<IDBFactory> factory;

View File

@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "jsapi.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/PBrowserParent.h"
#include "mozilla/dom/PContentDialogParent.h"
#include "mozilla/dom/TabContext.h"
@ -58,7 +59,7 @@ class TabParent : public PBrowserParent
typedef mozilla::layout::ScrollingBehavior ScrollingBehavior;
public:
TabParent(const TabContext& aContext);
TabParent(ContentParent* aManager, const TabContext& aContext);
virtual ~TabParent();
nsIDOMElement* GetOwnerElement() { return mFrameElement; }
void SetOwnerElement(nsIDOMElement* aElement);
@ -226,6 +227,8 @@ public:
static TabParent* GetFrom(nsFrameLoader* aFrameLoader);
static TabParent* GetFrom(nsIContent* aContent);
ContentParent* Manager() { return mManager; }
protected:
bool ReceiveMessage(const nsString& aMessage,
bool aSync,
@ -302,6 +305,7 @@ private:
already_AddRefed<nsFrameLoader> GetFrameLoader() const;
already_AddRefed<nsIWidget> GetWidget() const;
layout::RenderFrameParent* GetRenderFrame();
nsRefPtr<ContentParent> mManager;
void TryCacheDPIAndScale();
// When true, we create a pan/zoom controller for our frame and

View File

@ -68,4 +68,5 @@ IPDL_SOURCES += [
'PCrashReporter.ipdl',
'PDocumentRenderer.ipdl',
'PMemoryReportRequest.ipdl',
'PTabContext.ipdlh',
]

View File

@ -78,7 +78,7 @@ headingLevel = heading level %S
# more sophisticated list announcement
listStart = First item
listEnd = Last item
listItemCount = %S items
listItemCount = 1 item;#1 items
# Landmark announcements
banner = banner

View File

@ -48,6 +48,7 @@ MOCHITEST_FILES = \
test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html \
test_peerConnection_addCandidateInHaveLocalOffer.html \
test_peerConnection_bug822674.html \
test_peerConnection_bug825703.html \
test_peerConnection_bug827843.html \
test_peerConnection_bug834153.html \
test_peerConnection_bug835370.html \
@ -57,9 +58,6 @@ MOCHITEST_FILES = \
templates.js \
$(NULL)
# Disabled for hitting services outside of build infra (bug 890832)
# test_peerConnection_bug825703.html
# The following tests are leaking and cannot be run by default yet
ifdef MOZ_WEBRTC_LEAKING_TESTS
MOCHITEST_FILES += \

View File

@ -31,6 +31,8 @@
}
}
// This is a test of the iceServers parsing code.
runTest(function () {
var pc;
var exception = null;
@ -51,10 +53,10 @@
makePC({ iceServers: [{ url:"http:0.0.0.0" }] }, false);
makePC({ iceServers: [
{ url:"stun:0.0.0.0" },
{ url:"stuns:x.net", foo:"" },
{ url:"turn:[::192.9.5.5]:42", username:"p", credential:"p" },
{ url:"turns:x.org:42?transport=udp", username:"p", credential:"p" }
{ url:"stun:127.0.0.1" },
{ url:"stuns:localhost", foo:"" },
{ url:"turn:[::1]:3478", username:"p", credential:"p" },
{ url:"turns:localhost:3478?transport=udp", username:"p", credential:"p" }
]}, true);
pcs = null;

View File

@ -86,7 +86,7 @@ this.PermissionPromptHelper = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]),
allow: aCallbacks.allow,
cancel: aCallbacks.cancel,
window: Services.wm.getMostRecentWindow("navigator:browser")
window: Services.wm.getOuterWindowWithId(msg.windowID)
};
permissionPromptService.getPermission(request);

View File

@ -12,7 +12,7 @@ include protocol PStreamNotify;
include protocol PPluginSurface;
include "mozilla/plugins/PluginMessageUtils.h";
include "IPC/nsGUIEventIPC.h";
include "ipc/nsGUIEventIPC.h";
using NPError;
using NPRemoteWindow;

View File

@ -71,7 +71,8 @@ namespace plugins {
PluginHangUIParent::PluginHangUIParent(PluginModuleParent* aModule,
const int32_t aHangUITimeoutPref,
const int32_t aChildTimeoutPref)
: mModule(aModule),
: mMutex("mozilla::plugins::PluginHangUIParent::mMutex"),
mModule(aModule),
mTimeoutPrefMs(static_cast<uint32_t>(aHangUITimeoutPref) * 1000U),
mIPCTimeoutMs(static_cast<uint32_t>(aChildTimeoutPref) * 1000U),
mMainThreadMessageLoop(MessageLoop::current()),
@ -88,8 +89,9 @@ PluginHangUIParent::PluginHangUIParent(PluginModuleParent* aModule,
PluginHangUIParent::~PluginHangUIParent()
{
if (mRegWait) {
::UnregisterWaitEx(mRegWait, INVALID_HANDLE_VALUE);
{ // Scope for lock
MutexAutoLock lock(mMutex);
UnwatchHangUIChildProcess(true);
}
if (mShowEvent) {
::CloseHandle(mShowEvent);
@ -227,6 +229,7 @@ PluginHangUIParent::Init(const nsString& aPluginName)
}
mShowEvent = showEvent.Get();
MutexAutoLock lock(mMutex);
STARTUPINFO startupInfo = { sizeof(STARTUPINFO) };
PROCESS_INFORMATION processInfo = { NULL };
BOOL isProcessCreated = ::CreateProcess(exePath.value().c_str(),
@ -266,6 +269,7 @@ VOID CALLBACK PluginHangUIParent::SOnHangUIProcessExit(PVOID aContext,
BOOLEAN aIsTimer)
{
PluginHangUIParent* object = static_cast<PluginHangUIParent*>(aContext);
MutexAutoLock lock(object->mMutex);
// If the Hang UI child process died unexpectedly, act as if the UI cancelled
if (object->IsShowing()) {
object->RecvUserResponse(HANGUI_USER_RESPONSE_CANCEL);
@ -275,9 +279,44 @@ VOID CALLBACK PluginHangUIParent::SOnHangUIProcessExit(PVOID aContext,
}
}
// A precondition for this function is that the caller has locked mMutex
bool
PluginHangUIParent::UnwatchHangUIChildProcess(bool aWait)
{
mMutex.AssertCurrentThreadOwns();
if (mRegWait) {
// If aWait is false then we want to pass a NULL (i.e. default constructor)
// completionEvent
ScopedHandle completionEvent;
if (aWait) {
completionEvent.Set(::CreateEvent(NULL, FALSE, FALSE, NULL));
if (!completionEvent.IsValid()) {
return false;
}
}
// if aWait == false and UnregisterWaitEx fails with ERROR_IO_PENDING,
// it is okay to clear mRegWait; Windows is telling us that the wait's
// callback is running but will be cleaned up once the callback returns.
if (::UnregisterWaitEx(mRegWait, completionEvent) ||
!aWait && ::GetLastError() == ERROR_IO_PENDING) {
mRegWait = NULL;
if (aWait) {
// We must temporarily unlock mMutex while waiting for the registered
// wait callback to complete, or else we could deadlock.
MutexAutoUnlock unlock(mMutex);
::WaitForSingleObject(completionEvent, INFINITE);
}
return true;
}
}
return false;
}
bool
PluginHangUIParent::Cancel()
{
MutexAutoLock lock(mMutex);
bool result = mIsShowing && SendCancel();
if (result) {
mIsShowing = false;
@ -297,15 +336,17 @@ PluginHangUIParent::SendCancel()
return NS_SUCCEEDED(mMiniShm.Send());
}
// A precondition for this function is that the caller has locked mMutex
bool
PluginHangUIParent::RecvUserResponse(const unsigned int& aResponse)
{
mMutex.AssertCurrentThreadOwns();
if (!mIsShowing && !(aResponse & HANGUI_USER_RESPONSE_CANCEL)) {
// Don't process a user response if a cancellation is already pending
return true;
}
mLastUserResponse = aResponse;
mResponseTicks = GetTickCount();
mResponseTicks = ::GetTickCount();
mIsShowing = false;
// responseCode: 1 = Stop, 2 = Continue, 3 = Cancel
int responseCode;
@ -370,10 +411,8 @@ PluginHangUIParent::OnMiniShmEvent(MiniShmBase *aMiniShmObj)
if (NS_SUCCEEDED(rv)) {
// The child process has returned a response so we shouldn't worry about
// its state anymore.
if (::UnregisterWaitEx(mRegWait, NULL)) {
mRegWait = NULL;
}
MutexAutoLock lock(mMutex);
UnwatchHangUIChildProcess(false);
RecvUserResponse(response->mResponseBits);
}
}
@ -390,7 +429,7 @@ PluginHangUIParent::OnMiniShmConnect(MiniShmBase* aMiniShmObj)
}
cmd->mCode = PluginHangUICommand::HANGUI_CMD_SHOW;
if (NS_SUCCEEDED(aMiniShmObj->Send())) {
mShowTicks = GetTickCount();
mShowTicks = ::GetTickCount();
}
::SetEvent(mShowEvent);
}

View File

@ -12,6 +12,7 @@
#include "base/process.h"
#include "base/process_util.h"
#include "mozilla/Mutex.h"
#include "mozilla/plugins/PluginMessageUtils.h"
#include "MiniShmParent.h"
@ -126,15 +127,19 @@ private:
bool
RecvUserResponse(const unsigned int& aResponse);
bool
UnwatchHangUIChildProcess(bool aWait);
static
VOID CALLBACK SOnHangUIProcessExit(PVOID aContext, BOOLEAN aIsTimer);
private:
Mutex mMutex;
PluginModuleParent* mModule;
const uint32_t mTimeoutPrefMs;
const uint32_t mIPCTimeoutMs;
MessageLoop* mMainThreadMessageLoop;
volatile bool mIsShowing;
bool mIsShowing;
unsigned int mLastUserResponse;
base::ProcessHandle mHangUIProcessHandle;
NativeWindowHandle mMainWindowHandle;

View File

@ -7,6 +7,7 @@
DIRS += ['secondplugin']
MODULE = 'nptest'
NO_DIST_INSTALL = True
LIBRARY_NAME = 'nptest'

View File

@ -12,7 +12,6 @@ STL_FLAGS =
USE_STATIC_LIBS = 1
# Need to custom install plugins
NO_DIST_INSTALL = 1
NO_INSTALL = 1
VPATH += $(topsrcdir)/build

View File

@ -12,10 +12,10 @@
#include "CoreLocationLocationProvider.h"
#include "prtime.h"
#include <Corelocation/CLError.h>
#include <Corelocation/CLLocation.h>
#include <Corelocation/CLLocationManager.h>
#include <Corelocation/CLLocationManagerDelegate.h>
#include <CoreLocation/CLError.h>
#include <CoreLocation/CLLocation.h>
#include <CoreLocation/CLLocationManager.h>
#include <CoreLocation/CLLocationManagerDelegate.h>
using namespace mozilla;

View File

@ -227,7 +227,6 @@ var interfaceNamesInGlobalScope =
"IDBTransaction",
"IDBVersionChangeEvent",
"ImageData",
"ImageDocument",
"JSON",
"JSWindow",
"KeyEvent",

View File

@ -70,10 +70,11 @@ function run_test()
httpserver = new HttpServer();
httpserver.registerPathHandler("/geo", geoHandler);
httpserver.start(4444);
httpserver.start(-1);
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
prefs.setCharPref("geo.wifi.uri", "http://localhost:4444/geo");
prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
httpserver.identity.primaryPort + "/geo");
prefs.setBoolPref("geo.testing.ignore_ipc_principal", true);
prefs.setBoolPref("geo.wifi.scan", false);

View File

@ -45,15 +45,15 @@ function run_test()
{
do_test_pending();
httpserver = new HttpServer();
httpserver.registerPathHandler("/geo", geoHandler);
httpserver.start(4444);
if (Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
httpserver = new HttpServer();
httpserver.registerPathHandler("/geo", geoHandler);
httpserver.start(-1);
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
prefs.setBoolPref("geo.wifi.scan", false);
prefs.setCharPref("geo.wifi.uri", "http://localhost:4444/geo");
prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
httpserver.identity.primaryPort + "/geo");
prefs.setBoolPref("geo.testing.ignore_ipc_principal", true);
}

View File

@ -1,10 +1,19 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://testing-common/httpd.js");
var httpserver = null;
function run_test() {
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
prefs.setBoolPref("geo.wifi.scan", false);
prefs.setCharPref("geo.wifi.uri", "http://localhost:4444/geo");
httpserver = new HttpServer();
httpserver.start(-1);
prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
httpserver.identity.primaryPort + "/geo");
prefs.setBoolPref("geo.testing.ignore_ipc_principal", true);
run_test_in_child("./test_geolocation_timeout.js");
}

View File

@ -9,6 +9,7 @@
interface imgIRequest;
[ChromeOnly]
interface ImageDocument : HTMLDocument {
/* Whether the pref for image resizing has been set. */
readonly attribute boolean imageResizingEnabled;

View File

@ -12,6 +12,7 @@
[Pref="media.mediasource.enabled"]
interface VideoPlaybackQuality {
readonly attribute DOMHighResTimeStamp creationTime;
readonly attribute unsigned long totalVideoFrames;
readonly attribute unsigned long droppedVideoFrames;
readonly attribute unsigned long corruptedVideoFrames;

View File

@ -971,6 +971,12 @@ public:
static TemporaryRef<GlyphRenderingOptions>
CreateCairoGlyphRenderingOptions(FontHinting aHinting, bool aAutoHinting);
#endif
static TemporaryRef<DrawTarget>
CreateDualDrawTarget(DrawTarget *targetA, DrawTarget *targetB);
#ifdef XP_MACOSX
static TemporaryRef<DrawTarget> CreateDrawTargetForCairoCGContext(CGContextRef cg, const IntSize& aSize);
#endif
#ifdef WIN32
static TemporaryRef<DrawTarget> CreateDrawTargetForD3D10Texture(ID3D10Texture2D *aTexture, SurfaceFormat aFormat);

View File

@ -1030,13 +1030,23 @@ DrawTargetCG::Init(CGContextRef cgContext, const IntSize &aSize)
mData = nullptr;
assert(mCg);
// CGContext's default to have the origin at the bottom left
// so flip it to the top left
CGContextTranslateCTM(mCg, 0, mSize.height);
CGContextScaleCTM(mCg, 1, -1);
//XXX: set correct format
// CGContext's default to have the origin at the bottom left.
// However, currently the only use of this function is to construct a
// DrawTargetCG around a CGContextRef from a cairo quartz surface which
// already has it's origin adjusted.
//
// CGContextTranslateCTM(mCg, 0, mSize.height);
// CGContextScaleCTM(mCg, 1, -1);
mFormat = FORMAT_B8G8R8A8;
if (GetContextType(mCg) == CG_CONTEXT_TYPE_BITMAP) {
CGColorSpaceRef colorspace;
colorspace = CGBitmapContextGetColorSpace (mCg);
if (CGColorSpaceGetNumberOfComponents(colorspace) == 1) {
mFormat = FORMAT_A8;
}
}
return true;
}

View File

@ -344,6 +344,22 @@ Factory::CreateScaledFontWithCairo(const NativeFont& aNativeFont, Float aSize, c
#endif
}
TemporaryRef<DrawTarget>
Factory::CreateDualDrawTarget(DrawTarget *targetA, DrawTarget *targetB)
{
RefPtr<DrawTarget> newTarget =
new DrawTargetDual(targetA, targetB);
RefPtr<DrawTarget> retVal = newTarget;
if (mRecorder) {
retVal = new DrawTargetRecording(mRecorder, retVal);
}
return retVal;
}
#ifdef WIN32
TemporaryRef<DrawTarget>
Factory::CreateDrawTargetForD3D10Texture(ID3D10Texture2D *aTexture, SurfaceFormat aFormat)
@ -487,6 +503,26 @@ Factory::CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface, const IntSiz
return retVal;
}
#ifdef XP_MACOSX
TemporaryRef<DrawTarget>
Factory::CreateDrawTargetForCairoCGContext(CGContextRef cg, const IntSize& aSize)
{
RefPtr<DrawTarget> retVal;
RefPtr<DrawTargetCG> newTarget = new DrawTargetCG();
if (newTarget->Init(cg, aSize)) {
retVal = newTarget;
}
if (mRecorder && retVal) {
RefPtr<DrawTarget> recordDT = new DrawTargetRecording(mRecorder, retVal);
return recordDT;
}
return retVal;
}
#endif
TemporaryRef<DataSourceSurface>
Factory::CreateWrappingDataSourceSurface(uint8_t *aData, int32_t aStride,
const IntSize &aSize,

View File

@ -68,6 +68,12 @@ void
PathBuilderCG::Arc(const Point &aOrigin, Float aRadius, Float aStartAngle,
Float aEndAngle, bool aAntiClockwise)
{
CGPathAddArc(mCGPath, nullptr,
aOrigin.x, aOrigin.y,
aRadius,
aStartAngle,
aEndAngle,
!aAntiClockwise);
}
Point

View File

@ -136,7 +136,12 @@ public:
if (mContext) {
[mContext makeCurrentContext];
GLint swapInt = 1;
// Use blocking swap only with the default frame rate.
// If swapInt is 1, then glSwapBuffers will block and wait for a vblank signal.
// While this is fine for the default refresh rate, if the user chooses some
// other rate, and specifically if this rate is higher than the screen refresh rate,
// then we want a non-blocking glSwapBuffers, which will happen when swapInt==0.
GLint swapInt = gfxPlatform::GetPrefLayoutFrameRate() == -1 ? 1 : 0;
[mContext setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
}
return true;

View File

@ -767,6 +767,12 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
"BeginUpdate should always modify the draw region in the same way!");
FillSurface(onBlack, result.mRegionToDraw, nsIntPoint(drawBounds.x, drawBounds.y), gfxRGBA(0.0, 0.0, 0.0, 1.0));
FillSurface(onWhite, result.mRegionToDraw, nsIntPoint(drawBounds.x, drawBounds.y), gfxRGBA(1.0, 1.0, 1.0, 1.0));
if (gfxPlatform::GetPlatform()->SupportsAzureContent()) {
RefPtr<DrawTarget> onBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onBlack, onBlack->GetSize());
RefPtr<DrawTarget> onWhiteDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onWhite, onWhite->GetSize());
RefPtr<DrawTarget> dt = Factory::CreateDualDrawTarget(onBlackDT, onWhiteDT);
result.mContext = new gfxContext(dt);
} else {
gfxASurface* surfaces[2] = { onBlack.get(), onWhite.get() };
nsRefPtr<gfxTeeSurface> surf = new gfxTeeSurface(surfaces, ArrayLength(surfaces));
@ -782,13 +788,19 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
// be incorrect.
surf->SetAllowUseAsSource(false);
result.mContext = new gfxContext(surf);
}
} else {
result.mContext = nullptr;
}
} else {
nsRefPtr<gfxASurface> surf = GetUpdateSurface(BUFFER_BLACK, result.mRegionToDraw);
if (gfxPlatform::GetPlatform()->SupportsAzureContent()) {
RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(surf, surf->GetSize());
result.mContext = new gfxContext(dt);
} else {
result.mContext = new gfxContext(surf);
}
}
if (!result.mContext) {
NS_WARNING("unable to get context for update");
return result;

View File

@ -23,6 +23,7 @@
#include "gfxD2DSurface.h"
#elif defined(XP_MACOSX)
#include "gfxPlatformMac.h"
#include "gfxQuartzSurface.h"
#elif defined(MOZ_WIDGET_GTK)
#include "gfxPlatformGtk.h"
#elif defined(MOZ_WIDGET_QT)
@ -546,6 +547,24 @@ gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aS
return drawTarget;
}
// This is a temporary function used by ContentClient to build a DrawTarget
// around the gfxASurface. This should eventually be replaced by plumbing
// the DrawTarget through directly
RefPtr<DrawTarget>
gfxPlatform::CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const IntSize& aSize)
{
#ifdef XP_MACOSX
// this is a bit of a hack that assumes that the buffer associated with the CGContext
// will live around long enough that nothing bad will happen.
if (aSurface->GetType() == gfxASurface::SurfaceTypeQuartz) {
return Factory::CreateDrawTargetForCairoCGContext(static_cast<gfxQuartzSurface*>(aSurface)->GetCGContext(), aSize);
}
#endif
MOZ_CRASH();
return nullptr;
}
cairo_user_data_key_t kSourceSurface;
/**
@ -1817,6 +1836,7 @@ static bool sPrefLayersAccelerationForceEnabled = false;
static bool sPrefLayersAccelerationDisabled = false;
static bool sPrefLayersPreferOpenGL = false;
static bool sPrefLayersPreferD3D9 = false;
static int sPrefLayoutFrameRate = -1;
void InitLayersAccelerationPrefs()
{
@ -1830,6 +1850,7 @@ void InitLayersAccelerationPrefs()
sPrefLayersAccelerationDisabled = Preferences::GetBool("layers.acceleration.disabled", false);
sPrefLayersPreferOpenGL = Preferences::GetBool("layers.prefer-opengl", false);
sPrefLayersPreferD3D9 = Preferences::GetBool("layers.prefer-d3d9", false);
sPrefLayoutFrameRate = Preferences::GetInt("layout.frame_rate", -1);
sLayersAccelerationPrefsInitialized = true;
}
@ -1873,3 +1894,9 @@ bool gfxPlatform::GetPrefLayersPreferD3D9()
InitLayersAccelerationPrefs();
return sPrefLayersPreferD3D9;
}
int gfxPlatform::GetPrefLayoutFrameRate()
{
InitLayersAccelerationPrefs();
return sPrefLayoutFrameRate;
}

View File

@ -180,6 +180,9 @@ public:
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
CreateDrawTargetForSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize);
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize);
/*
* Creates a SourceSurface for a gfxASurface. This function does no caching,
* so the caller should cache the gfxASurface if it will be used frequently.
@ -464,6 +467,7 @@ public:
static bool GetPrefLayersAccelerationDisabled();
static bool GetPrefLayersPreferOpenGL();
static bool GetPrefLayersPreferD3D9();
static int GetPrefLayoutFrameRate();
/**
* Are we going to try color management?

View File

@ -164,7 +164,11 @@ MessagePump::ScheduleDelayedWork(const base::TimeTicks& aDelayedTime)
delayed_work_time_ = aDelayedTime;
base::TimeDelta delay = aDelayedTime - base::TimeTicks::Now();
// TimeDelta's constructor initializes to 0
base::TimeDelta delay;
if (aDelayedTime > base::TimeTicks::Now())
delay = aDelayedTime - base::TimeTicks::Now();
uint32_t delayMS = uint32_t(delay.InMilliseconds());
mDelayedWorkTimer->InitWithCallback(mDoWorkEvent, delayMS,
nsITimer::TYPE_ONE_SHOT);

View File

@ -43,13 +43,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef LIVEWIRE
#include <base/pblock.h>
#include <base/session.h>
#include <frame/log.h>
#include <frame/req.h>
#endif /* LIVEWIRE */
#define JSD_MAJOR_VERSION 1
#define JSD_MINOR_VERSION 1
@ -147,11 +140,6 @@ struct JSDScript
void* data;
JSDProfileData *profileData;
#ifdef LIVEWIRE
LWDBGApp* app;
LWDBGScript* lwscript;
#endif
};
struct JSDProfileData
@ -1066,44 +1054,4 @@ struct AutoSaveExceptionState {
JSExceptionState *mState;
};
/***************************************************************************/
/* Livewire specific API */
#ifdef LIVEWIRE
extern LWDBGScript*
jsdlw_GetLWScript(JSDContext* jsdc, JSDScript* jsdscript);
extern char*
jsdlw_BuildAppRelativeFilename(LWDBGApp* app, const char* filename);
extern JSDSourceText*
jsdlw_PreLoadSource(JSDContext* jsdc, LWDBGApp* app,
const char* filename, JSBool clear);
extern JSDSourceText*
jsdlw_ForceLoadSource(JSDContext* jsdc, JSDSourceText* jsdsrc);
extern JSBool
jsdlw_UserCodeAtPC(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc);
extern JSBool
jsdlw_RawToProcessedLineNumber(JSDContext* jsdc, JSDScript* jsdscript,
unsigned lineIn, unsigned* lineOut);
extern JSBool
jsdlw_ProcessedToRawLineNumber(JSDContext* jsdc, JSDScript* jsdscript,
unsigned lineIn, unsigned* lineOut);
#if 0
/* our hook proc for LiveWire app start/stop */
extern void
jsdlw_AppHookProc(LWDBGApp* app,
JSBool created,
void *callerdata);
#endif
#endif
/***************************************************************************/
#endif /* jsd_h___ */

View File

@ -201,9 +201,7 @@ jsd_DebuggerOnForUser(JSRuntime* jsrt,
JS_SetNewScriptHookProc(jsdc->jsrt, jsd_NewScriptHookProc, jsdc);
JS_SetDestroyScriptHookProc(jsdc->jsrt, jsd_DestroyScriptHookProc, jsdc);
jsd_DebuggerUnpause(jsdc);
#ifdef LIVEWIRE
LWDBG_SetNewScriptHookProc(jsd_NewScriptHookProc, jsdc);
#endif
if( jsdc->userCallbacks.setContext )
jsdc->userCallbacks.setContext(jsdc, jsdc->user);
return jsdc;
@ -224,9 +222,6 @@ jsd_DebuggerOff(JSDContext* jsdc)
/* clear hooks here */
JS_SetNewScriptHookProc(jsdc->jsrt, NULL, NULL);
JS_SetDestroyScriptHookProc(jsdc->jsrt, NULL, NULL);
#ifdef LIVEWIRE
LWDBG_SetNewScriptHookProc(NULL,NULL);
#endif
/* clean up */
JSD_LockScriptSubsystem(jsdc);

View File

@ -40,11 +40,6 @@ jsd_InterruptHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rva
if( ! jsdscript )
return JSTRAP_CONTINUE;
#ifdef LIVEWIRE
if( ! jsdlw_UserCodeAtPC(jsdc, jsdscript, (uintptr_t)pc) )
return JSTRAP_CONTINUE;
#endif
return jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_INTERRUPTED,
hook, hookData, rval);
}

View File

@ -38,28 +38,6 @@ void JSD_ASSERT_VALID_EXEC_HOOK(JSDExecHook* jsdhook)
}
#endif
#ifdef LIVEWIRE
static JSBool
HasFileExtention(const char* name, const char* ext)
{
int i;
int len = strlen(ext);
const char* p = strrchr(name,'.');
if( !p )
return JS_FALSE;
p++;
for(i = 0; i < len; i++ )
{
JS_ASSERT(islower(ext[i]));
if( 0 == p[i] || tolower(p[i]) != ext[i] )
return JS_FALSE;
}
if( 0 != p[i] )
return JS_FALSE;
return JS_TRUE;
}
#endif /* LIVEWIRE */
static JSDScript*
_newJSDScript(JSDContext* jsdc,
JSContext *cx,
@ -93,45 +71,7 @@ _newJSDScript(JSDContext* jsdc,
jsdscript->lineBase = lineno;
jsdscript->lineExtent = (unsigned)NOT_SET_YET;
jsdscript->data = NULL;
#ifndef LIVEWIRE
jsdscript->url = (char*) jsd_BuildNormalizedURL(raw_filename);
#else
jsdscript->app = LWDBG_GetCurrentApp();
if( jsdscript->app && raw_filename )
{
jsdscript->url = jsdlw_BuildAppRelativeFilename(jsdscript->app, raw_filename);
if( function )
{
JSString* funid = JS_GetFunctionId(function);
char* funbytes;
const char* funnanme;
if( fuinid )
{
funbytes = JS_EncodeString(cx, funid);
funname = funbytes ? funbytes : "";
}
else
{
funbytes = NULL;
funname = "anonymous";
}
jsdscript->lwscript =
LWDBG_GetScriptOfFunction(jsdscript->app,funname);
JS_Free(cx, funbytes);
/* also, make sure this file is added to filelist if is .js file */
if( HasFileExtention(raw_filename,"js") ||
HasFileExtention(raw_filename,"sjs") )
{
jsdlw_PreLoadSource(jsdc, jsdscript->app, raw_filename, JS_FALSE);
}
}
else
{
jsdscript->lwscript = LWDBG_GetCurrentTopLevelScript();
}
}
#endif
JS_INIT_CLIST(&jsdscript->hooks);
@ -513,15 +453,6 @@ jsd_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, unsigned line)
if( !jsdscript )
return 0;
#ifdef LIVEWIRE
if( jsdscript->lwscript )
{
unsigned newline;
jsdlw_RawToProcessedLineNumber(jsdc, jsdscript, line, &newline);
if( line != newline )
line = newline;
}
#endif
AutoSafeJSContext cx;
JSAutoCompartment ac(cx, jsdscript->script);
@ -547,15 +478,6 @@ jsd_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc)
if( line > last )
return last;
#ifdef LIVEWIRE
if( jsdscript && jsdscript->lwscript )
{
unsigned newline;
jsdlw_ProcessedToRawLineNumber(jsdc, jsdscript, line, &newline);
line = newline;
}
#endif
return line;
}
@ -786,7 +708,6 @@ jsd_TrapHandler(JSContext *cx, JSScript *script_, jsbytecode *pc, jsval *rval,
JSD_ExecutionHookProc hook;
void* hookData;
JSDContext* jsdc;
JSDScript* jsdscript;
JSD_LOCK();
@ -804,7 +725,6 @@ jsd_TrapHandler(JSContext *cx, JSScript *script_, jsbytecode *pc, jsval *rval,
hook = jsdhook->hook;
hookData = jsdhook->callerdata;
jsdscript = jsdhook->jsdscript;
/* do not use jsdhook-> after this point */
JSD_UNLOCK();
@ -815,11 +735,6 @@ jsd_TrapHandler(JSContext *cx, JSScript *script_, jsbytecode *pc, jsval *rval,
if( JSD_IS_DANGEROUS_THREAD(jsdc) )
return JSTRAP_CONTINUE;
#ifdef LIVEWIRE
if( ! jsdlw_UserCodeAtPC(jsdc, jsdscript, (uintptr_t)pc) )
return JSTRAP_CONTINUE;
#endif
return jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_BREAKPOINT,
hook, hookData, rval);
}

View File

@ -344,11 +344,8 @@ jsd_NewSourceText(JSDContext* jsdc, const char* url)
JSD_LOCK_SOURCE_TEXT(jsdc);
#ifdef LIVEWIRE
new_url_string = url; /* we take ownership of alloc'd string */
#else
new_url_string = jsd_BuildNormalizedURL(url);
#endif
if( ! new_url_string )
return NULL;

View File

@ -1318,54 +1318,3 @@ JSD_GetValueForObject(JSDContext* jsdc, JSDObject* jsdobj)
JSD_ASSERT_VALID_OBJECT(jsdobj);
return jsd_GetValueForObject(jsdc, jsdobj);
}
/***************************************************************************/
/* Livewire specific API */
#ifdef LIVEWIRE
JSD_PUBLIC_API(LWDBGScript*)
JSDLW_GetLWScript(JSDContext* jsdc, JSDScript* jsdscript)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
JSD_ASSERT_VALID_SCRIPT(jsdscript);
return jsdlw_GetLWScript(jsdc, jsdscript);
}
JSD_PUBLIC_API(JSDSourceText*)
JSDLW_PreLoadSource( JSDContext* jsdc, LWDBGApp* app,
const char* filename, JSBool clear )
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
JS_ASSERT(app);
JS_ASSERT(filename);
return jsdlw_PreLoadSource(jsdc, app, filename, clear);
}
JSD_PUBLIC_API(JSDSourceText*)
JSDLW_ForceLoadSource( JSDContext* jsdc, JSDSourceText* jsdsrc )
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc);
return jsdlw_ForceLoadSource(jsdc, jsdsrc);
}
JSD_PUBLIC_API(JSBool)
JSDLW_RawToProcessedLineNumber(JSDContext* jsdc, JSDScript* jsdscript,
unsigned lineIn, unsigned* lineOut)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
JSD_ASSERT_VALID_SCRIPT(jsdscript);
return jsdlw_RawToProcessedLineNumber(jsdc, jsdscript, lineIn, lineOut);
}
JSD_PUBLIC_API(JSBool)
JSDLW_ProcessedToRawLineNumber(JSDContext* jsdc, JSDScript* jsdscript,
unsigned lineIn, unsigned* lineOut)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
JSD_ASSERT_VALID_SCRIPT(jsdscript);
return jsdlw_ProcessedToRawLineNumber(jsdc, jsdscript, lineIn, lineOut);
}
#endif
/***************************************************************************/

View File

@ -13,9 +13,6 @@
#include "jsapi.h"
#include "jsdbgapi.h"
#ifdef LIVEWIRE
#include "lwdbgapi.h"
#endif
extern "C" {
@ -640,11 +637,9 @@ JSD_DestroyAllSources( JSDContext* jsdc );
/* functions for adding source items */
/*
* Add a new item for a given URL. If an iten already exists for the given URL
* Add a new item for a given URL. If an item already exists for the given URL
* then the old item is removed.
* 'url' may not be NULL.
*
* ifdef LIVEWIRE url is treated as a char* and ownership is claimed by jsd
*/
extern JSD_PUBLIC_API(JSDSourceText*)
JSD_NewSourceText(JSDContext* jsdc, const char* url);
@ -1522,31 +1517,6 @@ JSD_GetObjectForValue(JSDContext* jsdc, JSDValue* jsdval);
extern JSD_PUBLIC_API(JSDValue*)
JSD_GetValueForObject(JSDContext* jsdc, JSDObject* jsdobj);
/***************************************************************************/
/* Livewire specific API */
#ifdef LIVEWIRE
extern JSD_PUBLIC_API(LWDBGScript*)
JSDLW_GetLWScript(JSDContext* jsdc, JSDScript* jsdscript);
extern JSD_PUBLIC_API(JSDSourceText*)
JSDLW_PreLoadSource(JSDContext* jsdc, LWDBGApp* app,
const char* filename, JSBool clear);
extern JSD_PUBLIC_API(JSDSourceText*)
JSDLW_ForceLoadSource(JSDContext* jsdc, JSDSourceText* jsdsrc);
extern JSD_PUBLIC_API(JSBool)
JSDLW_RawToProcessedLineNumber(JSDContext* jsdc, JSDScript* jsdscript,
unsigned lineIn, unsigned* lineOut);
extern JSD_PUBLIC_API(JSBool)
JSDLW_ProcessedToRawLineNumber(JSDContext* jsdc, JSDScript* jsdscript,
unsigned lineIn, unsigned* lineOut);
#endif
/***************************************************************************/
} // extern "C"
#endif /* jsdebug_h___ */

View File

@ -45,6 +45,29 @@ class JSObject;
typedef JSBool
(* JSNative)(JSContext *cx, unsigned argc, JS::Value *vp);
/* Typedef for native functions that may be called in parallel. */
typedef js::ParallelResult
(* JSParallelNative)(js::ForkJoinSlice *slice, unsigned argc, JS::Value *vp);
/*
* Typedef for native functions that may be called either in parallel or
* sequential execution.
*/
typedef JSBool
(* JSThreadSafeNative)(js::ThreadSafeContext *cx, unsigned argc, JS::Value *vp);
/*
* Convenience wrappers for passing in ThreadSafeNative to places that expect
* a JSNative or a JSParallelNative.
*/
template <JSThreadSafeNative threadSafeNative>
inline JSBool
JSNativeThreadSafeWrapper(JSContext *cx, unsigned argc, JS::Value *vp);
template <JSThreadSafeNative threadSafeNative>
inline js::ParallelResult
JSParallelNativeThreadSafeWrapper(js::ForkJoinSlice *slice, unsigned argc, JS::Value *vp);
/*
* Compute |this| for the |vp| inside a JSNative, either boxing primitives or
* replacing with the global object as necessary.

View File

@ -142,10 +142,10 @@ class TwoByteCharsZ : public mozilla::RangedPtr<jschar>
* This method cannot trigger GC.
*/
extern Latin1CharsZ
LossyTwoByteCharsToNewLatin1CharsZ(JSContext *cx, TwoByteChars tbchars);
LossyTwoByteCharsToNewLatin1CharsZ(js::ThreadSafeContext *cx, TwoByteChars tbchars);
extern UTF8CharsZ
TwoByteCharsToNewUTF8CharsZ(JSContext *cx, TwoByteChars tbchars);
TwoByteCharsToNewUTF8CharsZ(js::ThreadSafeContext *cx, TwoByteChars tbchars);
} // namespace JS

View File

@ -12,7 +12,9 @@
#include "mozilla/Casting.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Move.h"
#include "mozilla/PodOperations.h"
#include "mozilla/ReentrancyGuard.h"
#include "mozilla/TypeTraits.h"
#include "mozilla/Util.h"
@ -136,18 +138,18 @@ class HashMap
template<typename KeyInput, typename ValueInput>
bool add(AddPtr &p, const KeyInput &k, const ValueInput &v) {
Entry e(k, v);
return impl.add(p, Move(e));
return impl.add(p, mozilla::Move(e));
}
bool add(AddPtr &p, const Key &k) {
Entry e(k, Value());
return impl.add(p, Move(e));
return impl.add(p, mozilla::Move(e));
}
template<typename KeyInput, typename ValueInput>
bool relookupOrAdd(AddPtr &p, const KeyInput &k, const ValueInput &v) {
Entry e(k, v);
return impl.relookupOrAdd(p, k, Move(e));
return impl.relookupOrAdd(p, k, mozilla::Move(e));
}
// |all()| returns a Range containing |count()| elements. E.g.:
@ -229,7 +231,7 @@ class HashMap
template<typename KeyInput, typename ValueInput>
bool putNew(const KeyInput &k, const ValueInput &v) {
Entry e(k, v);
return impl.putNew(k, Move(e));
return impl.putNew(k, mozilla::Move(e));
}
// Add (k,defaultValue) if |k| is not found. Return a false-y Ptr on oom.
@ -256,8 +258,8 @@ class HashMap
}
// HashMap is movable
HashMap(MoveRef<HashMap> rhs) : impl(Move(rhs->impl)) {}
void operator=(MoveRef<HashMap> rhs) { impl = Move(rhs->impl); }
HashMap(mozilla::MoveRef<HashMap> rhs) : impl(mozilla::Move(rhs->impl)) {}
void operator=(mozilla::MoveRef<HashMap> rhs) { impl = mozilla::Move(rhs->impl); }
private:
// HashMap is not copyable or assignable
@ -455,8 +457,8 @@ class HashSet
}
// HashSet is movable
HashSet(MoveRef<HashSet> rhs) : impl(Move(rhs->impl)) {}
void operator=(MoveRef<HashSet> rhs) { impl = Move(rhs->impl); }
HashSet(mozilla::MoveRef<HashSet> rhs) : impl(mozilla::Move(rhs->impl)) {}
void operator=(mozilla::MoveRef<HashSet> rhs) { impl = mozilla::Move(rhs->impl); }
private:
// HashSet is not copyable or assignable
@ -576,8 +578,8 @@ class HashMapEntry
template<typename KeyInput, typename ValueInput>
HashMapEntry(const KeyInput &k, const ValueInput &v) : key(k), value(v) {}
HashMapEntry(MoveRef<HashMapEntry> rhs)
: key(Move(rhs->key)), value(Move(rhs->value)) { }
HashMapEntry(mozilla::MoveRef<HashMapEntry> rhs)
: key(mozilla::Move(rhs->key)), value(mozilla::Move(rhs->value)) { }
typedef Key KeyType;
typedef Value ValueType;
@ -646,8 +648,8 @@ class HashTableEntry
}
void swap(HashTableEntry *other) {
Swap(keyHash, other->keyHash);
Swap(mem, other->mem);
mozilla::Swap(keyHash, other->keyHash);
mozilla::Swap(mem, other->mem);
}
T &get() { JS_ASSERT(isLive()); return *mem.addr(); }
@ -828,13 +830,13 @@ class HashTable : private AllocPolicy
};
// HashTable is movable
HashTable(MoveRef<HashTable> rhs)
HashTable(mozilla::MoveRef<HashTable> rhs)
: AllocPolicy(*rhs)
{
mozilla::PodAssign(this, &*rhs);
rhs->table = NULL;
}
void operator=(MoveRef<HashTable> rhs) {
void operator=(mozilla::MoveRef<HashTable> rhs) {
if (table)
destroyTable(*this, table, capacity());
mozilla::PodAssign(this, &*rhs);
@ -878,7 +880,7 @@ class HashTable : private AllocPolicy
# define METER(x)
#endif
friend class js::ReentrancyGuard;
friend class mozilla::ReentrancyGuard;
mutable mozilla::DebugOnly<bool> entered;
mozilla::DebugOnly<uint64_t> mutationCount;
@ -1161,7 +1163,7 @@ class HashTable : private AllocPolicy
for (Entry *src = oldTable, *end = src + oldCap; src < end; ++src) {
if (src->isLive()) {
HashNumber hn = src->getKeyHash();
findFreeEntry(hn).setLive(hn, Move(src->get()));
findFreeEntry(hn).setLive(hn, mozilla::Move(src->get()));
src->destroy();
}
}
@ -1354,7 +1356,7 @@ class HashTable : private AllocPolicy
Ptr lookup(const Lookup &l) const
{
ReentrancyGuard g(*this);
mozilla::ReentrancyGuard g(*this);
HashNumber keyHash = prepareHash(l);
return Ptr(lookup(l, keyHash, 0));
}
@ -1367,7 +1369,7 @@ class HashTable : private AllocPolicy
AddPtr lookupForAdd(const Lookup &l) const
{
ReentrancyGuard g(*this);
mozilla::ReentrancyGuard g(*this);
HashNumber keyHash = prepareHash(l);
Entry &entry = lookup(l, keyHash, sCollisionBit);
AddPtr p(entry, keyHash);
@ -1378,7 +1380,7 @@ class HashTable : private AllocPolicy
template <class U>
bool add(AddPtr &p, const U &rhs)
{
ReentrancyGuard g(*this);
mozilla::ReentrancyGuard g(*this);
JS_ASSERT(mutationCount == p.mutationCount);
JS_ASSERT(table);
JS_ASSERT(!p.found());
@ -1439,7 +1441,7 @@ class HashTable : private AllocPolicy
{
p.mutationCount = mutationCount;
{
ReentrancyGuard g(*this);
mozilla::ReentrancyGuard g(*this);
p.entry_ = &lookup(l, p.keyHash, sCollisionBit);
}
return p.found() || add(p, u);
@ -1448,7 +1450,7 @@ class HashTable : private AllocPolicy
void remove(Ptr p)
{
JS_ASSERT(table);
ReentrancyGuard g(*this);
mozilla::ReentrancyGuard g(*this);
JS_ASSERT(p.found());
remove(*p.entry_);
checkUnderloaded();
@ -1457,12 +1459,12 @@ class HashTable : private AllocPolicy
void rekey(Ptr p, const Lookup &l, const Key &k)
{
JS_ASSERT(table);
ReentrancyGuard g(*this);
mozilla::ReentrancyGuard g(*this);
JS_ASSERT(p.found());
typename HashTableEntry<T>::NonConstT t(Move(*p));
typename HashTableEntry<T>::NonConstT t(mozilla::Move(*p));
HashPolicy::setKey(t, const_cast<Key &>(k));
remove(*p.entry_);
putNewInfallible(l, Move(t));
putNewInfallible(l, mozilla::Move(t));
}
#undef METER

View File

@ -512,7 +512,7 @@ struct GCMethods<T *>
#endif
};
#if defined(DEBUG) && defined(JS_THREADSAFE)
#if defined(DEBUG)
/* This helper allows us to assert that Rooted<T> is scoped within a request. */
extern JS_PUBLIC_API(bool)
IsInRequest(JSContext *cx);
@ -533,21 +533,16 @@ namespace JS {
template <typename T>
class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
{
void init(JSContext *cxArg) {
MOZ_ASSERT(cxArg);
#ifdef JS_THREADSAFE
MOZ_ASSERT(js::IsInRequest(cxArg));
#endif
/* Note: CX is a subclass of either ContextFriendFields or PerThreadDataFriendFields. */
template <typename CX>
void init(CX *cx) {
#ifdef JSGC_TRACK_EXACT_ROOTS
js::ContextFriendFields *cx = js::ContextFriendFields::get(cxArg);
commonInit(cx->thingGCRooters);
#endif
}
js::ThingRootKind kind = js::GCMethods<T>::kind();
this->stack = &cx->thingGCRooters[kind];
this->prev = *stack;
*stack = reinterpret_cast<Rooted<void*>*>(this);
void init(js::PerThreadDataFriendFields *pt) {
MOZ_ASSERT(pt);
#ifdef JSGC_TRACK_EXACT_ROOTS
commonInit(pt->thingGCRooters);
JS_ASSERT(!js::GCMethods<T>::poisoned(ptr));
#endif
}
@ -557,7 +552,8 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
: ptr(js::GCMethods<T>::initial())
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
init(cx);
MOZ_ASSERT(js::IsInRequest(cx));
init(js::ContextFriendFields::get(cx));
}
Rooted(JSContext *cx, T initial
@ -565,23 +561,40 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
: ptr(initial)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
init(cx);
MOZ_ASSERT(js::IsInRequest(cx));
init(js::ContextFriendFields::get(cx));
}
Rooted(js::PerThreadData *pt
Rooted(js::ContextFriendFields *cx
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: ptr(js::GCMethods<T>::initial())
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
init(js::PerThreadDataFriendFields::get(pt));
init(cx);
}
Rooted(js::PerThreadData *pt, T initial
Rooted(js::ContextFriendFields *cx, T initial
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: ptr(initial)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
init(js::PerThreadDataFriendFields::get(pt));
init(cx);
}
Rooted(js::PerThreadDataFriendFields *pt
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: ptr(js::GCMethods<T>::initial())
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
init(pt);
}
Rooted(js::PerThreadDataFriendFields *pt, T initial
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: ptr(initial)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
init(pt);
}
Rooted(JSRuntime *rt
@ -642,20 +655,6 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
bool operator==(const T &other) const { return ptr == other; }
private:
void commonInit(Rooted<void*> **thingGCRooters) {
#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
scanned = false;
#endif
#ifdef JSGC_TRACK_EXACT_ROOTS
js::ThingRootKind kind = js::GCMethods<T>::kind();
this->stack = &thingGCRooters[kind];
this->prev = *stack;
*stack = reinterpret_cast<Rooted<void*>*>(this);
JS_ASSERT(!js::GCMethods<T>::poisoned(ptr));
#endif
}
#ifdef JSGC_TRACK_EXACT_ROOTS
Rooted<void*> **stack, *prev;
#endif
@ -713,8 +712,9 @@ class SkipRoot
const uint8_t *start;
const uint8_t *end;
template <typename T>
void init(SkipRoot **head, const T *ptr, size_t count) {
template <typename CX, typename T>
void init(CX *cx, const T *ptr, size_t count) {
SkipRoot **head = &cx->skipGCRooters;
this->stack = head;
this->prev = *stack;
*stack = this;
@ -723,23 +723,6 @@ class SkipRoot
}
public:
template <typename T>
SkipRoot(JSContext *cx, const T *ptr, size_t count = 1
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
{
init(&ContextFriendFields::get(cx)->skipGCRooters, ptr, count);
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
template <typename T>
SkipRoot(js::PerThreadData *ptd, const T *ptr, size_t count = 1
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
{
PerThreadDataFriendFields *ptff = PerThreadDataFriendFields::get(ptd);
init(&ptff->skipGCRooters, ptr, count);
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~SkipRoot() {
JS_ASSERT(*stack == this);
*stack = prev;
@ -753,22 +736,36 @@ class SkipRoot
#else /* DEBUG && JSGC_ROOT_ANALYSIS */
template <typename T>
void init(js::ContextFriendFields *cx, const T *ptr, size_t count) {}
public:
#endif /* DEBUG && JSGC_ROOT_ANALYSIS */
template <typename T>
SkipRoot(JSContext *cx, const T *ptr, size_t count = 1
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
{
init(ContextFriendFields::get(cx), ptr, count);
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
template <typename T>
SkipRoot(PerThreadData *ptd, const T *ptr, size_t count = 1
SkipRoot(ContextFriendFields *cx, const T *ptr, size_t count = 1
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
{
init(cx, ptr, count);
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
#endif /* DEBUG && JSGC_ROOT_ANALYSIS */
template <typename T>
SkipRoot(PerThreadData *pt, const T *ptr, size_t count = 1
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
{
init(PerThreadDataFriendFields::get(pt), ptr, count);
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
@ -778,14 +775,16 @@ template <typename T>
class FakeRooted : public RootedBase<T>
{
public:
FakeRooted(JSContext *cx
template <typename CX>
FakeRooted(CX *cx
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: ptr(GCMethods<T>::initial())
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
FakeRooted(JSContext *cx, T initial
template <typename CX>
FakeRooted(CX *cx, T initial
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: ptr(initial)
{

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