mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge fx-team to central, a=merge
This commit is contained in:
commit
f7d8f83c7f
@ -36,12 +36,33 @@ let gFxAccounts = {
|
||||
this.FxAccountsCommon.ONVERIFIED_NOTIFICATION,
|
||||
this.FxAccountsCommon.ONLOGOUT_NOTIFICATION,
|
||||
"weave:notification:removed",
|
||||
this.FxAccountsCommon.ON_PROFILE_CHANGE_NOTIFICATION,
|
||||
];
|
||||
},
|
||||
|
||||
get button() {
|
||||
delete this.button;
|
||||
return this.button = document.getElementById("PanelUI-fxa-status");
|
||||
get panelUIFooter() {
|
||||
delete this.panelUIFooter;
|
||||
return this.panelUIFooter = document.getElementById("PanelUI-footer-fxa");
|
||||
},
|
||||
|
||||
get panelUIStatus() {
|
||||
delete this.panelUIStatus;
|
||||
return this.panelUIStatus = document.getElementById("PanelUI-fxa-status");
|
||||
},
|
||||
|
||||
get panelUIAvatar() {
|
||||
delete this.panelUIAvatar;
|
||||
return this.panelUIAvatar = document.getElementById("PanelUI-fxa-avatar");
|
||||
},
|
||||
|
||||
get panelUILabel() {
|
||||
delete this.panelUILabel;
|
||||
return this.panelUILabel = document.getElementById("PanelUI-fxa-label");
|
||||
},
|
||||
|
||||
get panelUIIcon() {
|
||||
delete this.panelUIIcon;
|
||||
return this.panelUIIcon = document.getElementById("PanelUI-fxa-icon");
|
||||
},
|
||||
|
||||
get strings() {
|
||||
@ -135,6 +156,9 @@ let gFxAccounts = {
|
||||
this.fxaMigrator.recordTelemetry(this.fxaMigrator.TELEMETRY_DECLINED);
|
||||
}
|
||||
break;
|
||||
case this.FxAccountsCommon.ONPROFILE_IMAGE_CHANGE_NOTIFICATION:
|
||||
this.updateUI();
|
||||
break;
|
||||
default:
|
||||
this.updateUI();
|
||||
break;
|
||||
@ -211,59 +235,97 @@ let gFxAccounts = {
|
||||
return;
|
||||
}
|
||||
|
||||
let profileInfoEnabled = false;
|
||||
try {
|
||||
profileInfoEnabled = Services.prefs.getBoolPref("identity.fxaccounts.profile_image.enabled");
|
||||
} catch (e) { }
|
||||
|
||||
// Bail out if FxA is disabled.
|
||||
if (!this.weave.fxAccountsEnabled) {
|
||||
// When migration transitions from needs-verification to the null state,
|
||||
// fxAccountsEnabled is false because migration has not yet finished. In
|
||||
// that case, hide the button. We'll get another notification with a null
|
||||
// state once migration is complete.
|
||||
this.button.hidden = true;
|
||||
this.button.removeAttribute("fxastatus");
|
||||
this.panelUIFooter.removeAttribute("fxastatus");
|
||||
return;
|
||||
}
|
||||
|
||||
// FxA is enabled, show the widget.
|
||||
this.button.hidden = false;
|
||||
|
||||
// Make sure the button is disabled in customization mode.
|
||||
if (this._inCustomizationMode) {
|
||||
this.button.setAttribute("disabled", "true");
|
||||
this.panelUILabel.setAttribute("disabled", "true");
|
||||
this.panelUIAvatar.setAttribute("disabled", "true");
|
||||
this.panelUIIcon.setAttribute("disabled", "true");
|
||||
} else {
|
||||
this.button.removeAttribute("disabled");
|
||||
this.panelUILabel.removeAttribute("disabled");
|
||||
this.panelUIAvatar.removeAttribute("disabled");
|
||||
this.panelUIIcon.removeAttribute("disabled");
|
||||
}
|
||||
|
||||
let defaultLabel = this.button.getAttribute("defaultlabel");
|
||||
let errorLabel = this.button.getAttribute("errorlabel");
|
||||
let defaultLabel = this.panelUIStatus.getAttribute("defaultlabel");
|
||||
let errorLabel = this.panelUIStatus.getAttribute("errorlabel");
|
||||
let signedInTooltiptext = this.panelUIStatus.getAttribute("signedinTooltiptext");
|
||||
|
||||
// If the user is signed into their Firefox account and we are not
|
||||
// currently in customization mode, show their email address.
|
||||
let doUpdate = userData => {
|
||||
let updateWithUserData = (userData) => {
|
||||
// Reset the button to its original state.
|
||||
this.button.setAttribute("label", defaultLabel);
|
||||
this.button.removeAttribute("tooltiptext");
|
||||
this.button.removeAttribute("fxastatus");
|
||||
this.panelUILabel.setAttribute("label", defaultLabel);
|
||||
this.panelUIStatus.removeAttribute("tooltiptext");
|
||||
this.panelUIFooter.removeAttribute("fxastatus");
|
||||
this.panelUIFooter.removeAttribute("fxaprofileimage");
|
||||
this.panelUIAvatar.style.removeProperty("list-style-image");
|
||||
|
||||
if (!this._inCustomizationMode) {
|
||||
if (!this._inCustomizationMode && userData) {
|
||||
// At this point we consider the user as logged-in (but still can be in an error state)
|
||||
if (this.loginFailed) {
|
||||
let tooltipDescription = this.strings.formatStringFromName("reconnectDescription", [userData.email], 1);
|
||||
this.button.setAttribute("fxastatus", "error");
|
||||
this.button.setAttribute("label", errorLabel);
|
||||
this.button.setAttribute("tooltiptext", tooltipDescription);
|
||||
} else if (userData) {
|
||||
this.button.setAttribute("fxastatus", "signedin");
|
||||
this.button.setAttribute("label", userData.email);
|
||||
this.button.setAttribute("tooltiptext", userData.email);
|
||||
this.panelUIFooter.setAttribute("fxastatus", "error");
|
||||
this.panelUILabel.setAttribute("label", errorLabel);
|
||||
this.panelUIStatus.setAttribute("tooltiptext", tooltipDescription);
|
||||
} else {
|
||||
this.panelUIFooter.setAttribute("fxastatus", "signedin");
|
||||
this.panelUILabel.setAttribute("label", userData.email);
|
||||
this.panelUIStatus.setAttribute("tooltiptext", signedInTooltiptext);
|
||||
}
|
||||
if (profileInfoEnabled) {
|
||||
this.panelUIFooter.setAttribute("fxaprofileimage", "enabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let updateWithProfile = (profile) => {
|
||||
if (!this._inCustomizationMode && profileInfoEnabled) {
|
||||
if (profile.displayName) {
|
||||
this.panelUILabel.setAttribute("label", profile.displayName);
|
||||
}
|
||||
if (profile.avatar) {
|
||||
let img = new Image();
|
||||
// Make sure the image is available before attempting to display it
|
||||
img.onload = () => {
|
||||
this.panelUIFooter.setAttribute("fxaprofileimage", "set");
|
||||
this.panelUIAvatar.style.listStyleImage = "url('" + profile.avatar + "')";
|
||||
};
|
||||
img.src = profile.avatar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calling getSignedInUserProfile() without a user logged in causes log
|
||||
// noise that looks like an actual error...
|
||||
fxAccounts.getSignedInUser().then(userData => {
|
||||
doUpdate(userData);
|
||||
}).then(null, error => {
|
||||
// userData may be null here when the user is not signed-in, but that's expected
|
||||
updateWithUserData(userData);
|
||||
return fxAccounts.getSignedInUserProfile();
|
||||
}).then(profile => {
|
||||
if (!profile) {
|
||||
return;
|
||||
}
|
||||
updateWithProfile(profile);
|
||||
}).catch(error => {
|
||||
// This is most likely in tests, were we quickly log users in and out.
|
||||
// The most likely scenario is a user logged out, so reflect that.
|
||||
// Bug 995134 calls for better errors so we could retry if we were
|
||||
// sure this was the failure reason.
|
||||
doUpdate(null);
|
||||
this.FxAccountsCommon.log.error("Error updating FxA profile", error);
|
||||
updateWithUserData(null);
|
||||
});
|
||||
},
|
||||
|
||||
@ -274,7 +336,7 @@ let gFxAccounts = {
|
||||
case this.fxaMigrator.STATE_USER_FXA:
|
||||
status = "migrate-signup";
|
||||
label = this.strings.formatStringFromName("needUserShort",
|
||||
[this.button.getAttribute("fxabrandname")], 1);
|
||||
[this.panelUILabel.getAttribute("fxabrandname")], 1);
|
||||
break;
|
||||
case this.fxaMigrator.STATE_USER_FXA_VERIFIED:
|
||||
status = "migrate-verify";
|
||||
@ -283,9 +345,8 @@ let gFxAccounts = {
|
||||
1);
|
||||
break;
|
||||
}
|
||||
this.button.label = label;
|
||||
this.button.hidden = false;
|
||||
this.button.setAttribute("fxastatus", status);
|
||||
this.panelUILabel.label = label;
|
||||
this.panelUIFooter.setAttribute("fxastatus", status);
|
||||
}),
|
||||
|
||||
updateMigrationNotification: Task.async(function* () {
|
||||
@ -352,10 +413,9 @@ let gFxAccounts = {
|
||||
Weave.Notifications.replaceTitle(note);
|
||||
}),
|
||||
|
||||
onMenuPanelCommand: function (event) {
|
||||
let button = event.originalTarget;
|
||||
onMenuPanelCommand: function () {
|
||||
|
||||
switch (button.getAttribute("fxastatus")) {
|
||||
switch (this.panelUIFooter.getAttribute("fxastatus")) {
|
||||
case "signedin":
|
||||
this.openPreferences();
|
||||
break;
|
||||
|
@ -166,8 +166,15 @@ let gSyncUI = {
|
||||
return;
|
||||
|
||||
let syncButton = document.getElementById("sync-button");
|
||||
if (needsSetup && syncButton)
|
||||
syncButton.removeAttribute("tooltiptext");
|
||||
let statusButton = document.getElementById("PanelUI-fxa-icon");
|
||||
if (needsSetup) {
|
||||
if (syncButton) {
|
||||
syncButton.removeAttribute("tooltiptext");
|
||||
}
|
||||
if (statusButton) {
|
||||
statusButton.removeAttribute("tooltiptext");
|
||||
}
|
||||
}
|
||||
|
||||
this._updateLastSyncTime();
|
||||
},
|
||||
@ -184,9 +191,9 @@ let gSyncUI = {
|
||||
if (button) {
|
||||
button.setAttribute("status", "active");
|
||||
}
|
||||
button = document.getElementById("PanelUI-fxa-status");
|
||||
if (button) {
|
||||
button.setAttribute("syncstatus", "active");
|
||||
let container = document.getElementById("PanelUI-footer-fxa");
|
||||
if (container) {
|
||||
container.setAttribute("syncstatus", "active");
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -210,9 +217,9 @@ let gSyncUI = {
|
||||
if (syncButton) {
|
||||
syncButton.removeAttribute("status");
|
||||
}
|
||||
let panelHorizontalButton = document.getElementById("PanelUI-fxa-status");
|
||||
if (panelHorizontalButton) {
|
||||
panelHorizontalButton.removeAttribute("syncstatus");
|
||||
let fxaContainer = document.getElementById("PanelUI-footer-fxa");
|
||||
if (fxaContainer) {
|
||||
fxaContainer.removeAttribute("syncstatus");
|
||||
}
|
||||
},
|
||||
|
||||
@ -418,8 +425,7 @@ let gSyncUI = {
|
||||
return;
|
||||
|
||||
let syncButton = document.getElementById("sync-button");
|
||||
if (!syncButton)
|
||||
return;
|
||||
let statusButton = document.getElementById("PanelUI-fxa-icon");
|
||||
|
||||
let lastSync;
|
||||
try {
|
||||
@ -435,7 +441,12 @@ let gSyncUI = {
|
||||
}
|
||||
catch (e) { };
|
||||
if (!lastSync || this._needsSetup()) {
|
||||
syncButton.removeAttribute("tooltiptext");
|
||||
if (syncButton) {
|
||||
syncButton.removeAttribute("tooltiptext");
|
||||
}
|
||||
if (statusButton) {
|
||||
statusButton.removeAttribute("tooltiptext");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -444,7 +455,12 @@ let gSyncUI = {
|
||||
let lastSyncLabel =
|
||||
this._stringBundle.formatStringFromName("lastSync2.label", [lastSyncDateString], 1);
|
||||
|
||||
syncButton.setAttribute("tooltiptext", lastSyncLabel);
|
||||
if (syncButton) {
|
||||
syncButton.setAttribute("tooltiptext", lastSyncLabel);
|
||||
}
|
||||
if (statusButton) {
|
||||
statusButton.setAttribute("tooltiptext", lastSyncLabel);
|
||||
}
|
||||
},
|
||||
|
||||
clearError: function SUI_clearError(errorString) {
|
||||
|
@ -6,6 +6,10 @@
|
||||
@namespace html url("http://www.w3.org/1999/xhtml");
|
||||
@namespace svg url("http://www.w3.org/2000/svg");
|
||||
|
||||
:root {
|
||||
--panelui-subview-transition-duration: 150ms;
|
||||
}
|
||||
|
||||
#main-window:not([chromehidden~="toolbar"]) {
|
||||
%ifdef XP_MACOSX
|
||||
min-width: 335px;
|
||||
@ -110,11 +114,12 @@ panelview {
|
||||
}
|
||||
|
||||
.panel-mainview {
|
||||
transition: transform 150ms;
|
||||
transition: transform var(--panelui-subview-transition-duration);
|
||||
}
|
||||
|
||||
panelview:not([mainview]):not([current]) {
|
||||
display: none;
|
||||
transition: visibility 0s linear var(--panelui-subview-transition-duration);
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
tabbrowser {
|
||||
|
@ -9,24 +9,24 @@ Cu.import("resource://services-sync/FxaMigrator.jsm", imports);
|
||||
|
||||
add_task(function* test() {
|
||||
// Fake the state where we need an FxA user.
|
||||
let buttonPromise = promiseButtonMutation();
|
||||
let fxaPanelUIPromise = promiseButtonMutation();
|
||||
Services.obs.notifyObservers(null, STATE_CHANGED_TOPIC,
|
||||
imports.fxaMigrator.STATE_USER_FXA);
|
||||
let buttonState = yield buttonPromise;
|
||||
assertButtonState(buttonState, "migrate-signup", true);
|
||||
let buttonState = yield fxaPanelUIPromise;
|
||||
assertButtonState(buttonState, "migrate-signup");
|
||||
Assert.ok(Weave.Notifications.notifications.some(n => {
|
||||
return n.title == NOTIFICATION_TITLE;
|
||||
}), "Needs-user notification should be present");
|
||||
|
||||
// Fake the state where we need a verified FxA user.
|
||||
buttonPromise = promiseButtonMutation();
|
||||
fxaPanelUIPromise = promiseButtonMutation();
|
||||
let email = Cc["@mozilla.org/supports-string;1"].
|
||||
createInstance(Ci.nsISupportsString);
|
||||
email.data = "foo@example.com";
|
||||
Services.obs.notifyObservers(email, STATE_CHANGED_TOPIC,
|
||||
imports.fxaMigrator.STATE_USER_FXA_VERIFIED);
|
||||
buttonState = yield buttonPromise;
|
||||
assertButtonState(buttonState, "migrate-verify", true,
|
||||
buttonState = yield fxaPanelUIPromise;
|
||||
assertButtonState(buttonState, "migrate-verify",
|
||||
"foo@example.com not verified");
|
||||
let note = Weave.Notifications.notifications.find(n => {
|
||||
return n.title == NOTIFICATION_TITLE;
|
||||
@ -36,23 +36,22 @@ add_task(function* test() {
|
||||
"Needs-verification notification should include email");
|
||||
|
||||
// Fake the state where no migration is needed.
|
||||
buttonPromise = promiseButtonMutation();
|
||||
fxaPanelUIPromise = promiseButtonMutation();
|
||||
Services.obs.notifyObservers(null, STATE_CHANGED_TOPIC, null);
|
||||
buttonState = yield buttonPromise;
|
||||
buttonState = yield fxaPanelUIPromise;
|
||||
// In this case, the front end has called fxAccounts.getSignedInUser() to
|
||||
// update the button label and status. But since there isn't actually a user,
|
||||
// the button is left with no fxastatus.
|
||||
assertButtonState(buttonState, "", true);
|
||||
assertButtonState(buttonState, "");
|
||||
Assert.ok(!Weave.Notifications.notifications.some(n => {
|
||||
return n.title == NOTIFICATION_TITLE;
|
||||
}), "Migration notifications should no longer be present");
|
||||
});
|
||||
|
||||
function assertButtonState(buttonState, expectedStatus, expectedVisible,
|
||||
function assertButtonState(buttonState, expectedStatus,
|
||||
expectedLabel=undefined) {
|
||||
Assert.equal(buttonState.fxastatus, expectedStatus,
|
||||
"Button fxstatus attribute");
|
||||
Assert.equal(!buttonState.hidden, expectedVisible, "Button visibility");
|
||||
if (expectedLabel !== undefined) {
|
||||
Assert.equal(buttonState.label, expectedLabel, "Button label");
|
||||
}
|
||||
@ -66,12 +65,11 @@ function promiseButtonMutation() {
|
||||
if (mutations.some(m => m.attributeName == "fxastatus")) {
|
||||
obs.disconnect();
|
||||
resolve({
|
||||
fxastatus: gFxAccounts.button.getAttribute("fxastatus"),
|
||||
hidden: gFxAccounts.button.hidden,
|
||||
label: gFxAccounts.button.label,
|
||||
fxastatus: gFxAccounts.panelUIFooter.getAttribute("fxastatus"),
|
||||
label: gFxAccounts.panelUILabel.label,
|
||||
});
|
||||
}
|
||||
});
|
||||
obs.observe(gFxAccounts.button, { attributes: true });
|
||||
obs.observe(gFxAccounts.panelUIFooter, { attributes: true });
|
||||
});
|
||||
}
|
||||
|
@ -255,13 +255,13 @@ add_task(function* testRLLoginErrorRemains() {
|
||||
|
||||
function checkButtonsStatus(shouldBeActive) {
|
||||
let button = document.getElementById("sync-button");
|
||||
let panelbutton = document.getElementById("PanelUI-fxa-status");
|
||||
let fxaContainer = document.getElementById("PanelUI-footer-fxa");
|
||||
if (shouldBeActive) {
|
||||
Assert.equal(button.getAttribute("status"), "active");
|
||||
Assert.equal(panelbutton.getAttribute("syncstatus"), "active");
|
||||
Assert.equal(fxaContainer.getAttribute("syncstatus"), "active");
|
||||
} else {
|
||||
Assert.ok(!button.hasAttribute("status"));
|
||||
Assert.ok(!panelbutton.hasAttribute("syncstatus"));
|
||||
Assert.ok(!fxaContainer.hasAttribute("syncstatus"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,12 +369,10 @@ const CustomizableWidgets = [
|
||||
// Hardcode the addition of the "work offline" menuitem at the bottom:
|
||||
itemsToDisplay.push({localName: "menuseparator", getAttribute: () => {}});
|
||||
itemsToDisplay.push(doc.getElementById("goOfflineMenuitem"));
|
||||
fillSubviewFromMenuItems(itemsToDisplay, doc.getElementById("PanelUI-developerItems"));
|
||||
|
||||
},
|
||||
onViewHiding: function(aEvent) {
|
||||
let doc = aEvent.target.ownerDocument;
|
||||
clearSubview(doc.getElementById("PanelUI-developerItems"));
|
||||
let developerItems = doc.getElementById("PanelUI-developerItems");
|
||||
clearSubview(developerItems);
|
||||
fillSubviewFromMenuItems(itemsToDisplay, developerItems);
|
||||
}
|
||||
}, {
|
||||
id: "sidebar-button",
|
||||
@ -399,11 +397,9 @@ const CustomizableWidgets = [
|
||||
if (providerMenuSeps.length > 0)
|
||||
win.SocialSidebar.populateProviderMenu(providerMenuSeps[0]);
|
||||
|
||||
fillSubviewFromMenuItems([...menu.children], doc.getElementById("PanelUI-sidebarItems"));
|
||||
},
|
||||
onViewHiding: function(aEvent) {
|
||||
let doc = aEvent.target.ownerDocument;
|
||||
clearSubview(doc.getElementById("PanelUI-sidebarItems"));
|
||||
let sidebarItems = doc.getElementById("PanelUI-sidebarItems");
|
||||
clearSubview(sidebarItems);
|
||||
fillSubviewFromMenuItems([...menu.children], sidebarItems);
|
||||
}
|
||||
}, {
|
||||
id: "social-share-button",
|
||||
|
@ -23,9 +23,9 @@
|
||||
}
|
||||
|
||||
.panel-subviews[panelopen] {
|
||||
transition: transform 150ms;
|
||||
transition: transform var(--panelui-subview-transition-duration);
|
||||
}
|
||||
|
||||
.panel-viewcontainer[panelopen]:-moz-any(:not([viewtype="main"]),[transitioning="true"]) {
|
||||
transition: height 150ms;
|
||||
transition: height var(--panelui-subview-transition-duration);
|
||||
}
|
||||
|
@ -20,12 +20,21 @@
|
||||
oncommand="gMenuButtonUpdateBadge.onMenuPanelCommand(event);"
|
||||
wrap="true"
|
||||
hidden="true"/>
|
||||
<toolbarbutton id="PanelUI-fxa-status"
|
||||
defaultlabel="&fxaSignIn.label;"
|
||||
errorlabel="&fxaSignInError.label;"
|
||||
fxabrandname="&syncBrand.fxAccount.label;"
|
||||
oncommand="gFxAccounts.onMenuPanelCommand(event);"
|
||||
hidden="true"/>
|
||||
<hbox id="PanelUI-footer-fxa">
|
||||
<hbox id="PanelUI-fxa-status"
|
||||
defaultlabel="&fxaSignIn.label;"
|
||||
signedinTooltiptext="&fxaSignedIn.tooltip;"
|
||||
errorlabel="&fxaSignInError.label;"
|
||||
onclick="gFxAccounts.onMenuPanelCommand();">
|
||||
<image id="PanelUI-fxa-avatar"/>
|
||||
<toolbarbutton id="PanelUI-fxa-label"
|
||||
fxabrandname="&syncBrand.fxAccount.label;"/>
|
||||
</hbox>
|
||||
<toolbarseparator/>
|
||||
<toolbarbutton id="PanelUI-fxa-icon"
|
||||
oncommand="gSyncUI.doSync();"
|
||||
closemenu="none"/>
|
||||
</hbox>
|
||||
|
||||
<hbox id="PanelUI-footer-inner">
|
||||
<toolbarbutton id="PanelUI-customize" label="&appMenuCustomize.label;"
|
||||
|
@ -14,7 +14,7 @@
|
||||
</resources>
|
||||
<content>
|
||||
<xul:box anonid="viewContainer" class="panel-viewcontainer" xbl:inherits="panelopen,viewtype,transitioning">
|
||||
<xul:stack anonid="viewStack" xbl:inherits="viewtype" viewtype="main" class="panel-viewstack">
|
||||
<xul:stack anonid="viewStack" xbl:inherits="viewtype,transitioning" viewtype="main" class="panel-viewstack">
|
||||
<xul:vbox anonid="mainViewContainer" class="panel-mainview"/>
|
||||
|
||||
<!-- Used to capture click events over the PanelUI-mainView if we're in
|
||||
|
@ -22,8 +22,8 @@
|
||||
<script type="text/javascript" src="loop/libs/sdk.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/react-0.12.2.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/jquery-2.1.4.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/lodash-2.4.1.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/backbone-1.1.2.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/lodash-3.9.3.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/backbone-1.2.1.js"></script>
|
||||
|
||||
<script type="text/javascript" src="loop/shared/js/utils.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/js/mixins.js"></script>
|
||||
|
@ -17,8 +17,8 @@
|
||||
<script type="text/javascript" src="loop/shared/libs/react-0.12.2.js"></script>
|
||||
<script type="text/javascript" src="loop/libs/l10n.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/jquery-2.1.4.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/lodash-2.4.1.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/backbone-1.1.2.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/lodash-3.9.3.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/libs/backbone-1.2.1.js"></script>
|
||||
|
||||
<script type="text/javascript" src="loop/shared/js/utils.js"></script>
|
||||
<script type="text/javascript" src="loop/shared/js/models.js"></script>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
12235
browser/components/loop/content/shared/libs/lodash-3.9.3.js
Normal file
12235
browser/components/loop/content/shared/libs/lodash-3.9.3.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -101,9 +101,9 @@ browser.jar:
|
||||
#else
|
||||
content/browser/loop/shared/libs/react-0.12.2.js (content/shared/libs/react-0.12.2-prod.js)
|
||||
#endif
|
||||
content/browser/loop/shared/libs/lodash-2.4.1.js (content/shared/libs/lodash-2.4.1.js)
|
||||
content/browser/loop/shared/libs/lodash-3.9.3.js (content/shared/libs/lodash-3.9.3.js)
|
||||
content/browser/loop/shared/libs/jquery-2.1.4.js (content/shared/libs/jquery-2.1.4.js)
|
||||
content/browser/loop/shared/libs/backbone-1.1.2.js (content/shared/libs/backbone-1.1.2.js)
|
||||
content/browser/loop/shared/libs/backbone-1.2.1.js (content/shared/libs/backbone-1.2.1.js)
|
||||
|
||||
# Shared sounds
|
||||
content/browser/loop/shared/sounds/ringtone.ogg (content/shared/sounds/ringtone.ogg)
|
||||
|
@ -123,8 +123,8 @@
|
||||
<script type="text/javascript" src="libs/l10n-gaia-02ca67948fe8.js"></script>
|
||||
<script type="text/javascript" src="shared/libs/react-0.12.2.js"></script>
|
||||
<script type="text/javascript" src="shared/libs/jquery-2.1.4.js"></script>
|
||||
<script type="text/javascript" src="shared/libs/lodash-2.4.1.js"></script>
|
||||
<script type="text/javascript" src="shared/libs/backbone-1.1.2.js"></script>
|
||||
<script type="text/javascript" src="shared/libs/lodash-3.9.3.js"></script>
|
||||
<script type="text/javascript" src="shared/libs/backbone-1.2.1.js"></script>
|
||||
|
||||
<!-- app scripts -->
|
||||
<script type="text/javascript" src="config.js"></script>
|
||||
|
@ -32,8 +32,8 @@
|
||||
<script src="../../content/libs/l10n.js"></script>
|
||||
<script src="../../content/shared/libs/react-0.12.2.js"></script>
|
||||
<script src="../../content/shared/libs/jquery-2.1.4.js"></script>
|
||||
<script src="../../content/shared/libs/lodash-2.4.1.js"></script>
|
||||
<script src="../../content/shared/libs/backbone-1.1.2.js"></script>
|
||||
<script src="../../content/shared/libs/lodash-3.9.3.js"></script>
|
||||
<script src="../../content/shared/libs/backbone-1.2.1.js"></script>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<script src="../shared/vendor/mocha-2.2.5.js"></script>
|
||||
|
@ -31,8 +31,8 @@
|
||||
<!-- libs -->
|
||||
<script src="../../content/shared/libs/react-0.12.2.js"></script>
|
||||
<script src="../../content/shared/libs/jquery-2.1.4.js"></script>
|
||||
<script src="../../content/shared/libs/lodash-2.4.1.js"></script>
|
||||
<script src="../../content/shared/libs/backbone-1.1.2.js"></script>
|
||||
<script src="../../content/shared/libs/lodash-3.9.3.js"></script>
|
||||
<script src="../../content/shared/libs/backbone-1.2.1.js"></script>
|
||||
<script src="../../standalone/content/libs/l10n-gaia-02ca67948fe8.js"></script>
|
||||
|
||||
<!-- test dependencies -->
|
||||
@ -96,7 +96,7 @@
|
||||
|
||||
describe("Unexpected Warnings Check", function() {
|
||||
it("should long only the warnings we expect", function() {
|
||||
chai.expect(caughtWarnings.length).to.eql(183);
|
||||
chai.expect(caughtWarnings.length).to.eql(180);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -460,10 +460,6 @@ describe("loop.shared.views", function() {
|
||||
});
|
||||
|
||||
describe("#startPublishing", function() {
|
||||
beforeEach(function() {
|
||||
sandbox.stub(fakePublisher, "on");
|
||||
});
|
||||
|
||||
it("should publish local stream", function() {
|
||||
comp.startPublishing();
|
||||
|
||||
@ -471,15 +467,10 @@ describe("loop.shared.views", function() {
|
||||
sinon.assert.calledOnce(fakeSession.publish);
|
||||
});
|
||||
|
||||
// XXX This test would need reworking, but the code should be going
|
||||
// away after the obsolences of call urls (currently bug 1170150).
|
||||
it("should start listening to OT publisher accessDialogOpened and " +
|
||||
" accessDenied events",
|
||||
function() {
|
||||
comp.startPublishing();
|
||||
|
||||
sinon.assert.called(fakePublisher.on);
|
||||
sinon.assert.calledWith(fakePublisher.on,
|
||||
"accessDialogOpened accessDenied");
|
||||
});
|
||||
" accessDenied events");
|
||||
});
|
||||
|
||||
describe("#stopPublishing", function() {
|
||||
|
@ -32,8 +32,8 @@
|
||||
<!-- libs -->
|
||||
<script src="../../content/shared/libs/react-0.12.2.js"></script>
|
||||
<script src="../../content/shared/libs/jquery-2.1.4.js"></script>
|
||||
<script src="../../content/shared/libs/lodash-2.4.1.js"></script>
|
||||
<script src="../../content/shared/libs/backbone-1.1.2.js"></script>
|
||||
<script src="../../content/shared/libs/lodash-3.9.3.js"></script>
|
||||
<script src="../../content/shared/libs/backbone-1.2.1.js"></script>
|
||||
<script src="../../standalone/content/libs/l10n-gaia-02ca67948fe8.js"></script>
|
||||
<!-- test dependencies -->
|
||||
<script src="../shared/vendor/mocha-2.2.5.js"></script>
|
||||
|
@ -40,8 +40,8 @@
|
||||
<script src="../content/shared/libs/sdk.js"></script>
|
||||
<script src="../content/shared/libs/react-0.12.2.js"></script>
|
||||
<script src="../content/shared/libs/jquery-2.1.4.js"></script>
|
||||
<script src="../content/shared/libs/lodash-2.4.1.js"></script>
|
||||
<script src="../content/shared/libs/backbone-1.1.2.js"></script>
|
||||
<script src="../content/shared/libs/lodash-3.9.3.js"></script>
|
||||
<script src="../content/shared/libs/backbone-1.2.1.js"></script>
|
||||
<script src="../content/shared/js/feedbackApiClient.js"></script>
|
||||
<script src="../content/shared/js/actions.js"></script>
|
||||
<script src="../content/shared/js/utils.js"></script>
|
||||
|
@ -791,15 +791,33 @@ this.PlacesUIUtils = {
|
||||
browserWindow.gBrowser.loadTabs(urls, loadInBackground, false);
|
||||
},
|
||||
|
||||
openLiveMarkNodesInTabs:
|
||||
function PUIU_openLiveMarkNodesInTabs(aNode, aEvent, aView) {
|
||||
let window = aView.ownerWindow;
|
||||
|
||||
PlacesUtils.livemarks.getLivemark({id: aNode.itemId})
|
||||
.then(aLivemark => {
|
||||
urlsToOpen = [];
|
||||
|
||||
let nodes = aLivemark.getNodesForContainer(aNode);
|
||||
for (let node of nodes) {
|
||||
urlsToOpen.push({uri: node.uri, isBookmark: false});
|
||||
}
|
||||
|
||||
if (this._confirmOpenInTabs(urlsToOpen.length, window)) {
|
||||
this._openTabset(urlsToOpen, aEvent, window);
|
||||
}
|
||||
}, Cu.reportError);
|
||||
},
|
||||
|
||||
openContainerNodeInTabs:
|
||||
function PUIU_openContainerInTabs(aNode, aEvent, aView) {
|
||||
let window = aView.ownerWindow;
|
||||
|
||||
let urlsToOpen = PlacesUtils.getURLsForContainerNode(aNode);
|
||||
if (!this._confirmOpenInTabs(urlsToOpen.length, window))
|
||||
return;
|
||||
|
||||
this._openTabset(urlsToOpen, aEvent, window);
|
||||
if (this._confirmOpenInTabs(urlsToOpen.length, window)) {
|
||||
this._openTabset(urlsToOpen, aEvent, window);
|
||||
}
|
||||
},
|
||||
|
||||
openURINodesInTabs: function PUIU_openURINodesInTabs(aNodes, aEvent, aView) {
|
||||
|
@ -808,6 +808,12 @@ PlacesViewBase.prototype = {
|
||||
hasMultipleURIs = numURINodes > 1;
|
||||
}
|
||||
|
||||
let isLiveMark = false;
|
||||
if (this.controller.hasCachedLivemarkInfo(aPopup._placesNode)) {
|
||||
hasMultipleURIs = true;
|
||||
isLiveMark = true;
|
||||
}
|
||||
|
||||
if (!hasMultipleURIs) {
|
||||
aPopup.setAttribute("singleitempopup", "true");
|
||||
} else {
|
||||
@ -839,9 +845,15 @@ PlacesViewBase.prototype = {
|
||||
if (typeof this.options.extraClasses.footer == "string")
|
||||
aPopup._endOptOpenAllInTabs.classList.add(this.options.extraClasses.footer);
|
||||
|
||||
aPopup._endOptOpenAllInTabs.setAttribute("oncommand",
|
||||
"PlacesUIUtils.openContainerNodeInTabs(this.parentNode._placesNode, event, " +
|
||||
"PlacesUIUtils.getViewForNode(this));");
|
||||
if (isLiveMark) {
|
||||
aPopup._endOptOpenAllInTabs.setAttribute("oncommand",
|
||||
"PlacesUIUtils.openLiveMarkNodesInTabs(this.parentNode._placesNode, event, " +
|
||||
"PlacesUIUtils.getViewForNode(this));");
|
||||
} else {
|
||||
aPopup._endOptOpenAllInTabs.setAttribute("oncommand",
|
||||
"PlacesUIUtils.openContainerNodeInTabs(this.parentNode._placesNode, event, " +
|
||||
"PlacesUIUtils.getViewForNode(this));");
|
||||
}
|
||||
aPopup._endOptOpenAllInTabs.setAttribute("onclick",
|
||||
"checkForMiddleClick(this, event); event.stopPropagation();");
|
||||
aPopup._endOptOpenAllInTabs.setAttribute("label",
|
||||
|
@ -96,12 +96,12 @@ this.UITour = {
|
||||
targets: new Map([
|
||||
["accountStatus", {
|
||||
query: (aDocument) => {
|
||||
let statusButton = aDocument.getElementById("PanelUI-fxa-status");
|
||||
let statusButton = aDocument.getElementById("PanelUI-fxa-label");
|
||||
return aDocument.getAnonymousElementByAttribute(statusButton,
|
||||
"class",
|
||||
"toolbarbutton-icon");
|
||||
},
|
||||
widgetName: "PanelUI-fxa-status",
|
||||
widgetName: "PanelUI-fxa-label",
|
||||
}],
|
||||
["addons", {query: "#add-ons-button"}],
|
||||
["appMenu", {
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
// Check that variables view works as expected in the web console.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-eval-in-stackframe.html";
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
// Check that variables view is linked to the inspector for highlighting and
|
||||
// selecting DOM nodes
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-952277-highlight-nodes-in-vview.html";
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
// Test that makes sure web console eval works while the js debugger paused the
|
||||
// page, and while the inspector is active. See bug 886137.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-eval-in-stackframe.html";
|
||||
|
||||
@ -26,9 +28,9 @@ function consoleOpened(hud) {
|
||||
openDebugger().then(debuggerOpened);
|
||||
}
|
||||
|
||||
function debuggerOpened(aResult) {
|
||||
function debuggerOpened(result) {
|
||||
info("debugger opened");
|
||||
gDebuggerWin = aResult.panelWin;
|
||||
gDebuggerWin = result.panelWin;
|
||||
gDebuggerController = gDebuggerWin.DebuggerController;
|
||||
gThread = gDebuggerController.activeThread;
|
||||
gStackframes = gDebuggerController.StackFrames;
|
||||
@ -36,7 +38,7 @@ function debuggerOpened(aResult) {
|
||||
openInspector().then(inspectorOpened);
|
||||
}
|
||||
|
||||
function inspectorOpened(aPanel) {
|
||||
function inspectorOpened() {
|
||||
info("inspector opened");
|
||||
gThread.addOneTimeListener("framesadded", onFramesAdded);
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
// Make sure that JS eval result are properly formatted as strings.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-result-format-as-string.html";
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
// Bug 875456 - Log mixed content messages from the Mixed Content
|
||||
// Blocker to the Security Pane in the Web Console
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-mixedcontent-securityerrors.html";
|
||||
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/" +
|
||||
|
@ -75,7 +75,7 @@ function consoleOpened(HUD) {
|
||||
goDoCommand("cmd_paste");
|
||||
let notificationbox = jsterm.hud.document.getElementById("webconsole-notificationbox");
|
||||
let notification = notificationbox.getNotificationWithValue("selfxss-notification");
|
||||
ok(notification, "Self-xss notification shown");
|
||||
ok(notification, "Self-xss notification shown");
|
||||
is(oldVal, jsterm.inputNode.value, "Paste blocked by self-xss prevention");
|
||||
|
||||
// Allow pasting
|
||||
|
@ -8,7 +8,7 @@
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-console.html";
|
||||
"test/test-console.html";
|
||||
|
||||
let test = asyncTest(function*() {
|
||||
yield loadTab(TEST_URI);
|
||||
|
@ -6,6 +6,8 @@
|
||||
// Tests to ensure that errors don't appear when the console is closed while a
|
||||
// completion is being performed.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-console.html";
|
||||
|
||||
@ -45,4 +47,3 @@ function testClosingAfterCompletion(hud, browser) {
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,8 @@ let test = asyncTest(function* () {
|
||||
prefBranch.setIntPref("console", 20);
|
||||
|
||||
for (let i = 0; i < 30; i++) {
|
||||
console.log("foo #" + i); // must change message to prevent repeats
|
||||
// must change message to prevent repeats
|
||||
console.log("foo #" + i);
|
||||
}
|
||||
|
||||
yield waitForMessages({
|
||||
@ -63,7 +64,8 @@ let test = asyncTest(function* () {
|
||||
|
||||
prefBranch.setIntPref("console", 30);
|
||||
for (let i = 0; i < 20; i++) {
|
||||
console.log("boo #" + i); // must change message to prevent repeats
|
||||
// must change message to prevent repeats
|
||||
console.log("boo #" + i);
|
||||
}
|
||||
|
||||
yield waitForMessages({
|
||||
@ -86,4 +88,3 @@ let test = asyncTest(function* () {
|
||||
function countMessageNodes() {
|
||||
return outputNode.querySelectorAll(".message").length;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-585956-console-trace.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/" +
|
||||
"webconsole/test/test-bug-585956-console-trace.html";
|
||||
|
||||
function test() {
|
||||
Task.spawn(runner).then(finishTest);
|
||||
@ -35,14 +36,39 @@ function test() {
|
||||
|
||||
// The expected stack trace object.
|
||||
let stacktrace = [
|
||||
{ columnNumber: 3, filename: TEST_URI, functionName: "window.foobar585956c", language: 2, lineNumber: 9 },
|
||||
{ columnNumber: 10, filename: TEST_URI, functionName: "foobar585956b", language: 2, lineNumber: 14 },
|
||||
{ columnNumber: 10, filename: TEST_URI, functionName: "foobar585956a", language: 2, lineNumber: 18 },
|
||||
{ columnNumber: 1, filename: TEST_URI, functionName: "", language: 2, lineNumber: 21 }
|
||||
{
|
||||
columnNumber: 3,
|
||||
filename: TEST_URI,
|
||||
functionName: "window.foobar585956c",
|
||||
language: 2,
|
||||
lineNumber: 9
|
||||
},
|
||||
{
|
||||
columnNumber: 10,
|
||||
filename: TEST_URI,
|
||||
functionName: "foobar585956b",
|
||||
language: 2,
|
||||
lineNumber: 14
|
||||
},
|
||||
{
|
||||
columnNumber: 10,
|
||||
filename: TEST_URI,
|
||||
functionName: "foobar585956a",
|
||||
language: 2,
|
||||
lineNumber: 18
|
||||
},
|
||||
{
|
||||
columnNumber: 1,
|
||||
filename: TEST_URI,
|
||||
functionName: "",
|
||||
language: 2,
|
||||
lineNumber: 21
|
||||
}
|
||||
];
|
||||
|
||||
ok(obj._stacktrace, "found stacktrace object");
|
||||
is(obj._stacktrace.toSource(), stacktrace.toSource(), "stacktrace is correct");
|
||||
is(obj._stacktrace.toSource(), stacktrace.toSource(),
|
||||
"stacktrace is correct");
|
||||
isnot(node.textContent.indexOf("bug-585956"), -1, "found file name");
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,10 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<p>bug 585991 - autocomplete popup keyboard usage test";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<p>bug 585991 - autocomplete " +
|
||||
"popup keyboard usage test";
|
||||
let HUD, popup, jsterm, inputNode, completeNode;
|
||||
|
||||
let test = asyncTest(function*() {
|
||||
@ -54,7 +57,9 @@ let consoleOpened = Task.async(function*(aHud) {
|
||||
// toLocaleString toString toSource unwatch valueOf watch constructor.
|
||||
is(popup.itemCount, 19, "popup.itemCount is correct");
|
||||
|
||||
let sameItems = popup.getItems().reverse().map(function(e) {return e.label;});
|
||||
let sameItems = popup.getItems().reverse().map(function(e) {
|
||||
return e.label;
|
||||
});
|
||||
ok(sameItems.every(function(prop, index) {
|
||||
return [
|
||||
"__defineGetter__",
|
||||
@ -76,7 +81,8 @@ let consoleOpened = Task.async(function*(aHud) {
|
||||
"unwatch",
|
||||
"valueOf",
|
||||
"watch",
|
||||
][index] === prop}), "getItems returns the items we expect");
|
||||
][index] === prop;
|
||||
}), "getItems returns the items we expect");
|
||||
|
||||
is(popup.selectedIndex, 18,
|
||||
"Index of the first item from bottom is selected.");
|
||||
@ -113,7 +119,8 @@ let consoleOpened = Task.async(function*(aHud) {
|
||||
currentSelectionIndex = popup.selectedIndex;
|
||||
EventUtils.synthesizeKey("VK_PAGE_UP", {});
|
||||
|
||||
ok(popup.selectedIndex < currentSelectionIndex, "Index is less after Page UP");
|
||||
ok(popup.selectedIndex < currentSelectionIndex,
|
||||
"Index is less after Page UP");
|
||||
|
||||
EventUtils.synthesizeKey("VK_END", {});
|
||||
is(popup.selectedIndex, 18, "index is last after End");
|
||||
@ -136,8 +143,7 @@ let consoleOpened = Task.async(function*(aHud) {
|
||||
return deferred.promise;
|
||||
});
|
||||
|
||||
function popupHideAfterTab()
|
||||
{
|
||||
function popupHideAfterTab() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
// At this point the completion suggestion should be accepted.
|
||||
@ -193,8 +199,7 @@ function popupHideAfterTab()
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testReturnKey()
|
||||
{
|
||||
function testReturnKey() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
popup._panel.addEventListener("popupshown", function onShown() {
|
||||
@ -250,23 +255,24 @@ function testReturnKey()
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function dontShowArrayNumbers()
|
||||
{
|
||||
function dontShowArrayNumbers() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
info("dontShowArrayNumbers");
|
||||
content.wrappedJSObject.foobarBug585991 = ["Sherlock Holmes"];
|
||||
|
||||
let jsterm = HUD.jsterm;
|
||||
let popup = jsterm.autocompletePopup;
|
||||
let completeNode = jsterm.completeNode;
|
||||
jsterm = HUD.jsterm;
|
||||
popup = jsterm.autocompletePopup;
|
||||
|
||||
popup._panel.addEventListener("popupshown", function onShown() {
|
||||
popup._panel.removeEventListener("popupshown", onShown, false);
|
||||
|
||||
let sameItems = popup.getItems().map(function(e) {return e.label;});
|
||||
ok(!sameItems.some(function(prop, index) { prop === "0"; }),
|
||||
"Completing on an array doesn't show numbers.");
|
||||
let sameItems = popup.getItems().map(function(e) {
|
||||
return e.label;
|
||||
});
|
||||
ok(!sameItems.some(function(prop) {
|
||||
prop === "0";
|
||||
}), "Completing on an array doesn't show numbers.");
|
||||
|
||||
popup._panel.addEventListener("popuphidden", function popupHidden() {
|
||||
popup._panel.removeEventListener("popuphidden", popupHidden, false);
|
||||
@ -286,8 +292,7 @@ function dontShowArrayNumbers()
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testReturnWithNoSelection()
|
||||
{
|
||||
function testReturnWithNoSelection() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
info("test pressing return with open popup, but no selection, see bug 873250");
|
||||
@ -316,20 +321,18 @@ function testReturnWithNoSelection()
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function popupHideAfterReturnWithNoSelection()
|
||||
{
|
||||
function popupHideAfterReturnWithNoSelection() {
|
||||
ok(!popup.isOpen, "popup is not open after VK_RETURN");
|
||||
|
||||
is(inputNode.value, "", "inputNode is empty after VK_RETURN");
|
||||
is(completeNode.value, "", "completeNode is empty");
|
||||
is(jsterm.history[jsterm.history.length-1], "window.testBug",
|
||||
is(jsterm.history[jsterm.history.length - 1], "window.testBug",
|
||||
"jsterm history is correct");
|
||||
|
||||
return promise.resolve();
|
||||
}
|
||||
|
||||
function testCompletionInText()
|
||||
{
|
||||
function testCompletionInText() {
|
||||
info("test that completion works inside text, see bug 812618");
|
||||
|
||||
let deferred = promise.defer();
|
||||
@ -363,14 +366,14 @@ function testCompletionInText()
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function popupHideAfterCompletionInText()
|
||||
{
|
||||
function popupHideAfterCompletionInText() {
|
||||
// At this point the completion suggestion should be accepted.
|
||||
ok(!popup.isOpen, "popup is not open");
|
||||
is(inputNode.value, "dump(window.testBug873250b)",
|
||||
"completion was successful after VK_TAB");
|
||||
is(inputNode.selectionStart, 26, "cursor location is correct");
|
||||
is(inputNode.selectionStart, inputNode.selectionEnd, "cursor location (confirmed)");
|
||||
is(inputNode.selectionStart, inputNode.selectionEnd,
|
||||
"cursor location (confirmed)");
|
||||
ok(!completeNode.value, "completeNode is empty");
|
||||
|
||||
return promise.resolve();
|
||||
|
@ -3,10 +3,11 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<p>bug 585991 - autocomplete popup test";
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<p>bug 585991 - autocomplete " +
|
||||
"popup test";
|
||||
|
||||
let test = asyncTest(function*() {
|
||||
yield loadTab(TEST_URI);
|
||||
let hud = yield openConsole();
|
||||
@ -34,8 +35,8 @@ function consoleOpened(HUD) {
|
||||
ok(!popup.isOpen, "popup is not open");
|
||||
ok(!input.hasAttribute("aria-activedescendant"), "no aria-activedescendant");
|
||||
|
||||
popup._panel.addEventListener("popupshown", function() {
|
||||
popup._panel.removeEventListener("popupshown", arguments.callee, false);
|
||||
popup._panel.addEventListener("popupshown", function onPopupPanel() {
|
||||
popup._panel.removeEventListener("popupshown", onPopupPanel, false);
|
||||
|
||||
ok(popup.isOpen, "popup is open");
|
||||
|
||||
@ -116,4 +117,3 @@ function consoleOpened(HUD) {
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
@ -8,20 +8,19 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/";
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
let hud = yield openConsole();
|
||||
yield testSelectionWhenMovingBetweenBoxes(hud);
|
||||
performTestsAfterOutput(hud);
|
||||
})
|
||||
});
|
||||
|
||||
let testSelectionWhenMovingBetweenBoxes = Task.async(function *(aHud) {
|
||||
let hud = aHud;
|
||||
let testSelectionWhenMovingBetweenBoxes = Task.async(function*(hud) {
|
||||
let jsterm = hud.jsterm;
|
||||
|
||||
// Fill the console with some output.
|
||||
@ -47,8 +46,7 @@ let testSelectionWhenMovingBetweenBoxes = Task.async(function *(aHud) {
|
||||
});
|
||||
});
|
||||
|
||||
function performTestsAfterOutput(aHud) {
|
||||
let hud = aHud;
|
||||
function performTestsAfterOutput(hud) {
|
||||
let outputNode = hud.outputNode;
|
||||
|
||||
ok(outputNode.childNodes.length >= 3, "the output node has children after " +
|
||||
|
@ -8,12 +8,13 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-console.html";
|
||||
|
||||
let HUD, outputNode;
|
||||
|
||||
"use strict";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
@ -34,8 +35,8 @@ function consoleOpened(aHud) {
|
||||
|
||||
HUD.jsterm.clearOutput();
|
||||
|
||||
let controller = top.document.commandDispatcher.
|
||||
getControllerForCommand("cmd_copy");
|
||||
let controller = top.document.commandDispatcher
|
||||
.getControllerForCommand("cmd_copy");
|
||||
is(controller.isCommandEnabled("cmd_copy"), false, "cmd_copy is disabled");
|
||||
|
||||
content.console.log("Hello world! bug587617");
|
||||
@ -54,18 +55,22 @@ function consoleOpened(aHud) {
|
||||
outputNode.focus();
|
||||
|
||||
goUpdateCommand("cmd_copy");
|
||||
controller = top.document.commandDispatcher.getControllerForCommand("cmd_copy");
|
||||
controller = top.document.commandDispatcher
|
||||
.getControllerForCommand("cmd_copy");
|
||||
is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled");
|
||||
|
||||
// Remove new lines since getSelection() includes one between message and line
|
||||
// number, but the clipboard doesn't (see bug 1119503)
|
||||
let selection = (HUD.iframeWindow.getSelection() + "").replace(/\r?\n|\r/g, " ");
|
||||
// Remove new lines since getSelection() includes one between message and
|
||||
// line number, but the clipboard doesn't (see bug 1119503)
|
||||
let selection = (HUD.iframeWindow.getSelection() + "")
|
||||
.replace(/\r?\n|\r/g, " ");
|
||||
isnot(selection.indexOf("bug587617"), -1,
|
||||
"selection text includes 'bug587617'");
|
||||
|
||||
waitForClipboard((str) => { return selection.trim() == str.trim(); },
|
||||
() => { goDoCommand("cmd_copy") },
|
||||
deferred.resolve, deferred.resolve);
|
||||
waitForClipboard((str) => {
|
||||
return selection.trim() == str.trim();
|
||||
}, () => {
|
||||
goDoCommand("cmd_copy");
|
||||
}, deferred.resolve, deferred.resolve);
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
@ -84,15 +89,17 @@ function testContextMenuCopy() {
|
||||
|
||||
// Remove new lines since getSelection() includes one between message and line
|
||||
// number, but the clipboard doesn't (see bug 1119503)
|
||||
let selection = (HUD.iframeWindow.getSelection() + "").replace(/\r?\n|\r/g, " ");
|
||||
let selection = (HUD.iframeWindow.getSelection() + "")
|
||||
.replace(/\r?\n|\r/g, " ");
|
||||
|
||||
copyItem.doCommand();
|
||||
|
||||
waitForClipboard((str) => { return selection.trim() == str.trim(); },
|
||||
() => { goDoCommand("cmd_copy") },
|
||||
deferred.resolve, deferred.resolve);
|
||||
waitForClipboard((str) => {
|
||||
return selection.trim() == str.trim();
|
||||
}, () => {
|
||||
goDoCommand("cmd_copy");
|
||||
}, deferred.resolve, deferred.resolve);
|
||||
HUD = outputNode = null;
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
@ -8,12 +8,12 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 588342";
|
||||
|
||||
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||
|
||||
"use strict";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
let { browser } = yield loadTab(TEST_URI);
|
||||
|
||||
|
@ -5,10 +5,11 @@
|
||||
|
||||
// Tests that adding text to one of the output labels doesn't cause errors.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-console.html";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
@ -50,4 +51,3 @@ function testTextNodeInsertion(hud) {
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,11 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-console.html";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
@ -15,7 +16,6 @@ let test = asyncTest(function* () {
|
||||
testInputExpansion(hud);
|
||||
});
|
||||
|
||||
|
||||
function testInputExpansion(hud) {
|
||||
let input = hud.jsterm.inputNode;
|
||||
|
||||
@ -42,4 +42,3 @@ function testInputExpansion(hud) {
|
||||
|
||||
input = length = null;
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
"use strict"
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<div style='font-size:3em;" +
|
||||
"foobarCssParser:baz'>test CSS parser filter</div>";
|
||||
"foobarCssParser:baz'>test CSS parser filter</div>";
|
||||
|
||||
/**
|
||||
* Unit test for bug 589162:
|
||||
|
@ -28,8 +28,7 @@ let test = asyncTest(function*() {
|
||||
let error = false;
|
||||
try {
|
||||
jsterm.complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
}
|
||||
catch (ex) {
|
||||
} catch (ex) {
|
||||
error = true;
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,17 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_IFRAME_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud-iframe.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-593003-iframe-wrong-hud.html";
|
||||
|
||||
const TEST_DUMMY_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
const TEST_IFRAME_URI = "http://example.com/browser/browser/devtools/" +
|
||||
"webconsole/test/test-bug-593003-iframe-wrong-" +
|
||||
"hud-iframe.html";
|
||||
|
||||
const TEST_DUMMY_URI = "http://example.com/browser/browser/devtools/" +
|
||||
"webconsole/test/test-console.html";
|
||||
|
||||
let tab1, tab2;
|
||||
|
||||
|
@ -8,13 +8,14 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-console.html";
|
||||
let HUD;
|
||||
let outputItem;
|
||||
let outputNode;
|
||||
|
||||
"use strict";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
@ -118,7 +119,7 @@ function networkPanelHidden() {
|
||||
info("jsterm execute 'document' callback");
|
||||
|
||||
HUD.jsterm.once("variablesview-open", deferred.resolve);
|
||||
let outputItem = msg.querySelector(".message-body a");
|
||||
outputItem = msg.querySelector(".message-body a");
|
||||
ok(outputItem, "jsterm output message found");
|
||||
|
||||
// Send the mousedown and click events such that the property panel opens.
|
||||
|
@ -8,10 +8,12 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
"use strict";
|
||||
|
||||
let inputNode, values;
|
||||
|
||||
let TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 594497 and bug 619598";
|
||||
"use strict";
|
||||
let TEST_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 594497 and bug 619598";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
@ -60,5 +60,5 @@ function testMessages() {
|
||||
category: CATEGORY_NETWORK,
|
||||
severity: SEVERITY_LOG,
|
||||
}],
|
||||
})
|
||||
});
|
||||
}
|
||||
|
@ -12,6 +12,8 @@
|
||||
// Tests that the Web Console doesn't leak when multiple tabs and windows are
|
||||
// opened and then closed.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 595350";
|
||||
|
||||
let win1 = window, win2;
|
||||
@ -98,4 +100,3 @@ function closeConsoles() {
|
||||
|
||||
openTabs = win1 = win2 = null;
|
||||
}
|
||||
|
||||
|
@ -8,20 +8,27 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 595934 - message categories coverage.";
|
||||
const TESTS_PATH = "http://example.com/browser/browser/devtools/webconsole/test/";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 595934 - message categories coverage.";
|
||||
const TESTS_PATH = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/";
|
||||
const TESTS = [
|
||||
{ // #0
|
||||
{
|
||||
// #0
|
||||
file: "test-bug-595934-css-loader.html",
|
||||
category: "CSS Loader",
|
||||
matchString: "text/css",
|
||||
},
|
||||
{ // #1
|
||||
{
|
||||
// #1
|
||||
file: "test-bug-595934-imagemap.html",
|
||||
category: "Layout: ImageMap",
|
||||
matchString: "shape=\"rect\"",
|
||||
},
|
||||
{ // #2
|
||||
{
|
||||
// #2
|
||||
file: "test-bug-595934-html.html",
|
||||
category: "HTML",
|
||||
matchString: "multipart/form-data",
|
||||
@ -30,43 +37,51 @@ const TESTS = [
|
||||
form.submit();
|
||||
},
|
||||
},
|
||||
{ // #3
|
||||
{
|
||||
// #3
|
||||
file: "test-bug-595934-workers.html",
|
||||
category: "Web Worker",
|
||||
matchString: "fooBarWorker",
|
||||
expectError: true,
|
||||
},
|
||||
{ // #4
|
||||
{
|
||||
// #4
|
||||
file: "test-bug-595934-malformedxml.xhtml",
|
||||
category: "malformed-xml",
|
||||
matchString: "no element found",
|
||||
},
|
||||
{ // #5
|
||||
{
|
||||
// #5
|
||||
file: "test-bug-595934-svg.xhtml",
|
||||
category: "SVG",
|
||||
matchString: "fooBarSVG",
|
||||
},
|
||||
{ // #6
|
||||
{
|
||||
// #6
|
||||
file: "test-bug-595934-css-parser.html",
|
||||
category: "CSS Parser",
|
||||
matchString: "foobarCssParser",
|
||||
},
|
||||
{ // #7
|
||||
{
|
||||
// #7
|
||||
file: "test-bug-595934-malformedxml-external.html",
|
||||
category: "malformed-xml",
|
||||
matchString: "</html>",
|
||||
},
|
||||
{ // #8
|
||||
{
|
||||
// #8
|
||||
file: "test-bug-595934-empty-getelementbyid.html",
|
||||
category: "DOM",
|
||||
matchString: "getElementById",
|
||||
},
|
||||
{ // #9
|
||||
{
|
||||
// #9
|
||||
file: "test-bug-595934-canvas-css.html",
|
||||
category: "CSS Parser",
|
||||
matchString: "foobarCanvasCssParser",
|
||||
},
|
||||
{ // #10
|
||||
{
|
||||
// #10
|
||||
file: "test-bug-595934-image.html",
|
||||
category: "Image",
|
||||
matchString: "corrupt",
|
||||
@ -87,30 +102,28 @@ let testEnded = false;
|
||||
let TestObserver = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||
|
||||
observe: function test_observe(aSubject)
|
||||
{
|
||||
if (testEnded || !(aSubject instanceof Ci.nsIScriptError)) {
|
||||
observe: function testObserve(subject) {
|
||||
if (testEnded || !(subject instanceof Ci.nsIScriptError)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var expectedCategory = TESTS[pos].category;
|
||||
let expectedCategory = TESTS[pos].category;
|
||||
|
||||
info("test #" + pos + " console observer got " + aSubject.category +
|
||||
info("test #" + pos + " console observer got " + subject.category +
|
||||
", is expecting " + expectedCategory);
|
||||
|
||||
if (aSubject.category == expectedCategory) {
|
||||
if (subject.category == expectedCategory) {
|
||||
foundCategory = true;
|
||||
startNextTest();
|
||||
}
|
||||
else {
|
||||
info("unexpected message was: " + aSubject.sourceName + ":" +
|
||||
aSubject.lineNumber + "; " + aSubject.errorMessage);
|
||||
} else {
|
||||
info("unexpected message was: " + subject.sourceName + ":" +
|
||||
subject.lineNumber + "; " + subject.errorMessage);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function consoleOpened(aHud) {
|
||||
hud = aHud;
|
||||
function consoleOpened(hudConsole) {
|
||||
hud = hudConsole;
|
||||
output = hud.outputNode;
|
||||
jsterm = hud.jsterm;
|
||||
|
||||
@ -131,12 +144,12 @@ function testNext() {
|
||||
pos++;
|
||||
info("testNext: #" + pos);
|
||||
if (pos < TESTS.length) {
|
||||
let test = TESTS[pos];
|
||||
test = TESTS[pos];
|
||||
|
||||
waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [{
|
||||
name: "message for test #" + pos + ": '" + test.matchString +"'",
|
||||
name: "message for test #" + pos + ": '" + test.matchString + "'",
|
||||
text: test.matchString,
|
||||
}],
|
||||
}).then(() => {
|
||||
@ -145,14 +158,14 @@ function testNext() {
|
||||
});
|
||||
|
||||
let testLocation = TESTS_PATH + test.file;
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onLoad(aEvent) {
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
|
||||
if (content.location.href != testLocation) {
|
||||
return;
|
||||
}
|
||||
gBrowser.selectedBrowser.removeEventListener(aEvent.type, onLoad, true);
|
||||
gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
|
||||
|
||||
pageLoaded = true;
|
||||
test.onload && test.onload(aEvent);
|
||||
test.onload && test.onload(evt);
|
||||
|
||||
if (test.expectError) {
|
||||
content.addEventListener("error", function _onError() {
|
||||
@ -161,8 +174,7 @@ function testNext() {
|
||||
startNextTest();
|
||||
});
|
||||
expectUncaughtException();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pageError = true;
|
||||
}
|
||||
|
||||
@ -170,8 +182,7 @@ function testNext() {
|
||||
}, true);
|
||||
|
||||
content.location = testLocation;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
testEnded = true;
|
||||
finishTest();
|
||||
}
|
||||
@ -200,4 +211,3 @@ function test() {
|
||||
openConsole().then(consoleOpened);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-console.html";
|
||||
|
||||
let tab1, tab2, win1, win2;
|
||||
let noErrors = true;
|
||||
@ -39,8 +42,7 @@ function tab2Loaded(aEvent) {
|
||||
try {
|
||||
let target1 = TargetFactory.forTab(tab1);
|
||||
gDevTools.showToolbox(target1, "webconsole").then(onWebConsoleOpen);
|
||||
}
|
||||
catch (ex) {
|
||||
} catch (ex) {
|
||||
ok(false, "gDevTools.showToolbox(target1) exception: " + ex);
|
||||
noErrors = false;
|
||||
}
|
||||
@ -48,8 +50,7 @@ function tab2Loaded(aEvent) {
|
||||
try {
|
||||
let target2 = TargetFactory.forTab(tab2);
|
||||
gDevTools.showToolbox(target2, "webconsole").then(onWebConsoleOpen);
|
||||
}
|
||||
catch (ex) {
|
||||
} catch (ex) {
|
||||
ok(false, "gDevTools.showToolbox(target2) exception: " + ex);
|
||||
noErrors = false;
|
||||
}
|
||||
@ -62,14 +63,12 @@ function tab2Loaded(aEvent) {
|
||||
try {
|
||||
let target2 = TargetFactory.forTab(tab2);
|
||||
gDevTools.closeToolbox(target2).then(testEnd);
|
||||
}
|
||||
catch (ex) {
|
||||
} catch (ex) {
|
||||
ok(false, "gDevTools.closeToolbox(target2) exception: " + ex);
|
||||
noErrors = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (ex) {
|
||||
} catch (ex) {
|
||||
ok(false, "gDevTools.closeToolbox(target1) exception: " + ex);
|
||||
noErrors = false;
|
||||
}
|
||||
@ -101,4 +100,3 @@ function test() {
|
||||
tab1Loaded();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -4,45 +4,47 @@
|
||||
// Tests that network requests from chrome don't cause the Web Console to
|
||||
// throw exceptions.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/";
|
||||
|
||||
let good = true;
|
||||
let listener = {
|
||||
QueryInterface: XPCOMUtils.generateQI([ Ci.nsIObserver ]),
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aSubject instanceof Ci.nsIScriptError &&
|
||||
aSubject.category === "XPConnect JavaScript" &&
|
||||
aSubject.sourceName.contains("webconsole")) {
|
||||
good = false;
|
||||
}
|
||||
QueryInterface: XPCOMUtils.generateQI([ Ci.nsIObserver ]),
|
||||
observe: function(subject) {
|
||||
if (subject instanceof Ci.nsIScriptError &&
|
||||
subject.category === "XPConnect JavaScript" &&
|
||||
subject.sourceName.contains("webconsole")) {
|
||||
good = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let xhr;
|
||||
|
||||
function test() {
|
||||
Services.console.registerListener(listener);
|
||||
Services.console.registerListener(listener);
|
||||
|
||||
HUDService; // trigger a lazy-load of the HUD Service
|
||||
// trigger a lazy-load of the HUD Service
|
||||
HUDService;
|
||||
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", xhrComplete, false);
|
||||
xhr.open("GET", TEST_URI, true);
|
||||
xhr.send(null);
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", xhrComplete, false);
|
||||
xhr.open("GET", TEST_URI, true);
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function xhrComplete() {
|
||||
xhr.removeEventListener("load", xhrComplete, false);
|
||||
window.setTimeout(checkForException, 0);
|
||||
xhr.removeEventListener("load", xhrComplete, false);
|
||||
window.setTimeout(checkForException, 0);
|
||||
}
|
||||
|
||||
function checkForException() {
|
||||
ok(good, "no exception was thrown when sending a network request from a " +
|
||||
"chrome window");
|
||||
ok(good, "no exception was thrown when sending a network request from a " +
|
||||
"chrome window");
|
||||
|
||||
Services.console.unregisterListener(listener);
|
||||
listener = xhr = null;
|
||||
Services.console.unregisterListener(listener);
|
||||
listener = xhr = null;
|
||||
|
||||
finishTest();
|
||||
finishTest();
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-network.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-network.html";
|
||||
const PREF = "devtools.webconsole.persistlog";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
|
@ -8,7 +8,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-597756-reopen-closed-tab.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-597756-reopen-closed-tab.html";
|
||||
|
||||
let HUD;
|
||||
|
||||
|
@ -8,29 +8,30 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
"use strict";
|
||||
|
||||
const INIT_URI = "data:text/plain;charset=utf8,hello world";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-599725-response-headers.sjs";
|
||||
|
||||
let loads = 0;
|
||||
function performTest(aRequest, aConsole)
|
||||
{
|
||||
function performTest(request, console) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
let headers = null;
|
||||
|
||||
function readHeader(aName)
|
||||
{
|
||||
function readHeader(name) {
|
||||
for (let header of headers) {
|
||||
if (header.name == aName) {
|
||||
if (header.name == name) {
|
||||
return header.value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
aConsole.webConsoleClient.getResponseHeaders(aRequest.actor,
|
||||
function (aResponse) {
|
||||
headers = aResponse.headers;
|
||||
console.webConsoleClient.getResponseHeaders(request.actor,
|
||||
function(response) {
|
||||
headers = response.headers;
|
||||
ok(headers, "we have the response headers for reload");
|
||||
|
||||
let contentType = readHeader("Content-Type");
|
||||
@ -71,7 +72,7 @@ function waitForRequest() {
|
||||
let test = asyncTest(function* () {
|
||||
let { browser } = yield loadTab(INIT_URI);
|
||||
|
||||
let hud = yield openConsole();
|
||||
yield openConsole();
|
||||
|
||||
let gotLastRequest = waitForRequest();
|
||||
|
||||
|
@ -8,25 +8,28 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const INIT_URI = "data:text/html;charset=utf-8,Web Console - bug 600183 test";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-600183-charset.html";
|
||||
"use strict";
|
||||
|
||||
function performTest(lastFinishedRequest, aConsole)
|
||||
{
|
||||
const INIT_URI = "data:text/html;charset=utf-8,Web Console - bug 600183 test";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-600183-charset.html";
|
||||
|
||||
function performTest(lastFinishedRequest, console) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
ok(lastFinishedRequest, "charset test page was loaded and logged");
|
||||
HUDService.lastFinishedRequest.callback = null;
|
||||
|
||||
executeSoon(() => {
|
||||
aConsole.webConsoleClient.getResponseContent(lastFinishedRequest.actor,
|
||||
(aResponse) => {
|
||||
ok(!aResponse.contentDiscarded, "response body was not discarded");
|
||||
console.webConsoleClient.getResponseContent(lastFinishedRequest.actor,
|
||||
(response) => {
|
||||
ok(!response.contentDiscarded, "response body was not discarded");
|
||||
|
||||
let body = aResponse.content.text;
|
||||
let body = response.content.text;
|
||||
ok(body, "we have the response body");
|
||||
|
||||
let chars = "\u7684\u95ee\u5019!"; // 的问候!
|
||||
// 的问候!
|
||||
let chars = "\u7684\u95ee\u5019!";
|
||||
isnot(body.indexOf("<p>" + chars + "</p>"), -1,
|
||||
"found the chinese simplified string");
|
||||
|
||||
|
@ -8,13 +8,17 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 601177: log levels";
|
||||
const TEST_URI2 = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-601177-log-levels.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 601177: log levels";
|
||||
const TEST_URI2 = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-601177-log-levels.html";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
Services.prefs.setBoolPref("javascript.options.strict", true);
|
||||
|
||||
let { browser } = yield loadTab(TEST_URI);
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
let hud = yield openConsole();
|
||||
|
||||
|
@ -5,11 +5,14 @@
|
||||
// Test that the console output scrolls to JS eval results when there are many
|
||||
// messages displayed. See bug 601352.
|
||||
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
Task.spawn(runner).then(finishTest);
|
||||
|
||||
function* runner() {
|
||||
let {tab} = yield loadTab("data:text/html;charset=utf-8,Web Console test for bug 601352");
|
||||
let {tab} = yield loadTab("data:text/html;charset=utf-8,Web Console test " +
|
||||
"for bug 601352");
|
||||
let hud = yield openConsole(tab);
|
||||
hud.jsterm.clearOutput();
|
||||
|
||||
@ -49,7 +52,9 @@ function test() {
|
||||
let rectNode = node.getBoundingClientRect();
|
||||
let rectOutput = scrollNode.getBoundingClientRect();
|
||||
console.debug("rectNode", rectNode, "rectOutput", rectOutput);
|
||||
console.log("scrollNode scrollHeight", scrollNode.scrollHeight, "scrollTop", scrollNode.scrollTop, "clientHeight", scrollNode.clientHeight);
|
||||
console.log("scrollNode scrollHeight", scrollNode.scrollHeight,
|
||||
"scrollTop", scrollNode.scrollTop, "clientHeight",
|
||||
scrollNode.clientHeight);
|
||||
|
||||
isnot(scrollNode.scrollTop, 0, "scroll location is not at the top");
|
||||
|
||||
@ -59,10 +64,12 @@ function test() {
|
||||
// Visible scroll viewport.
|
||||
let height = rectOutput.height;
|
||||
|
||||
// Top and bottom coordinates of the last message node, relative to the outputNode.
|
||||
// Top and bottom coordinates of the last message node, relative to the
|
||||
// outputNode.
|
||||
let top = rectNode.top - rectOutput.top;
|
||||
let bottom = top + rectNode.height;
|
||||
info("node top " + top + " node bottom " + bottom + " node clientHeight " + node.clientHeight);
|
||||
info("node top " + top + " node bottom " + bottom + " node clientHeight " +
|
||||
node.clientHeight);
|
||||
|
||||
ok(top >= 0 && bottom <= height, "last message is visible");
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
// Tests that the filter button UI logic works correctly.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/";
|
||||
|
||||
let hud, hudId, hudBox;
|
||||
@ -33,13 +35,13 @@ function testFilterButtons() {
|
||||
testIsolateFilterButton("security");
|
||||
}
|
||||
|
||||
function testMenuFilterButton(aCategory) {
|
||||
let selector = ".webconsole-filter-button[category=\"" + aCategory + "\"]";
|
||||
function testMenuFilterButton(category) {
|
||||
let selector = ".webconsole-filter-button[category=\"" + category + "\"]";
|
||||
let button = hudBox.querySelector(selector);
|
||||
ok(button, "we have the \"" + aCategory + "\" button");
|
||||
ok(button, "we have the \"" + category + "\" button");
|
||||
|
||||
let firstMenuItem = button.querySelector("menuitem");
|
||||
ok(firstMenuItem, "we have the first menu item for the \"" + aCategory +
|
||||
ok(firstMenuItem, "we have the first menu item for the \"" + category +
|
||||
"\" button");
|
||||
|
||||
// Turn all the filters off, if they were on.
|
||||
@ -59,39 +61,39 @@ function testMenuFilterButton(aCategory) {
|
||||
prefKey = menuItem.getAttribute("prefKey");
|
||||
chooseMenuItem(menuItem);
|
||||
ok(isChecked(menuItem), "menu item " + prefKey + " for category " +
|
||||
aCategory + " is checked after clicking it");
|
||||
category + " is checked after clicking it");
|
||||
ok(hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
|
||||
"on after clicking the appropriate menu item");
|
||||
}
|
||||
menuItem = menuItem.nextSibling;
|
||||
}
|
||||
ok(isChecked(button), "the button for category " + aCategory + " is " +
|
||||
ok(isChecked(button), "the button for category " + category + " is " +
|
||||
"checked after turning on all its menu items");
|
||||
|
||||
// Turn one filter off; make sure the button is still checked.
|
||||
prefKey = firstMenuItem.getAttribute("prefKey");
|
||||
chooseMenuItem(firstMenuItem);
|
||||
ok(!isChecked(firstMenuItem), "the first menu item for category " +
|
||||
aCategory + " is no longer checked after clicking it");
|
||||
category + " is no longer checked after clicking it");
|
||||
ok(!hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
|
||||
"turned off after clicking the appropriate menu item");
|
||||
ok(isChecked(button), "the button for category " + aCategory + " is still " +
|
||||
ok(isChecked(button), "the button for category " + category + " is still " +
|
||||
"checked after turning off its first menu item");
|
||||
|
||||
// Turn all the filters off by clicking the main part of the button.
|
||||
let subbutton = getMainButton(button);
|
||||
ok(subbutton, "we have the subbutton for category " + aCategory);
|
||||
ok(subbutton, "we have the subbutton for category " + category);
|
||||
|
||||
clickButton(subbutton);
|
||||
ok(!isChecked(button), "the button for category " + aCategory + " is " +
|
||||
ok(!isChecked(button), "the button for category " + category + " is " +
|
||||
"no longer checked after clicking its main part");
|
||||
|
||||
menuItem = firstMenuItem;
|
||||
while (menuItem) {
|
||||
let prefKey = menuItem.getAttribute("prefKey");
|
||||
prefKey = menuItem.getAttribute("prefKey");
|
||||
if (prefKey) {
|
||||
ok(!isChecked(menuItem), "menu item " + prefKey + " for category " +
|
||||
aCategory + " is no longer checked after clicking the button");
|
||||
category + " is no longer checked after clicking the button");
|
||||
ok(!hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
|
||||
"off after clicking the button");
|
||||
}
|
||||
@ -101,22 +103,22 @@ function testMenuFilterButton(aCategory) {
|
||||
// Turn all the filters on by clicking the main part of the button.
|
||||
clickButton(subbutton);
|
||||
|
||||
ok(isChecked(button), "the button for category " + aCategory + " is " +
|
||||
ok(isChecked(button), "the button for category " + category + " is " +
|
||||
"checked after clicking its main part");
|
||||
|
||||
menuItem = firstMenuItem;
|
||||
while (menuItem) {
|
||||
if (menuItem.hasAttribute("prefKey")) {
|
||||
let prefKey = menuItem.getAttribute("prefKey");
|
||||
prefKey = menuItem.getAttribute("prefKey");
|
||||
// The CSS/Log menu item should not be checked. See bug 971798.
|
||||
if (aCategory == "css" && prefKey == "csslog") {
|
||||
if (category == "css" && prefKey == "csslog") {
|
||||
ok(!isChecked(menuItem), "menu item " + prefKey + " for category " +
|
||||
aCategory + " should not be checked after clicking the button");
|
||||
category + " should not be checked after clicking the button");
|
||||
ok(!hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
|
||||
"off after clicking the button");
|
||||
} else {
|
||||
ok(isChecked(menuItem), "menu item " + prefKey + " for category " +
|
||||
aCategory + " is checked after clicking the button");
|
||||
category + " is checked after clicking the button");
|
||||
ok(hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
|
||||
"on after clicking the button");
|
||||
}
|
||||
@ -136,25 +138,25 @@ function testMenuFilterButton(aCategory) {
|
||||
menuItem = menuItem.nextSibling;
|
||||
}
|
||||
|
||||
ok(!isChecked(button), "the button for category " + aCategory + " is " +
|
||||
ok(!isChecked(button), "the button for category " + category + " is " +
|
||||
"unchecked after unchecking all its filters");
|
||||
|
||||
// Turn all the filters on again by clicking the button.
|
||||
clickButton(subbutton);
|
||||
}
|
||||
|
||||
function testIsolateFilterButton(aCategory) {
|
||||
let selector = ".webconsole-filter-button[category=\"" + aCategory + "\"]";
|
||||
function testIsolateFilterButton(category) {
|
||||
let selector = ".webconsole-filter-button[category=\"" + category + "\"]";
|
||||
let targetButton = hudBox.querySelector(selector);
|
||||
ok(targetButton, "we have the \"" + aCategory + "\" button");
|
||||
ok(targetButton, "we have the \"" + category + "\" button");
|
||||
|
||||
// Get the main part of the filter button.
|
||||
let subbutton = getMainButton(targetButton);
|
||||
ok(subbutton, "we have the subbutton for category " + aCategory);
|
||||
ok(subbutton, "we have the subbutton for category " + category);
|
||||
|
||||
// Turn on all the filters by alt clicking the main part of the button.
|
||||
altClickButton(subbutton);
|
||||
ok(isChecked(targetButton), "the button for category " + aCategory +
|
||||
ok(isChecked(targetButton), "the button for category " + category +
|
||||
" is checked after isolating for filter");
|
||||
|
||||
// Check if all the filters for the target button are on.
|
||||
@ -162,16 +164,16 @@ function testIsolateFilterButton(aCategory) {
|
||||
Array.forEach(menuItems, (item) => {
|
||||
let prefKey = item.getAttribute("prefKey");
|
||||
// The CSS/Log filter should not be checked. See bug 971798.
|
||||
if (aCategory == "css" && prefKey == "csslog") {
|
||||
if (category == "css" && prefKey == "csslog") {
|
||||
ok(!isChecked(item), "menu item " + prefKey + " for category " +
|
||||
aCategory + " should not be checked after isolating for " + aCategory);
|
||||
category + " should not be checked after isolating for " + category);
|
||||
ok(!hud.ui.filterPrefs[prefKey], prefKey + " messages should be " +
|
||||
"turned off after isolating for " + aCategory);
|
||||
"turned off after isolating for " + category);
|
||||
} else if (prefKey) {
|
||||
ok(isChecked(item), "menu item " + prefKey + " for category " +
|
||||
aCategory + " is checked after isolating for " + aCategory);
|
||||
category + " is checked after isolating for " + category);
|
||||
ok(hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
|
||||
"turned on after isolating for " + aCategory);
|
||||
"turned on after isolating for " + category);
|
||||
}
|
||||
});
|
||||
|
||||
@ -180,18 +182,18 @@ function testIsolateFilterButton(aCategory) {
|
||||
let buttons = hudBox.querySelectorAll(".webconsole-filter-button[category]");
|
||||
Array.forEach(buttons, (filterButton) => {
|
||||
if (filterButton !== targetButton) {
|
||||
let category = filterButton.getAttribute("category");
|
||||
let categoryBtn = filterButton.getAttribute("category");
|
||||
ok(!isChecked(filterButton), "the button for category " +
|
||||
category + " is unchecked after isolating for " + aCategory);
|
||||
categoryBtn + " is unchecked after isolating for " + category);
|
||||
|
||||
menuItems = filterButton.querySelectorAll("menuitem");
|
||||
Array.forEach(menuItems, (item) => {
|
||||
let prefKey = item.getAttribute("prefKey");
|
||||
if (prefKey) {
|
||||
ok(!isChecked(item), "menu item " + prefKey + " for category " +
|
||||
aCategory + " is unchecked after isolating for " + aCategory);
|
||||
category + " is unchecked after isolating for " + category);
|
||||
ok(!hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
|
||||
"turned off after isolating for " + aCategory);
|
||||
"turned off after isolating for " + category);
|
||||
}
|
||||
});
|
||||
|
||||
@ -205,8 +207,8 @@ function testIsolateFilterButton(aCategory) {
|
||||
/**
|
||||
* Return the main part of the target filter button.
|
||||
*/
|
||||
function getMainButton(aTargetButton) {
|
||||
let anonymousNodes = hud.ui.document.getAnonymousNodes(aTargetButton);
|
||||
function getMainButton(targetButton) {
|
||||
let anonymousNodes = hud.ui.document.getAnonymousNodes(targetButton);
|
||||
let subbutton;
|
||||
|
||||
for (let i = 0; i < anonymousNodes.length; i++) {
|
||||
@ -220,22 +222,21 @@ function getMainButton(aTargetButton) {
|
||||
return subbutton;
|
||||
}
|
||||
|
||||
function clickButton(aNode) {
|
||||
EventUtils.sendMouseEvent({ type: "click" }, aNode);
|
||||
function clickButton(node) {
|
||||
EventUtils.sendMouseEvent({ type: "click" }, node);
|
||||
}
|
||||
|
||||
function altClickButton(aNode) {
|
||||
EventUtils.sendMouseEvent({ type: "click", altKey: true }, aNode);
|
||||
function altClickButton(node) {
|
||||
EventUtils.sendMouseEvent({ type: "click", altKey: true }, node);
|
||||
}
|
||||
|
||||
function chooseMenuItem(aNode) {
|
||||
function chooseMenuItem(node) {
|
||||
let event = document.createEvent("XULCommandEvent");
|
||||
event.initCommandEvent("command", true, true, window, 0, false, false, false,
|
||||
false, null);
|
||||
aNode.dispatchEvent(event);
|
||||
node.dispatchEvent(event);
|
||||
}
|
||||
|
||||
function isChecked(aNode) {
|
||||
return aNode.getAttribute("checked") === "true";
|
||||
function isChecked(node) {
|
||||
return node.getAttribute("checked") === "true";
|
||||
}
|
||||
|
||||
|
@ -8,17 +8,34 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
let menuitems = [], menupopups = [], huds = [], tabs = [], runCount = 0;
|
||||
"use strict";
|
||||
|
||||
const TEST_URI1 = "data:text/html;charset=utf-8,Web Console test for bug 602572: log bodies checkbox. tab 1";
|
||||
const TEST_URI2 = "data:text/html;charset=utf-8,Web Console test for bug 602572: log bodies checkbox. tab 2";
|
||||
let menuitems = [];
|
||||
let menupopups = [];
|
||||
let huds = [];
|
||||
let tabs = [];
|
||||
let runCount = 0;
|
||||
|
||||
function test()
|
||||
{
|
||||
const TEST_URI1 = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 602572: log bodies checkbox. tab 1";
|
||||
const TEST_URI2 = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 602572: log bodies checkbox. tab 2";
|
||||
|
||||
function test() {
|
||||
if (runCount == 0) {
|
||||
requestLongerTimeout(2);
|
||||
}
|
||||
|
||||
// open tab 2
|
||||
function openTab() {
|
||||
loadTab(TEST_URI2).then((tab) => {
|
||||
tabs.push(tab.tab);
|
||||
openConsole().then((hud) => {
|
||||
hud.iframeWindow.mozRequestAnimationFrame(startTest);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// open tab 1
|
||||
loadTab(TEST_URI1).then((tab) => {
|
||||
tabs.push(tab.tab);
|
||||
@ -26,28 +43,23 @@ function test()
|
||||
hud.iframeWindow.mozRequestAnimationFrame(() => {
|
||||
info("iframe1 root height " + hud.ui.rootElement.clientHeight);
|
||||
|
||||
// open tab 2
|
||||
loadTab(TEST_URI2).then((tab) => {
|
||||
tabs.push(tab.tab);
|
||||
openConsole().then((hud) => hud.iframeWindow.mozRequestAnimationFrame(startTest));
|
||||
});
|
||||
openTab();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function startTest()
|
||||
{
|
||||
function startTest() {
|
||||
// Find the relevant elements in the Web Console of tab 2.
|
||||
let win2 = tabs[runCount*2 + 1].linkedBrowser.contentWindow;
|
||||
let win2 = tabs[runCount * 2 + 1].linkedBrowser.contentWindow;
|
||||
huds[1] = HUDService.getHudByWindow(win2);
|
||||
info("startTest: iframe2 root height " + huds[1].ui.rootElement.clientHeight);
|
||||
|
||||
if (runCount == 0) {
|
||||
menuitems[1] = huds[1].ui.rootElement.querySelector("#saveBodies");
|
||||
}
|
||||
else {
|
||||
menuitems[1] = huds[1].ui.rootElement.querySelector("#saveBodiesContextMenu");
|
||||
} else {
|
||||
menuitems[1] = huds[1].ui.rootElement
|
||||
.querySelector("#saveBodiesContextMenu");
|
||||
}
|
||||
menupopups[1] = menuitems[1].parentNode;
|
||||
|
||||
@ -58,9 +70,8 @@ function startTest()
|
||||
});
|
||||
}
|
||||
|
||||
function onpopupshown2(aEvent)
|
||||
{
|
||||
menupopups[1].removeEventListener(aEvent.type, onpopupshown2, false);
|
||||
function onpopupshown2(evt) {
|
||||
menupopups[1].removeEventListener(evt.type, onpopupshown2, false);
|
||||
|
||||
// By default bodies are not logged.
|
||||
isnot(menuitems[1].getAttribute("checked"), "true",
|
||||
@ -73,30 +84,30 @@ function onpopupshown2(aEvent)
|
||||
menupopups[1].hidePopup();
|
||||
});
|
||||
|
||||
menupopups[1].addEventListener("popuphidden", function _onhidden(aEvent) {
|
||||
menupopups[1].removeEventListener(aEvent.type, _onhidden, false);
|
||||
menupopups[1].addEventListener("popuphidden", function _onhidden(evtPopup) {
|
||||
menupopups[1].removeEventListener(evtPopup.type, _onhidden, false);
|
||||
|
||||
info("menupopups[1] hidden");
|
||||
|
||||
// Reopen the context menu.
|
||||
huds[1].ui.once("save-bodies-ui-toggled", () => testpopup2b(aEvent));
|
||||
huds[1].ui.once("save-bodies-ui-toggled", () => testpopup2b(evtPopup));
|
||||
menupopups[1].openPopup();
|
||||
}, false);
|
||||
}
|
||||
|
||||
function testpopup2b(aEvent) {
|
||||
function testpopup2b() {
|
||||
is(menuitems[1].getAttribute("checked"), "true", "menuitems[1] is checked");
|
||||
|
||||
menupopups[1].addEventListener("popuphidden", function _onhidden(aEvent) {
|
||||
menupopups[1].removeEventListener(aEvent.type, _onhidden, false);
|
||||
menupopups[1].addEventListener("popuphidden", function _onhidden(evtPopup) {
|
||||
menupopups[1].removeEventListener(evtPopup.type, _onhidden, false);
|
||||
|
||||
info("menupopups[1] hidden");
|
||||
|
||||
// Switch to tab 1 and open the Web Console context menu from there.
|
||||
gBrowser.selectedTab = tabs[runCount*2];
|
||||
gBrowser.selectedTab = tabs[runCount * 2];
|
||||
waitForFocus(function() {
|
||||
// Find the relevant elements in the Web Console of tab 1.
|
||||
let win1 = tabs[runCount*2].linkedBrowser.contentWindow;
|
||||
let win1 = tabs[runCount * 2].linkedBrowser.contentWindow;
|
||||
huds[0] = HUDService.getHudByWindow(win1);
|
||||
|
||||
info("iframe1 root height " + huds[0].ui.rootElement.clientHeight);
|
||||
@ -106,7 +117,7 @@ function testpopup2b(aEvent) {
|
||||
|
||||
menupopups[0].addEventListener("popupshown", onpopupshown1, false);
|
||||
executeSoon(() => menupopups[0].openPopup());
|
||||
}, tabs[runCount*2].linkedBrowser.contentWindow);
|
||||
}, tabs[runCount * 2].linkedBrowser.contentWindow);
|
||||
}, false);
|
||||
|
||||
executeSoon(function() {
|
||||
@ -114,9 +125,8 @@ function testpopup2b(aEvent) {
|
||||
});
|
||||
}
|
||||
|
||||
function onpopupshown1(aEvent)
|
||||
{
|
||||
menupopups[0].removeEventListener(aEvent.type, onpopupshown1, false);
|
||||
function onpopupshown1(evt) {
|
||||
menupopups[0].removeEventListener(evt.type, onpopupshown1, false);
|
||||
|
||||
// The menuitem checkbox must not be in sync with the other tabs.
|
||||
isnot(menuitems[0].getAttribute("checked"), "true",
|
||||
@ -128,25 +138,25 @@ function onpopupshown1(aEvent)
|
||||
});
|
||||
|
||||
// Close the menu, and switch back to tab 2.
|
||||
menupopups[0].addEventListener("popuphidden", function _onhidden(aEvent) {
|
||||
menupopups[0].removeEventListener(aEvent.type, _onhidden, false);
|
||||
menupopups[0].addEventListener("popuphidden", function _onhidden(evtPopup) {
|
||||
menupopups[0].removeEventListener(evtPopup.type, _onhidden, false);
|
||||
|
||||
info("menupopups[0] hidden");
|
||||
|
||||
gBrowser.selectedTab = tabs[runCount*2 + 1];
|
||||
gBrowser.selectedTab = tabs[runCount * 2 + 1];
|
||||
waitForFocus(function() {
|
||||
// Reopen the context menu from tab 2.
|
||||
huds[1].ui.once("save-bodies-ui-toggled", () => testpopup2c(aEvent));
|
||||
huds[1].ui.once("save-bodies-ui-toggled", () => testpopup2c(evtPopup));
|
||||
menupopups[1].openPopup();
|
||||
}, tabs[runCount*2 + 1].linkedBrowser.contentWindow);
|
||||
}, tabs[runCount * 2 + 1].linkedBrowser.contentWindow);
|
||||
}, false);
|
||||
}
|
||||
|
||||
function testpopup2c(aEvent) {
|
||||
function testpopup2c() {
|
||||
is(menuitems[1].getAttribute("checked"), "true", "menuitems[1] is checked");
|
||||
|
||||
menupopups[1].addEventListener("popuphidden", function _onhidden(aEvent) {
|
||||
menupopups[1].removeEventListener(aEvent.type, _onhidden, false);
|
||||
menupopups[1].addEventListener("popuphidden", function _onhidden(evtPopup) {
|
||||
menupopups[1].removeEventListener(evtPopup.type, _onhidden, false);
|
||||
|
||||
info("menupopups[1] hidden");
|
||||
|
||||
@ -156,8 +166,7 @@ function testpopup2c(aEvent) {
|
||||
runCount++;
|
||||
info("start second run");
|
||||
executeSoon(test);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gBrowser.removeCurrentTab();
|
||||
gBrowser.selectedTab = tabs[2];
|
||||
gBrowser.removeCurrentTab();
|
||||
|
@ -8,11 +8,15 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-603750-websocket.html";
|
||||
const TEST_URI2 = "data:text/html;charset=utf-8,Web Console test for bug 603750: Web Socket errors";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-603750-websocket.html";
|
||||
const TEST_URI2 = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 603750: Web Socket errors";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
let { browser } = yield loadTab(TEST_URI2);
|
||||
yield loadTab(TEST_URI2);
|
||||
|
||||
let hud = yield openConsole();
|
||||
|
||||
@ -33,5 +37,6 @@ let test = asyncTest(function* () {
|
||||
category: CATEGORY_JS,
|
||||
severity: SEVERITY_ERROR,
|
||||
},
|
||||
]});
|
||||
]
|
||||
});
|
||||
});
|
||||
|
@ -2,12 +2,13 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_URI = 'data:text/html;charset=utf-8,<div style="-moz-opacity:0;">test repeated' +
|
||||
' css warnings</div><p style="-moz-opacity:0">hi</p>';
|
||||
let hud;
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = 'data:text/html;charset=utf-8,<div style="-moz-opacity:0;">' +
|
||||
'test repeated css warnings</div><p style="-moz-opacity:0">' +
|
||||
'hi</p>';
|
||||
let hud;
|
||||
|
||||
/**
|
||||
* Unit test for bug 611795:
|
||||
* Repeated CSS messages get collapsed into one.
|
||||
@ -28,8 +29,7 @@ let test = asyncTest(function* () {
|
||||
hud = null;
|
||||
});
|
||||
|
||||
function onContentLoaded()
|
||||
{
|
||||
function onContentLoaded() {
|
||||
let cssWarning = "Unknown property '-moz-opacity'. Declaration dropped.";
|
||||
|
||||
return waitForMessages({
|
||||
@ -43,13 +43,15 @@ function onContentLoaded()
|
||||
});
|
||||
}
|
||||
|
||||
function testConsoleLogRepeats()
|
||||
{
|
||||
function testConsoleLogRepeats() {
|
||||
let jsterm = hud.jsterm;
|
||||
|
||||
jsterm.clearOutput();
|
||||
|
||||
jsterm.setInputValue("for (let i = 0; i < 10; ++i) console.log('this is a line of reasonably long text that I will use to verify that the repeated text node is of an appropriate size.');");
|
||||
jsterm.setInputValue("for (let i = 0; i < 10; ++i) console.log('this is a " +
|
||||
"line of reasonably long text that I will use to " +
|
||||
"verify that the repeated text node is of an " +
|
||||
"appropriate size.');");
|
||||
jsterm.execute();
|
||||
|
||||
return waitForMessages({
|
||||
|
@ -8,8 +8,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-613013-console-api-iframe.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-613013-console-api-iframe.html";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
@ -6,6 +6,8 @@
|
||||
* Mihai Șucan <mihai.sucan@gmail.com>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 613280";
|
||||
|
||||
function test() {
|
||||
@ -20,7 +22,7 @@ function test() {
|
||||
severity: SEVERITY_LOG,
|
||||
}],
|
||||
}).then(performTest.bind(null, HUD));
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -30,11 +32,11 @@ function performTest(HUD, [result]) {
|
||||
let selection = getSelection();
|
||||
let contentSelection = content.getSelection();
|
||||
|
||||
let clipboard_setup = function() {
|
||||
let clipboardSetup = function() {
|
||||
goDoCommand("cmd_copy");
|
||||
};
|
||||
|
||||
let clipboard_copy_done = function() {
|
||||
let clipboardCopyDone = function() {
|
||||
finishTest();
|
||||
};
|
||||
|
||||
@ -56,8 +58,8 @@ function performTest(HUD, [result]) {
|
||||
goUpdateCommand("cmd_copy");
|
||||
}
|
||||
|
||||
let controller = top.document.commandDispatcher.
|
||||
getControllerForCommand("cmd_copy");
|
||||
let controller = top.document.commandDispatcher
|
||||
.getControllerForCommand("cmd_copy");
|
||||
is(controller.isCommandEnabled("cmd_copy"), false, "cmd_copy is disabled");
|
||||
|
||||
HUD.ui.output.selectMessage(msg);
|
||||
@ -65,16 +67,18 @@ function performTest(HUD, [result]) {
|
||||
|
||||
goUpdateCommand("cmd_copy");
|
||||
|
||||
controller = top.document.commandDispatcher.
|
||||
getControllerForCommand("cmd_copy");
|
||||
controller = top.document.commandDispatcher
|
||||
.getControllerForCommand("cmd_copy");
|
||||
is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled");
|
||||
|
||||
// Remove new lines since getSelection() includes one between message and line
|
||||
// number, but the clipboard doesn't (see bug 1119503)
|
||||
let selectionText = (HUD.iframeWindow.getSelection() + "").replace(/\r?\n|\r/g, " ");
|
||||
let selectionText = (HUD.iframeWindow.getSelection() + "")
|
||||
.replace(/\r?\n|\r/g, " ");
|
||||
isnot(selectionText.indexOf("foobarBazBug613280"), -1,
|
||||
"selection text includes 'foobarBazBug613280'");
|
||||
|
||||
waitForClipboard((str) => { return str.trim() == selectionText.trim(); },
|
||||
clipboard_setup, clipboard_copy_done, clipboard_copy_done);
|
||||
waitForClipboard((str) => {
|
||||
return str.trim() == selectionText.trim();
|
||||
}, clipboardSetup, clipboardCopyDone, clipboardCopyDone);
|
||||
}
|
||||
|
@ -7,7 +7,10 @@
|
||||
* Mihai Șucan <mihai.sucan@gmail.com>
|
||||
*/
|
||||
|
||||
let TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 613642: remember scroll location";
|
||||
"use strict";
|
||||
|
||||
let TEST_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 613642: remember scroll location";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
@ -52,7 +55,6 @@ let test = asyncTest(function* () {
|
||||
|
||||
yield scrolled.promise;
|
||||
|
||||
|
||||
// add a message and make sure scroll doesn't change
|
||||
content.console.log("test message 150");
|
||||
|
||||
@ -109,7 +111,8 @@ let test = asyncTest(function* () {
|
||||
return;
|
||||
}
|
||||
scrollBox.onscroll = null;
|
||||
isnot(scrollBox.scrollTop, oldScrollTop, "scroll location updated (moved to bottom again)");
|
||||
isnot(scrollBox.scrollTop, oldScrollTop,
|
||||
"scroll location updated (moved to bottom again)");
|
||||
scrolled.resolve();
|
||||
};
|
||||
yield scrolled.promise;
|
||||
|
@ -9,14 +9,15 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 613642: maintain scroll with pruning of old messages";
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 613642: maintain scroll with pruning of old messages";
|
||||
|
||||
let hud;
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
let hud = yield openConsole();
|
||||
hud = yield openConsole();
|
||||
|
||||
hud.jsterm.clearOutput();
|
||||
|
||||
|
@ -7,12 +7,15 @@
|
||||
* Mihai Șucan <mihai.sucan@gmail.com>
|
||||
*/
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 614793: jsterm result scroll";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 614793: jsterm result scroll";
|
||||
|
||||
"use strict";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
let { browser } = yield loadTab(TEST_URI);
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
let hud = yield openConsole();
|
||||
|
||||
@ -46,8 +49,7 @@ function consoleOpened(hud) {
|
||||
hud.jsterm.execute("'hello world'").then(onExecute);
|
||||
});
|
||||
|
||||
function onExecute(msg)
|
||||
{
|
||||
function onExecute(msg) {
|
||||
isnot(scrollNode.scrollTop, oldScrollTop, "scroll location updated");
|
||||
|
||||
oldScrollTop = scrollNode.scrollTop;
|
||||
|
@ -6,8 +6,11 @@
|
||||
// Tests that we report JS exceptions in event handlers coming from
|
||||
// network requests, like onreadystate for XHR. See bug 618078.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 618078";
|
||||
const TEST_URI2 = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-618078-network-exceptions.html";
|
||||
const TEST_URI2 = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-618078-network-exceptions.html";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
@ -3,7 +3,10 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-console.html";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
@ -19,12 +22,11 @@ let test = asyncTest(function* () {
|
||||
category: CATEGORY_NETWORK,
|
||||
severity: SEVERITY_LOG,
|
||||
}],
|
||||
})
|
||||
});
|
||||
|
||||
yield performTest(hud, results);
|
||||
});
|
||||
|
||||
|
||||
function performTest(HUD, results) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
@ -82,7 +84,8 @@ function performTest(HUD, results) {
|
||||
}
|
||||
});
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, networkLink, HUD.iframeWindow);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, networkLink,
|
||||
HUD.iframeWindow);
|
||||
EventUtils.sendMouseEvent({ type: "mouseup" }, networkLink, HUD.iframeWindow);
|
||||
EventUtils.sendMouseEvent({ type: "click" }, networkLink, HUD.iframeWindow);
|
||||
|
||||
|
@ -7,7 +7,10 @@
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
*/
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-621644-jsterm-dollar.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-621644-jsterm-dollar.html";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
@ -18,7 +21,6 @@ let test = asyncTest(function* () {
|
||||
yield test$$(hud);
|
||||
});
|
||||
|
||||
|
||||
function* test$(HUD) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const prefs = {
|
||||
"net": [
|
||||
"network",
|
||||
@ -62,7 +64,8 @@ function onConsoleOpen(hud) {
|
||||
for (let category in prefs) {
|
||||
let button = hudBox.querySelector(".webconsole-filter-button[category=\""
|
||||
+ category + "\"]");
|
||||
ok(isChecked(button), "main button for " + category + " category is checked");
|
||||
ok(isChecked(button), "main button for " + category +
|
||||
" category is checked");
|
||||
|
||||
prefs[category].forEach(function(pref) {
|
||||
let menuitem = hudBox.querySelector("menuitem[prefKey=" + pref + "]");
|
||||
@ -77,7 +80,7 @@ function onConsoleOpen(hud) {
|
||||
});
|
||||
}
|
||||
|
||||
//Re-init the console
|
||||
// Re-init the console
|
||||
closeConsole().then(() => {
|
||||
openConsole().then(deferred.resolve);
|
||||
});
|
||||
@ -95,7 +98,8 @@ function onConsoleReopen1(hud) {
|
||||
for (let category in prefs) {
|
||||
let button = hudBox.querySelector(".webconsole-filter-button[category=\""
|
||||
+ category + "\"]");
|
||||
ok(isUnchecked(button), "main button for " + category + " category is not checked");
|
||||
ok(isUnchecked(button), "main button for " + category +
|
||||
" category is not checked");
|
||||
|
||||
prefs[category].forEach(function(pref) {
|
||||
let menuitem = hudBox.querySelector("menuitem[prefKey=" + pref + "]");
|
||||
@ -123,9 +127,10 @@ function onConsoleReopen2(hud) {
|
||||
|
||||
// Check the main category button is checked and first menuitem is checked
|
||||
for (let category in prefs) {
|
||||
let button = hudBox.querySelector(".webconsole-filter-button[category=\""
|
||||
+ category + "\"]");
|
||||
ok(isChecked(button), category + " button is checked when first pref is true");
|
||||
let button = hudBox.querySelector(".webconsole-filter-button[category=\"" +
|
||||
category + "\"]");
|
||||
ok(isChecked(button), category +
|
||||
" button is checked when first pref is true");
|
||||
|
||||
let pref = prefs[category][0];
|
||||
let menuitem = hudBox.querySelector("menuitem[prefKey=" + pref + "]");
|
||||
|
@ -4,6 +4,8 @@
|
||||
// Test for https://bugzilla.mozilla.org/show_bug.cgi?id=623749
|
||||
// Map Control + A to Select All, In the web console input, on Windows
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Test console for bug 623749";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
|
@ -7,8 +7,12 @@
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
*/
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<p>Web Console test for bug 630733";
|
||||
const TEST_URI2 = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-630733-response-redirect-headers.sjs";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<p>Web Console test for " +
|
||||
"bug 630733";
|
||||
const TEST_URI2 = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-630733-response-redirect-headers.sjs";
|
||||
|
||||
let lastFinishedRequests = {};
|
||||
let webConsoleClient;
|
||||
@ -25,8 +29,7 @@ let test = asyncTest(function* () {
|
||||
performTest();
|
||||
});
|
||||
|
||||
function consoleOpened(hud)
|
||||
{
|
||||
function consoleOpened(hud) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
webConsoleClient = hud.ui.webConsoleClient;
|
||||
@ -34,22 +37,21 @@ function consoleOpened(hud)
|
||||
ok(hud.ui._saveRequestAndResponseBodies,
|
||||
"The saveRequestAndResponseBodies property was successfully set.");
|
||||
|
||||
HUDService.lastFinishedRequest.callback = (aHttpRequest) => {
|
||||
HUDService.lastFinishedRequest.callback = (aHttpRequest) => {
|
||||
let status = aHttpRequest.response.status;
|
||||
lastFinishedRequests[status] = aHttpRequest;
|
||||
if ("301" in lastFinishedRequests &&
|
||||
"404" in lastFinishedRequests) {
|
||||
deferred.resolve();
|
||||
}
|
||||
}
|
||||
};
|
||||
content.location = TEST_URI2;
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function getHeaders()
|
||||
{
|
||||
function getHeaders() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
HUDService.lastFinishedRequest.callback = null;
|
||||
@ -58,32 +60,31 @@ function getHeaders()
|
||||
ok("404" in lastFinishedRequests, "request 2: 404 Not found");
|
||||
|
||||
webConsoleClient.getResponseHeaders(lastFinishedRequests["301"].actor,
|
||||
function (aResponse) {
|
||||
lastFinishedRequests["301"].response.headers = aResponse.headers;
|
||||
function(response) {
|
||||
lastFinishedRequests["301"].response.headers = response.headers;
|
||||
|
||||
webConsoleClient.getResponseHeaders(lastFinishedRequests["404"].actor,
|
||||
function (aResponse) {
|
||||
lastFinishedRequests["404"].response.headers = aResponse.headers;
|
||||
function(resp) {
|
||||
lastFinishedRequests["404"].response.headers = resp.headers;
|
||||
executeSoon(deferred.resolve);
|
||||
});
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function getContent()
|
||||
{
|
||||
function getContent() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
webConsoleClient.getResponseContent(lastFinishedRequests["301"].actor,
|
||||
function (aResponse) {
|
||||
lastFinishedRequests["301"].response.content = aResponse.content;
|
||||
lastFinishedRequests["301"].discardResponseBody = aResponse.contentDiscarded;
|
||||
function(response) {
|
||||
lastFinishedRequests["301"].response.content = response.content;
|
||||
lastFinishedRequests["301"].discardResponseBody = response.contentDiscarded;
|
||||
|
||||
webConsoleClient.getResponseContent(lastFinishedRequests["404"].actor,
|
||||
function (aResponse) {
|
||||
lastFinishedRequests["404"].response.content = aResponse.content;
|
||||
function(resp) {
|
||||
lastFinishedRequests["404"].response.content = resp.content;
|
||||
lastFinishedRequests["404"].discardResponseBody =
|
||||
aResponse.contentDiscarded;
|
||||
resp.contentDiscarded;
|
||||
|
||||
webConsoleClient = null;
|
||||
executeSoon(deferred.resolve);
|
||||
@ -92,12 +93,10 @@ function getContent()
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function performTest()
|
||||
{
|
||||
function readHeader(aName)
|
||||
{
|
||||
function performTest() {
|
||||
function readHeader(name) {
|
||||
for (let header of headers) {
|
||||
if (header.name == aName) {
|
||||
if (header.name == name) {
|
||||
return header.value;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-632275-getters.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-632275-getters.html";
|
||||
|
||||
let getterValue = null;
|
||||
|
||||
@ -20,8 +23,7 @@ function consoleOpened(hud) {
|
||||
hud.jsterm.once("variablesview-fetched", onOpen);
|
||||
}
|
||||
|
||||
function onViewOpened(hud, event, view)
|
||||
{
|
||||
function onViewOpened(hud, event, view) {
|
||||
let doc = content.wrappedJSObject.document;
|
||||
|
||||
findVariableViewProperties(view, [
|
||||
@ -30,8 +32,8 @@ function onViewOpened(hud, event, view)
|
||||
{ name: "foobar.val", isGetter: true },
|
||||
], { webconsole: hud }).then(function() {
|
||||
is(doc.foobar._val, getterValue, "getter did not execute");
|
||||
is(doc.foobar.val, getterValue+1, "getter executed");
|
||||
is(doc.foobar._val, getterValue+1, "getter executed (recheck)");
|
||||
is(doc.foobar.val, getterValue + 1, "getter executed");
|
||||
is(doc.foobar._val, getterValue + 1, "getter executed (recheck)");
|
||||
|
||||
let textContent = hud.outputNode.textContent;
|
||||
is(textContent.indexOf("document.body.client"), -1,
|
||||
|
@ -3,7 +3,10 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-632347-iterators-generators.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-632347-iterators-generators.html";
|
||||
|
||||
function test() {
|
||||
requestLongerTimeout(6);
|
||||
@ -14,12 +17,14 @@ function test() {
|
||||
}
|
||||
|
||||
function consoleOpened(HUD) {
|
||||
let tools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
|
||||
let JSPropertyProvider = tools.require("devtools/toolkit/webconsole/utils").JSPropertyProvider;
|
||||
let tools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {})
|
||||
.devtools;
|
||||
let JSPropertyProvider = tools.require("devtools/toolkit/webconsole/utils")
|
||||
.JSPropertyProvider;
|
||||
|
||||
let tmp = Cu.import("resource://gre/modules/jsdebugger.jsm", {});
|
||||
tmp.addDebuggerToGlobal(tmp);
|
||||
let dbg = new tmp.Debugger;
|
||||
let dbg = new tmp.Debugger();
|
||||
|
||||
let jsterm = HUD.jsterm;
|
||||
let win = content.wrappedJSObject;
|
||||
@ -31,14 +36,14 @@ function consoleOpened(HUD) {
|
||||
let completion = JSPropertyProvider(dbgWindow, null, "_container.gen1.");
|
||||
isnot(completion.matches.length, 0, "Got matches for gen1");
|
||||
|
||||
is(result+1, container.gen1.next(), "gen1.next() did not execute");
|
||||
is(result + 1, container.gen1.next(), "gen1.next() did not execute");
|
||||
|
||||
result = container.gen2.next();
|
||||
|
||||
completion = JSPropertyProvider(dbgWindow, null, "_container.gen2.");
|
||||
isnot(completion.matches.length, 0, "Got matches for gen2");
|
||||
|
||||
is((result/2+1)*2, container.gen2.next(),
|
||||
is((result / 2 + 1) * 2, container.gen2.next(),
|
||||
"gen2.next() did not execute");
|
||||
|
||||
result = container.iter1.next();
|
||||
|
@ -4,25 +4,29 @@
|
||||
|
||||
// Tests that network log messages bring up the network panel.
|
||||
|
||||
const TEST_NETWORK_REQUEST_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-network-request.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
|
||||
const TEST_NETWORK_REQUEST_URI = "https://example.com/browser/browser/" +
|
||||
"devtools/webconsole/test/test-network-request.html";
|
||||
|
||||
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-image.png";
|
||||
|
||||
const TEST_DATA_JSON_CONTENT =
|
||||
'{ id: "test JSON data", myArray: [ "foo", "bar", "baz", "biff" ] }';
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console network logging tests";
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console network logging " +
|
||||
"tests";
|
||||
|
||||
let lastRequest = null;
|
||||
let requestCallback = null;
|
||||
let hud, browser;
|
||||
|
||||
function test()
|
||||
{
|
||||
function test() {
|
||||
const PREF = "devtools.webconsole.persistlog";
|
||||
const NET_PREF = "devtools.webconsole.filter.networkinfo";
|
||||
const NETXHR_PREF = "devtools.webconsole.filter.netxhr"
|
||||
const MIXED_AC_PREF = "security.mixed_content.block_active_content"
|
||||
const NETXHR_PREF = "devtools.webconsole.filter.netxhr";
|
||||
const MIXED_AC_PREF = "security.mixed_content.block_active_content";
|
||||
let original = Services.prefs.getBoolPref(NET_PREF);
|
||||
let originalXhr = Services.prefs.getBoolPref(NETXHR_PREF);
|
||||
let originalMixedActive = Services.prefs.getBoolPref(MIXED_AC_PREF);
|
||||
@ -39,23 +43,22 @@ function test()
|
||||
|
||||
loadTab(TEST_URI).then((tab) => {
|
||||
browser = tab.browser;
|
||||
openConsole().then((aHud) => {
|
||||
hud = aHud;
|
||||
openConsole().then((hudConsole) => {
|
||||
hud = hudConsole;
|
||||
|
||||
HUDService.lastFinishedRequest.callback = function(aRequest) {
|
||||
lastRequest = aRequest;
|
||||
HUDService.lastFinishedRequest.callback = function(request) {
|
||||
lastRequest = request;
|
||||
if (requestCallback) {
|
||||
requestCallback();
|
||||
}
|
||||
};
|
||||
|
||||
executeSoon(testPageLoad);
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testPageLoad()
|
||||
{
|
||||
function testPageLoad() {
|
||||
requestCallback = function() {
|
||||
// Check if page load was logged correctly.
|
||||
ok(lastRequest, "Page load was logged");
|
||||
@ -70,8 +73,7 @@ function testPageLoad()
|
||||
content.location = TEST_NETWORK_REQUEST_URI;
|
||||
}
|
||||
|
||||
function testPageLoadBody()
|
||||
{
|
||||
function testPageLoadBody() {
|
||||
let loaded = false;
|
||||
let requestCallbackInvoked = false;
|
||||
|
||||
@ -99,8 +101,7 @@ function testPageLoadBody()
|
||||
content.location.reload();
|
||||
}
|
||||
|
||||
function testXhrGet()
|
||||
{
|
||||
function testXhrGet() {
|
||||
requestCallback = function() {
|
||||
ok(lastRequest, "testXhrGet() was logged");
|
||||
is(lastRequest.request.method, "GET", "Method is correct");
|
||||
@ -113,8 +114,7 @@ function testXhrGet()
|
||||
content.wrappedJSObject.testXhrGet();
|
||||
}
|
||||
|
||||
function testXhrWarn()
|
||||
{
|
||||
function testXhrWarn() {
|
||||
requestCallback = function() {
|
||||
ok(lastRequest, "testXhrWarn() was logged");
|
||||
is(lastRequest.request.method, "GET", "Method is correct");
|
||||
@ -127,8 +127,7 @@ function testXhrWarn()
|
||||
content.wrappedJSObject.testXhrWarn();
|
||||
}
|
||||
|
||||
function testXhrPost()
|
||||
{
|
||||
function testXhrPost() {
|
||||
requestCallback = function() {
|
||||
ok(lastRequest, "testXhrPost() was logged");
|
||||
is(lastRequest.request.method, "POST", "Method is correct");
|
||||
@ -141,8 +140,7 @@ function testXhrPost()
|
||||
content.wrappedJSObject.testXhrPost();
|
||||
}
|
||||
|
||||
function testFormSubmission()
|
||||
{
|
||||
function testFormSubmission() {
|
||||
// Start the form submission test. As the form is submitted, the page is
|
||||
// loaded again. Bind to the load event to catch when this is done.
|
||||
requestCallback = function() {
|
||||
@ -227,15 +225,15 @@ function countMessageNodes() {
|
||||
let view = hud.iframeWindow;
|
||||
for (let i = 0; i < messageNodes.length; i++) {
|
||||
let computedStyle = view.getComputedStyle(messageNodes[i], null);
|
||||
if (computedStyle.display !== "none")
|
||||
if (computedStyle.display !== "none") {
|
||||
displayedMessageNodes++;
|
||||
}
|
||||
}
|
||||
|
||||
return displayedMessageNodes;
|
||||
}
|
||||
|
||||
function setStringFilter(aValue)
|
||||
{
|
||||
hud.ui.filterBox.value = aValue;
|
||||
function setStringFilter(value) {
|
||||
hud.ui.filterBox.value = value;
|
||||
hud.ui.adjustVisibilityOnSearchStringChange();
|
||||
}
|
||||
|
@ -8,6 +8,8 @@
|
||||
// Tests that the Web Console limits the number of lines displayed according to
|
||||
// the user's preferences.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<p>test for bug 642108.";
|
||||
const LOG_LIMIT = 20;
|
||||
|
||||
@ -55,7 +57,8 @@ function test() {
|
||||
severity: SEVERITY_WARNING,
|
||||
},
|
||||
{
|
||||
text: "css log 24", // LOG_LIMIT + 5
|
||||
// LOG_LIMIT + 5
|
||||
text: "css log 24",
|
||||
category: CATEGORY_CSS,
|
||||
severity: SEVERITY_WARNING,
|
||||
}],
|
||||
|
@ -7,7 +7,10 @@
|
||||
// Tests that the Web Console limits the number of lines displayed according to
|
||||
// the limit set for each category.
|
||||
|
||||
const INIT_URI = "data:text/html;charset=utf-8,Web Console test for bug 644419: Console should " +
|
||||
"use strict";
|
||||
|
||||
const INIT_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 644419: Console should " +
|
||||
"have user-settable log limits for each message category";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/" +
|
||||
@ -54,7 +57,7 @@ function testWebDevLimits() {
|
||||
category: CATEGORY_JS,
|
||||
severity: SEVERITY_ERROR,
|
||||
}],
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function testWebDevLimits2() {
|
||||
@ -71,7 +74,8 @@ function testWebDevLimits2() {
|
||||
severity: SEVERITY_LOG,
|
||||
}],
|
||||
}).then(() => {
|
||||
testLogEntry(outputNode, "test message 0", "first message is pruned", false, true);
|
||||
testLogEntry(outputNode, "test message 0", "first message is pruned",
|
||||
false, true);
|
||||
findLogEntry("test message 1");
|
||||
// Check if the sentinel entry is still there.
|
||||
findLogEntry("bar is not defined");
|
||||
@ -101,7 +105,7 @@ function testJsLimits2() {
|
||||
// Fill the log with JS errors.
|
||||
let head = content.document.getElementsByTagName("head")[0];
|
||||
for (let i = 0; i < 11; i++) {
|
||||
var script = content.document.createElement("script");
|
||||
let script = content.document.createElement("script");
|
||||
script.text = "fubar" + i + ".bogus(6);";
|
||||
|
||||
expectUncaughtException();
|
||||
@ -116,7 +120,8 @@ function testJsLimits2() {
|
||||
severity: SEVERITY_ERROR,
|
||||
}],
|
||||
}).then(() => {
|
||||
testLogEntry(outputNode, "fubar0 is not defined", "first message is pruned", false, true);
|
||||
testLogEntry(outputNode, "fubar0 is not defined", "first message is pruned",
|
||||
false, true);
|
||||
findLogEntry("fubar1 is not defined");
|
||||
// Check if the sentinel entry is still there.
|
||||
findLogEntry("testing JS limits");
|
||||
@ -125,7 +130,7 @@ function testJsLimits2() {
|
||||
});
|
||||
}
|
||||
|
||||
var gCounter, gImage;
|
||||
let gCounter, gImage;
|
||||
|
||||
function testNetLimits() {
|
||||
Services.prefs.setIntPref("devtools.hud.loglimit.network", 10);
|
||||
@ -156,7 +161,7 @@ function loadImage() {
|
||||
body.insertBefore(gImage, body.firstChild);
|
||||
gImage.addEventListener("load", loadImage, true);
|
||||
gCounter++;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
is(gCounter, 11, "loaded 11 files");
|
||||
@ -201,7 +206,7 @@ function testCssLimits2() {
|
||||
// Fill the log with CSS errors.
|
||||
let body = content.document.getElementsByTagName("body")[0];
|
||||
for (let i = 0; i < 11; i++) {
|
||||
var div = content.document.createElement("div");
|
||||
let div = content.document.createElement("div");
|
||||
div.setAttribute("style", "-moz-foobar" + i + ": 42;");
|
||||
body.insertBefore(div, body.firstChild);
|
||||
}
|
||||
|
@ -6,7 +6,10 @@
|
||||
// Tests that console logging methods display the method location along with
|
||||
// the output in the console.
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console file location display test";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console file location " +
|
||||
"display test";
|
||||
const TEST_URI2 = "http://example.com/browser/browser/devtools/" +
|
||||
"webconsole/test/" +
|
||||
"test-bug-646025-console-file-location.html";
|
||||
|
@ -5,10 +5,12 @@
|
||||
*/
|
||||
|
||||
// Tests that document.body autocompletes in the web console.
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console autocompletion bug in document.body";
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console autocompletion " +
|
||||
"bug in document.body";
|
||||
|
||||
let gHUD;
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
@ -24,12 +26,11 @@ let test = asyncTest(function* () {
|
||||
gHUD = null;
|
||||
});
|
||||
|
||||
function consoleOpened(aHud) {
|
||||
function consoleOpened() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
let jsterm = gHUD.jsterm;
|
||||
let popup = jsterm.autocompletePopup;
|
||||
let completeNode = jsterm.completeNode;
|
||||
|
||||
ok(!popup.isOpen, "popup is not open");
|
||||
|
||||
@ -58,16 +59,15 @@ function consoleOpened(aHud) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function autocompletePopupHidden()
|
||||
{
|
||||
function autocompletePopupHidden() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
let jsterm = gHUD.jsterm;
|
||||
let popup = jsterm.autocompletePopup;
|
||||
let completeNode = jsterm.completeNode;
|
||||
let inputNode = jsterm.inputNode;
|
||||
|
||||
popup._panel.removeEventListener("popuphidden", autocompletePopupHidden, false);
|
||||
popup._panel.removeEventListener("popuphidden", autocompletePopupHidden,
|
||||
false);
|
||||
|
||||
ok(!popup.isOpen, "popup is not open");
|
||||
|
||||
@ -84,8 +84,7 @@ function autocompletePopupHidden()
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testPropertyPanel()
|
||||
{
|
||||
function testPropertyPanel() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
let jsterm = gHUD.jsterm;
|
||||
@ -101,9 +100,8 @@ function testPropertyPanel()
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function onVariablesViewReady(aView)
|
||||
{
|
||||
return findVariableViewProperties(aView, [
|
||||
function onVariablesViewReady(view) {
|
||||
return findVariableViewProperties(view, [
|
||||
{ name: "body", value: "<body>" },
|
||||
], { webconsole: gHUD });
|
||||
}
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
// Tests that the $0 console helper works as intended.
|
||||
|
||||
"use strict";
|
||||
|
||||
let inspector, h1, outputNode;
|
||||
|
||||
function createDocument() {
|
||||
@ -68,7 +70,6 @@ let runSelectionTests = Task.async(function*(aInspector) {
|
||||
});
|
||||
|
||||
function performWebConsoleTests(hud) {
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
let jsterm = hud.jsterm;
|
||||
outputNode = hud.outputNode;
|
||||
|
||||
@ -103,5 +104,6 @@ function test() {
|
||||
waitForFocus(createDocument, content);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html;charset=utf-8,test for highlighter helper in web console";
|
||||
content.location = "data:text/html;charset=utf-8,test for highlighter " +
|
||||
"helper in web console";
|
||||
}
|
||||
|
@ -6,17 +6,19 @@
|
||||
|
||||
// Tests that the Console API implements the time() and timeEnd() methods.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-658368-time-methods.html";
|
||||
"test/test-bug-658368-time-methods.html";
|
||||
|
||||
const TEST_URI2 = "data:text/html;charset=utf-8,<script>" +
|
||||
"console.timeEnd('bTimer');</script>";
|
||||
"console.timeEnd('bTimer');</script>";
|
||||
|
||||
const TEST_URI3 = "data:text/html;charset=utf-8,<script>" +
|
||||
"console.time('bTimer');</script>";
|
||||
"console.time('bTimer');</script>";
|
||||
|
||||
const TEST_URI4 = "data:text/html;charset=utf-8," +
|
||||
"<script>console.timeEnd('bTimer');</script>";
|
||||
"<script>console.timeEnd('bTimer');</script>";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 659907: " +
|
||||
"Expand console object with a dir method";
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 659907: Expand console object with a dir method";
|
||||
|
||||
let test = asyncTest(function*() {
|
||||
yield loadTab(TEST_URI);
|
||||
@ -21,8 +21,17 @@ let test = asyncTest(function*() {
|
||||
let varView = yield hud.jsterm.once("variablesview-fetched");
|
||||
|
||||
yield findVariableViewProperties(varView, [
|
||||
{ name: "__proto__.__proto__.querySelectorAll", value: "querySelectorAll()" },
|
||||
{ name: "location", value: /Location \u2192 data:Web/ },
|
||||
{ name: "__proto__.write", value: "write()" },
|
||||
{
|
||||
name: "__proto__.__proto__.querySelectorAll",
|
||||
value: "querySelectorAll()"
|
||||
},
|
||||
{
|
||||
name: "location",
|
||||
value: /Location \u2192 data:Web/
|
||||
},
|
||||
{
|
||||
name: "__proto__.write",
|
||||
value: "write()"
|
||||
},
|
||||
], { webconsole: hud });
|
||||
});
|
||||
|
@ -2,7 +2,10 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<p>bug 660806 - history navigation must not show the autocomplete popup";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<p>bug 660806 - history " +
|
||||
"navigation must not show the autocomplete popup";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
@ -12,8 +15,7 @@ let test = asyncTest(function* () {
|
||||
yield consoleOpened(hud);
|
||||
});
|
||||
|
||||
function consoleOpened(HUD)
|
||||
{
|
||||
function consoleOpened(HUD) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
let jsterm = HUD.jsterm;
|
||||
|
@ -5,18 +5,21 @@
|
||||
*/
|
||||
|
||||
// Tests that console.group/groupEnd works as intended.
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 664131: Expand console object with group methods";
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 664131: Expand console object with group methods";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
let hud = yield openConsole();
|
||||
let jsterm = hud.jsterm;
|
||||
let outputNode = hud.outputNode;
|
||||
|
||||
hud.jsterm.clearOutput();
|
||||
|
||||
yield jsterm.execute("console.group('bug664131a')")
|
||||
yield jsterm.execute("console.group('bug664131a')");
|
||||
|
||||
yield waitForMessages({
|
||||
webconsole: hud,
|
||||
@ -26,7 +29,7 @@ let test = asyncTest(function* () {
|
||||
}],
|
||||
});
|
||||
|
||||
yield jsterm.execute("console.log('bug664131a-inside')")
|
||||
yield jsterm.execute("console.log('bug664131a-inside')");
|
||||
|
||||
yield waitForMessages({
|
||||
webconsole: hud,
|
||||
|
@ -5,7 +5,10 @@
|
||||
|
||||
// Tests that the autocompletion results contain the names of JSTerm helpers.
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf8,<p>test JSTerm Helpers autocomplete";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf8,<p>test JSTerm Helpers " +
|
||||
"autocomplete";
|
||||
|
||||
let jsterm;
|
||||
|
||||
@ -23,32 +26,44 @@ let test = asyncTest(function* () {
|
||||
input.setSelectionRange(1, 1);
|
||||
yield complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
||||
let newItems = popup.getItems().map(function(e) {return e.label;});
|
||||
ok(newItems.indexOf("inspect") > -1, "autocomplete results contain helper 'inspect'");
|
||||
let newItems = popup.getItems().map(function(e) {
|
||||
return e.label;
|
||||
});
|
||||
ok(newItems.indexOf("inspect") > -1,
|
||||
"autocomplete results contain helper 'inspect'");
|
||||
|
||||
// Test if 'window.' does not give 'inspect'.
|
||||
input.value = "window.";
|
||||
input.setSelectionRange(7, 7);
|
||||
yield complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
||||
newItems = popup.getItems().map(function(e) {return e.label;});
|
||||
is(newItems.indexOf("inspect"), -1, "autocomplete results do not contain helper 'inspect'");
|
||||
newItems = popup.getItems().map(function(e) {
|
||||
return e.label;
|
||||
});
|
||||
is(newItems.indexOf("inspect"), -1,
|
||||
"autocomplete results do not contain helper 'inspect'");
|
||||
|
||||
// Test if 'dump(i' gives 'inspect'
|
||||
input.value = "dump(i";
|
||||
input.setSelectionRange(6, 6);
|
||||
yield complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
||||
newItems = popup.getItems().map(function(e) {return e.label;});
|
||||
ok(newItems.indexOf("inspect") > -1, "autocomplete results contain helper 'inspect'");
|
||||
newItems = popup.getItems().map(function(e) {
|
||||
return e.label;
|
||||
});
|
||||
ok(newItems.indexOf("inspect") > -1,
|
||||
"autocomplete results contain helper 'inspect'");
|
||||
|
||||
// Test if 'window.dump(i' gives 'inspect'
|
||||
input.value = "window.dump(i";
|
||||
input.setSelectionRange(13, 13);
|
||||
yield complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
||||
newItems = popup.getItems().map(function(e) {return e.label;});
|
||||
ok(newItems.indexOf("inspect") > -1, "autocomplete results contain helper 'inspect'");
|
||||
newItems = popup.getItems().map(function(e) {
|
||||
return e.label;
|
||||
});
|
||||
ok(newItems.indexOf("inspect") > -1,
|
||||
"autocomplete results contain helper 'inspect'");
|
||||
|
||||
jsterm = null;
|
||||
});
|
||||
@ -57,4 +72,4 @@ function complete(type) {
|
||||
let updated = jsterm.once("autocomplete-updated");
|
||||
jsterm.complete(type);
|
||||
return updated;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,10 @@
|
||||
|
||||
// Tests for bug 704295
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-console.html";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
@ -16,8 +19,8 @@ let test = asyncTest(function* () {
|
||||
});
|
||||
|
||||
function testCompletion(hud) {
|
||||
var jsterm = hud.jsterm;
|
||||
var input = jsterm.inputNode;
|
||||
let jsterm = hud.jsterm;
|
||||
let input = jsterm.inputNode;
|
||||
|
||||
// Test typing 'var d = 5;' and press RETURN
|
||||
jsterm.setInputValue("var d = ");
|
||||
@ -36,4 +39,3 @@ function testCompletion(hud) {
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
is(jsterm.completeNode.value, "", "clear completion on execute()");
|
||||
}
|
||||
|
||||
|
@ -3,15 +3,18 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/browser/test-console.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/browser/test-console.html";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
let hud = yield openConsole();
|
||||
|
||||
var jsterm = hud.jsterm;
|
||||
var input = jsterm.inputNode;
|
||||
let jsterm = hud.jsterm;
|
||||
let input = jsterm.inputNode;
|
||||
|
||||
is(input.getAttribute("focused"), "true", "input has focus");
|
||||
EventUtils.synthesizeKey("VK_TAB", {});
|
||||
|
@ -10,13 +10,19 @@
|
||||
|
||||
// Tests that the Web Console Mixed Content messages are displayed
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf8,Web Console mixed content test";
|
||||
const TEST_HTTPS_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-bug-737873-mixedcontent.html";
|
||||
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/MixedContent";
|
||||
const TEST_HTTPS_URI = "https://example.com/browser/browser/devtools/" +
|
||||
"webconsole/test/test-bug-737873-mixedcontent.html";
|
||||
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/" +
|
||||
"MixedContent";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
Services.prefs.setBoolPref("security.mixed_content.block_display_content", false);
|
||||
Services.prefs.setBoolPref("security.mixed_content.block_active_content", false);
|
||||
Services.prefs.setBoolPref("security.mixed_content.block_display_content",
|
||||
false);
|
||||
Services.prefs.setBoolPref("security.mixed_content.block_active_content",
|
||||
false);
|
||||
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
|
@ -4,7 +4,10 @@
|
||||
// Tests that warnings about ineffective iframe sandboxing are logged to the
|
||||
// web console when necessary (and not otherwise).
|
||||
|
||||
const TEST_URI_WARNING = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning0.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI_WARNING = "http://example.com/browser/browser/devtools/" +
|
||||
"webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning0.html";
|
||||
const TEST_URI_NOWARNING = [
|
||||
"http://example.com/browser/browser/devtools/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning1.html",
|
||||
"http://example.com/browser/browser/devtools/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning2.html",
|
||||
@ -13,14 +16,15 @@ const TEST_URI_NOWARNING = [
|
||||
"http://example.com/browser/browser/devtools/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning5.html"
|
||||
];
|
||||
|
||||
const INEFFECTIVE_IFRAME_SANDBOXING_MSG = "An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can remove its sandboxing.";
|
||||
const INEFFECTIVE_IFRAME_SANDBOXING_MSG = "An iframe which has both " +
|
||||
"allow-scripts and allow-same-origin for its sandbox attribute can remove " +
|
||||
"its sandboxing.";
|
||||
const SENTINEL_MSG = "testing ineffective sandboxing message";
|
||||
|
||||
function test()
|
||||
{
|
||||
function test() {
|
||||
loadTab(TEST_URI_WARNING).then(() => {
|
||||
openConsole().then((hud) => {
|
||||
content.console.log(SENTINEL_MSG)
|
||||
content.console.log(SENTINEL_MSG);
|
||||
waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [
|
||||
@ -44,11 +48,10 @@ function test()
|
||||
});
|
||||
}
|
||||
|
||||
function testNoWarning(id)
|
||||
{
|
||||
function testNoWarning(id) {
|
||||
loadTab(TEST_URI_NOWARNING[id]).then(() => {
|
||||
openConsole().then((hud) => {
|
||||
content.console.log(SENTINEL_MSG)
|
||||
content.console.log(SENTINEL_MSG);
|
||||
waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [
|
||||
@ -68,6 +71,6 @@ function testNoWarning(id)
|
||||
finishTest();
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -5,9 +5,13 @@
|
||||
* to the web console
|
||||
*/
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-762593-insecure-passwords-about-blank-web-console-warning.html";
|
||||
const INSECURE_PASSWORD_MSG = "Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen.";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-762593-insecure-passwords-about-blank-web-console-warning.html";
|
||||
const INSECURE_PASSWORD_MSG = "Password fields present on an insecure " +
|
||||
"(http://) page. This is a security risk that allows user login " +
|
||||
"credentials to be stolen.";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
@ -5,11 +5,22 @@
|
||||
* to the web console
|
||||
*/
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-762593-insecure-passwords-web-console-warning.html";
|
||||
const INSECURE_PASSWORD_MSG = "Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen.";
|
||||
const INSECURE_FORM_ACTION_MSG = "Password fields present in a form with an insecure (http://) form action. This is a security risk that allows user login credentials to be stolen.";
|
||||
const INSECURE_IFRAME_MSG = "Password fields present on an insecure (http://) iframe. This is a security risk that allows user login credentials to be stolen.";
|
||||
const INSECURE_PASSWORDS_URI = "https://developer.mozilla.org/docs/Security/InsecurePasswords";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-762593-insecure-passwords-web-" +
|
||||
"console-warning.html";
|
||||
const INSECURE_PASSWORD_MSG = "Password fields present on an insecure " +
|
||||
"(http://) page. This is a security risk that allows user " +
|
||||
"login credentials to be stolen.";
|
||||
const INSECURE_FORM_ACTION_MSG = "Password fields present in a form with an " +
|
||||
"insecure (http://) form action. This is a security risk " +
|
||||
"that allows user login credentials to be stolen.";
|
||||
const INSECURE_IFRAME_MSG = "Password fields present on an insecure " +
|
||||
"(http://) iframe. This is a security risk that allows " +
|
||||
"user login credentials to be stolen.";
|
||||
const INSECURE_PASSWORDS_URI = "https://developer.mozilla.org/docs/Security/" +
|
||||
"InsecurePasswords";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
@ -4,7 +4,11 @@
|
||||
|
||||
// This is a test for the Open URL context menu item
|
||||
// that is shown for network requests
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html"
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-console.html";
|
||||
const COMMAND_NAME = "consoleCmd_openURL";
|
||||
const CONTEXT_MENU_ID = "#menu_openURL";
|
||||
|
||||
@ -22,11 +26,13 @@ let test = asyncTest(function* () {
|
||||
let results2 = yield testOnNetActivity();
|
||||
let msg = yield onNetworkMessage(results2);
|
||||
|
||||
yield testOnNetActivity_contextmenu(msg);
|
||||
yield testOnNetActivityContextMenu(msg);
|
||||
|
||||
Services.prefs.clearUserPref("devtools.webconsole.filter.networkinfo");
|
||||
|
||||
HUD = null, outputNode = null, contextMenu = null;
|
||||
HUD = null;
|
||||
outputNode = null;
|
||||
contextMenu = null;
|
||||
});
|
||||
|
||||
function consoleOpened() {
|
||||
@ -47,9 +53,9 @@ function consoleOpened() {
|
||||
});
|
||||
}
|
||||
|
||||
function onConsoleMessage(aResults) {
|
||||
function onConsoleMessage(results) {
|
||||
outputNode.focus();
|
||||
outputNode.selectedItem = [...aResults[0].matched][0];
|
||||
outputNode.selectedItem = [...results[0].matched][0];
|
||||
|
||||
// Check if the command is disabled non-network messages.
|
||||
goUpdateCommand(COMMAND_NAME);
|
||||
@ -82,20 +88,20 @@ function testOnNetActivity() {
|
||||
});
|
||||
}
|
||||
|
||||
function onNetworkMessage(aResults) {
|
||||
function onNetworkMessage(results) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
outputNode.focus();
|
||||
let msg = [...aResults[0].matched][0];
|
||||
let msg = [...results[0].matched][0];
|
||||
ok(msg, "network message");
|
||||
HUD.ui.output.selectMessage(msg);
|
||||
|
||||
let currentTab = gBrowser.selectedTab;
|
||||
let newTab = null;
|
||||
|
||||
gBrowser.tabContainer.addEventListener("TabOpen", function onOpen(aEvent) {
|
||||
gBrowser.tabContainer.addEventListener("TabOpen", function onOpen(evt) {
|
||||
gBrowser.tabContainer.removeEventListener("TabOpen", onOpen, true);
|
||||
newTab = aEvent.target;
|
||||
newTab = evt.target;
|
||||
newTab.linkedBrowser.addEventListener("load", onTabLoaded, true);
|
||||
}, true);
|
||||
|
||||
@ -119,7 +125,7 @@ function onNetworkMessage(aResults) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testOnNetActivity_contextmenu(msg) {
|
||||
function testOnNetActivityContextMenu(msg) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
outputNode.focus();
|
||||
|
@ -7,9 +7,15 @@
|
||||
|
||||
// Tests that the Web Console CSP messages are displayed
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf8,Web Console CSP violation test";
|
||||
const TEST_VIOLATION = "https://example.com/browser/browser/devtools/webconsole/test/test_bug_770099_violation.html";
|
||||
const CSP_VIOLATION_MSG = 'Content Security Policy: The page\'s settings blocked the loading of a resource at http://some.example.com/test.png ("default-src https://example.com").'
|
||||
const TEST_VIOLATION = "https://example.com/browser/browser/devtools/" +
|
||||
"webconsole/test/test_bug_770099_violation.html";
|
||||
const CSP_VIOLATION_MSG = "Content Security Policy: The page's settings " +
|
||||
"blocked the loading of a resource at " +
|
||||
"http://some.example.com/test.png (\"default-src " +
|
||||
"https://example.com\").";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
let { browser } = yield loadTab(TEST_URI);
|
||||
|
@ -4,6 +4,8 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test" +
|
||||
"/test-bug-782653-css-errors.html";
|
||||
|
||||
@ -20,8 +22,7 @@ let test = asyncTest(function* () {
|
||||
nodes = hud = StyleEditorUI = null;
|
||||
});
|
||||
|
||||
function testViewSource()
|
||||
{
|
||||
function testViewSource() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
waitForMessages({
|
||||
@ -57,14 +58,23 @@ function testViewSource()
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function onStyleEditorReady(aPanel)
|
||||
{
|
||||
function onStyleEditorReady(panel) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
let win = aPanel.panelWindow;
|
||||
let win = panel.panelWindow;
|
||||
ok(win, "Style Editor Window is defined");
|
||||
ok(StyleEditorUI, "Style Editor UI is defined");
|
||||
|
||||
function fireEvent(toolbox, href, line) {
|
||||
toolbox.once("styleeditor-selected", function(evt) {
|
||||
info(evt + " event fired");
|
||||
|
||||
checkStyleEditorForSheetAndLine(href, line - 1).then(deferred.resolve);
|
||||
});
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" }, nodes[1]);
|
||||
}
|
||||
|
||||
waitForFocus(function() {
|
||||
info("style editor window focused");
|
||||
|
||||
@ -78,20 +88,13 @@ function onStyleEditorReady(aPanel)
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
let toolbox = gDevTools.getToolbox(target);
|
||||
|
||||
let href = nodes[1].getAttribute("title");
|
||||
let line = nodes[1].sourceLine;
|
||||
href = nodes[1].getAttribute("title");
|
||||
line = nodes[1].sourceLine;
|
||||
ok(line, "found source line");
|
||||
|
||||
toolbox.selectTool("webconsole").then(function() {
|
||||
info("webconsole selected");
|
||||
|
||||
toolbox.once("styleeditor-selected", function(aEvent) {
|
||||
info(aEvent + " event fired");
|
||||
|
||||
checkStyleEditorForSheetAndLine(href, line - 1).then(deferred.resolve);
|
||||
});
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" }, nodes[1]);
|
||||
fireEvent(toolbox, href, line);
|
||||
});
|
||||
});
|
||||
}, win);
|
||||
@ -99,29 +102,26 @@ function onStyleEditorReady(aPanel)
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function checkStyleEditorForSheetAndLine(aHref, aLine)
|
||||
{
|
||||
function checkStyleEditorForSheetAndLine(href, line) {
|
||||
let foundEditor = null;
|
||||
for (let editor of StyleEditorUI.editors) {
|
||||
if (editor.styleSheet.href == aHref) {
|
||||
if (editor.styleSheet.href == href) {
|
||||
foundEditor = editor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ok(foundEditor, "found style editor for " + aHref);
|
||||
return performLineCheck(foundEditor, aLine);
|
||||
ok(foundEditor, "found style editor for " + href);
|
||||
return performLineCheck(foundEditor, line);
|
||||
}
|
||||
|
||||
function performLineCheck(aEditor, aLine)
|
||||
{
|
||||
function performLineCheck(editor, line) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
function checkForCorrectState()
|
||||
{
|
||||
is(aEditor.sourceEditor.getCursor().line, aLine,
|
||||
function checkForCorrectState() {
|
||||
is(editor.sourceEditor.getCursor().line, line,
|
||||
"correct line is selected");
|
||||
is(StyleEditorUI.selectedStyleSheetIndex, aEditor.styleSheet.styleSheetIndex,
|
||||
is(StyleEditorUI.selectedStyleSheetIndex, editor.styleSheet.styleSheetIndex,
|
||||
"correct stylesheet is selected in the editor");
|
||||
|
||||
executeSoon(deferred.resolve);
|
||||
@ -131,7 +131,7 @@ function performLineCheck(aEditor, aLine)
|
||||
|
||||
// Get out of the styleeditor-selected event loop.
|
||||
executeSoon(() => {
|
||||
aEditor.getSourceEditor().then(() => {
|
||||
editor.getSourceEditor().then(() => {
|
||||
// Get out of the editor's source-editor-load event loop.
|
||||
executeSoon(checkForCorrectState);
|
||||
});
|
||||
|
@ -13,7 +13,8 @@
|
||||
// see https://bugzilla.mozilla.org/show_bug.cgi?id=804845
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 804845 and bug 619598";
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 804845 and bug 619598";
|
||||
|
||||
let jsterm, inputNode;
|
||||
|
||||
@ -46,32 +47,42 @@ function testSingleLineInputNavNoHistory() {
|
||||
|
||||
// nav to start/end with ctrl-a and ctrl-e;
|
||||
EventUtils.synthesizeKey("a", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 0, "caret location after single char input and ctrl-a");
|
||||
is(inputNode.selectionStart, 0,
|
||||
"caret location after single char input and ctrl-a");
|
||||
|
||||
EventUtils.synthesizeKey("e", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 1, "caret location after single char input and ctrl-e");
|
||||
is(inputNode.selectionStart, 1,
|
||||
"caret location after single char input and ctrl-e");
|
||||
|
||||
// Second char input
|
||||
EventUtils.synthesizeKey("2", {});
|
||||
// nav to start/end with up/down keys; verify behaviour using ctrl-p/ctrl-n
|
||||
EventUtils.synthesizeKey("VK_UP", {});
|
||||
is(inputNode.selectionStart, 0, "caret location after two char input and VK_UP");
|
||||
is(inputNode.selectionStart, 0,
|
||||
"caret location after two char input and VK_UP");
|
||||
EventUtils.synthesizeKey("VK_DOWN", {});
|
||||
is(inputNode.selectionStart, 2, "caret location after two char input and VK_DOWN");
|
||||
is(inputNode.selectionStart, 2,
|
||||
"caret location after two char input and VK_DOWN");
|
||||
|
||||
EventUtils.synthesizeKey("a", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 0, "move caret to beginning of 2 char input with ctrl-a");
|
||||
is(inputNode.selectionStart, 0,
|
||||
"move caret to beginning of 2 char input with ctrl-a");
|
||||
EventUtils.synthesizeKey("a", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 0, "no change of caret location on repeat ctrl-a");
|
||||
is(inputNode.selectionStart, 0,
|
||||
"no change of caret location on repeat ctrl-a");
|
||||
EventUtils.synthesizeKey("p", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 0, "no change of caret location on ctrl-p from beginning of line");
|
||||
is(inputNode.selectionStart, 0,
|
||||
"no change of caret location on ctrl-p from beginning of line");
|
||||
|
||||
EventUtils.synthesizeKey("e", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 2, "move caret to end of 2 char input with ctrl-e");
|
||||
is(inputNode.selectionStart, 2,
|
||||
"move caret to end of 2 char input with ctrl-e");
|
||||
EventUtils.synthesizeKey("e", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 2, "no change of caret location on repeat ctrl-e");
|
||||
is(inputNode.selectionStart, 2,
|
||||
"no change of caret location on repeat ctrl-e");
|
||||
EventUtils.synthesizeKey("n", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 2, "no change of caret location on ctrl-n from end of line");
|
||||
is(inputNode.selectionStart, 2,
|
||||
"no change of caret location on ctrl-n from end of line");
|
||||
|
||||
EventUtils.synthesizeKey("p", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 0, "ctrl-p moves to start of line");
|
||||
@ -90,14 +101,16 @@ function testMultiLineInputNavNoHistory() {
|
||||
}
|
||||
let inputValue = inputNode.value;
|
||||
is(inputNode.selectionStart, inputNode.selectionEnd);
|
||||
is(inputNode.selectionStart, inputValue.length, "caret at end of multiline input");
|
||||
is(inputNode.selectionStart, inputValue.length,
|
||||
"caret at end of multiline input");
|
||||
|
||||
// possibility newline is represented by one ('\r', '\n') or two ('\r\n') chars
|
||||
// possibility newline is represented by one ('\r', '\n') or two
|
||||
// ('\r\n') chars
|
||||
let newlineString = inputValue.match(/(\r\n?|\n\r?)$/)[0];
|
||||
|
||||
// Ok, test navigating within the multi-line string!
|
||||
EventUtils.synthesizeKey("VK_UP", {});
|
||||
let expectedStringAfterCarat = lineValues[5]+newlineString;
|
||||
let expectedStringAfterCarat = lineValues[5] + newlineString;
|
||||
is(inputNode.value.slice(inputNode.selectionStart), expectedStringAfterCarat,
|
||||
"up arrow from end of multiline");
|
||||
|
||||
@ -112,9 +125,11 @@ function testMultiLineInputNavNoHistory() {
|
||||
|
||||
for (let i = 4; i >= 0; i--) {
|
||||
EventUtils.synthesizeKey("p", { ctrlKey: true });
|
||||
expectedStringAfterCarat = lineValues[i] + newlineString + expectedStringAfterCarat;
|
||||
is(inputNode.value.slice(inputNode.selectionStart), expectedStringAfterCarat,
|
||||
"ctrl-p from within line " + i + " of multiline input");
|
||||
expectedStringAfterCarat = lineValues[i] + newlineString +
|
||||
expectedStringAfterCarat;
|
||||
is(inputNode.value.slice(inputNode.selectionStart),
|
||||
expectedStringAfterCarat, "ctrl-p from within line " + i +
|
||||
" of multiline input");
|
||||
}
|
||||
EventUtils.synthesizeKey("p", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 0, "reached start of input");
|
||||
@ -138,13 +153,13 @@ function testMultiLineInputNavNoHistory() {
|
||||
caretPos = inputNode.selectionStart;
|
||||
expectedStringBeforeCarat += newlineString;
|
||||
is(inputNode.value.slice(0, caretPos), expectedStringBeforeCarat,
|
||||
"ctrl-a to beginning of line " + (i+1) + " in multiline input");
|
||||
"ctrl-a to beginning of line " + (i + 1) + " in multiline input");
|
||||
|
||||
EventUtils.synthesizeKey("e", { ctrlKey: true });
|
||||
caretPos = inputNode.selectionStart;
|
||||
expectedStringBeforeCarat += lineValues[i];
|
||||
is(inputNode.value.slice(0, caretPos), expectedStringBeforeCarat,
|
||||
"ctrl-e to end of line " + (i+1) + "in multiline input");
|
||||
"ctrl-e to end of line " + (i + 1) + "in multiline input");
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,16 +178,16 @@ function testNavWithHistory() {
|
||||
is(inputNode.selectionStart, 0, "caret location at start of empty line");
|
||||
|
||||
EventUtils.synthesizeKey("p", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, values[values.length-1].length,
|
||||
is(inputNode.selectionStart, values[values.length - 1].length,
|
||||
"caret location correct at end of last history input");
|
||||
|
||||
// Navigate backwards history with ctrl-p
|
||||
for (let i = values.length-1; i > 0; i--) {
|
||||
for (let i = values.length - 1; i > 0; i--) {
|
||||
let match = values[i].match(/(\n)/g);
|
||||
if (match) {
|
||||
// multi-line inputs won't update from history unless caret at beginning
|
||||
EventUtils.synthesizeKey("a", { ctrlKey: true });
|
||||
for (let i = 0; i < match.length; i++) {
|
||||
for (let j = 0; j < match.length; j++) {
|
||||
EventUtils.synthesizeKey("p", { ctrlKey: true });
|
||||
}
|
||||
EventUtils.synthesizeKey("p", { ctrlKey: true });
|
||||
@ -180,18 +195,19 @@ function testNavWithHistory() {
|
||||
// single-line inputs will update from history from end of line
|
||||
EventUtils.synthesizeKey("p", { ctrlKey: true });
|
||||
}
|
||||
is(inputNode.value, values[i-1],
|
||||
"ctrl-p updates inputNode from backwards history values[" + i-1 + "]");
|
||||
is(inputNode.value, values[i - 1],
|
||||
"ctrl-p updates inputNode from backwards history values[" + i - 1 + "]");
|
||||
}
|
||||
let inputValue = inputNode.value;
|
||||
EventUtils.synthesizeKey("p", { ctrlKey: true });
|
||||
is(inputNode.selectionStart, 0,
|
||||
"ctrl-p at beginning of history moves caret location to beginning of line");
|
||||
"ctrl-p at beginning of history moves caret location to beginning " +
|
||||
"of line");
|
||||
is(inputNode.value, inputValue,
|
||||
"no change to input value on ctrl-p from beginning of line");
|
||||
|
||||
// Navigate forwards history with ctrl-n
|
||||
for (let i = 1; i<values.length; i++) {
|
||||
for (let i = 1; i < values.length; i++) {
|
||||
EventUtils.synthesizeKey("n", { ctrlKey: true });
|
||||
is(inputNode.value, values[i],
|
||||
"ctrl-n updates inputNode from forwards history values[" + i + "]");
|
||||
@ -212,6 +228,6 @@ function testNavWithHistory() {
|
||||
|
||||
EventUtils.synthesizeKey("a", { ctrlKey: true });
|
||||
EventUtils.synthesizeKey("p", { ctrlKey: true });
|
||||
is(inputNode.value, values[values.length-1],
|
||||
is(inputNode.value, values[values.length - 1],
|
||||
"ctrl-p from start of multi-line triggers history");
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-bug-837351-security-errors.html";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-837351-security-errors.html";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield pushPrefEnv();
|
||||
@ -26,10 +29,11 @@ let test = asyncTest(function* () {
|
||||
});
|
||||
});
|
||||
|
||||
function pushPrefEnv()
|
||||
{
|
||||
function pushPrefEnv() {
|
||||
let deferred = promise.defer();
|
||||
let options = {'set': [["security.mixed_content.block_active_content", true]]};
|
||||
let options = {
|
||||
set: [["security.mixed_content.block_active_content", true]]
|
||||
};
|
||||
SpecialPowers.pushPrefEnv(options, deferred.resolve);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
@ -2,8 +2,13 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* Tests that errors about invalid HSTS security headers are logged
|
||||
* to the web console */
|
||||
const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-bug-846918-hsts-invalid-headers.html";
|
||||
const HSTS_INVALID_HEADER_MSG = "The site specified an invalid Strict-Transport-Security header.";
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-846918-hsts-invalid-headers.html";
|
||||
const HSTS_INVALID_HEADER_MSG = "The site specified an invalid " +
|
||||
"Strict-Transport-Security header.";
|
||||
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/HTTP_Strict_Transport_Security";
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
|
@ -4,8 +4,13 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that the 'Log Request and Response Bodies' buttons can be toggled with keyboard.
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 915141: Toggle log response bodies with keyboard";
|
||||
// Tests that the 'Log Request and Response Bodies' buttons can be toggled
|
||||
// with keyboard.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " +
|
||||
"bug 915141: Toggle log response bodies with keyboard";
|
||||
let hud;
|
||||
|
||||
function test() {
|
||||
@ -21,7 +26,8 @@ function test() {
|
||||
saveBodiesContextMenuItem = hud.ui.rootElement.querySelector("#saveBodiesContextMenu");
|
||||
|
||||
// Test the context menu action.
|
||||
info("Testing 'Log Request and Response Bodies' menuitem of right click context menu.");
|
||||
info("Testing 'Log Request and Response Bodies' menuitem of right click " +
|
||||
"context menu.");
|
||||
|
||||
return openPopup(saveBodiesContextMenuItem);
|
||||
})
|
||||
@ -34,20 +40,24 @@ function test() {
|
||||
EventUtils.synthesizeKey("VK_DOWN", {});
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
|
||||
return waitForUpdate(saveBodiesContextMenuItem);
|
||||
return waitForUpdate(saveBodiesContextMenuItem);
|
||||
})
|
||||
.then(() => {
|
||||
is(saveBodiesContextMenuItem.getAttribute("checked"), "true",
|
||||
"Context menu: 'log responses' is checked after menuitem was selected with keyboard.");
|
||||
"Context menu: 'log responses' is checked after menuitem was selected " +
|
||||
"with keyboard.");
|
||||
is(hud.ui._saveRequestAndResponseBodies, true,
|
||||
"Context menu: Responses are saved after menuitem was selected with keyboard.");
|
||||
"Context menu: Responses are saved after menuitem was selected with " +
|
||||
"keyboard.");
|
||||
|
||||
return openPopup(saveBodiesMenuItem);
|
||||
})
|
||||
.then(() => {
|
||||
// Test the 'Net' menu item.
|
||||
info("Testing 'Log Request and Response Bodies' menuitem of 'Net' menu in the console.");
|
||||
// 'Log Request and Response Bodies' should be selected due to previous test.
|
||||
info("Testing 'Log Request and Response Bodies' menuitem of 'Net' menu " +
|
||||
"in the console.");
|
||||
// 'Log Request and Response Bodies' should be selected due to previous
|
||||
// test.
|
||||
|
||||
is(saveBodiesMenuItem.getAttribute("checked"), "true",
|
||||
"Console net menu: 'log responses' is checked before action.");
|
||||
@ -58,11 +68,12 @@ function test() {
|
||||
EventUtils.synthesizeKey("VK_UP", {});
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
|
||||
return waitForUpdate(saveBodiesMenuItem);
|
||||
return waitForUpdate(saveBodiesMenuItem);
|
||||
})
|
||||
.then(() => {
|
||||
is(saveBodiesMenuItem.getAttribute("checked"), "false",
|
||||
"Console net menu: 'log responses' is NOT checked after menuitem was selected with keyboard.");
|
||||
"Console net menu: 'log responses' is NOT checked after menuitem was " +
|
||||
"selected with keyboard.");
|
||||
is(hud.ui._saveRequestAndResponseBodies, false,
|
||||
"Responses are NOT saved after menuitem was selected with keyboard.");
|
||||
hud = null;
|
||||
@ -71,13 +82,13 @@ function test() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens and waits for the menu containing aMenuItem to open.
|
||||
* @param aMenuItem MenuItem
|
||||
* Opens and waits for the menu containing menuItem to open.
|
||||
* @param menuItem MenuItem
|
||||
* A MenuItem in a menu that should be opened.
|
||||
* @return A promise that's resolved once menu is open.
|
||||
*/
|
||||
function openPopup(aMenuItem) {
|
||||
let menu = aMenuItem.parentNode;
|
||||
function openPopup(menuItem) {
|
||||
let menu = menuItem.parentNode;
|
||||
|
||||
let menuOpened = promise.defer();
|
||||
let uiUpdated = promise.defer();
|
||||
@ -86,7 +97,7 @@ function openPopup(aMenuItem) {
|
||||
// before continuing or the test might fail due to a race between menu being
|
||||
// shown and the item updated to have the correct state.
|
||||
hud.ui.once("save-bodies-ui-toggled", uiUpdated.resolve);
|
||||
menu.addEventListener("popupshown", function onPopup () {
|
||||
menu.addEventListener("popupshown", function onPopup() {
|
||||
menu.removeEventListener("popupshown", onPopup);
|
||||
menuOpened.resolve();
|
||||
});
|
||||
@ -96,18 +107,18 @@ function openPopup(aMenuItem) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for the settings and menu containing aMenuItem to update.
|
||||
* @param aMenuItem MenuItem
|
||||
* Waits for the settings and menu containing menuItem to update.
|
||||
* @param menuItem MenuItem
|
||||
* The menuitem that should be updated.
|
||||
* @return A promise that's resolved once the settings and menus are updated.
|
||||
*/
|
||||
function waitForUpdate(aMenuItem) {
|
||||
function waitForUpdate(menuItem) {
|
||||
info("Waiting for settings update to complete.");
|
||||
let deferred = promise.defer();
|
||||
hud.ui.once("save-bodies-pref-reversed", function () {
|
||||
hud.ui.once("save-bodies-pref-reversed", function() {
|
||||
hud.ui.once("save-bodies-ui-toggled", deferred.resolve);
|
||||
// The checked state is only updated once the popup is shown.
|
||||
aMenuItem.parentNode.openPopup();
|
||||
menuItem.parentNode.openPopup();
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
@ -6,7 +6,10 @@
|
||||
// Tests that the cached autocomplete results are used when the new
|
||||
// user input is a subset of the existing completion results.
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf8,<p>test cached autocompletion results";
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf8,<p>test cached autocompletion " +
|
||||
"results";
|
||||
|
||||
let jsterm;
|
||||
|
||||
@ -32,7 +35,7 @@ let test = asyncTest(function* () {
|
||||
input.setSelectionRange(7, 7);
|
||||
yield complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
||||
ok(popup.getItems().length > 0, "'window.' gave a list of suggestions")
|
||||
ok(popup.getItems().length > 0, "'window.' gave a list of suggestions");
|
||||
|
||||
yield jsterm.execute("window.docfoobar = true");
|
||||
|
||||
@ -43,8 +46,9 @@ let test = asyncTest(function* () {
|
||||
|
||||
let newItems = popup.getItems();
|
||||
ok(newItems.every(function(item) {
|
||||
return item.label != "docfoobar";
|
||||
}), "autocomplete cached results do not contain docfoobar. list has not been updated");
|
||||
return item.label != "docfoobar";
|
||||
}), "autocomplete cached results do not contain docfoobar. list has not " +
|
||||
"been updated");
|
||||
|
||||
// Test that backspace does not cause a request to the server
|
||||
input.value = "window.do";
|
||||
@ -53,13 +57,14 @@ let test = asyncTest(function* () {
|
||||
|
||||
newItems = popup.getItems();
|
||||
ok(newItems.every(function(item) {
|
||||
return item.label != "docfoobar";
|
||||
}), "autocomplete cached results do not contain docfoobar. list has not been updated");
|
||||
return item.label != "docfoobar";
|
||||
}), "autocomplete cached results do not contain docfoobar. list has not " +
|
||||
"been updated");
|
||||
|
||||
yield jsterm.execute("delete window.docfoobar");
|
||||
|
||||
// Test if 'window.getC' gives 'getComputedStyle'
|
||||
input.value = "window."
|
||||
input.value = "window.";
|
||||
input.setSelectionRange(7, 7);
|
||||
yield complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
||||
@ -93,8 +98,9 @@ let test = asyncTest(function* () {
|
||||
|
||||
newItems = popup.getItems();
|
||||
ok(newItems.every(function(item) {
|
||||
return item.label != "docfoobar";
|
||||
}), "autocomplete cached results do not contain docfoobar. list has not been updated");
|
||||
return item.label != "docfoobar";
|
||||
}), "autocomplete cached results do not contain docfoobar. list has not " +
|
||||
"been updated");
|
||||
|
||||
yield jsterm.execute("delete window.docfoobar");
|
||||
|
||||
|
@ -3,10 +3,13 @@
|
||||
|
||||
// Test that the cd() jsterm helper function works as expected. See bug 609872.
|
||||
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
let hud;
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-609872-cd-iframe-parent.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
|
||||
"test/test-bug-609872-cd-iframe-parent.html";
|
||||
|
||||
const parentMessages = [{
|
||||
name: "document.title in parent iframe",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user