Merge mozilla-central into services-central

This commit is contained in:
Gregory Szorc 2012-09-25 11:00:01 -07:00
commit 9948a801a7
372 changed files with 7946 additions and 2125 deletions

View File

@ -435,16 +435,17 @@ mai_util_remove_key_event_listener (guint remove_listener)
AtkObject*
mai_util_get_root(void)
{
if (nsAccessibilityService::IsShutdown()) {
// We've shutdown, try to use gail instead
// (to avoid assert in spi_atk_tidy_windows())
if (gail_get_root)
return gail_get_root();
ApplicationAccessible* app = ApplicationAcc();
if (app)
return app->GetAtkObject();
return nullptr;
}
// We've shutdown, try to use gail instead
// (to avoid assert in spi_atk_tidy_windows())
// XXX tbsaunde then why didn't we replace the gail atk_util impl?
if (gail_get_root)
return gail_get_root();
return ApplicationAcc()->GetAtkObject();
return nullptr;
}
G_CONST_RETURN gchar *

View File

@ -168,7 +168,6 @@ HTMLListBulletAccessible::Name(nsString &aName)
// Native anonymous content, ARIA can't be used. Get list bullet text.
nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
NS_ASSERTION(blockFrame, "No frame for list item!");
if (blockFrame) {
blockFrame->GetBulletText(aName);
@ -197,7 +196,6 @@ HTMLListBulletAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset,
{
nsAutoString bulletText;
nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
NS_ASSERTION(blockFrame, "No frame for list item!");
if (blockFrame)
blockFrame->GetBulletText(bulletText);

View File

@ -101,7 +101,7 @@
var gQueue = null;
//gA11yEventDumpID = "eventdump"; // debug stuff
gA11yEventDumpToConsole = true;
//gA11yEventDumpToConsole = true;
function doTests()
{

View File

@ -187,7 +187,7 @@
////////////////////////////////////////////////////////////////////////////
// Tests
//gA11yEventDumpToConsole = true; // debug
gA11yEventDumpToConsole = true; // debug
//gA11yEventDumpFeature = "parentchain:reorder";
var gQueue = null;

View File

@ -49,6 +49,8 @@
// a: traversal state
testStates("link_traversed", 0, 0, STATE_TRAVERSED);
enableLogging("docload");
registerA11yEventListener(EVENT_DOCUMENT_LOAD_COMPLETE,
traversedLinkTester);
@ -62,6 +64,7 @@
aEvent.accessible.rootDocument.window.close();
testStates("link_traversed", STATE_TRAVERSED);
disableLogging();
SimpleTest.finish();
}
};

View File

@ -20,6 +20,8 @@
<![CDATA[
function doTest()
{
disableLogging(); // a hack from failing test_link.html to stop logging.
// label with popup
testStates("labelWithPopup", STATE_HASPOPUP);

View File

@ -140,11 +140,11 @@
}
.statusIcon[type="throbber"] {
background: url(chrome:///content/images/throbber.png) no-repeat center;
background: url("chrome://browser/content/images/throbber.png") no-repeat center;
}
.statusIcon[type="error"] {
background: url(chrome://global/content/images/error.png) no-repeat center;
background: url("chrome://browser/content/images/error.png") no-repeat center;
}
/* CSS Transitions */

View File

@ -37,5 +37,5 @@ chrome.jar:
content/images/pause-hdpi.png (content/images/pause-hdpi.png)
content/images/play-hdpi.png (content/images/play-hdpi.png)
content/images/mute-hdpi.png (content/images/mute-hdpi.png)
content/images/throbber.png (content/images/error.png)
content/images/error.png (content/images/throbber.png)
content/images/throbber.png (content/images/throbber.png)
content/images/error.png (content/images/error.png)

View File

@ -49,9 +49,7 @@ MozKeyboard.prototype = {
uninit: function mozKeyboardUninit() {
Services.obs.removeObserver(this, "inner-window-destroyed");
if (this._messageManager) {
this._messageManager.removeMessageListener("Forms:Input", this);
}
this._messageManager = null;
this._window = null;
this._utils = null;
this._focusHandler = null;
@ -90,7 +88,7 @@ MozKeyboard.prototype = {
return this._focusHandler;
},
receiveMessage: function mozKeyboardReceiveMessage(msg) {
handleMessage: function mozKeyboardHandleMessage(msg) {
let handler = this._focusHandler;
if (!handler || !(handler instanceof Ci.nsIDOMEventListener))
return;
@ -117,8 +115,12 @@ MozKeyboard.prototype = {
case 'in-process-browser-frame-shown': {
let frameLoader = subject.QueryInterface(Ci.nsIFrameLoader);
let mm = frameLoader.messageManager;
this._messageManager = mm;
mm.addMessageListener("Forms:Input", this);
mm.addMessageListener("Forms:Input", (function receiveMessage(msg) {
// Need to save mm here so later the message can be sent back to the
// correct app in the methods called by the value selector.
this._messageManager = mm;
this.handleMessage(msg);
}).bind(this));
try {
mm.loadFrameScript(kFormsFrameScript, true);
} catch (e) {

View File

@ -14,7 +14,7 @@ export GONK_PRODUCT=generic
ac_add_options --with-gonk-toolchain-prefix="$topsrcdir/gonk-toolchain/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-"
ac_add_options --disable-elf-hack
ac_add_options --enable-debug-symbols
ac_add_options --enable-profiling
# ac_add_options --enable-profiling
# IonMonkey disabled in bug 789373
ac_add_options --disable-ion
#ac_add_options --with-ccache

View File

@ -42,4 +42,6 @@ ENABLE_MARIONETTE=1
ac_add_options --disable-elf-hack
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia
. "$topsrcdir/b2g/config/mozconfigs/common.override"

View File

@ -42,4 +42,6 @@ ENABLE_MARIONETTE=1
ac_add_options --disable-elf-hack
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia
. "$topsrcdir/b2g/config/mozconfigs/common.override"

View File

@ -53,6 +53,7 @@ let SocialUI = {
case "social:profile-changed":
SocialToolbar.updateProfile();
SocialShareButton.updateProfileInfo();
SocialChatBar.update();
break;
case "nsPref:changed":
SocialSidebar.updateSidebar();
@ -158,6 +159,10 @@ let SocialUI = {
undoActivation: function SocialUI_undoActivation() {
Social.active = false;
this.notificationPanel.hidePopup();
},
haveLoggedInUser: function SocialUI_haveLoggedInUser() {
return !!(Social.provider && Social.provider.profile && Social.provider.profile.userName);
}
}
@ -167,6 +172,8 @@ let SocialChatBar = {
},
// Whether the chats can be shown for this window.
get canShow() {
if (!SocialUI.haveLoggedInUser())
return false;
let docElem = document.documentElement;
let chromeless = docElem.getAttribute("disablechrome") ||
docElem.getAttribute("chromehidden").indexOf("extrachrome") >= 0;
@ -318,7 +325,7 @@ let SocialShareButton = {
},
updateProfileInfo: function SSB_updateProfileInfo() {
let profileRow = document.getElementById("editSharePopupHeader");
let profileRow = document.getElementById("unsharePopupHeader");
let profile = Social.provider.profile;
this.promptImages = null;
this.promptMessages = null;
@ -377,7 +384,11 @@ let SocialShareButton = {
}
promptImages[sub] = url;
}
for (let sub of ["shareTooltip", "unshareTooltip", "sharedLabel", "unsharedLabel"]) {
for (let sub of ["shareTooltip", "unshareTooltip",
"sharedLabel", "unsharedLabel", "unshareLabel",
"portraitLabel",
"unshareConfirmLabel", "unshareConfirmAccessKey",
"unshareCancelLabel", "unshareCancelAccessKey"]) {
if (typeof data.messages[sub] != "string" || data.messages[sub].length == 0) {
return reportError('messages["' + sub + '"] is not a valid string');
}
@ -391,19 +402,19 @@ let SocialShareButton = {
get shareButton() {
return document.getElementById("share-button");
},
get sharePopup() {
return document.getElementById("editSharePopup");
get unsharePopup() {
return document.getElementById("unsharePopup");
},
dismissSharePopup: function SSB_dismissSharePopup() {
this.sharePopup.hidePopup();
dismissUnsharePopup: function SSB_dismissUnsharePopup() {
this.unsharePopup.hidePopup();
},
updateButtonHiddenState: function SSB_updateButtonHiddenState() {
let shareButton = this.shareButton;
if (shareButton)
shareButton.hidden = !Social.uiVisible || this.promptImages == null ||
!Social.provider.profile || !Social.provider.profile.userName;
!SocialUI.haveLoggedInUser();
},
onClick: function SSB_onClick(aEvent) {
@ -417,27 +428,42 @@ let SocialShareButton = {
},
panelShown: function SSB_panelShown(aEvent) {
let sharePopupOkButton = document.getElementById("editSharePopupOkButton");
if (sharePopupOkButton)
sharePopupOkButton.focus();
function updateElement(id, attrs) {
let el = document.getElementById(id);
Object.keys(attrs).forEach(function(attr) {
el.setAttribute(attr, attrs[attr]);
});
}
let continueSharingButton = document.getElementById("unsharePopupContinueSharingButton");
continueSharingButton.focus();
updateElement("unsharePopupContinueSharingButton",
{label: this.promptMessages.unshareCancelLabel,
accesskey: this.promptMessages.unshareCancelAccessKey});
updateElement("unsharePopupStopSharingButton",
{label: this.promptMessages.unshareConfirmLabel,
accesskey: this.promptMessages.unshareConfirmAccessKey});
updateElement("socialUserPortrait",
{"aria-label": this.promptMessages.portraitLabel});
updateElement("socialUserRecommendedText",
{value: this.promptMessages.unshareLabel});
},
sharePage: function SSB_sharePage() {
this.sharePopup.hidden = false;
this.unsharePopup.hidden = false;
let uri = gBrowser.currentURI;
if (!Social.isPageShared(uri)) {
Social.sharePage(uri);
this.updateShareState();
} else {
this.sharePopup.openPopup(this.shareButton, "bottomcenter topright");
this.unsharePopup.openPopup(this.shareButton, "bottomcenter topright");
}
},
unsharePage: function SSB_unsharePage() {
Social.unsharePage(gBrowser.currentURI);
this.updateShareState();
this.dismissSharePopup();
this.dismissUnsharePopup();
},
updateShareState: function SSB_updateShareState() {
@ -499,7 +525,7 @@ var SocialToolbar = {
updateButtonHiddenState: function SocialToolbar_updateButtonHiddenState() {
this.button.hidden = !Social.uiVisible;
if (!Social.provider || !Social.provider.profile || !Social.provider.profile.userName) {
if (!SocialUI.haveLoggedInUser()) {
["social-notification-box",
"social-status-iconbox"].forEach(function removeChildren(parentId) {
let parent = document.getElementById(parentId);

View File

@ -71,11 +71,11 @@
<menuitem id="context_reloadTab" label="&reloadTab.label;" accesskey="&reloadTab.accesskey;"
oncommand="gBrowser.reloadTab(TabContextMenu.contextTab);"/>
<menuseparator/>
<menuitem id="context_pinTab" label="&pinAppTab.label;"
accesskey="&pinAppTab.accesskey;"
<menuitem id="context_pinTab" label="&pinTab.label;"
accesskey="&pinTab.accesskey;"
oncommand="gBrowser.pinTab(TabContextMenu.contextTab);"/>
<menuitem id="context_unpinTab" label="&unpinAppTab.label;" hidden="true"
accesskey="&unpinAppTab.accesskey;"
<menuitem id="context_unpinTab" label="&unpinTab.label;" hidden="true"
accesskey="&unpinTab.accesskey;"
oncommand="gBrowser.unpinTab(TabContextMenu.contextTab);"/>
<menu id="context_tabViewMenu" label="&moveToGroup.label;"
accesskey="&moveToGroup.accesskey;">
@ -216,7 +216,7 @@
</hbox>
</panel>
<panel id="editSharePopup"
<panel id="unsharePopup"
type="arrow"
orient="vertical"
ignorekeys="true"
@ -224,45 +224,39 @@
onpopupshown="SocialShareButton.panelShown(event);"
consumeoutsideclicks="true"
level="top">
<row id="editSharePopupHeader" align="center">
<!-- Note that 'label', 'accesskey', 'value' and 'aria-label' attributes
for many of these elements are supplied by the provider and filled
in at runtime
-->
<row id="unsharePopupHeader" align="center">
<vbox align="center">
<image id="socialUserPortrait" onclick="SocialUI.showProfile();"
aria-label="&social.sharePopup.portrait.arialabel;"/>
<image id="socialUserPortrait" onclick="SocialUI.showProfile();"/>
</vbox>
<vbox id="editSharePopupText">
<vbox id="unsharePopupText">
<button id="socialUserDisplayName" pack="start"
oncommand="SocialUI.showProfile();"/>
<spacer flex="1"/>
<label id="socialUserRecommendedText"
value="&social.sharePopup.shared.label;"/>
<label id="socialUserRecommendedText"/>
</vbox>
</row>
<hbox id="editSharePopupBottomButtons" pack="end">
<hbox id="unsharePopupBottomButtons" pack="end">
#ifdef XP_UNIX
<button id="editSharePopupUndoButton"
class="editSharePopupBottomButton"
label="&social.sharePopup.undo.label;"
accesskey="&social.sharePopup.undo.accesskey;"
<button id="unsharePopupStopSharingButton"
class="unsharePopupBottomButton"
command="Social:UnsharePage"/>
<button id="editSharePopupOkButton"
class="editSharePopupBottomButton"
<button id="unsharePopupContinueSharingButton"
class="unsharePopupBottomButton"
default="true"
autofocus="autofocus"
label="&social.ok.label;"
accesskey="&social.ok.accesskey;"
oncommand="SocialShareButton.dismissSharePopup();"/>
oncommand="SocialShareButton.dismissUnsharePopup();"/>
#else
<button id="editSharePopupOkButton"
class="editSharePopupBottomButton"
<button id="unsharePopupContinueSharingButton"
class="unsharePopupBottomButton"
default="true"
autofocus="autofocus"
label="&social.ok.label;"
accesskey="&social.ok.accesskey;"
oncommand="SocialShareButton.dismissSharePopup();"/>
<button id="editSharePopupUndoButton"
class="editSharePopupBottomButton"
label="&social.sharePopup.undo.label;"
accesskey="&social.sharePopup.undo.accesskey;"
oncommand="SocialShareButton.dismissUnsharePopup();"/>
<button id="unsharePopupStopSharingButton"
class="unsharePopupBottomButton"
command="Social:UnsharePage"/>
#endif
</hbox>

View File

@ -44,12 +44,12 @@ function testInitial(finishcb) {
ok(port, "Social provider has a port to its FrameWorker");
port.close();
let {shareButton, sharePopup} = SocialShareButton;
let {shareButton, unsharePopup} = SocialShareButton;
ok(shareButton, "share button exists");
ok(sharePopup, "share popup exists");
ok(unsharePopup, "share popup exists");
let okButton = document.getElementById("editSharePopupOkButton");
let undoButton = document.getElementById("editSharePopupUndoButton");
let okButton = document.getElementById("unsharePopupContinueSharingButton");
let undoButton = document.getElementById("unsharePopupStopSharingButton");
let shareStatusLabel = document.getElementById("share-button-status");
// ensure the worker initialization and handshakes are all done and we
@ -62,8 +62,8 @@ function testInitial(finishcb) {
is(profile.portrait, portrait, "portrait is set");
let displayName = document.getElementById("socialUserDisplayName");
is(displayName.label, profile.displayName, "display name is set");
ok(!document.getElementById("editSharePopupHeader").hidden, "user profile is visible");
ok(!document.getElementById("unsharePopupHeader").hidden, "user profile is visible");
// Check the strings from our worker actually ended up on the button.
is(shareButton.getAttribute("tooltiptext"), "Share this page", "check tooltip text is correct");
is(shareStatusLabel.getAttribute("value"), "", "check status label text is blank");
@ -85,9 +85,9 @@ function testInitial(finishcb) {
}
function testSecondClick(nextTest) {
let {shareButton, sharePopup} = SocialShareButton;
sharePopup.addEventListener("popupshown", function listener() {
sharePopup.removeEventListener("popupshown", listener);
let {shareButton, unsharePopup} = SocialShareButton;
unsharePopup.addEventListener("popupshown", function listener() {
unsharePopup.removeEventListener("popupshown", listener);
ok(true, "popup was shown after second click");
executeSoon(nextTest);
});
@ -95,10 +95,10 @@ function testSecondClick(nextTest) {
}
function testPopupOKButton() {
let {shareButton, sharePopup} = SocialShareButton;
let okButton = document.getElementById("editSharePopupOkButton");
sharePopup.addEventListener("popuphidden", function listener() {
sharePopup.removeEventListener("popuphidden", listener);
let {shareButton, unsharePopup} = SocialShareButton;
let okButton = document.getElementById("unsharePopupContinueSharingButton");
unsharePopup.addEventListener("popuphidden", function listener() {
unsharePopup.removeEventListener("popuphidden", listener);
is(shareButton.hasAttribute("shared"), true, "Share button should still have 'shared' attribute after OK button is clicked");
executeSoon(testSecondClick.bind(window, testPopupUndoButton));
});
@ -106,10 +106,10 @@ function testPopupOKButton() {
}
function testPopupUndoButton() {
let {shareButton, sharePopup} = SocialShareButton;
let undoButton = document.getElementById("editSharePopupUndoButton");
sharePopup.addEventListener("popuphidden", function listener() {
sharePopup.removeEventListener("popuphidden", listener);
let {shareButton, unsharePopup} = SocialShareButton;
let undoButton = document.getElementById("unsharePopupStopSharingButton");
unsharePopup.addEventListener("popuphidden", function listener() {
unsharePopup.removeEventListener("popuphidden", listener);
is(shareButton.hasAttribute("shared"), false, "Share button should not have 'shared' attribute after Undo button is clicked");
executeSoon(testShortcut);
});
@ -126,12 +126,12 @@ function testShortcut() {
}
function checkShortcutWorked(keyTarget) {
let {sharePopup, shareButton} = SocialShareButton;
let {unsharePopup, shareButton} = SocialShareButton;
is(shareButton.hasAttribute("shared"), true, "Share button should be in the 'shared' state after keyboard shortcut is used");
// Test a second invocation of the shortcut
sharePopup.addEventListener("popupshown", function listener() {
sharePopup.removeEventListener("popupshown", listener);
unsharePopup.addEventListener("popupshown", function listener() {
unsharePopup.removeEventListener("popupshown", listener);
ok(true, "popup was shown after second use of keyboard shortcut");
executeSoon(checkOKButton);
});
@ -139,10 +139,23 @@ function checkShortcutWorked(keyTarget) {
}
function checkOKButton() {
let okButton = document.getElementById("editSharePopupOkButton");
let undoButton = document.getElementById("editSharePopupUndoButton");
let okButton = document.getElementById("unsharePopupContinueSharingButton");
let undoButton = document.getElementById("unsharePopupStopSharingButton");
is(document.activeElement, okButton, "ok button should be focused by default");
// the undo button text, label text, access keys, etc should be as
// specified by the provider.
function isEltAttr(eltid, attr, expected) {
is(document.getElementById(eltid).getAttribute(attr), expected,
"element '" + eltid + "' has correct value for attribute '" + attr + "'");
}
isEltAttr("socialUserRecommendedText", "value", "You have already shared this page");
isEltAttr("unsharePopupContinueSharingButton", "label", "Got it!");
isEltAttr("unsharePopupContinueSharingButton", "accesskey", "G");
isEltAttr("unsharePopupStopSharingButton", "label", "Unshare it!");
isEltAttr("unsharePopupStopSharingButton", "accesskey", "U");
isEltAttr("socialUserPortrait", "aria-label", "Your pretty face");
// This rest of particular test doesn't really apply on Mac, since buttons
// aren't focusable by default.
if (navigator.platform.contains("Mac")) {
@ -183,10 +196,10 @@ function checkNextInTabOrder(element, next) {
}
function testCloseBySpace() {
let sharePopup = SocialShareButton.sharePopup;
is(document.activeElement.id, "editSharePopupOkButton", "testCloseBySpace, the ok button should be focused");
sharePopup.addEventListener("popuphidden", function listener() {
sharePopup.removeEventListener("popuphidden", listener);
let unsharePopup = SocialShareButton.unsharePopup;
is(document.activeElement.id, "unsharePopupContinueSharingButton", "testCloseBySpace, the ok button should be focused");
unsharePopup.addEventListener("popuphidden", function listener() {
unsharePopup.removeEventListener("popuphidden", listener);
ok(true, "space closed the share popup");
executeSoon(testStillSharedIn2Tabs);
});

View File

@ -108,6 +108,12 @@ onconnect = function(e) {
unshareTooltip: "Unshare this page",
sharedLabel: "This page has been shared",
unsharedLabel: "This page is no longer shared",
unshareLabel: "You have already shared this page",
portraitLabel: "Your pretty face",
unshareConfirmLabel: "Unshare it!",
unshareConfirmAccessKey: "U",
unshareCancelLabel: "Got it!",
unshareCancelAccessKey: "G"
}
}
});

View File

@ -18,10 +18,10 @@ Browser context menu tests.
/** Test for Login Manager: multiple login autocomplete. **/
SpecialPowers.wrap(Components).utils.import("resource://gre/modules/InlineSpellChecker.jsm", window);
SpecialPowers.Cu.import("resource://gre/modules/InlineSpellChecker.jsm", window);
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cc = SpecialPowers.Components.classes;
const Ci = SpecialPowers.Ci;
function openContextMenuFor(element, shiftkey, shouldWaitForFocus) {
// Context menu should be closed before we open it again.

View File

@ -26,7 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462856
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
const Cc = SpecialPowers.wrap(Components).classes;
const Cc = SpecialPowers.Cc;
var numFinished = 0;
@ -36,17 +36,17 @@ window.addEventListener("message", function(event) {
if (++numFinished == 3) {
// Clean up after ourself
var pm = Cc["@mozilla.org/permissionmanager;1"].
getService(Components.interfaces.nsIPermissionManager);
getService(SpecialPowers.Ci.nsIPermissionManager);
var ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
.getService(SpecialPowers.Ci.nsIIOService);
var uri1 = ioService.newURI(frames.testFrame.location, null, null);
var uri2 = ioService.newURI(frames.testFrame3.location, null, null);
var principal1 = Cc["@mozilla.org/scriptsecuritymanager;1"]
.getService(Components.interfaces.nsIScriptSecurityManager)
.getService(SpecialPowers.Ci.nsIScriptSecurityManager)
.getNoAppCodebasePrincipal(uri1);
var principal2 = Cc["@mozilla.org/scriptsecuritymanager;1"]
.getService(Components.interfaces.nsIScriptSecurityManager)
.getService(SpecialPowers.Ci.nsIScriptSecurityManager)
.getNoAppCodebasePrincipal(uri2);
pm.removeFromPrincipal(principal1, "offline-app");
@ -108,8 +108,8 @@ function loaded() {
// Click the notification bar's "Allow" button. This should kick
// off updates, which will eventually lead to getting messages from
// the children.
var wm = SpecialPowers.wrap(Components).classes["@mozilla.org/appshell/window-mediator;1"].
getService(Components.interfaces.nsIWindowMediator);
var wm = SpecialPowers.Cc["@mozilla.org/appshell/window-mediator;1"].
getService(SpecialPowers.Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var notificationBox = win.gBrowser.getNotificationBox();

View File

@ -32,14 +32,14 @@ SimpleTest.waitForExplicitFinish();
function finishTest() {
// Clean up after ourselves.
var Cc = SpecialPowers.wrap(Components).classes;
var Cc = SpecialPowers.Cc;
var pm = Cc["@mozilla.org/permissionmanager;1"].
getService(Components.interfaces.nsIPermissionManager);
getService(SpecialPowers.Ci.nsIPermissionManager);
var uri = Cc["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService)
var uri = Cc["@mozilla.org/network/io-service;1"].getService(SpecialPowers.Ci.nsIIOService)
.newURI(window.frames[0].location, null, null);
var principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
.getService(Components.interfaces.nsIScriptSecurityManager)
.getService(SpecialPowers.Ci.nsIScriptSecurityManager)
.getNoAppCodebasePrincipal(uri);
pm.removeFromPrincipal(principal, "offline-app");
@ -99,8 +99,8 @@ function loaded() {
// Click the notification bar's "Allow" button. This should kick
// off updates, which will eventually lead to getting messages from
// the iframe.
var wm = SpecialPowers.wrap(Components).classes["@mozilla.org/appshell/window-mediator;1"].
getService(Components.interfaces.nsIWindowMediator);
var wm = SpecialPowers.Cc["@mozilla.org/appshell/window-mediator;1"].
getService(SpecialPowers.Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var notificationBox = win.gBrowser.getNotificationBox();

View File

@ -761,12 +761,18 @@ let AboutPermissions = {
permissionValue = PermissionDefaults[aType];
if (aType == "plugins")
document.getElementById("plugins-pref-item").hidden = false;
else if (aType == "cookie")
// cookie-9 corresponds to ALLOW_FIRST_PARTY_ONLY, which is reserved
// for site-specific preferences only.
document.getElementById("cookie-9").hidden = true;
} else {
if (aType == "plugins") {
document.getElementById("plugins-pref-item").hidden =
!Services.prefs.getBoolPref("plugins.click_to_play");
return;
}
if (aType == "cookie")
document.getElementById("cookie-9").hidden = false;
let result = {};
permissionValue = this._selectedSite.getPermission(aType, result) ?
result.value : PermissionDefaults[aType];

View File

@ -127,6 +127,7 @@
<menupopup>
<menuitem id="cookie-1" value="1" label="&permission.allow;"/>
<menuitem id="cookie-8" value="8" label="&permission.allowForSession;"/>
<menuitem id="cookie-9" value="9" label="&permission.allowFirstPartyOnly;"/>
<menuitem id="cookie-2" value="2" label="&permission.block;"/>
</menupopup>
</menulist>

View File

@ -14,7 +14,6 @@ const TEST_URI_3 = NetUtil.newURI("http://wikipedia.org/");
const PERM_UNKNOWN = 0;
const PERM_ALLOW = 1;
const PERM_DENY = 2;
const PERM_SESION = 8;
// used to set permissions on test sites
const TEST_PERMS = {

View File

@ -16,7 +16,8 @@ const TEST_PRINCIPAL_2 = Services.scriptSecurityManager.getNoAppCodebasePrincipa
const PERM_UNKNOWN = 0;
const PERM_ALLOW = 1;
const PERM_DENY = 2;
const PERM_SESION = 8;
// cookie specific permissions
const PERM_FIRST_PARTY_ONLY = 9;
// used to set permissions on test sites
const TEST_PERMS = {
@ -253,6 +254,18 @@ var tests = [
is(Services.perms.testPermissionFromPrincipal(TEST_PRINCIPAL_2, "geo"), PERM_ALLOW,
"permission manager shows that geolocation is allowed");
// change a site-specific cookie permission, just for fun
let cookieMenuList = getPermissionMenulist("cookie");
let cookieItem = gBrowser.contentDocument.getElementById("cookie-" + PERM_FIRST_PARTY_ONLY);
cookieMenuList.selectedItem = cookieItem;
cookieMenuList.doCommand();
is(cookieMenuList.value, PERM_FIRST_PARTY_ONLY, "menulist correctly shows that " +
"first party only cookies are allowed");
is(Services.perms.testPermissionFromPrincipal(TEST_PRINCIPAL_2, "cookie"),
PERM_FIRST_PARTY_ONLY, "permission manager shows that first party cookies " +
"are allowed");
runNextTest();
},

View File

@ -4,3 +4,4 @@ ac_add_options --enable-valgrind
ac_add_options --disable-jemalloc
ac_add_options --disable-elf-hack
ac_add_options --enable-optimize="-g -O -freorder-blocks"
ac_add_options --disable-install-strip

View File

@ -4,3 +4,4 @@ ac_add_options --enable-valgrind
ac_add_options --disable-jemalloc
ac_add_options --disable-elf-hack
ac_add_options --enable-optimize="-g -O -freorder-blocks"
ac_add_options --disable-install-strip

View File

@ -60,7 +60,8 @@ let DebuggerController = {
DebuggerView.StackFrames.initialize();
DebuggerView.Breakpoints.initialize();
DebuggerView.Properties.initialize();
DebuggerView.showCloseButton(!this._isRemoteDebugger && !this._isChromeDebugger);
DebuggerView.toggleCloseButton(!this._isRemoteDebugger &&
!this._isChromeDebugger);
this.dispatchEvent("Debugger:Loaded");
this._connect();

View File

@ -6,6 +6,7 @@
"use strict";
const BREAKPOINT_LINE_TOOLTIP_MAX_SIZE = 1000; // chars
const PANES_APPEARANCE_DELAY = 50; // ms
const PROPERTY_VIEW_FLASH_DURATION = 400; // ms
const GLOBAL_SEARCH_MATCH_FLASH_DURATION = 100; // ms
const GLOBAL_SEARCH_URL_MAX_SIZE = 100; // chars
@ -103,8 +104,8 @@ let DebuggerView = {
this._stackframesAndBreakpoints.setAttribute("width", Prefs.stackframesWidth);
this._variables.setAttribute("width", Prefs.variablesWidth);
this.showStackframesAndBreakpointsPane(Prefs.stackframesPaneVisible);
this.showVariablesPane(Prefs.variablesPaneVisible);
this.toggleStackframesAndBreakpointsPane({ silent: true });
this.toggleVariablesPane({ silent: true });
},
/**
@ -173,34 +174,42 @@ let DebuggerView = {
* Called when the panes toggle button is clicked.
*/
_onTogglePanesButtonPressed: function DV__onTogglePanesButtonPressed() {
this.showStackframesAndBreakpointsPane(
this._togglePanesButton.getAttribute("stackframesAndBreakpointsHidden"), true);
this.showVariablesPane(
this._togglePanesButton.getAttribute("variablesHidden"), true);
this.toggleStackframesAndBreakpointsPane({
visible: !!this._togglePanesButton.getAttribute("stackframesAndBreakpointsHidden"),
animated: true
});
this.toggleVariablesPane({
visible: !!this._togglePanesButton.getAttribute("variablesHidden"),
animated: true
});
this._onPanesToggle();
},
/**
* Sets the close button hidden or visible. It's hidden by default.
* @param boolean aVisibleFlag
*/
showCloseButton: function DV_showCloseButton(aVisibleFlag) {
toggleCloseButton: function DV_toggleCloseButton(aVisibleFlag) {
document.getElementById("close").setAttribute("hidden", !aVisibleFlag);
},
/**
* Sets the stackframes and breakpoints pane hidden or visible.
* @param boolean aVisibleFlag
* @param boolean aAnimatedFlag
*
* @param object aFlags [optional]
* An object containing some of the following booleans:
* - visible: true if the pane should be shown, false for hidden
* - animated: true to display an animation on toggle
* - silent: true to not update any designated prefs
*/
showStackframesAndBreakpointsPane:
function DV_showStackframesAndBreakpointsPane(aVisibleFlag, aAnimatedFlag) {
if (aAnimatedFlag) {
toggleStackframesAndBreakpointsPane:
function DV_toggleStackframesAndBreakpointsPane(aFlags = {}) {
if (aFlags.animated) {
this._stackframesAndBreakpoints.setAttribute("animated", "");
} else {
this._stackframesAndBreakpoints.removeAttribute("animated");
}
if (aVisibleFlag) {
if (aFlags.visible) {
this._stackframesAndBreakpoints.style.marginLeft = "0";
this._togglePanesButton.removeAttribute("stackframesAndBreakpointsHidden");
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("collapsePanes"));
@ -210,22 +219,28 @@ let DebuggerView = {
this._togglePanesButton.setAttribute("stackframesAndBreakpointsHidden", "true");
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("expandPanes"));
}
Prefs.stackframesPaneVisible = aVisibleFlag;
if (!aFlags.silent) {
Prefs.stackframesPaneVisible = !!aFlags.visible;
}
},
/**
* Sets the variable spane hidden or visible.
* @param boolean aVisibleFlag
* @param boolean aAnimatedFlag
*
* @param object aFlags [optional]
* An object containing some of the following booleans:
* - visible: true if the pane should be shown, false for hidden
* - animated: true to display an animation on toggle
* - silent: true to not update any designated prefs
*/
showVariablesPane:
function DV_showVariablesPane(aVisibleFlag, aAnimatedFlag) {
if (aAnimatedFlag) {
toggleVariablesPane:
function DV_toggleVariablesPane(aFlags = {}) {
if (aFlags.animated) {
this._variables.setAttribute("animated", "");
} else {
this._variables.removeAttribute("animated");
}
if (aVisibleFlag) {
if (aFlags.visible) {
this._variables.style.marginRight = "0";
this._togglePanesButton.removeAttribute("variablesHidden");
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("collapsePanes"));
@ -235,7 +250,54 @@ let DebuggerView = {
this._togglePanesButton.setAttribute("variablesHidden", "true");
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("expandPanes"));
}
Prefs.variablesPaneVisible = aVisibleFlag;
if (!aFlags.silent) {
Prefs.variablesPaneVisible = !!aFlags.visible;
}
},
/**
* Shows the stackframes, breakpoints and variable panes if currently hidden
* and the preferences dictate otherwise.
*/
showPanesIfAllowed: function DV_showPanesIfAllowed() {
// Try to keep animations as smooth as possible, so wait a few cycles.
window.setTimeout(function() {
let shown;
if (Prefs.stackframesPaneVisible &&
this._togglePanesButton.getAttribute("stackframesAndBreakpointsHidden")) {
this.toggleStackframesAndBreakpointsPane({
visible: true,
animated: true,
silent: true
});
shown = true;
}
if (Prefs.variablesPaneVisible &&
this._togglePanesButton.getAttribute("variablesHidden")) {
this.toggleVariablesPane({
visible: true,
animated: true,
silent: true
});
shown = true;
}
if (shown) {
this._onPanesToggle();
}
}.bind(this), PANES_APPEARANCE_DELAY);
},
/**
* Displaying the panes may have the effect of triggering scrollbars to
* appear in the source editor, which would render the currently highlighted
* line to appear behind them in some cases.
*/
_onPanesToggle: function DV__onPanesToggle() {
document.addEventListener("transitionend", function onEvent() {
document.removeEventListener("transitionend", onEvent);
DebuggerController.StackFrames.updateEditorLocation();
});
},
/**
@ -1625,6 +1687,8 @@ StackFramesView.prototype = {
if (document.getElementById("stackframe-" + aDepth)) {
return null;
}
// Stackframes are UI elements which benefit from visible panes.
DebuggerView.showPanesIfAllowed();
let frame = document.createElement("box");
let frameName = document.createElement("label");

View File

@ -19,12 +19,32 @@ function test() {
gDebugger = gPane.contentWindow;
gView = gDebugger.DebuggerView;
testPanesState();
gView.toggleStackframesAndBreakpointsPane({ visible: true });
gView.toggleVariablesPane({ visible: true });
testPaneCollapse1();
testPaneCollapse2();
closeDebuggerAndFinish();
});
}
function testPanesState() {
let togglePanesButton =
gDebugger.document.getElementById("toggle-panes");
ok(togglePanesButton.getAttribute("stackframesAndBreakpointsHidden"),
"The stackframes and breakpoints pane should initially be invisible.");
is(gDebugger.Prefs.stackframesPaneVisible, true,
"The stackframes and breakpoints pane should initially be preffed as visible.");
ok(togglePanesButton.getAttribute("variablesHidden"),
"The stackframes and breakpoints pane should initially be invisible.");
is(gDebugger.Prefs.variablesPaneVisible, true,
"The stackframes and breakpoints pane should initially be preffed as visible.");
}
function testPaneCollapse1() {
let stackframesAndBrekpoints =
gDebugger.document.getElementById("stackframes+breakpoints");
@ -35,16 +55,16 @@ function testPaneCollapse1() {
is(width, gDebugger.Prefs.stackframesWidth,
"The stackframes and breakpoints pane has an incorrect width.");
is(stackframesAndBrekpoints.style.marginLeft, "0px",
"The stackframes and breakpoints pane has an incorrect initial left margin.");
"The stackframes and breakpoints pane has an incorrect left margin.");
ok(!stackframesAndBrekpoints.hasAttribute("animated"),
"The stackframes and breakpoints pane has an incorrect initial animated attribute.");
"The stackframes and breakpoints pane has an incorrect animated attribute.");
ok(!togglePanesButton.getAttribute("stackframesAndBreakpointsHidden"),
"The stackframes and breakpoints pane should initially be visible.");
"The stackframes and breakpoints pane should at this point be visible.");
is(gDebugger.Prefs.stackframesPaneVisible, true,
"The stackframes and breakpoints pane should initially be visible.");
"The stackframes and breakpoints pane should at this point be visible.");
gView.showStackframesAndBreakpointsPane(false, true);
gView.toggleStackframesAndBreakpointsPane({ visible: false, animated: true });
is(gDebugger.Prefs.stackframesPaneVisible, false,
"The stackframes and breakpoints pane should be hidden after collapsing.");
@ -62,7 +82,7 @@ function testPaneCollapse1() {
is(gDebugger.Prefs.stackframesPaneVisible, false,
"The stackframes and breakpoints pane should be hidden before uncollapsing.");
gView.showStackframesAndBreakpointsPane(true, false);
gView.toggleStackframesAndBreakpointsPane({ visible: true, animated: false });
is(gDebugger.Prefs.stackframesPaneVisible, true,
"The stackframes and breakpoints pane should be visible after uncollapsing.");
@ -87,16 +107,16 @@ function testPaneCollapse2() {
is(width, gDebugger.Prefs.variablesWidth,
"The variables pane has an incorrect width.");
is(variables.style.marginRight, "0px",
"The variables pane has an incorrect initial right margin.");
"The variables pane has an incorrect right margin.");
ok(!variables.hasAttribute("animated"),
"The variables pane has an incorrect initial animated attribute.");
"The variables pane has an incorrect animated attribute.");
ok(!togglePanesButton.getAttribute("variablesHidden"),
"The variables pane should initially be visible.");
"The variables pane should at this point be visible.");
is(gDebugger.Prefs.variablesPaneVisible, true,
"The variables pane should initially be visible.");
"The variables pane should at this point be visible.");
gView.showVariablesPane(false, true);
gView.toggleVariablesPane({ visible: false, animated: true });
is(gDebugger.Prefs.variablesPaneVisible, false,
"The variables pane should be hidden after collapsing.");
@ -114,7 +134,7 @@ function testPaneCollapse2() {
is(gDebugger.Prefs.variablesPaneVisible, false,
"The variables pane should be hidden before uncollapsing.");
gView.showVariablesPane(true, false);
gView.toggleVariablesPane({ visible: true, animated: false });
is(gDebugger.Prefs.variablesPaneVisible, true,
"The variables pane should be visible after uncollapsing.");

View File

@ -23,15 +23,15 @@
<!ENTITY closeOtherTabs.label "Close Other Tabs">
<!ENTITY closeOtherTabs.accesskey "o">
<!-- LOCALIZATION NOTE (pinAppTab.label, unpinAppTab.label): "Pin" is being
<!-- LOCALIZATION NOTE (pinTab.label, unpinTab.label): "Pin" is being
used as a metaphor for expressing the fact that these tabs are "pinned" to the
left edge of the tabstrip. Really we just want the string to express the idea
that this is a lightweight and reversible action that keeps your tab where you
can reach it easily. -->
<!ENTITY pinAppTab.label "Pin as App Tab">
<!ENTITY pinAppTab.accesskey "P">
<!ENTITY unpinAppTab.label "Unpin Tab">
<!ENTITY unpinAppTab.accesskey "b">
<!ENTITY pinTab.label "Pin Tab">
<!ENTITY pinTab.accesskey "P">
<!ENTITY unpinTab.label "Unpin Tab">
<!ENTITY unpinTab.accesskey "b">
<!ENTITY moveToGroup.label "Move to Group">
<!ENTITY moveToGroup.accesskey "M">
<!ENTITY moveToNewGroup.label "New Group">
@ -648,19 +648,9 @@ toolbar button -->
<!ENTITY socialToolbar.title "Social Toolbar Button">
<!ENTITY social.notLoggedIn.label "Not logged in">
<!-- LOCALIZATION NOTE (social.ok.label, social.ok.accesskey): this string is
used for the "OK" button for two different social panels. One appears when
the feature is activated (social.activated.* below), and the other when
the user clicks the "Share" button a second time (social.sharePopup.*
below). -->
<!ENTITY social.ok.label "OK">
<!ENTITY social.ok.accesskey "O">
<!ENTITY social.sharePopup.undo.label "Unshare">
<!ENTITY social.sharePopup.undo.accesskey "U">
<!ENTITY social.sharePopup.shared.label "You shared this page.">
<!ENTITY social.sharePopup.portrait.arialabel "User profile picture">
<!ENTITY social.toggleSidebar.label "Show sidebar">
<!ENTITY social.toggleSidebar.accesskey "s">

View File

@ -20,6 +20,7 @@
<!ENTITY permission.alwaysAsk "Always Ask">
<!ENTITY permission.allow "Allow">
<!ENTITY permission.allowForSession "Allow for Session">
<!ENTITY permission.allowFirstPartyOnly "Allow First Party Only">
<!ENTITY permission.block "Block">
<!ENTITY password.label "Store Passwords">

View File

@ -1408,11 +1408,11 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
text-decoration: underline;
}
#editSharePopupText {
#unsharePopupText {
height: 48px;
}
#editSharePopupBottomButtons {
#unsharePopupBottomButtons {
margin-top: 1em;
}
@ -2563,12 +2563,17 @@ html|*#gcli-output-frame {
box-shadow: 0 1px 2px rgba(0,0,0,.5) inset, 0 1px 0 hsla(210,16%,76%,.15);
}
.developer-toolbar-button[checked=true] {
.developer-toolbar-button:hover,
.developer-toolbar-button[checked=true],
.developer-toolbar-button[open=true] {
color: hsl(208,100%,60%) !important;
background: rgba(0,0,0,.4);
text-shadow: 0 0 6px hsl(208,100%,60%);
}
.developer-toolbar-button[checked=true] {
background: rgba(0,0,0,.4);
}
#developer-toolbar-webconsole {
-moz-image-region: rect(0, 16px, 16px, 0);
}

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#body {
background: -moz-dialog;
background-color: white;
}
/**

View File

@ -1280,11 +1280,11 @@ window[tabsontop="false"] richlistitem[type~="action"][actiontype="switchtab"][s
text-decoration: underline;
}
#editSharePopupText {
#unsharePopupText {
height: 48px;
}
#editSharePopupBottomButtons {
#unsharePopupBottomButtons {
margin-top: 1em;
}

View File

@ -7,7 +7,7 @@
%include ../shared.inc
#body {
background: -moz-dialog;
background-color: white;
}
/**

View File

@ -1671,11 +1671,11 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
text-decoration: underline;
}
#editSharePopupText {
#unsharePopupText {
height: 48px;
}
#editSharePopupBottomButtons {
#unsharePopupBottomButtons {
margin-top: 1em;
}
@ -3240,12 +3240,17 @@ html|*#gcli-output-frame {
box-shadow: 0 1px 2px rgba(0,0,0,.5) inset, 0 1px 0 hsla(210,16%,76%,.1);
}
.developer-toolbar-button[checked=true] {
.developer-toolbar-button:hover,
.developer-toolbar-button[checked=true],
.developer-toolbar-button[open=true] {
color: hsl(208,100%,60%) !important;
background: rgba(0,0,0,.4);
text-shadow: 0 0 6px hsl(208,100%,60%);
}
.developer-toolbar-button[checked=true] {
background: rgba(0,0,0,.4);
}
#developer-toolbar-webconsole {
-moz-image-region: rect(0, 16px, 16px, 0);
}

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#body {
background: -moz-dialog;
background-color: white;
}
/**

View File

@ -150,7 +150,7 @@ _VALGRIND_DIR = $(DEPTH)/_valgrind
GARBAGE_DIRS += $(_VALGRIND_DIR)
_VALGRIND_FILES = \
$(topsrcdir)/build/valgrind/i686-redhat-linux-gnu.sup \
$(topsrcdir)/build/valgrind/i386-redhat-linux-gnu.sup \
$(topsrcdir)/build/valgrind/x86_64-redhat-linux-gnu.sup \
$(NULL)

View File

@ -89,8 +89,7 @@ function goQuitApplication()
throw 'goQuitApplication: no AppStartup/appShell';
}
var windowManager = Components.
classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.
QueryInterface(Components.interfaces.nsIWindowMediator);

View File

@ -84,8 +84,7 @@
throw 'goQuitApplication: no AppStartup/appShell';
}
var windowManager = Components.
classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.
QueryInterface(Components.interfaces.nsIWindowMediator);

View File

@ -6,6 +6,11 @@ import logging, re, os, sys
import parserdata, parser, functions, process, util, implicit
from cStringIO import StringIO
if sys.version_info[0] < 3:
str_type = basestring
else:
str_type = str
_log = logging.getLogger('pymake.data')
class DataError(util.MakeError):
@ -141,7 +146,7 @@ class StringExpansion(BaseExpansion):
simple = True
def __init__(self, s, loc):
assert isinstance(s, str)
assert isinstance(s, str_type)
self.s = s
self.loc = loc
@ -227,7 +232,7 @@ class Expansion(BaseExpansion, list):
return e
def appendstr(self, s):
assert isinstance(s, str)
assert isinstance(s, str_type)
if s == '':
return
@ -321,9 +326,9 @@ class Expansion(BaseExpansion, list):
if isfunc:
e.resolve(makefile, variables, fd, setting)
else:
assert isinstance(e, str)
assert isinstance(e, str_type)
fd.write(e)
def resolvestr(self, makefile, variables, setting=[]):
fd = StringIO()
self.resolve(makefile, variables, fd, setting)
@ -501,7 +506,7 @@ class Variables(object):
def set(self, name, flavor, source, value):
assert flavor in (self.FLAVOR_RECURSIVE, self.FLAVOR_SIMPLE)
assert source in (self.SOURCE_OVERRIDE, self.SOURCE_COMMANDLINE, self.SOURCE_MAKEFILE, self.SOURCE_ENVIRONMENT, self.SOURCE_AUTOMATIC, self.SOURCE_IMPLICIT)
assert isinstance(value, str), "expected str, got %s" % type(value)
assert isinstance(value, str_type), "expected str, got %s" % type(value)
prevflavor, prevsource, prevvalue = self.get(name)
if prevsource is not None and source > prevsource:
@ -513,7 +518,7 @@ class Variables(object):
def append(self, name, source, value, variables, makefile):
assert source in (self.SOURCE_OVERRIDE, self.SOURCE_MAKEFILE, self.SOURCE_AUTOMATIC)
assert isinstance(value, str)
assert isinstance(value, str_type)
if name not in self._map:
self._map[name] = self.FLAVOR_APPEND, source, value, None
@ -646,7 +651,7 @@ class Pattern(object):
@param mustmatch If true and this pattern doesn't match the word, throw a DataError. Otherwise
return word unchanged.
"""
assert isinstance(replacement, str)
assert isinstance(replacement, str_type)
stem = self.match(word)
if stem is None:
@ -965,7 +970,7 @@ class Target(object):
wasremade = False
def __init__(self, target, makefile):
assert isinstance(target, str)
assert isinstance(target, str_type)
self.target = target
self.vpathtarget = None
self.rules = []
@ -1687,7 +1692,7 @@ class Makefile(object):
return target in self._targets
def gettarget(self, target):
assert isinstance(target, str)
assert isinstance(target, str_type)
target = target.rstrip('/')

View File

@ -0,0 +1,162 @@
{
Bug 793532
Memcheck:Leak
fun:malloc
fun:_ZN8JSObject25allocateSlowArrayElementsEP9JSContext
...
}
{
Bug 793533
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_Z22xpc_CreateGlobalObjectP9JSContextP7JSClassP12nsIPrincipalP11nsISupportsbPP8JSObjectPP13JSCompartment
...
}
{
PR_SetEnv requires its argument to be leaked, but does not appear on stacks. (See bug 793534 and see bug 793549.)
Memcheck:Leak
...
fun:_ZL9SaveToEnvPKc
...
}
{
PR_SetEnv requires its argument to be leaked, but does not appear on stacks. (See bug 793534 and see bug 793549.)
Memcheck:Leak
...
fun:_ZL13SaveWordToEnvPKcRK19nsACString_internal
...
}
{
Bug 793535
Memcheck:Leak
fun:calloc
fun:_dlerror_run
fun:dlsym
fun:PR_SetCurrentThreadName
...
}
{
Bug 793536 (all 64-bit systems)
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZNSt11_Deque_baseIN11MessageLoop11PendingTaskESaIS1_EE17_M_initialize_mapEm
...
}
{
Bug 793536 (all 32-bit systems)
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZNSt11_Deque_baseIN11MessageLoop11PendingTaskESaIS1_EE17_M_initialize_mapEj
...
}
{
Bug 793548
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:NS_Alloc_P
fun:_Z12ToNewCStringRK19nsACString_internal
fun:_ZN13CrashReporter14SetupExtraDataEP7nsIFileRK19nsACString_internal
...
}
{
Bug 793601
Memcheck:Leak
fun:malloc
fun:_ZN2js15ArgumentsObject6createEP9JSContextPNS_10StackFrameE
...
}
{
Bug 793602
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_Z22NS_NewComputedDOMStylePN7mozilla3dom7ElementERK18nsAString_internalP12nsIPresShell
fun:_ZN14nsGlobalWindow16GetComputedStyleEP13nsIDOMElementRK18nsAString_internalPP25nsIDOMCSSStyleDeclaration
...
}
{
Bug 793603
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZN18nsDeflateConverter15OnDataAvailableEP10nsIRequestP11nsISupportsP14nsIInputStreammj
...
}
{
Bug 793605
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_Z30nsStringInputStreamConstructorP11nsISupportsRK4nsIDPPv
...
}
{
Bug 793606
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZL27nsXMLHttpRequestConstructorP11nsISupportsRK4nsIDPPv
...
}
{
Bug 793607
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZN11nsZipWriter14AddEntryStreamERK19nsACString_internalliP14nsIInputStreambj
...
}
{
Bug 793608
Memcheck:Leak
fun:malloc
fun:__libc_res_nsend
fun:__libc_res_nquery
fun:__libc_res_nquerydomain
fun:__libc_res_nsearch
obj:*
fun:gaih_inet
fun:getaddrinfo
fun:PR_GetAddrInfoByName
fun:_ZN14nsHostResolver10ThreadFuncEPv
fun:_pt_root
fun:start_thread
fun:clone
}
{
Bug 793611
Memcheck:Leak
fun:memalign
fun:tls_get_addr_tail
fun:__tls_get_addr
fun:_ZN8nsThread16ProcessNextEventEbPb
fun:_Z21NS_ProcessNextEvent_PP9nsIThreadb
fun:_ZN8nsThread10ThreadFuncEPv
fun:_pt_root
fun:start_thread
fun:clone
}
{
Bug 793615
Memcheck:Leak
fun:malloc
fun:sqlite3MemMalloc
...
}
{
Bug 793616
Memcheck:Leak
fun:malloc
fun:make_request
fun:__check_pf
fun:getaddrinfo
fun:PR_GetAddrInfoByName
fun:_ZN14nsHostResolver10ThreadFuncEPv
fun:_pt_root
fun:start_thread
fun:clone
}

View File

@ -0,0 +1,14 @@
{
Bug 793537
Memcheck:Leak
...
obj:/usr/lib/libpango-1.0.so.0.2800.1
...
}
{
Bug 793539 which may be fixed or change when bug 713802 is fixed
Memcheck:Leak
...
obj:/usr/lib/libgnomevfs-2.so.0.2400.2
...
}

View File

@ -1,102 +0,0 @@
{
writev-XQueryExtension
Memcheck:Param
writev(vector[...])
fun:writev
fun:_X11TransSocketWritev
fun:_X11TransWritev
fun:_XSend
fun:XQueryExtension
}
{
write-gdk_x11_drawable_get_picture
Memcheck:Param
write(buf)
obj:/lib/libpthread-2.5.so
fun:_X11TransWrite
fun:_XFlushInt
fun:XRenderCreatePicture
fun:gdk_x11_drawable_get_picture
}
{
writev-XChangeProperty
Memcheck:Param
writev(vector[...])
fun:writev
fun:_X11TransSocketWritev
fun:_X11TransWritev
fun:_XSend
fun:XChangeProperty
}
{
malloc-libmozsqlite3.so
Memcheck:Leak
fun:malloc
...
obj:/builds/slave/valgrind-linux/objdir/dist/firefox/libmozsqlite3.so
}
{
Bug 793532
Memcheck:Leak
fun:malloc
fun:_ZN8JSObject25allocateSlowArrayElementsEP9JSContext
...
}
{
This is intended, see bug 793534
Memcheck:Leak
fun:malloc
fun:strdup
fun:moz_strdup
fun:_ZL9SaveToEnvPKc
...
}
{
Bug 793535
Memcheck:Leak
fun:calloc
fun:_dlerror_run
fun:dlsym
fun:PR_SetCurrentThreadName
...
}
{
Bug 793536
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZNSt11_Deque_baseIN11MessageLoop11PendingTaskESaIS1_EE17_M_initialize_mapEj
...
}
{
Bug 793537
Memcheck:Leak
...
obj:/usr/lib/libpango-1.0.so.0.2800.1
...
}
{
Bug 793539 which may be fixed or change when bug 713802 is fixed
Memcheck:Leak
...
obj:/usr/lib/libgnomevfs-2.so.0.2400.2
...
}
{
Bug 793548
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:NS_Alloc_P
fun:_Z12ToNewCStringRK19nsACString_internal
fun:_ZN13CrashReporter14SetupExtraDataEP7nsIFileRK19nsACString_internal
...
}
{
Bug 793549
Memcheck:Leak
fun:realloc
fun:PR_Realloc
fun:GrowStuff
...
}

View File

@ -1,74 +1,3 @@
{
inflateReset2
Memcheck:Cond
fun:inflateReset2
fun:inflateInit2_
}
{
write-XQueryExtension
Memcheck:Param
writev(vector[...])
fun:writev
fun:_X11TransSocketWritev
fun:_XSend
fun:XQueryExtension
}
{
write-pthread
Memcheck:Param
write(buf)
obj:/lib64/libpthread-2.5.so
}
{
write-XChangeProperty
Memcheck:Param
writev(vector[...])
fun:writev
fun:_X11TransSocketWritev
fun:_XSend
fun:XChangeProperty
}
{
Bug 793532
Memcheck:Leak
fun:malloc
fun:_ZN8JSObject25allocateSlowArrayElementsEP9JSContext
...
}
{
Bug 793533
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_Z22xpc_CreateGlobalObjectP9JSContextP7JSClassP12nsIPrincipalP11nsISupportsbPP8JSObjectPP13JSCompartment
...
}
{
This is intended, see bug 793534
Memcheck:Leak
fun:malloc
fun:strdup
fun:moz_strdup
fun:_ZL9SaveToEnvPKc
...
}
{
Bug 793535
Memcheck:Leak
fun:calloc
fun:_dlerror_run
fun:dlsym
fun:PR_SetCurrentThreadName
...
}
{
Bug 793536
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZNSt11_Deque_baseIN11MessageLoop11PendingTaskESaIS1_EE17_M_initialize_mapEm
...
}
{
Bug 793537
Memcheck:Leak
@ -83,3 +12,21 @@
obj:/usr/lib64/libgnomevfs-2.so.0.2400.2
...
}
{
Bug 793598
Memcheck:Leak
fun:realloc
...
obj:/lib64/libdbus-1.so.3.4.0
...
}
{
Bug 793600
Memcheck:Leak
fun:realloc
obj:/usr/lib64/libfontconfig.so.1.4.4
obj:/usr/lib64/libfontconfig.so.1.4.4
fun:FcDefaultSubstitute
fun:_ZN17gfxPangoFontGroup11MakeFontSetEP14_PangoLanguagedP9nsAutoRefI10_FcPatternE
...
}

View File

@ -8,6 +8,7 @@ mozprofile.pth:testing/mozbase/mozprofile
mozrunner.pth:testing/mozbase/mozrunner
blessings.pth:python/blessings
mozbuild.pth:python/mozbuild
pymake.pth:build/pymake
optional:setup.py:python/psutil:build_ext:--inplace
optional:psutil.pth:python/psutil
which.pth:python/which

View File

@ -50,14 +50,14 @@ function tryChromeLoad()
function tryComponentsClasses()
{
return Components.classes["@mozilla.org/dummy;1"];
return SpecialPowers.Components.classes["@mozilla.org/dummy;1"];
}
is(inciteCaps(tryChromeLoad), "denied-stack",
"should get stack for content-loading-chrome rejection");
is(inciteCaps(tryComponentsClasses), "denied-stack",
"should get stack for Components.classes rejection");
"should get stack for SpecialPowers.Components.classes rejection");
</script>
</pre>
</body>

View File

@ -57,9 +57,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=62178
var objectCount = 0;
function objectStatus(object) {
object instanceof Components.interfaces.nsIObjectLoadingContent;
object instanceof SpecialPowers.Ci.nsIObjectLoadingContent;
if (object.displayedType != Components.interfaces.nsIObjectLoadingContent.TYPE_NULL) {
if (object.displayedType != SpecialPowers.Ci.nsIObjectLoadingContent.TYPE_NULL) {
//object loaded
parent.postMessage({"test": "object", "msg": "insecure object loaded"}, "http://mochi.test:8888");
}

View File

@ -21,10 +21,10 @@ function runTests() {
let tearDown = (function setUp() {
SimpleTest.waitForExplicitFinish();
const {classes: Cc, interfaces: Ci} = SpecialPowers.wrap(Components);
const {classes: Cc, interfaces: Ci} = SpecialPowers.wrap(SpecialPowers.Components);
let authMgr = Cc["@mozilla.org/network/http-auth-manager;1"]
.getService(Components.interfaces.nsIHttpAuthManager)
.getService(SpecialPowers.Ci.nsIHttpAuthManager)
authMgr.setAuthIdentity("http", "example.com", 80, "basic", "testrealm",
"", "example.com", "user1", "password1");

View File

@ -16,7 +16,7 @@
<script class="testbody" type="application/javascript;version=1.8">
function runTests() {
var comp = SpecialPowers.wrap(Components);
var comp = SpecialPowers.wrap(SpecialPowers.Components);
SimpleTest.waitForExplicitFinish();
SpecialPowers.addPermission("systemXHR", true, document);

View File

@ -21,19 +21,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=166235
<script type="application/javascript">
/** Test for Bug 166235 **/
var Cc = SpecialPowers.wrap(Components).classes;
var Ci = SpecialPowers.wrap(Components).interfaces;
var Cc = SpecialPowers.Cc;
var Ci = SpecialPowers.Ci;
var webnav = SpecialPowers.wrap(window).QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
var webnav = SpecialPowers.wrap(window).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIWebNavigation)
var docShell = webnav.QueryInterface(Components.interfaces.nsIDocShell);
var docShell = webnav.QueryInterface(SpecialPowers.Ci.nsIDocShell);
var documentViewer = docShell.contentViewer
.QueryInterface(Components.interfaces.nsIContentViewerEdit);
.QueryInterface(SpecialPowers.Ci.nsIContentViewerEdit);
var clipboard = Cc["@mozilla.org/widget/clipboard;1"]
.getService(Components.interfaces.nsIClipboard);
.getService(SpecialPowers.Ci.nsIClipboard);
var textarea = SpecialPowers.wrap(document).getElementById('input');
@ -54,7 +54,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=166235
}
function getClipboardData(mime) {
var transferable = Cc['@mozilla.org/widget/transferable;1']
.createInstance(Components.interfaces.nsITransferable);
.createInstance(SpecialPowers.Ci.nsITransferable);
transferable.init(getLoadContext());
transferable.addDataFlavor(mime);
clipboard.getData(transferable, 1);
@ -65,7 +65,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=166235
function testClipboardValue(mime, expected, test) {
var data = getClipboardData(mime);
is (data.value == null ? data.value :
data.value.QueryInterface(Components.interfaces.nsISupportsString).data,
data.value.QueryInterface(SpecialPowers.Ci.nsISupportsString).data,
expected,
mime + " value in the clipboard");
return data.value;
@ -73,7 +73,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=166235
function testPasteText(expected, test) {
textarea.value="";
textarea.focus();
textarea.QueryInterface(Components.interfaces.nsIDOMNSEditableElement)
textarea.QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement)
.editor.paste(1);
is(textarea.value, expected, test + ": textarea paste");
}

View File

@ -32,11 +32,11 @@ function afterLoad() {
iframeDoc.getElementById("password").value = "123456";
iframeDoc.getElementById("hidden").value = "gecko";
var file = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("TmpD", Components.interfaces.nsILocalFile);
var file = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"]
.getService(SpecialPowers.Ci.nsIProperties)
.get("TmpD", SpecialPowers.Ci.nsILocalFile);
file.append("345339_test.file");
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
file.createUnique(SpecialPowers.Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
filePath = file.path;
SpecialPowers.wrap(iframeDoc).getElementById("file").value = filePath;

View File

@ -29,7 +29,7 @@ function checkTypes(aNode, aNodeType, aTypeArray)
function checkInterfaces(aNode, aNodeType, aInterfaceArray)
{
for (var i = 0; i < aInterfaceArray.length; ++i) {
ok(aNode instanceof Components.interfaces[aInterfaceArray[i]],
ok(aNode instanceof SpecialPowers.Ci[aInterfaceArray[i]],
aNodeType + " interface test " + i,
aNodeType + " should be a " + aInterfaceArray[i]);
}

View File

@ -53,7 +53,7 @@ function checkTypes(aNode, aNodeType, aTypeArray)
function checkInterfaces(aNode, aNodeType, aInterfaceArray)
{
for (var i = 0; i < aInterfaceArray.length; ++i) {
ok(aNode instanceof Components.interfaces[aInterfaceArray[i]],
ok(aNode instanceof SpecialPowers.Ci[aInterfaceArray[i]],
aNodeType + " interface test " + i,
aNodeType + " should be a " + aInterfaceArray[i]);
}

View File

@ -31,7 +31,6 @@ SimpleTest.waitForExplicitFinish();
function doPrincipalTest(id) {
var doc = $(id).contentDocument;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
isnot(SpecialPowers.getNodePrincipal(doc), undefined, "Should have a principal");
isnot(SpecialPowers.getNodePrincipal(doc), null, "Should have a non-null principal");
is(SpecialPowers.getNodePrincipal(doc),
@ -45,7 +44,7 @@ function doContentTest(id) {
}
function checkPrincipal() {
is(SpecialPowers.getNodePrincipal(document) instanceof Components.interfaces.nsIPrincipal,
is(SpecialPowers.getNodePrincipal(document) instanceof SpecialPowers.Ci.nsIPrincipal,
true,
"Should be a principal");
}

View File

@ -21,11 +21,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=375314
var lastContentType = -1;
const testURL = window.location.href + "/this/is/the/test/url";
const Cc = SpecialPowers.wrap(Components).classes;
const Ci = Components.interfaces;
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
// Content policy / factory implementation for the test
var policyID = SpecialPowers.wrap(Components).ID("{b80e19d0-878f-d41b-2654-194714a4115c}");
var policyID = SpecialPowers.wrap(SpecialPowers.Components).ID("{b80e19d0-878f-d41b-2654-194714a4115c}");
var policyName = "@mozilla.org/testpolicy;1";
var policy = {
// nsISupports implementation
@ -37,7 +37,7 @@ var policy = {
iid.equals(Ci.nsIContentPolicy))
return this;
throw SpecialPowers.wrap(Components).results.NS_ERROR_NO_INTERFACE;
throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
},
// nsIFactory implementation
@ -64,7 +64,7 @@ var policy = {
}
// Register content policy
var componentManager = SpecialPowers.wrap(Components).manager
var componentManager = SpecialPowers.wrap(SpecialPowers.Components).manager
.QueryInterface(Ci.nsIComponentRegistrar);
componentManager.registerFactory(policyID, "Test content policy", policyName, policy);

View File

@ -24,7 +24,7 @@ req.setRequestHeader("Content-Type", "text/plain; charset=us-ascii; boundary=012
req.send("Some text");
is(SpecialPowers.wrap(req).channel
.QueryInterface(Components.interfaces.nsIHttpChannel)
.QueryInterface(SpecialPowers.Ci.nsIHttpChannel)
.getRequestHeader("Content-Type"),
"text/plain; charset=UTF-8; boundary=01234567890",
"Headers should match");

View File

@ -25,7 +25,7 @@ req.setRequestHeader("Content-Type", "text/plain; charset='uTf-8'");
req.send("Some text");
is(SpecialPowers.wrap(req).channel
.QueryInterface(Components.interfaces.nsIHttpChannel)
.QueryInterface(SpecialPowers.Ci.nsIHttpChannel)
.getRequestHeader("Content-Type"),
"text/plain; charset='uTf-8'",
"Headers should match");

View File

@ -24,7 +24,7 @@ req.setRequestHeader("Content-Type", "text/plain; boundary=01234567890");
req.send("Some text");
is(SpecialPowers.wrap(req).channel
.QueryInterface(Components.interfaces.nsIHttpChannel)
.QueryInterface(SpecialPowers.Ci.nsIHttpChannel)
.getRequestHeader("Content-Type"),
"text/plain; charset=UTF-8; boundary=01234567890",
"Charset should come before boundary");

View File

@ -23,17 +23,17 @@ function loadFileContent(aFile, aCharset) {
if(aCharset == undefined)
aCharset = 'UTF-8';
var baseUri = SpecialPowers.wrap(Components).classes['@mozilla.org/network/standard-url;1']
.createInstance(Components.interfaces.nsIURI);
var baseUri = SpecialPowers.Cc['@mozilla.org/network/standard-url;1']
.createInstance(SpecialPowers.Ci.nsIURI);
baseUri.spec = window.location.href;
var ios = SpecialPowers.wrap(Components).classes['@mozilla.org/network/io-service;1']
.getService(Components.interfaces.nsIIOService);
var ios = SpecialPowers.Cc['@mozilla.org/network/io-service;1']
.getService(SpecialPowers.Ci.nsIIOService);
var chann = ios.newChannel(aFile, aCharset, baseUri);
var cis = Components.interfaces.nsIConverterInputStream;
var cis = SpecialPowers.Ci.nsIConverterInputStream;
var inputStream = SpecialPowers.wrap(Components).classes["@mozilla.org/intl/converter-input-stream;1"]
var inputStream = SpecialPowers.Cc["@mozilla.org/intl/converter-input-stream;1"]
.createInstance(cis);
inputStream.init(chann.open(), aCharset, 1024, cis.DEFAULT_REPLACEMENT_CHARACTER);
var str = {}, content = '';
@ -45,9 +45,9 @@ function loadFileContent(aFile, aCharset) {
function testHtmlSerializer_1 () {
const de = Components.interfaces.nsIDocumentEncoder
var encoder = SpecialPowers.wrap(Components).classes["@mozilla.org/layout/documentEncoder;1?type=application/xhtml+xml"]
.createInstance(Components.interfaces.nsIDocumentEncoder);
const de = SpecialPowers.Ci.nsIDocumentEncoder
var encoder = SpecialPowers.Cc["@mozilla.org/layout/documentEncoder;1?type=application/xhtml+xml"]
.createInstance(SpecialPowers.Ci.nsIDocumentEncoder);
var doc = SpecialPowers.wrap($("testframe")).contentDocument;
var out, expected;

View File

@ -19,9 +19,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=422537
<script class="testbody" type="text/javascript">
/** Test for Bug 422537 **/
var isupports_string = SpecialPowers.wrap(Components)
.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);
var isupports_string = SpecialPowers.Cc["@mozilla.org/supports-string;1"]
.createInstance(SpecialPowers.Ci.nsISupportsString);
isupports_string.data = "foo";
const url = "http://mochi.test:8888";
@ -39,13 +38,13 @@ for each (var i in body) {
else
xhr.send(i);
var chan = SpecialPowers.wrap(xhr).channel;
if (!SpecialPowers.call_Instanceof(chan, Components.interfaces.nsIUploadChannel))
if (!SpecialPowers.call_Instanceof(chan, SpecialPowers.Ci.nsIUploadChannel))
throw "Must be an upload channel";
var stream = chan.uploadStream;
if (!stream || !SpecialPowers.call_Instanceof(stream, Components.interfaces.nsISeekableStream))
if (!stream || !SpecialPowers.call_Instanceof(stream, SpecialPowers.Ci.nsISeekableStream))
throw "Stream must be seekable";
// the following is a no-op, but should not throw an exception
stream.seek(Components.interfaces.nsISeekableStream.NS_SEEK_CUR, 0);
stream.seek(SpecialPowers.Ci.nsISeekableStream.NS_SEEK_CUR, 0);
}
ok(true, "xhr is seekable");

View File

@ -98,7 +98,7 @@ addLoadEvent(function() {
var xhr = new XMLHttpRequest();
xhr.open("POST", document.location.href);
xhr.send(createDoc());
is(SpecialPowers.wrap(xhr).channel.QueryInterface(Components.interfaces.nsIHttpChannel)
is(SpecialPowers.wrap(xhr).channel.QueryInterface(SpecialPowers.Ci.nsIHttpChannel)
.getRequestHeader("Content-Type"),
"application/xml; charset=UTF-8", "Testing correct type on the wire");
xhr.abort();

View File

@ -62,14 +62,10 @@ function maybeStop(evt) {
}
function openXHR(xhr, method, url, privileged) {
try {
if (privileged) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
} catch (ex) {
ok(false, ex);
}
xhr.open(method, url);
if (privileged)
SpecialPowers.wrap(xhr).open(method, url);
else
xhr.open(method, url);
}
function start(obj) {
@ -175,8 +171,8 @@ for (var largeLength = 0; largeLength < (0x0000FFFF + 2); ++largeLength) {
large += "A";
}
const XHR = Components.interfaces.nsIXMLHttpRequest;
const UPLOAD = Components.interfaces.nsIXMLHttpRequestUpload;
const XHR = SpecialPowers.Ci.nsIXMLHttpRequest;
const UPLOAD = SpecialPowers.Ci.nsIXMLHttpRequestUpload;
var tests =
[

View File

@ -32,9 +32,9 @@ function testHTMLDocuments(ids, isXHTML) {
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
ok(!doc1.documentElement, "Document shouldn't have document element!");
is(doc1.body, null, "Shouldn't have .body!");
ok(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument,
ok(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument,
"Document should be an HTML document!");
ok(!(doc1 instanceof Components.interfaces.nsIDOMSVGDocument),
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument),
"Document shouldn't be an SVG document!");
var docType2 =
@ -68,9 +68,9 @@ function testSVGDocument() {
var doc1 = document.implementation.createDocument(null, null, docType1);
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
ok(!doc1.documentElement, "Document shouldn't have document element!");
ok(!(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument),
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument),
"Document shouldn't be an HTML document!");
ok(doc1 instanceof Components.interfaces.nsIDOMSVGDocument,
ok(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument,
"Document should be an SVG document!");
// SVG documents have .rootElement.
@ -95,9 +95,9 @@ function testFooBarDocument() {
var doc1 = document.implementation.createDocument(null, null, docType1);
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
ok(!doc1.documentElement, "Document shouldn't have document element!");
ok(!(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument),
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument),
"Document shouldn't be an HTML document!");
ok(!(doc1 instanceof Components.interfaces.nsIDOMSVGDocument),
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument),
"Document shouldn't be an SVG document!");
var docType2 =
@ -112,9 +112,9 @@ function testFooBarDocument() {
function testNullDocTypeDocument() {
var doc1 = document.implementation.createDocument(null, null, null);
ok(!doc1.documentElement, "Document shouldn't have document element!");
ok(!(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument),
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument),
"Document shouldn't be an HTML document!");
ok(!(doc1 instanceof Components.interfaces.nsIDOMSVGDocument),
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument),
"Document shouldn't be an SVG document!");
var doc2 = document.implementation.createDocument("FooBarNS",

View File

@ -17,7 +17,7 @@ var path = "http://mochi.test:8888/tests/content/base/test/";
function fromCache(xhr)
{
var ch = SpecialPowers.wrap(xhr).channel.QueryInterface(Components.interfaces.nsICachingChannel);
var ch = SpecialPowers.wrap(xhr).channel.QueryInterface(SpecialPowers.Ci.nsICachingChannel);
return ch.isFromCache();
}

View File

@ -11,9 +11,9 @@
var url = "bug482935.sjs";
function clearCache() {
SpecialPowers.wrap(Components).classes["@mozilla.org/network/cache-service;1"].
getService(Components.interfaces.nsICacheService).
evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
SpecialPowers.Cc["@mozilla.org/network/cache-service;1"].
getService(SpecialPowers.Ci.nsICacheService).
evictEntries(SpecialPowers.Ci.nsICache.STORE_ANYWHERE);
}
// Tests that the response is cached if the request is cancelled

View File

@ -19,7 +19,7 @@ function setPass(aNode) {
SimpleTest.waitForExplicitFinish();
window.addEventListener("load", function() {
const nsIDOMNodeFilter = Components.interfaces.nsIDOMNodeFilter;
const nsIDOMNodeFilter = SpecialPowers.Ci.nsIDOMNodeFilter;
var walker = document.createTreeWalker(
document,
nsIDOMNodeFilter.SHOW_TEXT | nsIDOMNodeFilter.SHOW_DOCUMENT,

View File

@ -56,7 +56,7 @@ for (i = 0; i < headers.length; i++)
request.setRequestHeader(headers[i], "test" + i);
// Read out headers
var channel = SpecialPowers.wrap(request).channel.QueryInterface(Components.interfaces.nsIHttpChannel);
var channel = SpecialPowers.wrap(request).channel.QueryInterface(SpecialPowers.Ci.nsIHttpChannel);
for (i = 0; i < headers.length; i++) {
// Retrieving Content-Length will throw an exception
var value = null;
@ -69,14 +69,13 @@ for (i = 0; i < headers.length; i++) {
}
// Try setting headers in privileged context
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
request = new XMLHttpRequest();
request = SpecialPowers.wrap(new XMLHttpRequest());
request.open("GET", window.location.href);
for (i = 0; i < headers.length; i++)
request.setRequestHeader(headers[i], "test" + i);
// Read out headers
var channel = SpecialPowers.wrap(request).channel.QueryInterface(Components.interfaces.nsIHttpChannel);
var channel = request.channel.QueryInterface(SpecialPowers.Ci.nsIHttpChannel);
for (i = 0; i < headers.length; i++) {
var value = channel.getRequestHeader(headers[i]);
is(value, "test" + i, "Setting " + headers[i] + " header in privileged context");

View File

@ -6,14 +6,14 @@
<script>
SimpleTest.waitForExplicitFinish();
const Cc = SpecialPowers.wrap(Components).classes;
const Cr = SpecialPowers.wrap(Components).results;
const Cc = SpecialPowers.Cc;
const Cr = SpecialPowers.Cr;
function IsD2DEnabled() {
var enabled = false;
try {
enabled = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).D2DEnabled;
enabled = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).D2DEnabled;
} catch(e) {}
return enabled;
@ -29,7 +29,7 @@ function IsMacOSX10_5orOlder() {
if (navigator.platform.indexOf("Mac") == 0) {
var version = Cc["@mozilla.org/system-info;1"]
.getService(Components.interfaces.nsIPropertyBag2)
.getService(SpecialPowers.Ci.nsIPropertyBag2)
.getProperty("version");
// the next line is correct: Mac OS 10.6 corresponds to Darwin version 10 !
// Mac OS 10.5 would be Darwin version 9. the |version| string we've got here
@ -44,7 +44,7 @@ function IsAzureEnabled() {
var enabled = false;
try {
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
var backend = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo().AzureCanvasBackend;
enabled = (backend != "none");
} catch (e) { }
@ -55,7 +55,7 @@ function IsAzureSkia() {
var enabled = false;
try {
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
var backend = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo().AzureCanvasBackend;
enabled = (backend == "skia");
} catch (e) { }
@ -66,7 +66,7 @@ function IsAzureCairo() {
var enabled = false;
try {
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
var backend = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo().AzureCanvasBackend;
enabled = (backend == "cairo");
} catch (e) { }

View File

@ -122,6 +122,7 @@ nsIDocument* nsEventStateManager::sMouseOverDocument = nullptr;
nsWeakFrame nsEventStateManager::sLastDragOverFrame = nullptr;
nsIntPoint nsEventStateManager::sLastRefPoint = nsIntPoint(0,0);
nsIntPoint nsEventStateManager::sLastScreenPoint = nsIntPoint(0,0);
nsIntPoint nsEventStateManager::sSynthCenteringPoint = nsIntPoint(-1,-1);
nsIntPoint nsEventStateManager::sLastClientPoint = nsIntPoint(0,0);
bool nsEventStateManager::sIsPointerLocked = false;
// Reference to the pointer locked element.
@ -383,12 +384,11 @@ CanScrollOn(nsIScrollableFrame* aScrollFrame, double aDeltaX, double aDeltaY)
nsPoint scrollPt = aScrollFrame->GetScrollPosition();
nsRect scrollRange = aScrollFrame->GetScrollRange();
nscoord oneDevPixel =
aScrollFrame->GetScrolledFrame()->PresContext()->AppUnitsPerDevPixel();
uint32_t directions = aScrollFrame->GetPerceivedScrollingDirections();
return (aDeltaX && scrollRange.width >= oneDevPixel &&
return (aDeltaX && (directions & nsIScrollableFrame::HORIZONTAL) &&
CanScrollInRange(scrollRange.x, scrollPt.x, scrollRange.XMost(), aDeltaX)) ||
(aDeltaY && scrollRange.height >= oneDevPixel &&
(aDeltaY && (directions & nsIScrollableFrame::VERTICAL) &&
CanScrollInRange(scrollRange.y, scrollPt.y, scrollRange.YMost(), aDeltaY));
}
@ -4090,7 +4090,8 @@ nsEventStateManager::NotifyMouseOver(nsGUIEvent* aEvent, nsIContent* aContent)
// Returns the center point of the window's inner content area.
// This is in widget coordinates, i.e. relative to the widget's top
// left corner, not in screen coordinates.
// left corner, not in screen coordinates, the same units that
// nsDOMUIEvent::refPoint is in.
static nsIntPoint
GetWindowInnerRectCenter(nsPIDOMWindow* aWindow,
nsIWidget* aWidget,
@ -4132,18 +4133,36 @@ nsEventStateManager::GenerateMouseEnterExit(nsGUIEvent* aEvent)
switch(aEvent->message) {
case NS_MOUSE_MOVE:
{
// Mouse movement is reported on the MouseEvent.movement{X,Y} fields.
// Movement is calculated in nsDOMUIEvent::GetMovementPoint() as:
// previous_mousemove_refPoint - current_mousemove_refPoint.
if (sIsPointerLocked && aEvent->widget) {
// Perform mouse lock by recentering the mouse directly, and storing
// the refpoints so movement deltas can be calculated.
// The pointer is locked. If the pointer is not located at the center of
// the window, dispatch a synthetic mousemove to return the pointer there.
// Doing this between "real" pointer moves gives the impression that the
// (locked) pointer can continue moving and won't stop at the screen
// boundary. We cancel the synthetic event so that we don't end up
// dispatching the centering move event to content.
nsIntPoint center = GetWindowInnerRectCenter(mDocument->GetWindow(),
aEvent->widget,
mPresContext);
aEvent->lastRefPoint = center;
if (aEvent->refPoint != center) {
// This mouse move doesn't finish at the center of the widget,
// dispatch a synthetic mouse move to return the mouse back to
// the center.
aEvent->widget->SynthesizeNativeMouseMove(center);
// Mouse move doesn't finish at the center of the window. Dispatch a
// synthetic native mouse event to move the pointer back to the center
// of the window, to faciliate more movement. But first, record that
// we've dispatched a synthetic mouse movement, so we can cancel it
// in the other branch here.
sSynthCenteringPoint = center;
aEvent->widget->SynthesizeNativeMouseMove(
center + aEvent->widget->WidgetToScreenOffset());
} else if (aEvent->refPoint == sSynthCenteringPoint) {
// This is the "synthetic native" event we dispatched to re-center the
// pointer. Cancel it so we don't expose the centering move to content.
aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
// Clear sSynthCenteringPoint so we don't cancel other events
// targeted at the center.
sSynthCenteringPoint = nsIntPoint(-1,-1);
}
} else {
aEvent->lastRefPoint = sLastRefPoint;
@ -4215,7 +4234,8 @@ nsEventStateManager::SetPointerLock(nsIWidget* aWidget,
sLastRefPoint = GetWindowInnerRectCenter(aElement->OwnerDoc()->GetWindow(),
aWidget,
mPresContext);
aWidget->SynthesizeNativeMouseMove(sLastRefPoint);
aWidget->SynthesizeNativeMouseMove(
sLastRefPoint + aWidget->WidgetToScreenOffset());
// Retarget all events to this element via capture.
nsIPresShell::SetCapturingContent(aElement, CAPTURE_POINTERLOCK);
@ -4230,7 +4250,8 @@ nsEventStateManager::SetPointerLock(nsIWidget* aWidget,
// pre-pointerlock position, so that the synthetic mouse event reports
// no movement.
sLastRefPoint = mPreLockPoint;
aWidget->SynthesizeNativeMouseMove(mPreLockPoint);
aWidget->SynthesizeNativeMouseMove(
mPreLockPoint + aWidget->WidgetToScreenOffset());
// Don't retarget events to this element any more.
nsIPresShell::SetCapturingContent(nullptr, CAPTURE_POINTERLOCK);

View File

@ -697,6 +697,13 @@ private:
// after unlocking.
nsIntPoint mPreLockPoint;
// Stores the refPoint of the last synthetic mouse move we dispatched
// to re-center the mouse when we were pointer locked. If this is (-1,-1) it
// means we've not recently dispatched a centering event. We use this to
// detect when we receive the synth event, so we can cancel and not send it
// to content.
static nsIntPoint sSynthCenteringPoint;
nsWeakFrame mCurrentTarget;
nsCOMPtr<nsIContent> mCurrentTargetContent;
nsWeakFrame mLastMouseOverFrame;

View File

@ -19,8 +19,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
/** Test for Bug 409604 **/
var modifier = Components.interfaces.nsIDOMEvent.ALT_MASK |
Components.interfaces.nsIDOMEvent.SHIFT_MASK;
var modifier = SpecialPowers.Ci.nsIDOMEvent.ALT_MASK |
SpecialPowers.Ci.nsIDOMEvent.SHIFT_MASK;
var expectedFocus = "a,c,d,e,f,g,h,i,j,k,l,m,n,p,x,y";
// XXX the "map" test is causing trouble, see bug 433089
var focusArray = expectedFocus.split(",");

View File

@ -23,12 +23,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=448602
function runTests() {
/*
Disabled due to lack of present support for JSD in JM
var jsdIDebuggerService = Components.interfaces.jsdIDebuggerService;
var jsd = Components.classes['@mozilla.org/js/jsd/debugger-service;1']
var jsdIDebuggerService = SpecialPowers.Ci.jsdIDebuggerService;
var jsd = SpecialPowers.Components.classes['@mozilla.org/js/jsd/debugger-service;1']
.getService(jsdIDebuggerService);
*/
var els = SpecialPowers.wrap(Components).classes["@mozilla.org/eventlistenerservice;1"]
.getService(Components.interfaces.nsIEventListenerService);
var els = SpecialPowers.Cc["@mozilla.org/eventlistenerservice;1"]
.getService(SpecialPowers.Ci.nsIEventListenerService);
// Event listener info tests
var root = document.getElementById("testroot");
@ -53,7 +53,7 @@ function runTests() {
jsd.on();
ok(jsd.isOn, "JSD should be running.");
}
var jsdvalue = infos[0].getDebugObject().QueryInterface(Components.interfaces.jsdIValue);
var jsdvalue = infos[0].getDebugObject().QueryInterface(SpecialPowers.Ci.jsdIValue);
is(jsdvalue.jsType, 3, "Event listener should be a function! (1)");
*/
@ -72,7 +72,7 @@ function runTests() {
is(infos[0].capturing, true, "Wrong phase (2)");
is(infos[0].allowsUntrusted, true, "Should allow untrusted events (2)");
/*
jsdvalue = infos[0].getDebugObject().QueryInterface(Components.interfaces.jsdIValue);
jsdvalue = infos[0].getDebugObject().QueryInterface(SpecialPowers.Ci.jsdIValue);
is(jsdvalue.jsType, 3, "Event listener should be a function!(2)");
is(jsdvalue.getWrappedValue(), l, "Wrong JS value! (1)");
*/
@ -84,7 +84,7 @@ function runTests() {
is(infos[1].allowsUntrusted, false, "Shouldn't allow untrusted events (1)");
/*
jsdvalue2 = infos[1].getDebugObject().QueryInterface(Components.interfaces.jsdIValue);
jsdvalue2 = infos[1].getDebugObject().QueryInterface(SpecialPowers.Ci.jsdIValue);
is(jsdvalue2.jsType, 3, "Event listener should be a function! (3)");
is(jsdvalue2.getWrappedValue(), l, "Wrong JS value! (2)");
*/

View File

@ -40,7 +40,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493251
var utils = SpecialPowers.getDOMWindowUtils(win);
ok(true, "Dipatching key event: type=" + type);
utils.sendKeyEvent(type,
Components.interfaces.nsIDOMKeyEvent.DOM_VK_A,
SpecialPowers.Ci.nsIDOMKeyEvent.DOM_VK_A,
0, 0);
}
@ -82,8 +82,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493251
}
ok(true, aEvent.type + " event is handled: " + detail);
var fm = SpecialPowers.wrap(Components).classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager);
var fm = SpecialPowers.Cc["@mozilla.org/focus-manager;1"].
getService(SpecialPowers.Ci.nsIFocusManager);
ok(true, "focused element is \"" + fm.focusedElement +
"\" and focused window is \"" + fm.focusedWindow +
"\" (the testing window is \"" + win + "\"");

View File

@ -36,7 +36,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=545268
function dispatchKeyEvent(type) {
var utils = SpecialPowers.getDOMWindowUtils(subwin);
utils.sendKeyEvent(type,
Components.interfaces.nsIDOMKeyEvent.DOM_VK_A,
SpecialPowers.Ci.nsIDOMKeyEvent.DOM_VK_A,
0, 0);
}

View File

@ -26,8 +26,8 @@ function prepareListener(eventName, expectedValue) {
};
}
const INPUT_SOURCE_UNKNOWN = Components.interfaces.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
const INPUT_SOURCE_KEYBOARD = Components.interfaces.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
const INPUT_SOURCE_UNKNOWN = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
const INPUT_SOURCE_KEYBOARD = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
function doTest() {
var eventNames = [

View File

@ -29,13 +29,13 @@ function check(event) {
function doTest() {
setup();
expectedInputSource = Components.interfaces.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
testKeyboard();
expectedInputSource = Components.interfaces.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
testMouse();
expectedInputSource = Components.interfaces.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
testScriptedClicks();
cleanup();

View File

@ -18,8 +18,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=402089
function getListenerCount() {
var Cc = SpecialPowers.wrap(Components).classes;
var Ci = SpecialPowers.wrap(Components).interfaces;
var Cc = SpecialPowers.Cc;
var Ci = SpecialPowers.Ci;
var dss = Cc["@mozilla.org/devicesensors;1"].getService(Ci.nsIDeviceSensors);
return dss.listenerCount(Ci.nsIDeviceSensorData.TYPE_ORIENTATION);

View File

@ -11,6 +11,7 @@
#include "nsIDocument.h"
#include "jsfriendapi.h"
#include "nsContentUtils.h"
#include "nsJSUtils.h"
using namespace mozilla::dom;
@ -93,9 +94,18 @@ nsHTMLAudioElement::Initialize(nsISupports* aOwner, JSContext* aContext,
return NS_OK;
}
// The only (optional) argument is the src of the audio (which can
// be a URL string or a MediaStream object)
return SetSrc(aContext, argv[0]);
// The only (optional) argument is the url of the audio
JSString* jsstr = JS_ValueToString(aContext, argv[0]);
if (!jsstr)
return NS_ERROR_FAILURE;
nsDependentJSString str;
if (!str.init(aContext, jsstr))
return NS_ERROR_FAILURE;
// The only (optional) argument is the src of the audio (which must
// be a URL string), used to initialize the 'src' attribute.
return SetSrc(str);
}
NS_IMETHODIMP

View File

@ -429,6 +429,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsHTMLMediaElement)
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
// nsIDOMHTMLMediaElement
NS_IMPL_URI_ATTR(nsHTMLMediaElement, Src, src)
NS_IMPL_STRING_ATTR(nsHTMLMediaElement, Crossorigin, crossorigin)
NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Controls, controls)
NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Autoplay, autoplay)
NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Loop, loop)
@ -436,47 +438,38 @@ NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, DefaultMuted, muted)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLMediaElement, Preload, preload, NULL)
NS_IMETHODIMP
nsHTMLMediaElement::GetSrc(JSContext* aCtx, jsval *aParams)
nsHTMLMediaElement::GetMozSrcObject(JSContext* aCtx, jsval *aParams)
{
if (mSrcAttrStream) {
NS_ASSERTION(mSrcAttrStream->GetStream(), "MediaStream should have been set up properly");
return nsContentUtils::WrapNative(aCtx, JS_GetGlobalForScopeChain(aCtx),
mSrcAttrStream, aParams);
}
nsAutoString str;
nsresult rv = GetURIAttr(nsGkAtoms::src, nullptr, str);
NS_ENSURE_SUCCESS(rv, rv);
if (!xpc::StringToJsval(aCtx, str, aParams)) {
return NS_ERROR_FAILURE;
}
*aParams = JSVAL_NULL;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLMediaElement::SetSrc(JSContext* aCtx, const jsval & aParams)
nsHTMLMediaElement::SetMozSrcObject(JSContext* aCtx, const jsval & aParams)
{
if (aParams.isNull()) {
mSrcAttrStream = nullptr;
Load();
return NS_OK;
}
if (aParams.isObject()) {
nsCOMPtr<nsIDOMMediaStream> stream;
stream = do_QueryInterface(nsContentUtils::XPConnect()->
GetNativeOfWrapper(aCtx, JSVAL_TO_OBJECT(aParams)));
if (stream) {
mSrcAttrStream = static_cast<nsDOMMediaStream*>(stream.get());
UnsetAttr(kNameSpaceID_None, nsGkAtoms::src, true);
Load();
return NS_OK;
}
}
mSrcAttrStream = nullptr;
JSString* jsStr = JS_ValueToString(aCtx, aParams);
if (!jsStr)
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
nsDependentJSString str;
if (!str.init(aCtx, jsStr))
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
// Will trigger Load()
return SetAttrHelper(nsGkAtoms::src, str);
// Should we store unsupported values on the element's attribute anyway?
// Let's not.
return NS_OK;
}
/* readonly attribute nsIDOMHTMLMediaElement mozAutoplayEnabled; */
@ -1434,6 +1427,7 @@ nsHTMLMediaElement::GetMozSampleRate(uint32_t *aMozSampleRate)
typedef struct {
JSContext* cx;
JSObject* tags;
bool error;
} MetadataIterCx;
PLDHashOperator
@ -1449,6 +1443,7 @@ nsHTMLMediaElement::BuildObjectFromTags(nsCStringHashKey::KeyType aKey,
if (!JS_DefineProperty(args->cx, args->tags, aKey.Data(), value,
NULL, NULL, JSPROP_ENUMERATE)) {
NS_WARNING("Failed to set metadata property");
args->error = true;
return PL_DHASH_STOP;
}
@ -1467,11 +1462,9 @@ nsHTMLMediaElement::MozGetMetadata(JSContext* cx, JS::Value* aValue)
return NS_ERROR_FAILURE;
}
if (mTags) {
MetadataIterCx iter = {cx, tags};
uint32_t ret = mTags->EnumerateRead(BuildObjectFromTags,
static_cast<void*>(&iter));
LOG(PR_LOG_DEBUG, ("tag enumerator returned %d", ret));
if (ret == PL_DHASH_STOP) {
MetadataIterCx iter = {cx, tags, false};
mTags->EnumerateRead(BuildObjectFromTags, static_cast<void*>(&iter));
if (iter.error) {
NS_WARNING("couldn't create metadata object!");
return NS_ERROR_FAILURE;
}
@ -1851,8 +1844,6 @@ NS_IMETHODIMP nsHTMLMediaElement::Play()
return NS_OK;
}
NS_IMPL_STRING_ATTR(nsHTMLMediaElement, Crossorigin, crossorigin)
bool nsHTMLMediaElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
@ -2542,8 +2533,11 @@ class nsHTMLMediaElement::StreamListener : public MediaStreamListener {
public:
StreamListener(nsHTMLMediaElement* aElement) :
mElement(aElement),
mHaveCurrentData(false),
mBlocked(false),
mMutex("nsHTMLMediaElement::StreamListener"),
mPendingNotifyOutput(false)
mPendingNotifyOutput(false),
mDidHaveCurrentData(false)
{}
void Forget() { mElement = nullptr; }
@ -2554,17 +2548,22 @@ public:
mElement->PlaybackEnded();
}
}
void UpdateReadyStateForData()
{
if (mElement && mHaveCurrentData) {
mElement->UpdateReadyStateForData(
mBlocked ? NEXT_FRAME_UNAVAILABLE_BUFFERING : NEXT_FRAME_AVAILABLE);
}
}
void DoNotifyBlocked()
{
if (mElement) {
mElement->UpdateReadyStateForData(NEXT_FRAME_UNAVAILABLE_BUFFERING);
}
mBlocked = true;
UpdateReadyStateForData();
}
void DoNotifyUnblocked()
{
if (mElement) {
mElement->UpdateReadyStateForData(NEXT_FRAME_AVAILABLE);
}
mBlocked = false;
UpdateReadyStateForData();
}
void DoNotifyOutput()
{
@ -2572,10 +2571,19 @@ public:
MutexAutoLock lock(mMutex);
mPendingNotifyOutput = false;
}
if (mElement) {
if (mElement && mHaveCurrentData) {
mElement->FireTimeUpdate(true);
}
}
void DoNotifyHaveCurrentData()
{
mHaveCurrentData = true;
if (mElement) {
mElement->FirstFrameLoaded(false);
}
UpdateReadyStateForData();
DoNotifyOutput();
}
// These notifications run on the media graph thread so we need to
// dispatch events to the main thread.
@ -2595,6 +2603,22 @@ public:
NS_NewRunnableMethod(this, &StreamListener::DoNotifyFinished);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event);
}
virtual void NotifyHasCurrentData(MediaStreamGraph* aGraph,
bool aHasCurrentData)
{
MutexAutoLock lock(mMutex);
if (mDidHaveCurrentData == aHasCurrentData)
return;
mDidHaveCurrentData = aHasCurrentData;
// Ignore the case where aHasCurrentData is false. If aHasCurrentData
// changes from true to false, we don't worry about it. Video elements
// preserve the last played frame anyway.
if (aHasCurrentData) {
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(this, &StreamListener::DoNotifyHaveCurrentData);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event);
}
}
virtual void NotifyOutput(MediaStreamGraph* aGraph)
{
MutexAutoLock lock(mMutex);
@ -2607,10 +2631,15 @@ public:
}
private:
// These fields may only be accessed on the main thread
nsHTMLMediaElement* mElement;
bool mHaveCurrentData;
bool mBlocked;
// mMutex protects the fields below; they can be accessed on any thread
Mutex mMutex;
bool mPendingNotifyOutput;
bool mDidHaveCurrentData;
};
void nsHTMLMediaElement::SetupSrcMediaStreamPlayback()
@ -2638,7 +2667,11 @@ void nsHTMLMediaElement::SetupSrcMediaStreamPlayback()
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
DispatchAsyncEvent(NS_LITERAL_STRING("durationchange"));
DispatchAsyncEvent(NS_LITERAL_STRING("loadedmetadata"));
ResourceLoaded();
DispatchAsyncEvent(NS_LITERAL_STRING("suspend"));
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_IDLE;
AddRemoveSelfReference();
// FirstFrameLoaded(false) will be called when the stream has current data,
// to complete the setup by entering the HAVE_CURRENT_DATA state.
}
void nsHTMLMediaElement::EndSrcMediaStreamPlayback()
@ -2769,6 +2802,8 @@ void nsHTMLMediaElement::FirstFrameLoaded(bool aResourceFullyLoaded)
void nsHTMLMediaElement::ResourceLoaded()
{
NS_ASSERTION(!mSrcStream, "Don't call this for streams");
mBegun = false;
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_IDLE;
AddRemoveSelfReference();

View File

@ -34,7 +34,7 @@ var escKeyReceived = false;
var escKeySent = false;
function keyHandler(event) {
if (escKeyReceived == Components.interfaces.nsIDOMKeyEvent.DOM_VK_ESC) {
if (escKeyReceived == SpecialPowers.Ci.nsIDOMKeyEvent.DOM_VK_ESC) {
escKeyReceived = true;
}
}

View File

@ -107,8 +107,7 @@ for each (var data in types) {
.getService(Components.interfaces.nsIProperties);
var file = dirSvc.get("ProfD", Components.interfaces.nsIFile);
file.append('635499_file');
var outStream = Components.
classes["@mozilla.org/network/file-output-stream;1"].
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
outStream.init(file, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);

View File

@ -107,8 +107,7 @@ for each (var data in types) {
.getService(Components.interfaces.nsIProperties);
var file = dirSvc.get("ProfD", Components.interfaces.nsIFile);
file.append('635499_file');
var outStream = Components.
classes["@mozilla.org/network/file-output-stream;1"].
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
outStream.init(file, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);

View File

@ -307,8 +307,7 @@ function checkInputRequiredValidityForFile()
.getService(Components.interfaces.nsIProperties);
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
testFile.append(fileName);
var outStream = Components.
classes["@mozilla.org/network/file-output-stream;1"].
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);

View File

@ -101,8 +101,7 @@ for each (var data in types) {
.getService(Components.interfaces.nsIProperties);
var file = dirSvc.get("ProfD", Components.interfaces.nsIFile);
file.append('635499_file');
var outStream = Components.
classes["@mozilla.org/network/file-output-stream;1"].
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
outStream.init(file, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);

View File

@ -26,10 +26,9 @@ var fullPath;
function initVals() {
var dirSvc = SpecialPowers.wrap(Components)
.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
var file = dirSvc.get("XpcomLib", Components.interfaces.nsILocalFile);
var dirSvc = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"]
.getService(SpecialPowers.Ci.nsIProperties);
var file = dirSvc.get("XpcomLib", SpecialPowers.Ci.nsILocalFile);
isnot(file, null, "Must have file here");
leafName = file.leafName;

View File

@ -45,7 +45,7 @@ function HTML_TAG(aTagName, aImplClass) {
"nsISupportsWeakReference" ];
var interfaceName = "nsIDOM" + getClassName(aTagName);
if (interfaceName in Components.interfaces) { // no nsIDOMHTMLSpanElement
if (interfaceName in SpecialPowers.Ci) { // no nsIDOMHTMLSpanElement
interfaces[aTagName].push(interfaceName);
interfacesNonClassinfo[aTagName].push("nsIDOMHTMLElement");
} else {
@ -54,7 +54,7 @@ function HTML_TAG(aTagName, aImplClass) {
}
var interfaceNameNS = "nsIDOMNS" + getClassName(aTagName);
if (interfaceNameNS in Components.interfaces) {
if (interfaceNameNS in SpecialPowers.Ci) {
interfaces[aTagName].push(interfaceNameNS);
}
@ -245,24 +245,24 @@ for each (var tag in allTags) {
tagName(tag) + " not an instance of " + classInfos[tag]);
is(node instanceof HTMLUnknownElement, false,
tagName(tag) + " is an instance of HTMLUnknownElement");
is(node instanceof Components.interfaces.nsIDOMHTMLUnknownElement, false,
is(node instanceof SpecialPowers.Ci.nsIDOMHTMLUnknownElement, false,
tagName(tag) + " is an instance of nsIDOMHTMLUnknownElement");
// Check that each node QIs to all the things we expect it to QI to
for each (var iface in interfaces[tag].concat(interfacesNonClassinfo[tag])) {
is(iface in Components.interfaces, true,
is(iface in SpecialPowers.Ci, true,
iface + " not in Components.interfaces");
is(node instanceof Components.interfaces[iface], true,
is(node instanceof SpecialPowers.Ci[iface], true,
tagName(tag) + " does not QI to " + iface);
}
// Now see what classinfo reports
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var nodeClassInfo = node.QueryInterface(Components.interfaces.nsIClassInfo);
var nodeClassInfo = SpecialPowers.wrap(node).QueryInterface(SpecialPowers.Ci.nsIClassInfo);
var count = {};
var classInfoInterfaces =
nodeClassInfo.getInterfaces(count).
map(function(id) { return Components.interfacesByID[id].toString(); });
map(function(id) { return SpecialPowers.Components.interfacesByID[id].toString(); });
// Make sure that we know about all the things classinfo claims
for each (var classInfoInterface in classInfoInterfaces) {

View File

@ -44,13 +44,12 @@ function setFileInputs () {
}
function createFileWithData(fileName, fileData) {
var dirSvc = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
var dirSvc = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"]
.getService(SpecialPowers.Ci.nsIProperties);
var testFile = dirSvc.get("ProfD", SpecialPowers.Ci.nsIFile);
testFile.append(fileName);
var outStream = SpecialPowers.wrap(Components).
classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
var outStream = SpecialPowers.Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(SpecialPowers.Ci.nsIFileOutputStream);
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);
outStream.write(fileData, fileData.length);

View File

@ -39,8 +39,7 @@ function createFileWithData(fileName, fileData) {
.getService(Components.interfaces.nsIProperties);
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
testFile.append(fileName);
var outStream = Components.
classes["@mozilla.org/network/file-output-stream;1"].
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);

View File

@ -22,8 +22,7 @@ function createFileWithData(fileName, fileData)
.getService(Components.interfaces.nsIProperties);
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
testFile.append(fileName);
var outStream = Components.
classes["@mozilla.org/network/file-output-stream;1"].
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);

View File

@ -26,11 +26,11 @@ SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var viewer =
SpecialPowers.wrap(frame.contentWindow
.QueryInterface(Components.interfaces.nsIInterfaceRequestor))
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShell)
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor))
.getInterface(SpecialPowers.Ci.nsIWebNavigation)
.QueryInterface(SpecialPowers.Ci.nsIDocShell)
.contentViewer
.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
.QueryInterface(SpecialPowers.Ci.nsIMarkupDocumentViewer);
viewer.fullZoom = 1.5;

View File

@ -294,6 +294,10 @@ public:
* Get the current audio position of the stream's audio output.
*/
GraphTime GetAudioPosition(MediaStream* aStream);
/**
* Call NotifyHaveCurrentData on aStream's listeners.
*/
void NotifyHasCurrentData(MediaStream* aStream);
/**
* If aStream needs an audio stream but doesn't have one, create it.
* If aStream doesn't need an audio stream but has one, destroy it.
@ -1106,6 +1110,16 @@ MediaStreamGraphImpl::RecomputeBlockingAt(const nsTArray<MediaStream*>& aStreams
}
}
void
MediaStreamGraphImpl::NotifyHasCurrentData(MediaStream* aStream)
{
for (uint32_t j = 0; j < aStream->mListeners.Length(); ++j) {
MediaStreamListener* l = aStream->mListeners[j];
l->NotifyHasCurrentData(this,
GraphTimeToStreamTime(aStream, mCurrentTime) < aStream->mBuffer.GetEnd());
}
}
void
MediaStreamGraphImpl::CreateOrDestroyAudioStreams(GraphTime aAudioOutputStartTime,
MediaStream* aStream)
@ -1397,6 +1411,7 @@ MediaStreamGraphImpl::RunThread()
GraphTimeToStreamTime(stream, mStateComputedTime),
"Stream did not produce enough data");
}
NotifyHasCurrentData(stream);
CreateOrDestroyAudioStreams(prevComputedTime, stream);
PlayAudio(stream, prevComputedTime, mStateComputedTime);
audioStreamsActive += stream->mAudioOutputStreams.Length();

View File

@ -127,6 +127,12 @@ public:
*/
virtual void NotifyBlockingChanged(MediaStreamGraph* aGraph, Blocking aBlocked) {}
/**
* Notify that the stream has (or does not have) data in each track
* for the stream's current time.
*/
virtual void NotifyHasCurrentData(MediaStreamGraph* aGraph, bool aHasCurrentData) {}
/**
* Notify that the stream output is advancing.
*/

View File

@ -129,6 +129,7 @@ MOCHITEST_FILES = \
test_seekLies.html \
test_media_sniffer.html \
contentType.sjs \
test_streams_srcObject.html \
$(NULL)
$(warning test_error_in_video_document.html is disabled for intermittent failures. Bug 608634)

View File

@ -175,9 +175,9 @@ function fileUriToSrc(path, mustExist) {
if (navigator.appVersion.indexOf("Android") != -1)
return path;
const Ci = Components.interfaces;
const Cc = SpecialPowers.wrap(Components).classes;
const Cr = SpecialPowers.wrap(Components).results;
const Ci = SpecialPowers.Ci;
const Cc = SpecialPowers.Cc;
const Cr = SpecialPowers.Cr;
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
var f = dirSvc.get("CurWorkD", Ci.nsILocalFile);
@ -352,6 +352,10 @@ var gMetadataTests = [
}
},
{ name:"sound.ogg", tags: { } },
{ name:"small-shot.ogg", tags: {
title:"Pew SFX"
}
},
{ name:"badtags.ogg", tags: {
// We list only the valid tags here, and verify
// the invalid ones are filtered out.
@ -536,9 +540,9 @@ function mediaTestCleanup() {
(function() {
// Ensure that preload preferences are comsistent
var prefService = SpecialPowers.wrap(Components)
var prefService = SpecialPowers.wrap(SpecialPowers.Components)
.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
.getService(SpecialPowers.Ci.nsIPrefService);
var branch = prefService.getBranch("media.");
var oldDefault = 2;
var oldAuto = 3;

Binary file not shown.

View File

@ -31,8 +31,8 @@ function startTest(test, token) {
v.src = test.name;
var stream = v.mozCaptureStreamUntilEnded();
is(stream.currentTime, 0, test.name + " stream initial currentTime");
vout.src = stream;
is(vout.src, stream, test.name + " set output element .src correctly");
vout.mozSrcObject = stream;
is(vout.mozSrcObject, stream, test.name + " set output element .srcObject correctly");
var checkEnded = function(test, vout, stream) { return function() {
is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime");

View File

@ -17,8 +17,8 @@ SimpleTest.waitForExplicitFinish();
var v = document.getElementById('v');
var vout = document.getElementById('vout');
var vout_untilended = document.getElementById('vout_untilended');
vout.src = v.mozCaptureStream();
vout_untilended.src = v.mozCaptureStreamUntilEnded();
vout.mozSrcObject = v.mozCaptureStream();
vout_untilended.mozSrcObject = v.mozCaptureStreamUntilEnded();
function dumpEvent(event) {
dump("GOT EVENT " + event.type + " currentTime=" + event.target.currentTime +

View File

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test interactions of src and srcObject</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>
<body onload="doTest()">
<audio id="a"></audio>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var a = document.getElementById('a');
a.src = getPlayableAudio(gSmallTests).name;
var b = new Audio();
function doTest() {
var newSrc = a.src + "?2";
b.src = newSrc;
is(b.mozSrcObject, null, "Initial srcObject is null");
var stream = a.mozCaptureStream();
b.mozSrcObject = stream;
is(b.mozSrcObject, stream, "Stream set correctly");
b.mozSrcObject = "invalid";
is(b.mozSrcObject, stream, "Stream not set to invalid value");
is(b.src, newSrc, "src attribute not affected by setting srcObject");
var step = 0;
b.addEventListener("loadedmetadata", function() {
if (step == 0) {
is(b.currentSrc, "", "currentSrc set to empty string while playing srcObject");
b.mozSrcObject = null;
is(b.mozSrcObject, null, "Stream set to null");
// The resource selection algorithm will run again and choose b.src
} else if (step == 1) {
is(b.currentSrc, b.src, "currentSrc set to src now that srcObject is null");
SimpleTest.finish();
}
++step;
});
}
</script>
</pre>
</body>
</html>

View File

@ -855,6 +855,12 @@ nsSVGArcConverter::nsSVGArcConverter(const gfxPoint &from,
bool sweepFlag)
{
const double radPerDeg = M_PI/180.0;
mSegIndex = 0;
if (from == to) {
mNumSegs = 0;
return;
}
// Convert to center parameterization as shown in
// http://www.w3.org/TR/SVG/implnote.html
@ -910,7 +916,6 @@ nsSVGArcConverter::nsSVGArcConverter(const gfxPoint &from,
mT = 8.0/3.0 * sin(mDelta/4.0) * sin(mDelta/4.0) / sin(mDelta/2.0);
mFrom = from;
mSegIndex = 0;
}
bool

View File

@ -48,12 +48,10 @@ obs.prototype = {
if (ir instanceof this.window.Components.interfaces.nsIClassInfo) {
var count = {};
var interfaces = ir.
QueryInterface(this.window.Components
.interfaces.nsIClassInfo).
QueryInterface(this.window.Components.interfaces.nsIClassInfo).
getInterfaces(count).
map(function(id) {
return this.window.Components
.interfacesByID[id].toString();
return this.window.Components.interfacesByID[id].toString();
});
this.window.isnot(interfaces.indexOf("nsIInterfaceRequestor"), -1,
"Must have interface requestor classinfo");

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