This commit is contained in:
Philipp von Weitershausen 2011-09-27 09:47:53 -07:00
Родитель 637d6d0212 db620ee652
Коммит aafa22d564
1031 изменённых файлов: 26767 добавлений и 106846 удалений

Просмотреть файл

@ -49,7 +49,7 @@ IA2DIR = $(topsrcdir)/other-licenses/ia2
include $(DEPTH)/config/autoconf.mk
DEFINES += -DREGISTER_PROXY_DLL -D_WIN32_WINNT=0x400
DEFINES += -DREGISTER_PROXY_DLL
GARBAGE += $(MIDL_GENERATED_FILES)

Просмотреть файл

@ -53,7 +53,7 @@ XPIDLSRCS = \
nsIWinAccessNode.idl \
$(NULL)
DEFINES += -DREGISTER_PROXY_DLL -D_WIN32_WINNT=0x400
DEFINES += -DREGISTER_PROXY_DLL
GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c

1
aclocal.m4 поставляемый
Просмотреть файл

@ -4,7 +4,6 @@ dnl The contents of this file are under the Public Domain.
dnl
builtin(include, build/autoconf/glib.m4)dnl
builtin(include, build/autoconf/libIDL.m4)dnl
builtin(include, build/autoconf/nspr.m4)dnl
builtin(include, build/autoconf/nss.m4)dnl
builtin(include, build/autoconf/pkg.m4)dnl

Просмотреть файл

@ -214,5 +214,7 @@
<key>x86_64</key>
<string>10.6.0</string>
</dict>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>

Просмотреть файл

@ -254,7 +254,7 @@ pref("browser.warnOnRestart", false);
pref("browser.showQuitWarning", false);
pref("browser.fullscreen.autohide", true);
pref("browser.fullscreen.animateUp", 1);
pref("browser.overlink-delay", 70);
pref("browser.overlink-delay", 80);
#ifdef UNIX_BUT_NOT_MAC
pref("browser.urlbar.clickSelectsAll", false);
@ -866,10 +866,6 @@ pref("browser.privatebrowsing.dont_prompt_on_enter", false);
// bookmarking dialog
pref("browser.bookmarks.editDialog.firstEditField", "namePicker");
// base url for the wifi geolocation network provider
pref("geo.wifi.uri", "https://maps.googleapis.com/maps/api/browserlocation/json");
pref("geo.wifi.protocol", 0);
// Whether to use a panel that looks like an OS X sheet for customization
#ifdef XP_MACOSX
pref("toolbar.customization.usesheet", true);

Просмотреть файл

@ -56,7 +56,6 @@ endif
EXTRA_JS_MODULES = \
content/openLocationLastURL.jsm \
content/NetworkPrioritizer.jsm \
content/domplate.jsm \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -21,6 +21,8 @@
#
# Contributor(s):
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
# Rob Campbell <rcampbell@mozilla.com>
# Panagiotis Astithas <past@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -340,3 +342,9 @@
label="&bidiSwitchPageDirectionItem.label;"
accesskey="&bidiSwitchPageDirectionItem.accesskey;"
oncommand="gContextMenu.switchPageDirection();"/>
<menuseparator id="inspect-separator" hidden="true"/>
<menuitem id="context-inspect"
hidden="true"
label="&inspectContextMenu.label;"
accesskey="&inspectContextMenu.accesskey;"
oncommand="gContextMenu.inspectNode();"/>

Просмотреть файл

@ -511,16 +511,20 @@ statuspanel[type=status] {
}
statuspanel[type=overLink] {
-moz-transition: opacity 100ms ease-out;
-moz-transition: opacity 120ms ease-out;
direction: ltr;
}
statuspanel[label=""] {
statuspanel[inactive] {
-moz-transition: none;
opacity: 0;
pointer-events: none;
}
statuspanel[inactive][previoustype=overLink] {
-moz-transition: opacity 200ms ease-out;
}
.statuspanel-inner {
height: 3em;
width: 100%;

Просмотреть файл

@ -173,6 +173,12 @@ XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () {
}
});
XPCOMUtils.defineLazyGetter(this, "InspectorUI", function() {
let tmp = {};
Cu.import("resource:///modules/inspector.jsm", tmp);
return new tmp.InspectorUI(window);
});
let gInitialPages = [
"about:blank",
"about:privatebrowsing",
@ -180,7 +186,6 @@ let gInitialPages = [
];
#include browser-fullZoom.js
#include inspector.js
#include browser-places.js
#include browser-tabPreviews.js
#include browser-tabview.js
@ -1676,7 +1681,7 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
TabView.init();
// Enable Inspector?
let enabled = gPrefService.getBoolPref(InspectorUI.prefEnabledName);
let enabled = gPrefService.getBoolPref("devtools.inspector.enabled");
if (enabled) {
document.getElementById("menu_pageinspect").hidden = false;
document.getElementById("Tools:Inspect").removeAttribute("disabled");
@ -1725,6 +1730,9 @@ function BrowserShutdown() {
if (!gStartupRan)
return;
if (!__lookupGetter__("InspectorUI"))
InspectorUI.destroy();
// First clean up services initialized in BrowserStartup (or those whose
// uninit methods don't depend on the services having been initialized).
allTabs.uninit();
@ -4675,7 +4683,7 @@ var LinkTargetDisplay = {
return this.DELAY_SHOW = Services.prefs.getIntPref("browser.overlink-delay");
},
DELAY_HIDE: 150,
DELAY_HIDE: 250,
_timer: 0,
get _isVisible () XULBrowserWindow.statusTextField.label != "",

Просмотреть файл

@ -232,7 +232,6 @@
noautohide="true"
titlebar="normal"
close="true"
onpopuphiding="InspectorUI.closeInspectorUI();"
label="&inspectPanelTitle.label;">
<hbox id="tree-panel-resizer-box" align="end">
<spacer flex="1" />
@ -957,7 +956,7 @@
contentcontextmenu="contentAreaContextMenu"
autocompletepopup="PopupAutoComplete"
onclick="return contentAreaClick(event, false);"/>
<statuspanel id="statusbar-display" label=""/>
<statuspanel id="statusbar-display" inactive="true"/>
</vbox>
<vbox id="browser-border-end" hidden="true" layer="true"/>
</hbox>

Просмотреть файл

@ -46,6 +46,7 @@
# Kathleen Brade <brade@pearlcrescent.com>
# Mark Smith <mcs@pearlcrescent.com>
# Kailas Patil <patilkr24@gmail.com>
# Rob Campbell <rcampbell@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -244,8 +245,11 @@ nsContextMenu.prototype = {
this.onImage || this.onCanvas ||
this.onVideo || this.onAudio ||
this.onLink || this.onTextInput);
var showInspect = gPrefService.getBoolPref("devtools.inspector.enabled");
this.showItem("context-viewsource", shouldShow);
this.showItem("context-viewinfo", shouldShow);
this.showItem("inspect-separator", showInspect);
this.showItem("context-inspect", showInspect);
this.showItem("context-sep-viewsource", shouldShow);
@ -429,6 +433,15 @@ nsContextMenu.prototype = {
this.showItem("context-media-sep-commands", onMedia);
},
inspectNode: function CM_inspectNode() {
if (InspectorUI.isTreePanelOpen) {
InspectorUI.inspectNode(this.target);
InspectorUI.stopInspecting();
} else {
InspectorUI.openInspectorUI(this.target);
}
},
// Set various context menu attributes based on the state of the world.
setTarget: function (aNode, aRangeParent, aRangeOffset) {
const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

Просмотреть файл

@ -4177,6 +4177,11 @@
aMenuitem.removeAttribute("busy");
}
if (aTab.hasAttribute("pending"))
aMenuitem.setAttribute("pending", aTab.getAttribute("pending"));
else
aMenuitem.removeAttribute("pending");
if (aTab.selected)
aMenuitem.setAttribute("selected", "true");
else
@ -4274,11 +4279,17 @@
this.getAttribute("previoustype") == "status"
? getComputedStyle(this).width : "";
this.setAttribute("label", val);
if (val) {
this.setAttribute("label", val);
this.removeAttribute("inactive");
} else {
this.setAttribute("inactive", "true");
}
return val;
]]></setter>
<getter>
return this.getAttribute("label");
return this.hasAttribute("inactive") ? "" : this.getAttribute("label");
</getter>
</property>

Просмотреть файл

@ -492,15 +492,15 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// options - an object with additional parameters, see below
//
// Possible options:
// forceStacked - true to force content bounds for stacked mode
// stacked - true to get content bounds for stacked mode
getContentBounds: function GroupItem_getContentBounds(options) {
var box = this.getBounds();
var titleHeight = this.$titlebar.height();
let box = this.getBounds();
let titleHeight = this.$titlebar.height();
box.top += titleHeight;
box.height -= titleHeight;
let appTabTrayContainer = iQ(this.$appTabTray[0].parentNode);
var appTabTrayWidth = appTabTrayContainer.width();
let appTabTrayWidth = appTabTrayContainer.width();
if (appTabTrayWidth)
appTabTrayWidth += parseInt(appTabTrayContainer.css(UI.rtl ? "left" : "right"));
@ -513,9 +513,8 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// themeable --OR-- compute this from actual bounds. Bug 586546
box.inset(6, 6);
// make some room for the expand button if we're stacked
let isStacked = (options && options.forceStacked) || this.isStacked();
if (isStacked)
// make some room for the expand button in stacked mode
if (options && options.stacked)
box.height -= this.$expander.height() + 9; // the button height plus padding
return box;
@ -1087,7 +1086,8 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// tabItem - The tabItem that is closed.
_onChildClose: function GroupItem__onChildClose(tabItem) {
let count = this._children.length;
let dontArrange = this.expanded || !this.shouldStack(count);
let dontArrange = tabItem.closedManually &&
(this.expanded || !this.shouldStack(count));
let dontClose = !tabItem.closedManually && gBrowser._numPinnedTabs > 0;
this.remove(tabItem, {dontArrange: dontArrange, dontClose: dontClose});
@ -1212,6 +1212,10 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
.attr("src", iconUrl)
.data("xulTab", xulTab)
.appendTo(this.$appTabTray)
.mousedown(function onAppTabMousedown(event) {
// stop mousedown propagation to disable group dragging on app tabs
event.stopPropagation();
})
.click(function(event) {
if (!Utils.isLeftClick(event))
return;
@ -1296,8 +1300,8 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
if (count <= 1)
return false;
var bb = this.getContentBounds();
var options = {
let bb = this.getContentBounds();
let options = {
return: 'widthAndColumns',
count: count || this._children.length,
hideTitle: false
@ -1403,7 +1407,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
GroupItems.pushArrange(this, options);
return false;
}
let shouldStack = this.shouldStack(childrenToArrange.length + (options.addTab ? 1 : 0));
let shouldStackArrange = (shouldStack && !this.expanded);
let box;
@ -1411,12 +1415,12 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// if we should stack and we're not expanded
if (shouldStackArrange) {
this.showExpandControl();
box = this.getContentBounds({forceStacked: true});
box = this.getContentBounds({stacked: true});
this._stackArrange(childrenToArrange, box, options);
return false;
} else {
this.hideExpandControl();
box = this.getContentBounds({forceStacked: false});
box = this.getContentBounds();
// a dropIndex is returned
return this._gridArrange(childrenToArrange, box, options);
}
@ -2605,7 +2609,7 @@ let GroupItems = {
if (groupItemId) {
groupItem = GroupItems.groupItem(groupItemId);
groupItem.add(tab._tabViewTabItem);
UI.setReorderTabItemsOnShow(groupItem);
groupItem.reorderTabsBasedOnTabItemOrder()
} else {
let pageBounds = Items.getPageBounds();
pageBounds.inset(20, 20);

Просмотреть файл

@ -228,7 +228,7 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
groupID: (this.parent ? this.parent.id : 0),
title: this.tab.label
};
if (this.parent.getActiveTab() == this)
if (this.parent && this.parent.getActiveTab() == this)
data.active = true;
return data;

Просмотреть файл

@ -42,7 +42,6 @@ relativesrcdir = browser/base/content/test
DIRS += \
tabview \
inspector \
$(NULL)
include $(DEPTH)/config/autoconf.mk
@ -53,6 +52,8 @@ _TEST_FILES = \
feed_discovery.html \
test_bug395533.html \
bug395533-data.txt \
test_contextmenu.html \
subtst_contextmenu.html \
ctxmenu-image.png \
video.ogg \
test_offlineNotification.html \
@ -75,16 +76,6 @@ _TEST_FILES = \
gZipOfflineChild.cacheManifest^headers^ \
$(NULL)
ifeq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
_TEST_FILES += \
test_contextmenu.html \
subtst_contextmenu.html \
$(NULL)
else
$(warning test_contextmenu.html disabled because of intermittent failures; bug 513558)
endif
# The following tests are disabled because they are unreliable:
# browser_bug423833.js is bug 428712
# browser_sanitize-download-history.js is bug 432425

Просмотреть файл

@ -738,8 +738,12 @@ function waitForAsyncUpdates(aCallback, aScope, aArguments)
let args = aArguments || [];
let db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
.DBConnection;
db.createAsyncStatement("BEGIN EXCLUSIVE").executeAsync();
db.createAsyncStatement("COMMIT").executeAsync({
let begin = db.createAsyncStatement("BEGIN EXCLUSIVE");
begin.executeAsync();
begin.finalize();
let commit = db.createAsyncStatement("COMMIT");
commit.executeAsync({
handleResult: function() {},
handleError: function() {},
handleCompletion: function(aReason)
@ -747,6 +751,7 @@ function waitForAsyncUpdates(aCallback, aScope, aArguments)
aCallback.apply(scope, args);
}
});
commit.finalize();
}
/**

Просмотреть файл

@ -542,8 +542,12 @@ function waitForAsyncUpdates(aCallback, aScope, aArguments)
let args = aArguments || [];
let db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
.DBConnection;
db.createAsyncStatement("BEGIN EXCLUSIVE").executeAsync();
db.createAsyncStatement("COMMIT").executeAsync({
let begin = db.createAsyncStatement("BEGIN EXCLUSIVE");
begin.executeAsync();
begin.finalize();
let commit = db.createAsyncStatement("COMMIT");
commit.executeAsync({
handleResult: function() {},
handleError: function() {},
handleCompletion: function(aReason)
@ -551,6 +555,7 @@ function waitForAsyncUpdates(aCallback, aScope, aArguments)
aCallback.apply(scope, args);
}
});
commit.finalize();
}
/**

Просмотреть файл

@ -1,92 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Inspector Initializationa and Shutdown Tests.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Rob Campbell <rcampbell@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function startInspectorTests()
{
ok(InspectorUI, "InspectorUI variable exists");
Services.obs.addObserver(runInspectorTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function runInspectorTests()
{
Services.obs.removeObserver(runInspectorTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
Services.obs.addObserver(finishInspectorTests,
INSPECTOR_NOTIFICATIONS.CLOSED, false);
ok(!InspectorUI.toolbar.hidden, "toolbar is visible");
let iframe = document.getElementById("inspector-tree-iframe");
is(InspectorUI.treeIFrame, iframe, "Inspector IFrame matches");
ok(InspectorUI.inspecting, "Inspector is inspecting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
ok(InspectorUI.highlighter, "Highlighter is up");
executeSoon(function() {
InspectorUI.closeInspectorUI();
});
}
function finishInspectorTests()
{
Services.obs.removeObserver(finishInspectorTests,
INSPECTOR_NOTIFICATIONS.CLOSED, false);
ok(!InspectorUI.highlighter, "Highlighter is gone");
ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is closed");
ok(!InspectorUI.inspecting, "Inspector is not inspecting");
ok(InspectorUI.toolbar.hidden, "toolbar is hidden");
gBrowser.removeCurrentTab();
finish();
}
function test()
{
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
waitForFocus(startInspectorTests, content);
}, true);
content.location = "data:text/html,basic tests for inspector";
}

Просмотреть файл

@ -1,61 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
let doc;
let node1;
let node2;
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onload() {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
doc = content.document;
waitForFocus(setupTest, content);
}, true);
content.location = "data:text/html,<div><p></p></div>";
function setupTest() {
node1 = doc.querySelector("div");
node2 = doc.querySelector("p");
Services.obs.addObserver(runTests, INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function runTests() {
Services.obs.removeObserver(runTests, INSPECTOR_NOTIFICATIONS.OPENED);
testNode1();
}
function testNode1() {
let box = InspectorUI.ioBox.createObjectBox(node1);
box.click();
executeSoon(function() {
is(InspectorUI.selection, node1, "selection matches node");
is(InspectorUI.highlighter.node, node1, "selection matches node");
testNode2();
});
}
function testNode2() {
let box = InspectorUI.ioBox.createObjectBox(node2);
box.click();
executeSoon(function() {
is(InspectorUI.selection, node2, "selection matches node");
is(InspectorUI.highlighter.node, node2, "selection matches node");
Services.obs.addObserver(finishUp, INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.closeInspectorUI();
});
}
function finishUp() {
Services.obs.removeObserver(finishUp, INSPECTOR_NOTIFICATIONS.CLOSED);
doc = node1 = node2 = null;
gBrowser.removeCurrentTab();
finish();
}
}

Просмотреть файл

@ -158,6 +158,9 @@ _BROWSER_FILES = \
browser_tabview_bug677310.js \
browser_tabview_bug679853.js \
browser_tabview_bug681599.js \
browser_tabview_bug685476.js \
browser_tabview_bug685692.js \
browser_tabview_bug686654.js \
browser_tabview_click_group.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \

Просмотреть файл

@ -18,12 +18,16 @@ function test() {
finish();
}
let closeTabItemManually = function (tabItem) {
EventUtils.synthesizeMouseAtCenter(tabItem.container, {button: 1}, cw);
}
let prepareTest = function (testName) {
let originalBounds = groupItem.getChild(0).getBounds();
let tabItem = groupItem.getChild(1);
let bounds = tabItem.getBounds();
tabItem.close();
closeTabItemManually(tabItem);
ok(originalBounds.equals(groupItem.getChild(0).getBounds()), testName + ': tabs did not change their size');
ok(bounds.equals(groupItem.getChild(1).getBounds()), testName + ': third tab is now on second tab\'s previous position');
@ -180,7 +184,7 @@ function test() {
let bounds = tabItem.getBounds();
while (groupItem.getChildren().length > 2)
groupItem.getChild(1).close();
closeTabItemManually(groupItem.getChild(1));
ok(originalBounds.equals(groupItem.getChild(0).getBounds()), 'testExpandedMode: tabs did not change their size');

Просмотреть файл

@ -27,7 +27,7 @@ function test() {
// remove two tabs and see if the remaining tabs are re-arranged to fill
// the resulting gaps
for (let i = 0; i < 2; i++) {
children[1].close();
EventUtils.synthesizeMouseAtCenter(children[1].container, {button: 1}, cw);
ok(bounds.equals(children[1].getBounds()), "tabItems were re-arranged");
}

Просмотреть файл

@ -21,7 +21,7 @@ function test() {
let bounds = tabItem.getBounds();
is(groupItem.getActiveTab(), tabItem, "the first tab is active");
tabItem.close();
EventUtils.synthesizeMouseAtCenter(tabItem.container, {button: 1}, cw);
is(groupItem.getChildren().indexOf(tabItem), -1, "tabItem got removed");
ok(bounds.equals(groupItem.getChild(0).getBounds()), "tabItem bounds didn't change");

Просмотреть файл

@ -0,0 +1,24 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
showTabView(function () {
let tab = gBrowser.addTab();
gBrowser.pinTab(tab);
registerCleanupFunction(function () gBrowser.removeTab(tab));
let cw = TabView.getContentWindow();
let body = cw.document.body;
let [appTabIcon] = cw.iQ(".appTabTray .appTabIcon");
EventUtils.synthesizeMouseAtCenter(appTabIcon, {type: "mousedown"}, cw);
EventUtils.synthesizeMouse(body, 500, 100, {type: "mousemove"}, cw);
EventUtils.synthesizeMouse(body, 500, 100, {type: "mouseup"}, cw);
ok(TabView.isVisible(), "tabview is still visible");
hideTabView(finish);
});
}

Просмотреть файл

@ -0,0 +1,54 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
gBrowser.addTab("http://example.com/");
gBrowser.addTab("http://example.com/");
registerCleanupFunction(function () {
while (gBrowser.tabs.length > 1)
gBrowser.removeTab(gBrowser.tabs[1]);
hideTabView();
})
afterAllTabsLoaded(function() {
showTabView(function() {
let cw = TabView.getContentWindow();
let groupItemOne = cw.GroupItems.groupItems[0];
is(groupItemOne.getChildren().length, 3, "The number of tabs in group one is 3");
// create a group with a blank tab
let groupItemTwo = createGroupItemWithBlankTabs(window, 400, 400, 40, 1);
is(groupItemTwo.getChildren().length, 1, "The number of tabs in group two is 1");
cw.UI.setActive(groupItemOne);
moveTabToAnotherGroup(groupItemOne.getChild(2).tab, groupItemOne, groupItemTwo, function() {
moveTabToAnotherGroup(groupItemOne.getChild(1).tab, groupItemOne, groupItemTwo, function() {
cw.UI.setActive(groupItemOne);
hideTabView(finish);
});
});
});
});
}
function moveTabToAnotherGroup(targetTab, groupItemOne, groupItemTwo, callback) {
hideTabView(function() {
let tabCountInGroupItemOne = groupItemOne.getChildren().length;
let tabCountInGroupItemTwo = groupItemTwo.getChildren().length;
TabView.moveTabTo(targetTab, groupItemTwo.id);
showTabView(function() {
is(groupItemOne.getChildren().length, --tabCountInGroupItemOne, "The number of tab items in group one is decreased");
is(groupItemTwo.getChildren().length, ++tabCountInGroupItemTwo, "The number of tab items in group two is increased");
is(groupItemTwo.getChild(tabCountInGroupItemTwo-1).tab, targetTab, "The last tab is the moved tab");
callback();
});
});
}

Просмотреть файл

@ -0,0 +1,46 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
newWindowWithTabView(function(win) {
let cw = win.TabView.getContentWindow();
let groupItem = cw.GroupItems.groupItems[0];
// set the group to 180 x 100 so it shows two tab items without going into
// the stacked mode
groupItem.setBounds(new cw.Rect(100, 0, 180, 100));
hideTabView(function() {
groupItem.addSubscriber("childAdded", function onChildAdded(data) {
groupItem.removeSubscriber("childAdded", onChildAdded);
is(groupItem.getChildren().length, 3, "The number of children in group is 3");
ok(groupItem.isStacked(), "The group item is stacked after adding a new tab");
let tabItem = groupItem.getChild(2);
groupItem.addSubscriber("childRemoved", function onChildRemoved() {
tabItem.removeSubscriber("childRemoved", onChildRemoved);
is(groupItem.getChildren().length, 2, "The number of children in group is 2");
// give a delay for the active item to be set
executeSoon(function() {
showTabView(function() {
ok(!groupItem.isStacked(), "The group item is not stacked after removing a tab");
finish();
}, win);
});
});
win.BrowserCloseTabOrWindow();
});
win.gBrowser.loadOneTab("", {inBackground: true});
}, win);
}, function(win) {
registerCleanupFunction(function () {
win.close();
});
win.gBrowser.addTab();
});
}

Просмотреть файл

@ -251,7 +251,9 @@ function runTest(testNum) {
"context-selectall", true,
"---", null,
"context-viewsource", true,
"context-viewinfo", true]);
"context-viewinfo", true,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(link); // Invoke context menu for next test.
break;
@ -264,14 +266,18 @@ function runTest(testNum) {
"context-bookmarklink", true,
"context-savelink", true,
"context-sendlink", true,
"context-copylink", true]);
"context-copylink", true,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(mailto); // Invoke context menu for next test.
break;
case 4:
// Context menu for text mailto-link
checkContextMenu(["context-copyemail", true]);
checkContextMenu(["context-copyemail", true,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(input); // Invoke context menu for next test.
break;
@ -285,9 +291,11 @@ function runTest(testNum) {
"context-paste", null, // ignore clipboard state
"context-delete", false,
"---", null,
"context-selectall", true,
"context-selectall", false,
"---", null,
"spell-check-enabled", true]);
"spell-check-enabled", true,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(img); // Invoke context menu for next test.
break;
@ -301,7 +309,9 @@ function runTest(testNum) {
"context-saveimage", true,
"context-sendimage", true,
"context-setDesktopBackground", true,
"context-viewimageinfo", true]);
"context-viewimageinfo", true,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(canvas); // Invoke context menu for next test.
break;
@ -311,7 +321,9 @@ function runTest(testNum) {
checkContextMenu(["context-viewimage", true,
"context-saveimage", true,
"context-bookmarkpage", true,
"context-selectall", true]);
"context-selectall", true,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(video_ok); // Invoke context menu for next test.
break;
@ -327,7 +339,9 @@ function runTest(testNum) {
"context-copyvideourl", true,
"---", null,
"context-savevideo", true,
"context-sendvideo", true]);
"context-sendvideo", true,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(video_bad); // Invoke context menu for next test.
break;
@ -343,7 +357,9 @@ function runTest(testNum) {
"context-copyvideourl", true,
"---", null,
"context-savevideo", true,
"context-sendvideo", true]);
"context-sendvideo", true,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(video_bad2); // Invoke context menu for next test.
break;
@ -359,7 +375,9 @@ function runTest(testNum) {
"context-copyvideourl", false,
"---", null,
"context-savevideo", false,
"context-sendvideo", false]);
"context-sendvideo", false,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(iframe); // Invoke context menu for next test.
break;
@ -393,7 +411,9 @@ function runTest(testNum) {
"context-viewframeinfo", true], null,
"---", null,
"context-viewsource", true,
"context-viewinfo", true]);
"context-viewinfo", true,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(textarea); // Invoke context menu for next test.
break;
@ -416,7 +436,9 @@ function runTest(testNum) {
"spell-dictionaries", true,
["spell-check-dictionary-en-US", true,
"---", null,
"spell-add-dictionaries", true], null]);
"spell-add-dictionaries", true], null,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(contenteditable); // Invoke context menu for next test.
@ -440,7 +462,9 @@ function runTest(testNum) {
"spell-dictionaries", true,
["spell-check-dictionary-en-US", true,
"---", null,
"spell-add-dictionaries", true], null]);
"spell-add-dictionaries", true], null,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(inputspell); // Invoke context menu for next test.
@ -464,7 +488,9 @@ function runTest(testNum) {
"spell-dictionaries", true,
["spell-check-dictionary-en-US", true,
"---", null,
"spell-add-dictionaries", true], null]);
"spell-add-dictionaries", true], null,
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(link); // Invoke context menu for next test.
@ -511,7 +537,9 @@ function runTest(testNum) {
"context-selectall", true,
"---", null,
"context-viewsource", true,
"context-viewinfo", true]);
"context-viewinfo", true,
"---", null,
"context-inspect", true]);
invokeItemAction("0");
closeContextMenu();
@ -534,7 +562,9 @@ function runTest(testNum) {
"context-selectall", true,
"---", null,
"context-viewsource", true,
"context-viewinfo", true]);
"context-viewinfo", true,
"---", null,
"context-inspect", true]);
subwindow.close();
SimpleTest.finish();

Просмотреть файл

@ -38,8 +38,8 @@ window.addEventListener("message", function(event) {
var pm = Components.classes["@mozilla.org/permissionmanager;1"].
getService(Components.interfaces.nsIPermissionManager);
pm.remove(frames.testFrame.document.documentURIObject.host, "offline-app");
pm.remove(frames.testFrame3.document.documentURIObject.host, "offline-app");
pm.remove(frames.testFrame.location.hostname, "offline-app");
pm.remove(frames.testFrame3.location.hostname, "offline-app");
SimpleTest.finish();
}

Просмотреть файл

@ -31,7 +31,6 @@ browser.jar:
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
* content/browser/content.js (content/content.js)
* content/browser/fullscreen-video.xhtml (content/fullscreen-video.xhtml)
* content/browser/inspector.html (content/inspector.html)
* content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul)
* content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js)
* content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css)

Просмотреть файл

@ -782,7 +782,7 @@ BrowserGlue.prototype = {
var productName = brandBundle.GetStringFromName("brandFullName");
var serverOwner = Services.prefs.getCharPref(PREF_TELEMETRY_SERVER_OWNER);
var telemetryText = browserBundle.formatStringFromName("telemetryText", [productName, serverOwner], 2);
var telemetryPrompt = browserBundle.formatStringFromName("telemetryPrompt", [productName, serverOwner], 2);
var buttons = [
{
@ -804,8 +804,8 @@ BrowserGlue.prototype = {
// Set pref to indicate we've shown the notification.
Services.prefs.setBoolPref(PREF_TELEMETRY_PROMPTED, true);
var notification = notifyBox.appendNotification(telemetryText, "telemetry", null, notifyBox.PRIORITY_INFO_LOW, buttons);
notification.persistence = 3; // arbitrary number, just so bar sticks around for a bit
var notification = notifyBox.appendNotification(telemetryPrompt, "telemetry", null, notifyBox.PRIORITY_INFO_LOW, buttons);
notification.persistence = 6; // arbitrary number, just so bar sticks around for a bit
let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let link = notification.ownerDocument.createElementNS(XULNS, "label");
@ -818,7 +818,7 @@ BrowserGlue.prototype = {
notification.parentNode.removeNotification(notification, true);
// Add a new notification to that tab, with no "Learn more" link
var notifyBox = browser.getNotificationBox();
notifyBox.appendNotification(telemetryText, "telemetry", null, notifyBox.PRIORITY_INFO_LOW, buttons);
notifyBox.appendNotification(telemetryPrompt, "telemetry", null, notifyBox.PRIORITY_INFO_LOW, buttons);
}, false);
let description = notification.ownerDocument.getAnonymousElementByAttribute(notification, "anonid", "messageText");
description.appendChild(link);

Просмотреть файл

@ -77,7 +77,7 @@ var gEditItemOverlay = {
if (aInfo && aInfo.hiddenRows)
this._hiddenRows = aInfo.hiddenRows;
else
this._hiddenRows.splice(0);
this._hiddenRows.splice(0, this._hiddenRows.length);
// force-read-only
this._readOnly = aInfo && aInfo.forceReadOnly;
},

Просмотреть файл

@ -77,7 +77,7 @@ var PlacesOrganizer = {
this.selectLeftPaneQuery(leftPaneSelection);
// clear the back-stack
this._backHistory.splice(0);
this._backHistory.splice(0, this._backHistory.length);
document.getElementById("OrganizerCommand:Back").setAttribute("disabled", true);
var view = this._content.treeBoxObject.view;
@ -162,7 +162,7 @@ var PlacesOrganizer = {
if (this.location) {
this._backHistory.unshift(this.location);
this._forwardHistory.splice(0);
this._forwardHistory.splice(0, this._forwardHistory.length);
}
this._location = aLocation;

Просмотреть файл

@ -67,8 +67,12 @@ function waitForAsyncUpdates(aCallback, aScope, aArguments)
let args = aArguments || [];
let db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
.DBConnection;
db.createAsyncStatement("BEGIN EXCLUSIVE").executeAsync();
db.createAsyncStatement("COMMIT").executeAsync({
let begin = db.createAsyncStatement("BEGIN EXCLUSIVE");
begin.executeAsync();
begin.finalize();
let commit = db.createAsyncStatement("COMMIT");
commit.executeAsync({
handleResult: function() {},
handleError: function() {},
handleCompletion: function(aReason)
@ -76,4 +80,5 @@ function waitForAsyncUpdates(aCallback, aScope, aArguments)
aCallback.apply(scope, args);
}
});
commit.finalize();
}

Просмотреть файл

@ -52,7 +52,6 @@ const TOPIC_CONNECTION_CLOSED = "places-connection-closed";
let EXPECTED_NOTIFICATIONS = [
"places-shutdown"
, "places-will-close-connection"
, "places-connection-closing"
, "places-expiration-finished"
, "places-connection-closed"
];

Просмотреть файл

@ -244,10 +244,8 @@ Site.prototype = {
* @return An array of the logins stored for the site.
*/
get logins() {
// There could be more logins for different schemes/ports, but this covers
// the vast majority of cases.
let httpLogins = Services.logins.findLogins({}, this.httpURI.prePath, "", null);
let httpsLogins = Services.logins.findLogins({}, this.httpsURI.prePath, "", null);
let httpLogins = Services.logins.findLogins({}, this.httpURI.prePath, "", "");
let httpsLogins = Services.logins.findLogins({}, this.httpsURI.prePath, "", "");
return httpLogins.concat(httpsLogins);
},

Просмотреть файл

@ -41,7 +41,7 @@ var gTreeUtils = {
{
for (var i = 0; i < aItems.length; ++i)
aDeletedItems.push(aItems[i]);
aItems.splice(0);
aItems.splice(0, aItems.length);
var oldCount = aView.rowCount;
aView._rowCount = 0;
aTree.treeBoxObject.rowCountChanged(0, -oldCount);

Просмотреть файл

@ -629,7 +629,7 @@ SessionStoreService.prototype = {
// preserved update our internal states to match that max
case "sessionstore.max_tabs_undo":
for (let ix in this._windows) {
this._windows[ix]._closedTabs.splice(this._prefBranch.getIntPref("sessionstore.max_tabs_undo"));
this._windows[ix]._closedTabs.splice(this._prefBranch.getIntPref("sessionstore.max_tabs_undo"), this._windows[ix]._closedTabs.length);
}
break;
case "sessionstore.max_windows_undo":
@ -1166,7 +1166,7 @@ SessionStoreService.prototype = {
// If the tab hasn't been restored yet, move it into the right _tabsToRestore bucket
if (aTab.linkedBrowser.__SS_restoreState &&
aTab.linkedBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
this._tabsToRestore.hidden.splice(this._tabsToRestore.hidden.indexOf(aTab));
this._tabsToRestore.hidden.splice(this._tabsToRestore.hidden.indexOf(aTab), this._tabsToRestore.hidden.length);
// Just put it at the end of the list of visible tabs;
this._tabsToRestore.visible.push(aTab);
@ -1184,7 +1184,7 @@ SessionStoreService.prototype = {
// If the tab hasn't been restored yet, move it into the right _tabsToRestore bucket
if (aTab.linkedBrowser.__SS_restoreState &&
aTab.linkedBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
this._tabsToRestore.visible.splice(this._tabsToRestore.visible.indexOf(aTab));
this._tabsToRestore.visible.splice(this._tabsToRestore.visible.indexOf(aTab), this._tabsToRestore.visible.length);
// Just put it at the end of the list of hidden tabs;
this._tabsToRestore.hidden.push(aTab);
}
@ -1550,7 +1550,7 @@ SessionStoreService.prototype = {
if (winState._closedTabs && winState._closedTabs.length) {
let curWinState = this._windows[windowToUse.__SSi];
curWinState._closedTabs = curWinState._closedTabs.concat(winState._closedTabs);
curWinState._closedTabs.splice(this._prefBranch.getIntPref("sessionstore.max_tabs_undo"));
curWinState._closedTabs.splice(this._prefBranch.getIntPref("sessionstore.max_tabs_undo"), curWinState._closedTabs.length);
}
// Restore into that window - pretend it's a followup since we'll already
@ -2590,7 +2590,7 @@ SessionStoreService.prototype = {
(!winData.tabs[0].entries || winData.tabs[0].entries.length == 0)) {
winData.tabs = [];
}
var tabbrowser = aWindow.gBrowser;
var openTabCount = aOverwriteTabs ? tabbrowser.browsers.length : -1;
var newTabCount = winData.tabs.length;
@ -2600,11 +2600,6 @@ SessionStoreService.prototype = {
var tabstrip = tabbrowser.tabContainer.mTabstrip;
var smoothScroll = tabstrip.smoothScroll;
tabstrip.smoothScroll = false;
// make sure that the selected tab won't be closed in order to
// prevent unnecessary flickering
if (aOverwriteTabs && tabbrowser.selectedTab._tPos >= newTabCount)
tabbrowser.moveTabTo(tabbrowser.selectedTab, newTabCount - 1);
// unpin all tabs to ensure they are not reordered in the next loop
if (aOverwriteTabs) {
@ -2612,6 +2607,11 @@ SessionStoreService.prototype = {
tabbrowser.unpinTab(tabbrowser.tabs[t]);
}
// make sure that the selected tab won't be closed in order to
// prevent unnecessary flickering
if (aOverwriteTabs && tabbrowser.selectedTab._tPos >= newTabCount)
tabbrowser.moveTabTo(tabbrowser.selectedTab, newTabCount - 1);
for (var t = 0; t < newTabCount; t++) {
tabs.push(t < openTabCount ?
tabbrowser.tabs[t] :
@ -2825,6 +2825,7 @@ SessionStoreService.prototype = {
// a tab gets closed before it's been properly restored
browser.__SS_data = tabData;
browser.__SS_restoreState = TAB_STATE_NEEDS_RESTORE;
tab.setAttribute("pending", "true");
// Make sure that set/getTabValue will set/read the correct data by
// wiping out any current value in tab.__SS_extdata.
@ -3007,6 +3008,7 @@ SessionStoreService.prototype = {
// Set this tab's state to restoring
browser.__SS_restoreState = TAB_STATE_RESTORING;
aTab.removeAttribute("pending");
// Remove the history listener, since we no longer need it once we start restoring
this._removeSHistoryListener(aTab);
@ -3014,24 +3016,17 @@ SessionStoreService.prototype = {
let activeIndex = (tabData.index || tabData.entries.length) - 1;
if (activeIndex >= tabData.entries.length)
activeIndex = tabData.entries.length - 1;
// Reset currentURI. This creates a new session history entry with a new
// doc identifier, so we need to explicitly save and restore the old doc
// identifier (corresponding to the SHEntry at activeIndex) below.
browser.webNavigation.setCurrentURI(this._getURIFromString("about:blank"));
// Attach data that will be restored on "load" event, after tab is restored.
if (activeIndex > -1) {
let curSHEntry = browser.webNavigation.sessionHistory.
getEntryAtIndex(activeIndex, false).
QueryInterface(Ci.nsISHEntry);
// restore those aspects of the currently active documents which are not
// preserved in the plain history entries (mainly scroll state and text data)
browser.__SS_restore_data = tabData.entries[activeIndex] || {};
browser.__SS_restore_pageStyle = tabData.pageStyle || "";
browser.__SS_restore_tab = aTab;
didStartLoad = true;
try {
// In order to work around certain issues in session history, we need to
@ -4144,7 +4139,7 @@ SessionStoreService.prototype = {
if (normalWindowIndex >= maxWindowsUndo)
spliceTo = normalWindowIndex + 1;
#endif
this._closedWindows.splice(spliceTo);
this._closedWindows.splice(spliceTo, this._closedWindows.length);
},
_clearRestoringWindows: function sss__clearRestoringWindows() {

Просмотреть файл

@ -152,6 +152,7 @@ _BROWSER_TEST_FILES = \
browser_645428.js \
browser_659591.js \
browser_662812.js \
browser_682507.js \
$(NULL)
ifneq ($(OS_ARCH),Darwin)

Просмотреть файл

@ -0,0 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true);
gBrowser.addTab("about:mozilla");
ss.setTabState(gBrowser.tabs[1], ss.getTabState(gBrowser.tabs[1]));
ok(gBrowser.tabs[1].hasAttribute("pending"), "second tab should have 'pending' attribute");
gBrowser.selectedTab = gBrowser.tabs[1];
ok(!gBrowser.tabs[1].hasAttribute("pending"), "second tab should have not 'pending' attribute");
gBrowser.removeTab(gBrowser.tabs[1]);
Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
}

Просмотреть файл

@ -47,6 +47,7 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
DIRS = \
highlighter \
webconsole \
scratchpad \
sourceeditor \

Просмотреть файл

@ -125,6 +125,9 @@ InsideOutBoxView = {
* The box object containing the InsideOutBox. Required to add/remove
* children during box manipulation (toggling opened or closed).
*/
var EXPORTED_SYMBOLS = ["InsideOutBox"];
function InsideOutBox(aView, aBox)
{
this.view = aView;
@ -450,7 +453,7 @@ InsideOutBox.prototype =
try {
this.box.removeChild(this.rootObjectBox);
} catch (exc) {
InspectorUI._log("this.box.removeChild(this.rootObjectBox) FAILS " +
this.view._log("this.box.removeChild(this.rootObjectBox) FAILS " +
this.box + " must not contain " + this.rootObjectBox);
}
}
@ -643,4 +646,18 @@ InsideOutBox.prototype =
return node;
},
/**
* Clean up our mess.
*/
destroy: function IOBox_destroy()
{
delete this.view;
delete this.box;
delete this.rootObject;
delete this.rootObjectBox;
delete this.selectedObjectBox;
delete this.highlightedObjectBox;
delete this.scrollIntoView;
}
};

Просмотреть файл

@ -12,15 +12,16 @@
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
# The Original Code is Highlighter Build Code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# The Initial Developer of the Original Code is The Mozilla Foundation.
#
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Samir Gehani <sgehani@netscape.com>
# Rob Campbell <rcampbell@mozilla.com>
# Mihai Sucan <mihai.sucan@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -42,36 +43,16 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(srcdir)/../src/objs.mk
MODULE = zlib
LIBRARY_NAME = mozz_s
EXTRA_JS_MODULES = \
inspector.jsm \
domplate.jsm \
InsideOutBox.jsm \
TreePanel.jsm \
$(NULL)
CSRCS = $(MODULES_ZLIB_SRC_LCSRCS)
FORCE_STATIC_LIB = 1
SRCS_IN_OBJDIR = 1
ifeq ($(OS_ARCH),WINNT)
USE_STATIC_LIBS=1
endif
ifeq ($(OS_ARCH),OS2)
USE_STATIC_LIBS=1
endif
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_NSPR_LIBS)
GARBAGE += $(MODULES_ZLIB_SRC_LCSRCS) $(wildcard *.$(OBJ_SUFFIX))
ifeq ($(OS_ARCH),WINNT)
GARBAGE += $(addprefix $(srcdir)/,$(MODULES_ZLIB_SRC_LCSRCS))
ifdef ENABLE_TESTS
DIRS += test
endif
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = -I$(srcdir)/../src
export:: $(MODULES_ZLIB_SRC_CSRCS)
$(INSTALL) $^ .

Просмотреть файл

@ -0,0 +1,779 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla Tree Panel.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Rob Campbell <rcampbell@mozilla.com> (original author)
* Mihai Șucan <mihai.sucan@gmail.com>
* Julian Viereck <jviereck@mozilla.com>
* Paul Rouget <paul@mozilla.com>
* Kyle Simpson <getify@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const Cu = Components.utils;
Cu.import("resource:///modules/domplate.jsm");
Cu.import("resource:///modules/InsideOutBox.jsm");
Cu.import("resource:///modules/Services.jsm");
var EXPORTED_SYMBOLS = ["TreePanel"];
const INSPECTOR_URI = "chrome://browser/content/inspector.html";
/**
* TreePanel
* A container for the Inspector's HTML Tree Panel widget constructor function.
* @param aContext nsIDOMWindow (xulwindow)
* @param aIUI global InspectorUI object
*/
function TreePanel(aContext, aIUI) {
this._init(aContext, aIUI);
};
TreePanel.prototype = {
showTextNodesWithWhitespace: false,
id: "treepanel", // DO NOT LOCALIZE
openInDock: true,
/**
* The tree panel container element.
* @returns xul:panel|xul:vbox|null
* xul:panel is returned when the tree panel is not docked, or
* xul:vbox when when the tree panel is docked.
* null is returned when no container is available.
*/
get container()
{
if (this.openInDock) {
return this.document.getElementById("inspector-tree-box");
}
return this.document.getElementById("inspector-tree-panel");
},
/**
* Main TreePanel boot-strapping method. Initialize the TreePanel with the
* originating context and the InspectorUI global.
* @param aContext nsIDOMWindow (xulwindow)
* @param aIUI global InspectorUI object
*/
_init: function TP__init(aContext, aIUI)
{
this.IUI = aIUI;
this.window = aContext;
this.document = this.window.document;
domplateUtils.setDOM(this.window);
let isOpen = this.isOpen.bind(this);
this.registrationObject = {
id: this.id,
label: this.IUI.strings.GetStringFromName("htmlPanel.label"),
tooltiptext: this.IUI.strings.GetStringFromName("htmlPanel.tooltiptext"),
accesskey: this.IUI.strings.GetStringFromName("htmlPanel.accesskey"),
context: this,
get isOpen() isOpen(),
show: this.open,
hide: this.close,
onSelect: this.select,
panel: this.openInDock ? null : this.container,
unregister: this.destroy,
};
this.editingEvents = {};
if (!this.openInDock) {
this._boundClose = this.close.bind(this);
this.container.addEventListener("popuphiding", this._boundClose, false);
}
// Register the HTML panel with the highlighter
this.IUI.registerTool(this.registrationObject);
},
/**
* Initialization function for the TreePanel.
*/
initializeIFrame: function TP_initializeIFrame()
{
if (!this.initializingTreePanel || this.treeLoaded) {
return;
}
this.treeBrowserDocument = this.treeIFrame.contentDocument;
this.treePanelDiv = this.treeBrowserDocument.createElement("div");
this.treeBrowserDocument.body.appendChild(this.treePanelDiv);
this.treePanelDiv.ownerPanel = this;
this.ioBox = new InsideOutBox(this, this.treePanelDiv);
this.ioBox.createObjectBox(this.IUI.win.document.documentElement);
this.treeLoaded = true;
this.treeIFrame.addEventListener("click", this.onTreeClick.bind(this), false);
this.treeIFrame.addEventListener("dblclick", this.onTreeDblClick.bind(this), false);
delete this.initializingTreePanel;
Services.obs.notifyObservers(null,
this.IUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY, null);
if (this.IUI.selection)
this.select(this.IUI.selection, true);
},
/**
* Open the inspector's tree panel and initialize it.
*/
open: function TP_open()
{
if (this.initializingTreePanel && !this.treeLoaded) {
return;
}
this.initializingTreePanel = true;
if (!this.openInDock)
this.container.hidden = false;
this.treeIFrame = this.document.getElementById("inspector-tree-iframe");
if (!this.treeIFrame) {
this.treeIFrame = this.document.createElement("iframe");
this.treeIFrame.setAttribute("id", "inspector-tree-iframe");
this.treeIFrame.flex = 1;
this.treeIFrame.setAttribute("type", "content");
}
if (this.openInDock) { // Create vbox
this.openDocked();
return;
}
let resizerBox = this.document.getElementById("tree-panel-resizer-box");
this.treeIFrame = this.container.insertBefore(this.treeIFrame, resizerBox);
let boundLoadedInitializeTreePanel = function loadedInitializeTreePanel()
{
this.treeIFrame.removeEventListener("load",
boundLoadedInitializeTreePanel, true);
this.initializeIFrame();
}.bind(this);
let boundTreePanelShown = function treePanelShown()
{
this.container.removeEventListener("popupshown",
boundTreePanelShown, false);
this.treeIFrame.addEventListener("load",
boundLoadedInitializeTreePanel, true);
let src = this.treeIFrame.getAttribute("src");
if (src != INSPECTOR_URI) {
this.treeIFrame.setAttribute("src", INSPECTOR_URI);
} else {
this.treeIFrame.contentWindow.location.reload();
}
}.bind(this);
this.container.addEventListener("popupshown", boundTreePanelShown, false);
const panelWidthRatio = 7 / 8;
const panelHeightRatio = 1 / 5;
let width = parseInt(this.IUI.win.outerWidth * panelWidthRatio);
let height = parseInt(this.IUI.win.outerHeight * panelHeightRatio);
let y = Math.min(this.document.defaultView.screen.availHeight - height,
this.IUI.win.innerHeight);
this.container.openPopup(this.browser, "overlap", 0, 0,
false, false);
this.container.moveTo(80, y);
this.container.sizeTo(width, height);
},
openDocked: function TP_openDocked()
{
let treeBox = null;
let toolbar = this.IUI.toolbar.nextSibling; // Addons bar, typically
let toolbarParent =
this.IUI.browser.ownerDocument.getElementById("browser-bottombox");
treeBox = this.document.createElement("vbox");
treeBox.id = "inspector-tree-box";
treeBox.state = "open"; // for the registerTools API.
treeBox.minHeight = 10;
treeBox.flex = 1;
toolbarParent.insertBefore(treeBox, toolbar);
this.createResizer();
treeBox.appendChild(this.treeIFrame);
let boundLoadedInitializeTreePanel = function loadedInitializeTreePanel()
{
this.treeIFrame.removeEventListener("load",
boundLoadedInitializeTreePanel, true);
this.initializeIFrame();
}.bind(this);
this.treeIFrame.addEventListener("load",
boundLoadedInitializeTreePanel, true);
let src = this.treeIFrame.getAttribute("src");
if (src != INSPECTOR_URI) {
this.treeIFrame.setAttribute("src", INSPECTOR_URI);
} else {
this.treeIFrame.contentWindow.location.reload();
}
},
/**
* Lame resizer on the toolbar.
*/
createResizer: function TP_createResizer()
{
let resizer = this.document.createElement("resizer");
resizer.id = "inspector-horizontal-splitter";
resizer.setAttribute("dir", "top");
resizer.flex = 1;
resizer.setAttribute("element", "inspector-tree-box");
resizer.height = 24;
this.IUI.toolbar.appendChild(resizer);
this.resizer = resizer;
},
/**
* Close the TreePanel.
*/
close: function TP_close()
{
if (this.openInDock) {
this.IUI.toolbar.removeChild(this.resizer);
let treeBox = this.container;
let treeBoxParent = treeBox.parentNode;
treeBoxParent.removeChild(treeBox);
} else {
this.container.hidePopup();
}
if (this.treePanelDiv) {
this.treePanelDiv.ownerPanel = null;
let parent = this.treePanelDiv.parentNode;
parent.removeChild(this.treePanelDiv);
delete this.treePanelDiv;
delete this.treeBrowserDocument;
}
this.treeLoaded = false;
},
/**
* Is the TreePanel open?
* @returns boolean
*/
isOpen: function TP_isOpen()
{
if (this.openInDock)
return this.treeLoaded && this.container;
return this.treeLoaded && this.container.state == "open";
},
/**
* Create the ObjectBox for the given object.
* @param object nsIDOMNode
* @param isRoot boolean - Is this the root object?
* @returns InsideOutBox
*/
createObjectBox: function TP_createObjectBox(object, isRoot)
{
let tag = domplateUtils.getNodeTag(object);
if (tag)
return tag.replace({object: object}, this.treeBrowserDocument);
},
getParentObject: function TP_getParentObject(node)
{
let parentNode = node ? node.parentNode : null;
if (!parentNode) {
// Documents have no parentNode; Attr, Document, DocumentFragment, Entity,
// and Notation. top level windows have no parentNode
if (node && node == this.window.Node.DOCUMENT_NODE) {
// document type
if (node.defaultView) {
let embeddingFrame = node.defaultView.frameElement;
if (embeddingFrame)
return embeddingFrame.parentNode;
}
}
// a Document object without a parentNode or window
return null; // top level has no parent
}
if (parentNode.nodeType == this.window.Node.DOCUMENT_NODE) {
if (parentNode.defaultView) {
return parentNode.defaultView.frameElement;
}
// parent is document element, but no window at defaultView.
return null;
}
if (!parentNode.localName)
return null;
return parentNode;
},
getChildObject: function TP_getChildObject(node, index, previousSibling)
{
if (!node)
return null;
if (node.contentDocument) {
// then the node is a frame
if (index == 0) {
return node.contentDocument.documentElement; // the node's HTMLElement
}
return null;
}
if (node instanceof this.window.GetSVGDocument) {
let svgDocument = node.getSVGDocument();
if (svgDocument) {
// then the node is a frame
if (index == 0) {
return svgDocument.documentElement; // the node's SVGElement
}
return null;
}
}
let child = null;
if (previousSibling) // then we are walking
child = this.getNextSibling(previousSibling);
else
child = this.getFirstChild(node);
if (this.showTextNodesWithWhitespace)
return child;
for (; child; child = this.getNextSibling(child)) {
if (!domplateUtils.isWhitespaceText(child))
return child;
}
return null; // we have no children worth showing.
},
getFirstChild: function TP_getFirstChild(node)
{
this.treeWalker = node.ownerDocument.createTreeWalker(node,
this.window.NodeFilter.SHOW_ALL, null, false);
return this.treeWalker.firstChild();
},
getNextSibling: function TP_getNextSibling(node)
{
let next = this.treeWalker.nextSibling();
if (!next)
delete this.treeWalker;
return next;
},
/////////////////////////////////////////////////////////////////////
// Event Handling
/**
* Handle click events in the html tree panel.
* @param aEvent
* The mouse event.
*/
onTreeClick: function TP_onTreeClick(aEvent)
{
let node;
let target = aEvent.target;
let hitTwisty = false;
if (this.hasClass(target, "twisty")) {
node = this.getRepObject(aEvent.target.nextSibling);
hitTwisty = true;
} else {
node = this.getRepObject(aEvent.target);
}
if (node) {
if (hitTwisty) {
this.ioBox.toggleObject(node);
} else {
if (this.IUI.inspecting) {
this.IUI.stopInspecting(true);
} else {
this.IUI.select(node, true, false);
this.IUI.highlighter.highlightNode(node);
}
}
}
},
/**
* Handle double-click events in the html tree panel.
* (double-clicking an attribute value allows it to be edited)
* @param aEvent
* The mouse event.
*/
onTreeDblClick: function TP_onTreeDblClick(aEvent)
{
// if already editing an attribute value, double-clicking elsewhere
// in the tree is the same as a click, which dismisses the editor
if (this.editingContext)
this.closeEditor();
let target = aEvent.target;
if (this.hasClass(target, "nodeValue")) {
let repObj = this.getRepObject(target);
let attrName = target.getAttribute("data-attributeName");
let attrVal = target.innerHTML;
this.editAttributeValue(target, repObj, attrName, attrVal);
}
},
/**
* Starts the editor for an attribute value.
* @param aAttrObj
* The DOM object representing the attribute value in the HTML Tree
* @param aRepObj
* The original DOM (target) object being inspected/edited
* @param aAttrName
* The name of the attribute being edited
* @param aAttrVal
* The current value of the attribute being edited
*/
editAttributeValue:
function TP_editAttributeValue(aAttrObj, aRepObj, aAttrName, aAttrVal)
{
let editor = this.treeBrowserDocument.getElementById("attribute-editor");
let editorInput =
this.treeBrowserDocument.getElementById("attribute-editor-input");
let attrDims = aAttrObj.getBoundingClientRect();
// figure out actual viewable viewport dimensions (sans scrollbars)
let viewportWidth = this.treeBrowserDocument.documentElement.clientWidth;
let viewportHeight = this.treeBrowserDocument.documentElement.clientHeight;
// saves the editing context for use when the editor is saved/closed
this.editingContext = {
attrObj: aAttrObj,
repObj: aRepObj,
attrName: aAttrName
};
// highlight attribute-value node in tree while editing
this.addClass(aAttrObj, "editingAttributeValue");
// show the editor
this.addClass(editor, "editing");
// offset the editor below the attribute-value node being edited
let editorVeritcalOffset = 2;
// keep the editor comfortably within the bounds of the viewport
let editorViewportBoundary = 5;
// outer editor is sized based on the <input> box inside it
editorInput.style.width = Math.min(attrDims.width, viewportWidth -
editorViewportBoundary) + "px";
editorInput.style.height = Math.min(attrDims.height, viewportHeight -
editorViewportBoundary) + "px";
let editorDims = editor.getBoundingClientRect();
// calculate position for the editor according to the attribute node
let editorLeft = attrDims.left + this.treeIFrame.contentWindow.scrollX -
// center the editor against the attribute value
((editorDims.width - attrDims.width) / 2);
let editorTop = attrDims.top + this.treeIFrame.contentWindow.scrollY +
attrDims.height + editorVeritcalOffset;
// but, make sure the editor stays within the visible viewport
editorLeft = Math.max(0, Math.min(
(this.treeIFrame.contentWindow.scrollX +
viewportWidth - editorDims.width),
editorLeft)
);
editorTop = Math.max(0, Math.min(
(this.treeIFrame.contentWindow.scrollY +
viewportHeight - editorDims.height),
editorTop)
);
// position the editor
editor.style.left = editorLeft + "px";
editor.style.top = editorTop + "px";
// set and select the text
editorInput.value = aAttrVal;
editorInput.select();
// listen for editor specific events
this.bindEditorEvent(editor, "click", function(aEvent) {
aEvent.stopPropagation();
});
this.bindEditorEvent(editor, "dblclick", function(aEvent) {
aEvent.stopPropagation();
});
this.bindEditorEvent(editor, "keypress",
this.handleEditorKeypress.bind(this));
// event notification
Services.obs.notifyObservers(null, this.IUI.INSPECTOR_NOTIFICATIONS.EDITOR_OPENED,
null);
},
/**
* Handle binding an event handler for the editor.
* (saves the callback for easier unbinding later)
* @param aEditor
* The DOM object for the editor
* @param aEventName
* The name of the event to listen for
* @param aEventCallback
* The callback to bind to the event (and also to save for later
* unbinding)
*/
bindEditorEvent:
function TP_bindEditorEvent(aEditor, aEventName, aEventCallback)
{
this.editingEvents[aEventName] = aEventCallback;
aEditor.addEventListener(aEventName, aEventCallback, false);
},
/**
* Handle unbinding an event handler from the editor.
* (unbinds the previously bound and saved callback)
* @param aEditor
* The DOM object for the editor
* @param aEventName
* The name of the event being listened for
*/
unbindEditorEvent: function TP_unbindEditorEvent(aEditor, aEventName)
{
aEditor.removeEventListener(aEventName, this.editingEvents[aEventName],
false);
this.editingEvents[aEventName] = null;
},
/**
* Handle keypress events in the editor.
* @param aEvent
* The keyboard event.
*/
handleEditorKeypress: function TP_handleEditorKeypress(aEvent)
{
if (aEvent.which == this.window.KeyEvent.DOM_VK_RETURN) {
this.saveEditor();
} else if (aEvent.keyCode == this.window.KeyEvent.DOM_VK_ESCAPE) {
this.closeEditor();
}
},
/**
* Close the editor and cleanup.
*/
closeEditor: function TP_closeEditor()
{
let editor = this.treeBrowserDocument.getElementById("attribute-editor");
let editorInput =
this.treeBrowserDocument.getElementById("attribute-editor-input");
// remove highlight from attribute-value node in tree
this.removeClass(this.editingContext.attrObj, "editingAttributeValue");
// hide editor
this.removeClass(editor, "editing");
// stop listening for editor specific events
this.unbindEditorEvent(editor, "click");
this.unbindEditorEvent(editor, "dblclick");
this.unbindEditorEvent(editor, "keypress");
// clean up after the editor
editorInput.value = "";
editorInput.blur();
this.editingContext = null;
this.editingEvents = {};
// event notification
Services.obs.notifyObservers(null, this.IUI.INSPECTOR_NOTIFICATIONS.EDITOR_CLOSED,
null);
},
/**
* Commit the edits made in the editor, then close it.
*/
saveEditor: function TP_saveEditor()
{
let editorInput =
this.treeBrowserDocument.getElementById("attribute-editor-input");
// set the new attribute value on the original target DOM element
this.editingContext.repObj.setAttribute(this.editingContext.attrName,
editorInput.value);
// update the HTML tree attribute value
this.editingContext.attrObj.innerHTML = editorInput.value;
this.IUI.isDirty = true;
// event notification
Services.obs.notifyObservers(null, this.IUI.INSPECTOR_NOTIFICATIONS.EDITOR_SAVED,
null);
this.closeEditor();
},
/**
* Simple tree select method.
* @param aNode the DOM node in the content document to select.
* @param aScroll boolean scroll to the visible node?
*/
select: function TP_select(aNode, aScroll)
{
if (this.ioBox)
this.ioBox.select(aNode, true, true, aScroll);
},
///////////////////////////////////////////////////////////////////////////
//// Utility functions
/**
* Does the given object have a class attribute?
* @param aNode
* the DOM node.
* @param aClass
* The class string.
* @returns boolean
*/
hasClass: function TP_hasClass(aNode, aClass)
{
if (!(aNode instanceof this.window.Element))
return false;
return aNode.classList.contains(aClass);
},
/**
* Add the class name to the given object.
* @param aNode
* the DOM node.
* @param aClass
* The class string.
*/
addClass: function TP_addClass(aNode, aClass)
{
if (aNode instanceof this.window.Element)
aNode.classList.add(aClass);
},
/**
* Remove the class name from the given object
* @param aNode
* the DOM node.
* @param aClass
* The class string.
*/
removeClass: function TP_removeClass(aNode, aClass)
{
if (aNode instanceof this.window.Element)
aNode.classList.remove(aClass);
},
/**
* Get the "repObject" from the HTML panel's domplate-constructed DOM node.
* In this system, a "repObject" is the Object being Represented by the box
* object. It is the "real" object that we're building our facade around.
*
* @param element
* The element in the HTML panel the user clicked.
* @returns either a real node or null
*/
getRepObject: function TP_getRepObject(element)
{
let target = null;
for (let child = element; child; child = child.parentNode) {
if (this.hasClass(child, "repTarget"))
target = child;
if (child.repObject) {
if (!target && this.hasClass(child.repObject, "repIgnore"))
break;
else
return child.repObject;
}
}
return null;
},
/**
* Destructor function. Cleanup.
*/
destroy: function TP_destroy()
{
if (this.isOpen()) {
this.close();
}
domplateUtils.setDOM(null);
delete this.resizer;
delete this.treeWalker;
if (this.treePanelDiv) {
this.treePanelDiv.ownerPanel = null;
let parent = this.treePanelDiv.parentNode;
parent.removeChild(this.treePanelDiv);
delete this.treePanelDiv;
delete this.treeBrowserDocument;
}
if (this.treeIFrame) {
this.treeIFrame.removeEventListener("dblclick", this.onTreeDblClick, false);
this.treeIFrame.removeEventListener("click", this.onTreeClick, false);
let parent = this.treeIFrame.parentNode;
parent.removeChild(this.treeIFrame);
delete this.treeIFrame;
}
if (this.ioBox) {
this.ioBox.destroy();
delete this.ioBox;
}
if (!this.openInDock) {
this.container.removeEventListener("popuphiding", this._boundClose, false);
delete this._boundClose;
}
}
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -34,11 +34,11 @@
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../../..
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = browser/base/content/test/inspector
relativesrcdir = browser/devtools/highlighter/test
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
@ -61,5 +61,8 @@ _BROWSER_FILES = \
browser_inspector_bug_566084_location_changed.js \
$(NULL)
# Disabled due to constant failures
# browser_inspector_treePanel_click.js \
libs:: $(_BROWSER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)

Просмотреть файл

@ -5,19 +5,19 @@ let notificationBox = null;
function startLocationTests() {
ok(window.InspectorUI, "InspectorUI variable exists");
Services.obs.addObserver(runInspectorTests, INSPECTOR_NOTIFICATIONS.OPENED, null);
Services.obs.addObserver(runInspectorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, null);
InspectorUI.toggleInspectorUI();
}
function runInspectorTests() {
Services.obs.removeObserver(runInspectorTests, INSPECTOR_NOTIFICATIONS.OPENED, null);
Services.obs.removeObserver(runInspectorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, null);
let para = content.document.querySelector("p");
ok(para, "found the paragraph element");
is(para.textContent, "init", "paragraph content is correct");
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Panel is open");
ok(InspectorUI.isInspectorOpen, "Inspector is open");
InspectorUI.isDirty = true;
@ -56,7 +56,7 @@ function onPageLoad() {
is(para.textContent, "test2", "paragraph content is correct");
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(!InspectorUI.isTreePanelOpen, "Inspector Panel is not open");
ok(!InspectorUI.isInspectorOpen, "Inspector Panel is not open");
testEnd();
}
@ -68,7 +68,7 @@ function locationTest2() {
is(para.textContent, "init", "paragraph content is correct");
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Panel is open");
ok(InspectorUI.isInspectorOpen, "Inspector Panel is open");
notificationBox.addEventListener("AlertActive", alertActive2, false);
@ -102,7 +102,6 @@ function alertActive2() {
function testEnd() {
notificationBox = null;
InspectorUI.isDirty = false;
gBrowser.removeCurrentTab();
executeSoon(finish);
}

Просмотреть файл

@ -23,18 +23,18 @@ function test()
objectNode = doc.querySelector("object");
ok(objectNode, "we have the object node");
Services.obs.addObserver(runObjectInspectionTest,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function runObjectInspectionTest()
{
Services.obs.removeObserver(runObjectInspectionTest,
INSPECTOR_NOTIFICATIONS.OPENED);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
executeSoon(function() {
Services.obs.addObserver(performTestComparison,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.inspectNode(objectNode);
});
@ -43,18 +43,18 @@ function test()
function performTestComparison()
{
Services.obs.removeObserver(performTestComparison,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
is(InspectorUI.selection, objectNode, "selection matches node");
Services.obs.addObserver(finishUp,
INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.closeInspectorUI();
}
function finishUp() {
Services.obs.removeObserver(finishUp, INSPECTOR_NOTIFICATIONS.CLOSED);
Services.obs.removeObserver(finishUp, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
doc = objectNode = null;
gBrowser.removeCurrentTab();
finish();

Просмотреть файл

@ -47,18 +47,18 @@ function test()
ok(iframeNode, "we have the iframe node");
ok(iframeBodyNode, "we have the body node");
Services.obs.addObserver(runTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function runTests()
{
Services.obs.removeObserver(runTests,
INSPECTOR_NOTIFICATIONS.OPENED);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
executeSoon(function() {
Services.obs.addObserver(isTheIframeSelected,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
moveMouseOver(iframeNode, 1, 1);
});
@ -67,7 +67,7 @@ function test()
function isTheIframeSelected()
{
Services.obs.removeObserver(isTheIframeSelected,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
is(InspectorUI.selection, iframeNode, "selection matches node");
iframeNode.style.marginBottom = doc.defaultView.innerHeight + "px";
@ -75,7 +75,7 @@ function test()
executeSoon(function() {
Services.obs.addObserver(isTheIframeContentSelected,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
moveMouseOver(iframeNode, 40, 40);
});
@ -84,7 +84,7 @@ function test()
function isTheIframeContentSelected()
{
Services.obs.removeObserver(isTheIframeContentSelected,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
is(InspectorUI.selection, iframeBodyNode, "selection matches node");
// 184 == 200 + 11(border) + 13(padding) - 40(scroll)
@ -92,12 +92,12 @@ function test()
"highlighter height");
Services.obs.addObserver(finishUp,
INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.closeInspectorUI();
}
function finishUp() {
Services.obs.removeObserver(finishUp, INSPECTOR_NOTIFICATIONS.CLOSED);
Services.obs.removeObserver(finishUp, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
doc = iframeNode = iframeBodyNode = null;
gBrowser.removeCurrentTab();
finish();

Просмотреть файл

@ -3,11 +3,11 @@
/* ***** BEGIN LICENSE BLOCK *****
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*
*
* Contributor(s):
* Rob Campbell <rcampbell@mozilla.com>
* Mihai Sucan <mihai.sucan@gmail.com>
* Kyle Simpson <ksimpson@mozilla.com>
* Kyle Simpson <ksimpson@mozilla.com>
*
* ***** END LICENSE BLOCK ***** */
@ -25,23 +25,30 @@ function setupEditorTests()
div.setAttribute("id", "foobar");
div.setAttribute("class", "barbaz");
doc.body.appendChild(div);
Services.obs.addObserver(runEditorTests, INSPECTOR_NOTIFICATIONS.OPENED, false);
Services.obs.addObserver(setupHTMLPanel, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function setupHTMLPanel()
{
Services.obs.removeObserver(setupHTMLPanel, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
Services.obs.addObserver(runEditorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY, false);
InspectorUI.treePanel.open();
}
function runEditorTests()
{
Services.obs.removeObserver(runEditorTests, INSPECTOR_NOTIFICATIONS.OPENED, false);
Services.obs.removeObserver(runEditorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY);
InspectorUI.stopInspecting();
// setup generator for async test steps
editorTestSteps = doEditorTestSteps();
// add step listeners
Services.obs.addObserver(doNextStep, INSPECTOR_NOTIFICATIONS.EDITOR_OPENED, false);
Services.obs.addObserver(doNextStep, INSPECTOR_NOTIFICATIONS.EDITOR_CLOSED, false);
Services.obs.addObserver(doNextStep, INSPECTOR_NOTIFICATIONS.EDITOR_SAVED, false);
Services.obs.addObserver(doNextStep, InspectorUI.INSPECTOR_NOTIFICATIONS.EDITOR_OPENED, false);
Services.obs.addObserver(doNextStep, InspectorUI.INSPECTOR_NOTIFICATIONS.EDITOR_CLOSED, false);
Services.obs.addObserver(doNextStep, InspectorUI.INSPECTOR_NOTIFICATIONS.EDITOR_SAVED, false);
// start the tests
doNextStep();
@ -49,16 +56,17 @@ function runEditorTests()
function doEditorTestSteps()
{
let editor = InspectorUI.treeBrowserDocument.getElementById("attribute-editor");
let editorInput = InspectorUI.treeBrowserDocument.getElementById("attribute-editor-input");
let treePanel = InspectorUI.treePanel;
let editor = treePanel.treeBrowserDocument.getElementById("attribute-editor");
let editorInput = treePanel.treeBrowserDocument.getElementById("attribute-editor-input");
// Step 1: grab and test the attribute-value nodes in the HTML panel, then open editor
let attrValNode_id = InspectorUI.treeBrowserDocument.querySelectorAll(".nodeValue.editable[data-attributeName='id']")[0];
let attrValNode_class = InspectorUI.treeBrowserDocument.querySelectorAll(".nodeValue.editable[data-attributeName='class']")[0];
let attrValNode_id = treePanel.treeBrowserDocument.querySelectorAll(".nodeValue.editable[data-attributeName='id']")[0];
let attrValNode_class = treePanel.treeBrowserDocument.querySelectorAll(".nodeValue.editable[data-attributeName='class']")[0];
is(attrValNode_id.innerHTML, "foobar", "Step 1: we have the correct `id` attribute-value node in the HTML panel");
is(attrValNode_class.innerHTML, "barbaz", "we have the correct `class` attribute-value node in the HTML panel");
// double-click the `id` attribute-value node to open the editor
executeSoon(function() {
// firing 2 clicks right in a row to simulate a double-click
@ -69,7 +77,7 @@ function doEditorTestSteps()
// Step 2: validate editing session, enter new attribute value into editor, and save input
ok(InspectorUI.editingContext, "Step 2: editor session started");
ok(InspectorUI.treePanel.editingContext, "Step 2: editor session started");
let editorVisible = editor.classList.contains("editing");
ok(editorVisible, "editor popup visible");
@ -88,13 +96,13 @@ function doEditorTestSteps()
let attrValNodeHighlighted = attrValNode_id.classList.contains("editingAttributeValue");
ok(attrValNodeHighlighted, "`id` attribute-value node is editor-highlighted");
is(InspectorUI.editingContext.repObj, div, "editor session has correct reference to div");
is(InspectorUI.editingContext.attrObj, attrValNode_id, "editor session has correct reference to `id` attribute-value node in HTML panel");
is(InspectorUI.editingContext.attrName, "id", "editor session knows correct attribute-name");
is(treePanel.editingContext.repObj, div, "editor session has correct reference to div");
is(treePanel.editingContext.attrObj, attrValNode_id, "editor session has correct reference to `id` attribute-value node in HTML panel");
is(treePanel.editingContext.attrName, "id", "editor session knows correct attribute-name");
editorInput.value = "Hello World";
editorInput.focus();
// hit <enter> to save the inputted value
executeSoon(function() {
EventUtils.synthesizeKey("VK_RETURN", {}, attrValNode_id.ownerDocument.defaultView);
@ -106,7 +114,7 @@ function doEditorTestSteps()
// Step 3: validate that the previous editing session saved correctly, then open editor on `class` attribute value
ok(!InspectorUI.editingContext, "Step 3: editor session ended");
ok(!treePanel.editingContext, "Step 3: editor session ended");
editorVisible = editor.classList.contains("editing");
ok(!editorVisible, "editor popup hidden");
attrValNodeHighlighted = attrValNode_id.classList.contains("editingAttributeValue");
@ -124,16 +132,16 @@ function doEditorTestSteps()
// Step 4: enter value into editor, then hit <escape> to discard it
ok(InspectorUI.editingContext, "Step 4: editor session started");
ok(treePanel.editingContext, "Step 4: editor session started");
editorVisible = editor.classList.contains("editing");
ok(editorVisible, "editor popup visible");
is(InspectorUI.editingContext.attrObj, attrValNode_class, "editor session has correct reference to `class` attribute-value node in HTML panel");
is(InspectorUI.editingContext.attrName, "class", "editor session knows correct attribute-name");
is(treePanel.editingContext.attrObj, attrValNode_class, "editor session has correct reference to `class` attribute-value node in HTML panel");
is(treePanel.editingContext.attrName, "class", "editor session knows correct attribute-name");
editorInput.value = "Hello World";
editorInput.focus();
// hit <escape> to discard the inputted value
executeSoon(function() {
EventUtils.synthesizeKey("VK_ESCAPE", {}, attrValNode_class.ownerDocument.defaultView);
@ -143,7 +151,7 @@ function doEditorTestSteps()
// Step 5: validate that the previous editing session discarded correctly, then open editor on `id` attribute value again
ok(!InspectorUI.editingContext, "Step 5: editor session ended");
ok(!treePanel.editingContext, "Step 5: editor session ended");
editorVisible = editor.classList.contains("editing");
ok(!editorVisible, "editor popup hidden");
is(div.getAttribute("class"), "barbaz", "`class` attribute-value *not* updated");
@ -159,15 +167,15 @@ function doEditorTestSteps()
// Step 6: validate that editor opened again, then test double-click inside of editor (should do nothing)
ok(InspectorUI.editingContext, "Step 6: editor session started");
ok(treePanel.editingContext, "Step 6: editor session started");
editorVisible = editor.classList.contains("editing");
ok(editorVisible, "editor popup visible");
// double-click on the editor input box
executeSoon(function() {
// firing 2 clicks right in a row to simulate a double-click
EventUtils.synthesizeMouse(editorInput, 2, 2, {clickCount: 2}, editorInput.ownerDocument.defaultView);
// since the previous double-click is supposed to do nothing,
// wait a brief moment, then move on to the next step
executeSoon(function() {
@ -178,12 +186,12 @@ function doEditorTestSteps()
yield; // End of Step 6
// Step 7: validate that editing session is still correct, then enter a value and try a click
// Step 7: validate that editing session is still correct, then enter a value and try a click
// outside of editor (should cancel the editing session)
ok(InspectorUI.editingContext, "Step 7: editor session still going");
ok(treePanel.editingContext, "Step 7: editor session still going");
editorVisible = editor.classList.contains("editing");
ok(editorVisible, "editor popup still visible");
editorInput.value = "all your base are belong to us";
// single-click the `class` attribute-value node
@ -195,18 +203,18 @@ function doEditorTestSteps()
// Step 8: validate that the editor was closed and that the editing was not saved
ok(!InspectorUI.editingContext, "Step 8: editor session ended");
ok(!treePanel.editingContext, "Step 8: editor session ended");
editorVisible = editor.classList.contains("editing");
ok(!editorVisible, "editor popup hidden");
is(div.getAttribute("id"), "Hello World", "`id` attribute-value *not* updated");
is(attrValNode_id.innerHTML, "Hello World", "attribute-value node in HTML panel *not* updated");
// End of Step 8
// end of all steps, so clean up
Services.obs.removeObserver(doNextStep, INSPECTOR_NOTIFICATIONS.EDITOR_OPENED, false);
Services.obs.removeObserver(doNextStep, INSPECTOR_NOTIFICATIONS.EDITOR_CLOSED, false);
Services.obs.removeObserver(doNextStep, INSPECTOR_NOTIFICATIONS.EDITOR_SAVED, false);
Services.obs.removeObserver(doNextStep, InspectorUI.INSPECTOR_NOTIFICATIONS.EDITOR_OPENED, false);
Services.obs.removeObserver(doNextStep, InspectorUI.INSPECTOR_NOTIFICATIONS.EDITOR_CLOSED, false);
Services.obs.removeObserver(doNextStep, InspectorUI.INSPECTOR_NOTIFICATIONS.EDITOR_SAVED, false);
executeSoon(finishUp);
}

Просмотреть файл

@ -80,18 +80,18 @@ function setupHighlighterTests()
h1 = doc.querySelectorAll("h1")[0];
ok(h1, "we have the header node");
Services.obs.addObserver(runSelectionTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function runSelectionTests()
{
Services.obs.removeObserver(runSelectionTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
executeSoon(function() {
Services.obs.addObserver(performTestComparisons,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
});
}
@ -99,7 +99,7 @@ function runSelectionTests()
function performTestComparisons(evt)
{
Services.obs.removeObserver(performTestComparisons,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.stopInspecting();
ok(InspectorUI.highlighter.isHighlighting, "highlighter is highlighting");

Просмотреть файл

@ -43,7 +43,6 @@ let div1;
let div2;
let iframe1;
let iframe2;
let highlighterFrame;
function createDocument()
{
@ -87,28 +86,27 @@ function moveMouseOver(aElement)
function setupIframeTests()
{
Services.obs.addObserver(runIframeTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.openInspectorUI();
}
function runIframeTests()
{
Services.obs.removeObserver(runIframeTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
Services.obs.addObserver(performTestComparisons1,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
highlighterFrame = InspectorUI.highlighter.iframe;
executeSoon(moveMouseOver.bind(this, div1));
}
function performTestComparisons1()
{
Services.obs.removeObserver(performTestComparisons1,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
Services.obs.addObserver(performTestComparisons2,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
is(InspectorUI.selection, div1, "selection matches div1 node");
is(InspectorUI.highlighter.highlitNode, div1, "highlighter matches selection");
@ -119,7 +117,7 @@ function performTestComparisons1()
function performTestComparisons2()
{
Services.obs.removeObserver(performTestComparisons2,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
is(InspectorUI.selection, div2, "selection matches div2 node");
is(InspectorUI.highlighter.highlitNode, div2, "highlighter matches selection");

Просмотреть файл

@ -0,0 +1,196 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Inspector Initializationa and Shutdown Tests.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Rob Campbell <rcampbell@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
let doc;
let salutation;
let closing;
function createDocument()
{
doc.body.innerHTML = '<div id="first" style="{ margin: 10em; ' +
'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA}">\n' +
'<h1>Some header text</h1>\n' +
'<p id="salutation" style="{font-size: 12pt}">hi.</p>\n' +
'<p id="body" style="{font-size: 12pt}">I am a test-case. This text exists ' +
'solely to provide some things to test the inspector initialization.</p>\n' +
'If you are reading this, you should go do something else instead. Maybe ' +
'read a book. Or better yet, write some test-cases for another bit of code. ' +
'<span style="{font-style: italic}">Maybe more inspector test-cases!</span></p>\n' +
'<p id="closing">end transmission</p>\n' +
'</div>';
doc.title = "Inspector Initialization Test";
startInspectorTests();
}
function startInspectorTests()
{
ok(InspectorUI, "InspectorUI variable exists");
Services.obs.addObserver(runInspectorTests,
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function runInspectorTests()
{
Services.obs.removeObserver(runInspectorTests,
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
Services.obs.addObserver(treePanelTests,
InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY, false);
ok(InspectorUI.toolbar, "we have the toolbar.");
ok(!InspectorUI.toolbar.hidden, "toolbar is visible");
ok(InspectorUI.inspecting, "Inspector is inspecting");
ok(!InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is not open");
ok(InspectorUI.highlighter, "Highlighter is up");
InspectorUI.treePanel.open();
}
function treePanelTests()
{
Services.obs.removeObserver(treePanelTests,
InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY);
Services.obs.addObserver(runContextMenuTest,
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
ok(InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is open");
executeSoon(function() {
InspectorUI.closeInspectorUI();
});
}
function runContextMenuTest()
{
Services.obs.removeObserver(runContextMenuTest, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
Services.obs.addObserver(inspectNodesFromContextTest, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
salutation = doc.getElementById("salutation");
ok(salutation, "hello, context menu test!");
let eventDeets = { type : "contextmenu", button : 2 };
let contextMenu = document.getElementById("contentAreaContextMenu");
ok(contextMenu, "we have the context menu");
let contextInspectMenuItem = document.getElementById("context-inspect");
ok(contextInspectMenuItem, "we have the inspect context menu item");
EventUtils.synthesizeMouse(salutation, 2, 2, eventDeets);
is(contextMenu.state, "showing", "context menu is open");
is(!contextInspectMenuItem.hidden, gPrefService.getBoolPref("devtools.inspector.enabled"), "is context menu item enabled?");
contextMenu.hidePopup();
executeSoon(function() {
InspectorUI.openInspectorUI(salutation);
});
}
function inspectNodesFromContextTest()
{
Services.obs.removeObserver(inspectNodesFromContextTest, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
Services.obs.addObserver(openInspectorForContextTest, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
ok(!InspectorUI.inspecting, "Inspector is not actively highlighting");
is(InspectorUI.selection, salutation, "Inspector is highlighting salutation");
ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is closed");
// TODO: These tests depend on the style inspector patches.
todo(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
executeSoon(function() {
InspectorUI.closeInspectorUI(true);
});
}
function openInspectorForContextTest()
{
Services.obs.removeObserver(openInspectorForContextTest, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
Services.obs.addObserver(inspectNodesFromContextTestWhileOpen, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
executeSoon(function() {
InspectorUI.openInspectorUI(salutation);
});
}
function inspectNodesFromContextTestWhileOpen()
{
Services.obs.removeObserver(inspectNodesFromContextTestWhileOpen, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
Services.obs.addObserver(inspectNodesFromContextTestTrap, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
Services.obs.addObserver(inspectNodesFromContextTestHighlight, InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
is(InspectorUI.selection, salutation, "Inspector is highlighting salutation");
closing = doc.getElementById("closing");
ok(closing, "we have the closing statement");
executeSoon(function() {
InspectorUI.openInspectorUI(closing);
});
}
function inspectNodesFromContextTestHighlight()
{
Services.obs.removeObserver(inspectNodesFromContextTestHighlight, InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
Services.obs.addObserver(finishInspectorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
is(InspectorUI.selection, closing, "InspectorUI.selection is header");
executeSoon(function() {
InspectorUI.closeInspectorUI(true);
});
}
function inspectNodesFromContextTestTrap()
{
Services.obs.removeObserver(inspectNodesFromContextTestTrap, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
ok(false, "Inspector UI has been opened again. We Should Not Be Here!");
}
function finishInspectorTests()
{
Services.obs.removeObserver(finishInspectorTests,
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
ok(!InspectorUI.highlighter, "Highlighter is gone");
ok(!InspectorUI.treePanel, "Inspector Tree Panel is closed");
ok(!InspectorUI.inspecting, "Inspector is not inspecting");
ok(!InspectorUI.toolbar, "toolbar is hidden");
gBrowser.removeCurrentTab();
finish();
}
function test()
{
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
doc = content.document;
waitForFocus(createDocument, content);
}, true);
content.location = "data:text/html,basic tests for inspector";
}

Просмотреть файл

@ -39,16 +39,20 @@
let doc;
let h1;
let p2;
let toolsLength = 0;
let toolEvents = 0;
let tool1;
let tool2;
let tool3;
let initToolsMethod = InspectorUI.initTools;
function createDocument()
{
let div = doc.createElement("div");
let h1 = doc.createElement("h1");
h1 = doc.createElement("h1");
let p1 = doc.createElement("p");
let p2 = doc.createElement("p");
p2 = doc.createElement("p");
let div2 = doc.createElement("div");
let p3 = doc.createElement("p");
doc.title = "Inspector Tree Selection Test";
@ -79,73 +83,70 @@ function createDocument()
function setupHighlighterTests()
{
h1 = doc.querySelectorAll("h1")[0];
ok(h1, "we have the header node");
Services.obs.addObserver(inspectorOpen, "inspector-opened", false);
Services.obs.addObserver(inspectorOpen, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
registerTools();
InspectorUI.toggleInspectorUI();
}
function inspectorOpen()
{
info("we received the inspector-opened notification");
Services.obs.removeObserver(inspectorOpen, "inspector-opened", false);
Services.obs.addObserver(startToolTests, "inspector-highlighting", false);
let rect = h1.getBoundingClientRect();
executeSoon(function() {
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
});
Services.obs.removeObserver(inspectorOpen, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
toolsLength = InspectorUI.tools.length;
toolEvents = InspectorUI.toolEvents.length;
info("tools registered");
Services.obs.addObserver(startToolTests, InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.inspectNode(h1);
}
function startToolTests(evt)
{
info("we received the inspector-highlighting notification");
Services.obs.removeObserver(startToolTests, "inspector-highlighting", false);
Services.obs.removeObserver(startToolTests, InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
InspectorUI.stopInspecting();
info("Getting InspectorUI.tools");
let tools = InspectorUI.tools;
tool1 = InspectorUI.tools["tool_1"];
tool2 = InspectorUI.tools["tool_2"];
tool3 = InspectorUI.tools["tool_3"];
info("Checking panel states 1");
ok(tool1.context.panelIsClosed, "Panel 1 is closed");
ok(tool2.context.panelIsClosed, "Panel 2 is closed");
ok(tool3.context.panelIsClosed, "Panel 3 is closed");
ok(!tool1.isOpen, "Panel 1 is closed");
ok(!tool2.isOpen, "Panel 2 is closed");
ok(!tool3.isOpen, "Panel 3 is closed");
info("Calling show method for all tools");
tool1.onShow.apply(tool1.context, [h1]);
tool2.onShow.apply(tool2.context, [h1]);
tool3.onShow.apply(tool3.context, [h1]);
InspectorUI.toolShow(tool1);
InspectorUI.toolShow(tool2);
InspectorUI.toolShow(tool3);
info("Checking panel states 2");
ok(tool1.context.panelIsOpen, "Panel 1 is open");
ok(tool2.context.panelIsOpen, "Panel 2 is open");
ok(tool3.context.panelIsOpen, "Panel 3 is open");
ok(tool1.isOpen, "Panel 1 is open");
ok(tool2.isOpen, "Panel 2 is open");
ok(tool3.isOpen, "Panel 3 is open");
info("Calling selectNode method for all tools");
tool1.onSelect.apply(tool1.context, [h1]);
tool2.onSelect.apply(tool2.context, [h1]);
tool3.onSelect.apply(tool3.context, [h1]);
info("Calling selectNode method for all tools, should see 3 selects");
InspectorUI.inspectNode(p2);
info("Calling hide method for all tools");
tool1.onHide.apply(tool1.context, [h1]);
tool2.onHide.apply(tool2.context, [h1]);
tool3.onHide.apply(tool3.context, [h1]);
InspectorUI.toolHide(tool1);
InspectorUI.toolHide(tool2);
InspectorUI.toolHide(tool3);
info("Checking panel states 3");
ok(tool1.context.panelIsClosed, "Panel 1 is closed");
ok(tool2.context.panelIsClosed, "Panel 2 is closed");
ok(tool3.context.panelIsClosed, "Panel 3 is closed");
ok(!tool1.isOpen, "Panel 1 is closed");
ok(!tool2.isOpen, "Panel 2 is closed");
ok(!tool3.isOpen, "Panel 3 is closed");
info("Showing tools 1 & 3");
tool1.onShow.apply(tool1.context, [h1]);
tool3.onShow.apply(tool3.context, [h1]);
InspectorUI.toolShow(tool1);
InspectorUI.toolShow(tool3);
info("Checking panel states 4");
ok(tool1.context.panelIsOpen, "Panel 1 is open");
ok(tool2.context.panelIsClosed, "Panel 2 is closed");
ok(tool3.context.panelIsOpen, "Panel 3 is open");
ok(tool1.isOpen, "Panel 1 is open");
ok(!tool2.isOpen, "Panel 2 is closed");
ok(tool3.isOpen, "Panel 3 is open");
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() {
@ -160,24 +161,52 @@ function testSecondTab()
{
info("Opened second tab");
info("Checking panel states 5");
ok(tool1.context.panelIsClosed, "Panel 1 is closed");
ok(tool2.context.panelIsClosed, "Panel 2 is closed");
ok(tool3.context.panelIsClosed, "Panel 3 is closed");
let tools = InspectorUI.tools;
ok(!(tool1 in tools), "Panel 1 not in tools");
ok(!(tool2 in tools), "Panel 2 not in tools");
ok(!(tool3 in tools), "Panel 3 not in tools");
info("Closing current tab");
Services.obs.addObserver(testOriginalTab, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
gBrowser.removeCurrentTab();
}
function testOriginalTab()
{
Services.obs.removeObserver(testOriginalTab, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
info("Checking panel states 6");
ok(tool1.context.panelIsOpen, "Panel 1 is open");
ok(tool2.context.panelIsClosed, "Panel 2 is closed");
ok(tool3.context.panelIsOpen, "Panel 3 is open");
executeSoon(finishUp);
info("Tools: " + InspectorUI.tools);
// reacquaint ourselves with our tools
tool1 = InspectorUI.tools["tool_1"];
tool2 = InspectorUI.tools["tool_2"];
tool3 = InspectorUI.tools["tool_3"];
ok(tool1.isOpen, "Panel 1 is open after reactivation");
ok(!tool2.isOpen, "Panel 2 is closed after reactivation");
ok(tool3.isOpen, "Panel 3 is open after reactivation");
Services.obs.addObserver(unregisterTools, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.closeInspectorUI(true);
}
function unregisterTools()
{
Services.obs.removeObserver(unregisterTools, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
let tools = InspectorUI.tools;
ok(!(tool1 in tools), "Tool 1 removed");
ok(!(tool2 in tools), "Tool 2 removed");
ok(!(tool3 in tools), "Tool 3 removed");
is(tools.length, toolsLength, "Number of Registered Tools matches original");
is(InspectorUI.toolEvents.length, toolEvents, "Number of tool events matches original");
finishUp();
}
function finishUp() {
InspectorUI.closeInspectorUI(true);
gBrowser.removeCurrentTab();
InspectorUI.initTools = initToolsMethod;
finish();
}
@ -188,7 +217,7 @@ function test()
gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
doc = content.document;
waitForFocus(registerTools, content);
waitForFocus(createDocument, content);
}, true);
content.location = "data:text/html,registertool tests for inspector";
@ -196,10 +225,12 @@ function test()
function registerTools()
{
createDocument();
registerTool(new testTool("tool_1", "Tool 1", "Tool 1 tooltip", "I"));
registerTool(new testTool("tool_2", "Tool 2", "Tool 2 tooltip", "J"));
registerTool(new testTool("tool_3", "Tool 3", "Tool 3 tooltip", "K"));
InspectorUI.initTools = function() {
info("(re)registering tools");
registerTool(new testTool("tool_1", "Tool 1", "Tool 1 tooltip", "I"));
registerTool(new testTool("tool_2", "Tool 2", "Tool 2 tooltip", "J"));
registerTool(new testTool("tool_3", "Tool 3", "Tool 3 tooltip", "K"));
}
}
function registerTool(aTool)
@ -210,10 +241,11 @@ function registerTool(aTool)
tooltiptext: aTool.tooltip,
accesskey: aTool.accesskey,
context: aTool,
get isOpen() aTool.isOpen(),
onSelect: aTool.selectNode,
onShow: aTool.show,
onHide: aTool.hide,
panel: aTool.panel
show: aTool.show,
hide: aTool.hide,
unregister: aTool.destroy,
});
}
@ -223,19 +255,13 @@ function testTool(aToolId, aLabel, aTooltip, aAccesskey)
this.id = aToolId;
this.label = aLabel;
this.tooltip = aTooltip;
this.accesskey = aAccesskey
this.panel = this.createPanel();
this.accesskey = aAccesskey;
this._isOpen = false;
}
testTool.prototype = {
get panelIsOpen()
{
return this.panel.state == "open" || this.panel.state == "showing";
},
get panelIsClosed()
{
return this.panel.state == "closed" || this.panel.state == "hiding";
isOpen: function BIR_isOpen() {
return this._isOpen;
},
selectNode: function BIR_selectNode(aNode) {
@ -244,32 +270,23 @@ testTool.prototype = {
},
show: function BIR_show(aNode) {
this.panel.openPopup(gBrowser.selectedBrowser,
"end_before", 0, 20, false, false);
this._isOpen = true;
is(InspectorUI.selection, aNode,
"show: currently selected node was passed: " + this.id);
},
hide: function BIR_hide() {
info(this.id + " hide");
this.panel.hidePopup();
this._isOpen = false;
},
createPanel: function BIR_createPanel() {
let popupSet = document.getElementById("mainPopupSet");
let ns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let panel = this.panel = document.createElementNS(ns, "panel");
panel.setAttribute("orient", "vertical");
panel.setAttribute("noautofocus", "true");
panel.setAttribute("noautohide", "true");
panel.setAttribute("titlebar", "normal");
panel.setAttribute("close", "true");
panel.setAttribute("label", "Panel for " + this.id);
panel.setAttribute("width", 200);
panel.setAttribute("height", 400);
popupSet.appendChild(panel);
ok(panel.parentNode == popupSet, "Panel created and appended successfully");
return panel;
destroy: function BIR_destroy() {
info("tool destroyed " + this.id);
if (this.isOpen())
this.hide();
delete this.id;
delete this.label;
delete this.tooltip;
delete this.accesskey;
},
};

Просмотреть файл

@ -65,16 +65,16 @@ function createDocument()
function toggleInspector()
{
Services.obs.addObserver(inspectNode, INSPECTOR_NOTIFICATIONS.OPENED, false);
Services.obs.addObserver(inspectNode, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function inspectNode()
{
Services.obs.removeObserver(inspectNode,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
Services.obs.addObserver(performScrollingTest,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
executeSoon(function() {
InspectorUI.inspectNode(div);
@ -84,7 +84,7 @@ function inspectNode()
function performScrollingTest()
{
Services.obs.removeObserver(performScrollingTest,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
EventUtils.synthesizeMouseScroll(div, 10, 10,
{axis:"vertical", delta:50, type:"MozMousePixelScroll"},

Просмотреть файл

@ -39,8 +39,8 @@
function test()
{
ok(window.InspectorUI, "InspectorUI variable exists");
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
let InspectorStore = InspectorUI.store;
is(InspectorStore.length, 0, "InspectorStore is empty");
ok(InspectorStore.isEmpty(), "InspectorStore is empty (confirmed)");
is(typeof InspectorStore.store, "object",

Просмотреть файл

@ -47,23 +47,23 @@ function inspectorTabOpen1()
{
ok(window.InspectorUI, "InspectorUI variable exists");
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(InspectorStore.isEmpty(), "InspectorStore is empty");
ok(InspectorUI.store.isEmpty(), "Inspector.store is empty");
Services.obs.addObserver(inspectorUIOpen1,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.openInspectorUI();
}
function inspectorUIOpen1()
{
Services.obs.removeObserver(inspectorUIOpen1,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
// Make sure the inspector is open.
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
ok(!InspectorStore.isEmpty(), "InspectorStore is not empty");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
ok(!InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is not open");
ok(!InspectorUI.store.isEmpty(), "InspectorUI.store is not empty");
is(InspectorUI.store.length, 1, "Inspector.store.length = 1");
// Highlight a node.
div = content.document.getElementsByTagName("div")[0];
@ -87,13 +87,13 @@ function inspectorTabOpen2()
{
// Make sure the inspector is closed.
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(!InspectorUI.isPanelOpen, "Inspector Tree Panel is closed");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
ok(!InspectorUI.treePanel, "Inspector Tree Panel is closed");
is(InspectorUI.store.length, 1, "Inspector.store.length = 1");
// Activate the inspector again.
executeSoon(function() {
Services.obs.addObserver(inspectorUIOpen2,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.openInspectorUI();
});
}
@ -101,12 +101,12 @@ function inspectorTabOpen2()
function inspectorUIOpen2()
{
Services.obs.removeObserver(inspectorUIOpen2,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
// Make sure the inspector is open.
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
is(InspectorStore.length, 2, "InspectorStore.length = 2");
ok(!InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is not open");
is(InspectorUI.store.length, 2, "Inspector.store.length = 2");
// Disable highlighting.
InspectorUI.toggleInspection();
@ -115,7 +115,7 @@ function inspectorUIOpen2()
// Switch back to tab 1.
executeSoon(function() {
Services.obs.addObserver(inspectorFocusTab1,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
gBrowser.selectedTab = tab1;
});
}
@ -123,29 +123,78 @@ function inspectorUIOpen2()
function inspectorFocusTab1()
{
Services.obs.removeObserver(inspectorFocusTab1,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
// Make sure the inspector is still open.
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
is(InspectorStore.length, 2, "InspectorStore.length = 2");
ok(!InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is not open");
is(InspectorUI.store.length, 2, "Inspector.store.length = 2");
is(InspectorUI.selection, div, "selection matches the div element");
Services.obs.addObserver(inspectorOpenTreePanelTab1,
InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY, false);
InspectorUI.treePanel.open();
}
function inspectorOpenTreePanelTab1()
{
Services.obs.removeObserver(inspectorOpenTreePanelTab1,
InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY);
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is open");
is(InspectorUI.store.length, 2, "Inspector.store.length = 2");
is(InspectorUI.selection, div, "selection matches the div element");
// Switch back to tab 2.
Services.obs.addObserver(inspectorFocusTab2,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
gBrowser.selectedTab = tab2;
}
function inspectorFocusTab2()
{
Services.obs.removeObserver(inspectorFocusTab2,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
// Make sure the inspector is still open.
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
is(InspectorStore.length, 2, "InspectorStore.length = 2");
ok(!InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is not open");
is(InspectorUI.store.length, 2, "Inspector.store.length is 2");
isnot(InspectorUI.selection, div, "selection does not match the div element");
// Switch back to tab 1.
Services.obs.addObserver(inspectorSecondFocusTab1,
InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY, false);
gBrowser.selectedTab = tab1;
}
function inspectorSecondFocusTab1()
{
Services.obs.removeObserver(inspectorSecondFocusTab1,
InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY);
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is open");
is(InspectorUI.store.length, 2, "Inspector.store.length = 2");
is(InspectorUI.selection, div, "selection matches the div element");
// Switch back to tab 2.
Services.obs.addObserver(inspectorSecondFocusTab2,
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
gBrowser.selectedTab = tab2;
}
function inspectorSecondFocusTab2()
{
Services.obs.removeObserver(inspectorSecondFocusTab2,
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
// Make sure the inspector is still open.
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(!InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is not open");
is(InspectorUI.store.length, 2, "Inspector.store.length is 2");
isnot(InspectorUI.selection, div, "selection does not match the div element");
// Remove tab 1.
@ -161,8 +210,8 @@ function inspectorTabUnload1(evt)
// Make sure the Inspector is still open and that the state is correct.
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
ok(!InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is not open");
is(InspectorUI.store.length, 1, "Inspector.store.length = 1");
InspectorUI.closeInspectorUI();
gBrowser.removeCurrentTab();

Просмотреть файл

@ -0,0 +1,65 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
let doc;
let node1;
let node2;
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onload() {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
doc = content.document;
waitForFocus(setupTest, content);
}, true);
content.location = 'data:text/html,<div style="width: 200px; height: 200px"><p></p></div>';
function setupTest() {
node1 = doc.querySelector("div");
node2 = doc.querySelector("p");
Services.obs.addObserver(runTests, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function runTests() {
Services.obs.removeObserver(runTests, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
Services.obs.addObserver(testNode1, InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY, false);
InspectorUI.select(node1, true, true, true);
InspectorUI.openTreePanel();
}
function testNode1() {
dump("testNode1\n");
Services.obs.removeObserver(testNode1, InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY);
is(InspectorUI.selection, node1, "selection matches node");
is(InspectorUI.highlighter.node, node1, "selection matches node");
testNode2();
}
function testNode2() {
dump("testNode2\n")
Services.obs.addObserver(testHighlightingNode2, InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.treePanelSelect("node2");
}
function testHighlightingNode2() {
dump("testHighlightingNode2\n")
Services.obs.removeObserver(testHighlightingNode2, InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
is(InspectorUI.selection, node2, "selection matches node");
is(InspectorUI.highlighter.node, node2, "selection matches node");
Services.obs.addObserver(finishUp, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.closeInspectorUI();
}
function finishUp() {
Services.obs.removeObserver(finishUp, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
doc = node1 = node2 = null;
gBrowser.removeCurrentTab();
finish();
}
}

Просмотреть файл

@ -42,8 +42,8 @@ let doc = null;
let xhr = null;
let expectedResult = "";
const TEST_URI = "http://mochi.test:8888/browser/browser/base/content/test/inspector/browser_inspector_treePanel_input.html";
const RESULT_URI = "http://mochi.test:8888/browser/browser/base/content/test/inspector/browser_inspector_treePanel_result.html";
const TEST_URI = "http://mochi.test:8888/browser/browser/devtools/highlighter/test/browser_inspector_treePanel_input.html";
const RESULT_URI = "http://mochi.test:8888/browser/browser/devtools/highlighter/test/browser_inspector_treePanel_result.html";
function tabFocused()
{
@ -64,17 +64,26 @@ function xhr_onReadyStateChange() {
xhr = null;
Services.obs.addObserver(inspectorOpened,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.openInspectorUI();
}
function inspectorOpened()
{
Services.obs.removeObserver(inspectorOpened,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
Services.obs.addObserver(treePanelOpened, InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY, false);
InspectorUI.treePanel.open();
}
function treePanelOpened()
{
Services.obs.removeObserver(treePanelOpened,
InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY);
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
ok(InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is open");
InspectorUI.stopInspecting();
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
@ -91,23 +100,23 @@ function inspectorOpened()
ok(iframeDiv, "Found the div element inside the iframe");
InspectorUI.inspectNode(iframeDiv);
ok(InspectorUI.treePanelDiv, "InspectorUI.treePanelDiv is available");
is(InspectorUI.treePanelDiv.innerHTML.replace(/^\s+|\s+$/mg, ''),
ok(InspectorUI.treePanel.treePanelDiv, "InspectorUI.treePanelDiv is available");
is(InspectorUI.treePanel.treePanelDiv.innerHTML.replace(/^\s+|\s+$/mg, ''),
expectedResult, "treePanelDiv.innerHTML is correct");
expectedResult = null;
Services.obs.addObserver(inspectorClosed,
INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.closeInspectorUI();
}
function inspectorClosed()
{
Services.obs.removeObserver(inspectorClosed,
INSPECTOR_NOTIFICATIONS.CLOSED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is not open");
ok(!InspectorUI.treePanel, "Inspector Tree Panel is not open");
gBrowser.removeCurrentTab();
finish();

Просмотреть файл

@ -68,16 +68,16 @@ function setupSelectionTests()
h1 = doc.querySelectorAll("h1")[0];
ok(h1, "we have the header node");
Services.obs.addObserver(runSelectionTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.openInspectorUI();
}
function runSelectionTests()
{
Services.obs.removeObserver(runSelectionTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
Services.obs.addObserver(performTestComparisons,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
executeSoon(function() {
InspectorUI.inspectNode(h1);
});
@ -86,7 +86,7 @@ function runSelectionTests()
function performTestComparisons(evt)
{
Services.obs.removeObserver(performTestComparisons,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
is(h1, InspectorUI.selection, "selection matches node");
ok(InspectorUI.highlighter.isHighlighting, "highlighter is highlighting");

Просмотреть файл

@ -1,7 +1,9 @@
browser.jar:
* content/browser/inspector.html (highlighter/inspector.html)
content/browser/NetworkPanel.xhtml (webconsole/NetworkPanel.xhtml)
* content/browser/scratchpad.xul (scratchpad/scratchpad.xul)
* content/browser/scratchpad.js (scratchpad/scratchpad.js)
content/browser/csshtmltree.xhtml (styleinspector/csshtmltree.xhtml)
content/browser/orion.js (sourceeditor/orion/orion.js)
content/browser/orion.css (sourceeditor/orion/orion.css)
* content/browser/inspector.html (highlighter/inspector.html)

Просмотреть файл

@ -12,11 +12,11 @@
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is HUDService code.
# The Original Code is Scratchpad Build Code.
#
# The Initial Developer of the Original Code is Mozilla Corporation.
#
# Portions created by the Initial Developer are Copyright (C) 2010
# The Initial Developer of the Original Code is The Mozilla Foundation.
#
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
@ -44,9 +44,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifdef ENABLE_TESTS
ifneq (mobile,$(MOZ_BUILD_APP))
DIRS += test
endif
endif
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -21,9 +21,10 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Walker (jwalker@mozilla.com) (original author)
* Joe Walker (jwalker@mozilla.com) (Original Author)
* Mihai Șucan <mihai.sucan@gmail.com>
* Michael Ratcliffe <mratcliffe@mozilla.com>
* Rob Campbell <rcampbell@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or

Просмотреть файл

@ -21,7 +21,8 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mike Ratcliffe <mratcliffe@mozilla.com>
* Mike Ratcliffe <mratcliffe@mozilla.com> (Original Author)
* Rob Campbell <rcampbell@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -109,8 +110,6 @@ var StyleInspector = {
let iframeReady = false;
function SI_iframeOnload() {
iframe.removeEventListener("load", SI_iframeOnload, true);
panel.cssLogic = new CssLogic();
panel.cssHtmlTree = new CssHtmlTree(iframe, panel.cssLogic, panel);
iframeReady = true;
if (panelReady) {
SI_popupShown.call(panel);
@ -124,6 +123,10 @@ var StyleInspector = {
function SI_popupShown() {
panelReady = true;
if (iframeReady) {
if (!this.cssLogic) {
this.cssLogic = new CssLogic();
this.cssHtmlTree = new CssHtmlTree(iframe, this.cssLogic, this);
}
let selectedNode = this.selectedNode || null;
this.cssLogic.highlight(selectedNode);
this.cssHtmlTree.highlight(selectedNode);
@ -162,12 +165,9 @@ var StyleInspector = {
panel.selectNode = function SI_selectNode(aNode)
{
this.selectedNode = aNode;
if (this.isOpen()) {
if (this.isOpen() && !this.hasAttribute("dimmed")) {
this.cssLogic.highlight(aNode);
this.cssHtmlTree.highlight(aNode);
} else {
let win = Services.wm.getMostRecentWindow("navigator:browser");
this.openPopup(win.gBrowser.selectedBrowser, "end_before", 0, 0, false, false);
}
};
@ -176,6 +176,10 @@ var StyleInspector = {
*/
panel.destroy = function SI_destroy()
{
if (!this.cssLogic)
return;
if (this.isOpen())
this.hideTool();
this.cssLogic = null;
this.cssHtmlTree = null;
this.removeEventListener("popupshown", SI_popupShown);
@ -184,6 +188,37 @@ var StyleInspector = {
Services.obs.notifyObservers(null, "StyleInspector-closed", null);
};
/**
* Dim or undim a panel by setting or removing a dimmed attribute.
*
* @param aState
* true = dim, false = undim
*/
panel.dimTool = function SI_dimTool(aState)
{
if (!this.isOpen())
return;
if (aState) {
this.setAttribute("dimmed", "true");
} else if (this.hasAttribute("dimmed")) {
this.removeAttribute("dimmed");
}
};
panel.showTool = function SI_showTool(aSelection)
{
this.selectNode(aSelection);
let win = Services.wm.getMostRecentWindow("navigator:browser");
this.openPopup(win.gBrowser.selectedBrowser, "end_before", 0, 0,
false, false);
};
panel.hideTool = function SI_hideTool()
{
this.hidePopup();
};
/**
* Is the Style Inspector initialized?
* @returns {Boolean} true or false

Просмотреть файл

@ -174,26 +174,18 @@ function styleInspectorClosedFromConsole1()
{
Services.obs.removeObserver(styleInspectorClosedFromConsole1,
"StyleInspector-closed", false);
info("Style Inspector 1 closed");
Services.obs.addObserver(styleInspectorClosedFromConsole2,
"StyleInspector-closed", false);
}
function styleInspectorClosedFromConsole2()
{
Services.obs.removeObserver(styleInspectorClosedFromConsole2,
"StyleInspector-closed", false);
info("Style Inspector 2 closed");
info("Style Inspector 1 and 2 closed");
executeSoon(cleanUp);
}
function cleanUp()
{
let popupSet = document.getElementById("mainPopupSet");
ok(!popupSet.lastChild.hasAttribute("hudToolId"),
let panels = document.querySelector("panel[hudToolId]");
ok(!panels,
"all style inspector panels are now detached and ready for garbage collection");
info("cleaning up");
doc = hudBox = stylePanels = jsterm = null;
finishTest();
}

Просмотреть файл

@ -165,7 +165,10 @@ const LEVELS = {
info: SEVERITY_INFO,
log: SEVERITY_LOG,
trace: SEVERITY_LOG,
dir: SEVERITY_LOG
dir: SEVERITY_LOG,
group: SEVERITY_LOG,
groupCollapsed: SEVERITY_LOG,
groupEnd: SEVERITY_LOG
};
// The lowest HTTP response code (inclusive) that is considered an error.
@ -252,6 +255,9 @@ const ERRORS = { LOG_MESSAGE_MISSING_ARGS:
LOG_OUTPUT_FAILED: "Log Failure: Could not append messageNode to outputNode",
};
// The indent of a console group in pixels.
const GROUP_INDENT = 12;
/**
* Implements the nsIStreamListener and nsIRequestObserver interface. Used
* within the HS_httpObserverFactory function to get the response body of
@ -2005,6 +2011,20 @@ HUD_SERVICE.prototype =
sourceLine = aMessage.lineNumber;
break;
case "group":
case "groupCollapsed":
clipboardText = body = formatResult(args);
sourceURL = aMessage.filename;
sourceLine = aMessage.lineNumber;
hud.groupDepth++;
break;
case "groupEnd":
if (hud.groupDepth > 0) {
hud.groupDepth--;
}
return;
default:
Cu.reportError("Unknown Console API log level: " + level);
return;
@ -2014,6 +2034,7 @@ HUD_SERVICE.prototype =
CATEGORY_WEBDEV,
LEVELS[level],
body,
aHUDId,
sourceURL,
sourceLine,
clipboardText,
@ -2076,7 +2097,8 @@ HUD_SERVICE.prototype =
let chromeDocument = hud.HUDBox.ownerDocument;
let message = stringBundle.GetStringFromName("ConsoleAPIDisabled");
let node = ConsoleUtils.createMessageNode(chromeDocument, CATEGORY_JS,
SEVERITY_WARNING, message);
SEVERITY_WARNING, message,
aHUDId);
ConsoleUtils.outputMessageNode(node, aHUDId);
},
@ -2116,6 +2138,7 @@ HUD_SERVICE.prototype =
aCategory,
severity,
aScriptError.errorMessage,
hudId,
aScriptError.sourceName,
aScriptError.lineNumber);
@ -2576,6 +2599,7 @@ HUD_SERVICE.prototype =
CATEGORY_NETWORK,
SEVERITY_LOG,
msgNode,
hudId,
null,
null,
clipboardText);
@ -3081,6 +3105,11 @@ HeadsUpDisplay.prototype = {
consolePanel: null,
/**
* The nesting depth of the currently active console group.
*/
groupDepth: 0,
get mainPopupSet()
{
return this.chromeDocument.getElementById("mainPopupSet");
@ -4438,7 +4467,7 @@ function JSTermHelper(aJSTerm)
if (!errstr) {
let stylePanel = StyleInspector.createPanel();
stylePanel.setAttribute("hudToolId", aJSTerm.hudId);
stylePanel.selectNode(aNode);
stylePanel.showTool(aNode);
} else {
aJSTerm.writeOutput(errstr + "\n", CATEGORY_OUTPUT, SEVERITY_ERROR);
}
@ -4752,7 +4781,8 @@ JSTerm.prototype = {
let node = ConsoleUtils.createMessageNode(this.parentNode.ownerDocument,
CATEGORY_OUTPUT,
SEVERITY_LOG,
aOutputString);
aOutputString,
this.hudId);
let linkNode = node.querySelector(".webconsole-msg-body");
@ -4799,7 +4829,7 @@ JSTerm.prototype = {
{
let node = ConsoleUtils.createMessageNode(this.parentNode.ownerDocument,
aCategory, aSeverity,
aOutputMessage);
aOutputMessage, this.hudId);
ConsoleUtils.outputMessageNode(node, this.hudId);
},
@ -5540,6 +5570,8 @@ ConsoleUtils = {
* The severity of the message: one of the SEVERITY_* constants;
* @param string|nsIDOMNode aBody
* The body of the message, either a simple string or a DOM node.
* @param number aHUDId
* The HeadsUpDisplay ID.
* @param string aSourceURL [optional]
* The URL of the source file that emitted the error.
* @param number aSourceLine [optional]
@ -5557,8 +5589,8 @@ ConsoleUtils = {
*/
createMessageNode:
function ConsoleUtils_createMessageNode(aDocument, aCategory, aSeverity,
aBody, aSourceURL, aSourceLine,
aClipboardText, aLevel) {
aBody, aHUDId, aSourceURL,
aSourceLine, aClipboardText, aLevel) {
if (aBody instanceof Ci.nsIDOMNode && aClipboardText == null) {
throw new Error("HUDService.createMessageNode(): DOM node supplied " +
"without any clipboard text");
@ -5569,6 +5601,9 @@ ConsoleUtils = {
// long multi-line messages.
let iconContainer = aDocument.createElementNS(XUL_NS, "vbox");
iconContainer.classList.add("webconsole-msg-icon-container");
// Apply the curent group by indenting appropriately.
let hud = HUDService.getHudReferenceById(aHUDId);
iconContainer.style.marginLeft = hud.groupDepth * GROUP_INDENT + "px";
// Make the icon node. It's sprited and the actual region of the image is
// determined by CSS rules.
@ -6669,6 +6704,7 @@ ConsoleProgressListener.prototype = {
CATEGORY_NETWORK,
SEVERITY_LOG,
msgNode,
this.hudId,
null,
null,
uri.spec);

Просмотреть файл

@ -145,6 +145,7 @@ _BROWSER_TEST_FILES = \
browser_webconsole_bug_653531_highlighter_console_helper.js \
browser_webconsole_bug_659907_console_dir.js \
browser_webconsole_bug_678816.js \
browser_webconsole_bug_664131_console_group.js \
head.js \
$(NULL)

Просмотреть файл

@ -82,7 +82,7 @@ function testGroups() {
"one group divider exists after the third console message");
jsterm.clearOutput();
jsterm.history.splice(0); // workaround for bug 592552
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
finishTest();
}

Просмотреть файл

@ -25,7 +25,8 @@ function populateConsoleRepeats(aHudRef) {
let node = ConsoleUtils.createMessageNode(hud.ownerDocument,
CATEGORY_CSS,
SEVERITY_WARNING,
"css log x");
"css log x",
aHudRef.hudId);
ConsoleUtils.outputMessageNode(node, aHudRef.hudId);
}
}
@ -38,7 +39,8 @@ function populateConsole(aHudRef) {
let node = ConsoleUtils.createMessageNode(hud.ownerDocument,
CATEGORY_CSS,
SEVERITY_WARNING,
"css log " + i);
"css log " + i,
aHudRef.hudId);
ConsoleUtils.outputMessageNode(node, aHudRef.hudId);
}
}

Просмотреть файл

@ -82,18 +82,18 @@ function setupHighlighterTests()
h1 = doc.querySelectorAll("h1")[0];
ok(h1, "we have the header node");
Services.obs.addObserver(runSelectionTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.toggleInspectorUI();
}
function runSelectionTests()
{
Services.obs.removeObserver(runSelectionTests,
INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
executeSoon(function() {
Services.obs.addObserver(performTestComparisons,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
});
}
@ -101,7 +101,7 @@ function runSelectionTests()
function performTestComparisons(evt)
{
Services.obs.removeObserver(performTestComparisons,
INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.stopInspecting();
ok(InspectorUI.highlighter.isHighlighting, "highlighter is highlighting");

Просмотреть файл

@ -0,0 +1,48 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests that console.group/groupEnd works as intended.
const GROUP_INDENT = 12;
function test() {
addTab("data:text/html,Web Console test for bug 664131: Expand console " +
"object with group methods");
browser.addEventListener("load", onLoad, true);
}
function onLoad(aEvent) {
browser.removeEventListener(aEvent.type, arguments.callee, true);
openConsole();
let hudId = HUDService.getHudIdByWindow(content);
let hud = HUDService.hudReferences[hudId];
outputNode = hud.outputNode;
content.console.group("a");
findLogEntry("a");
let msg = outputNode.querySelectorAll(".webconsole-msg-icon-container");
is(msg.length, 1, "one message node displayed");
is(msg[0].style.marginLeft, GROUP_INDENT + "px", "correct group indent found");
content.console.log("inside");
findLogEntry("inside");
let msg = outputNode.querySelectorAll(".webconsole-msg-icon-container");
is(msg.length, 2, "two message nodes displayed");
is(msg[1].style.marginLeft, GROUP_INDENT + "px", "correct group indent found");
content.console.groupEnd("a");
content.console.log("outside");
findLogEntry("outside");
let msg = outputNode.querySelectorAll(".webconsole-msg-icon-container");
is(msg.length, 3, "three message nodes displayed");
is(msg[2].style.marginLeft, "0px", "correct group indent found");
content.console.groupCollapsed("b");
findLogEntry("b");
let msg = outputNode.querySelectorAll(".webconsole-msg-icon-container");
is(msg.length, 4, "four message nodes displayed");
is(msg[3].style.marginLeft, GROUP_INDENT + "px", "correct group indent found");
finishTest();
}

Просмотреть файл

@ -89,7 +89,7 @@ function testCompletion() {
is(jsterm.completeNode.value, " entById", "'document.getElem' completion");
jsterm.clearOutput();
jsterm.history.splice(0); // workaround for bug 592552
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
input.value = "docu";
jsterm.complete(jsterm.COMPLETE_HINT_ONLY);

Просмотреть файл

@ -68,7 +68,7 @@ function testExecutionScope() {
"command was executed in the window scope");
jsterm.clearOutput();
jsterm.history.splice(0); // workaround for bug 592552
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
finishTest();
}

Просмотреть файл

@ -99,7 +99,7 @@ function testHistory() {
is (input.value, executeList[idxLast], "check history next idx:" + idxLast);
jsterm.clearOutput();
jsterm.history.splice(0); // workaround for bug 592552
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
finishTest();
}

Просмотреть файл

@ -75,7 +75,7 @@ function testJSInputAndOutputStyling() {
"JS output node is of the CSS class 'webconsole-msg-output'");
jsterm.clearOutput();
jsterm.history.splice(0); // workaround for bug 592552
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
finishTest();
}

Просмотреть файл

@ -73,7 +73,7 @@ function testNullAndUndefinedOutput() {
ok(nodes[1].textContent.indexOf("undefined") > -1, "'undefined' printed to output");
jsterm.clearOutput();
jsterm.history.splice(0); // workaround for bug 592552
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
finishTest();
}

Просмотреть файл

@ -71,7 +71,7 @@ function testOutputOrder() {
ok(executedStringFirst && outputSecond, "executed string comes first");
jsterm.clearOutput();
jsterm.history.splice(0); // workaround for bug 592552
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
finishTest();
}

Просмотреть файл

@ -10,9 +10,6 @@
console.assert()
console.clear()
console.dirxml()
console.group()
console.groupCollapsed()
console.groupEnd()
console.profile()
console.profileEnd()
console.count()

Просмотреть файл

@ -194,6 +194,9 @@ can reach it easily. -->
<!ENTITY inspectMenu.accesskey "T">
<!ENTITY inspectMenu.commandkey "I">
<!ENTITY inspectContextMenu.label "Inspect Element">
<!ENTITY inspectContextMenu.accesskey "Q">
<!-- LOCALIZATION NOTE (scratchpad.label): This menu item label appears
- in the Tools menu. See bug 653093.
- The Scratchpad is intended to provide a simple text editor for creating

Просмотреть файл

@ -327,9 +327,9 @@ syncPromoNotification.passwords.description=You can access your passwords on all
syncPromoNotification.learnMoreLinkText=Learn More
# Telemetry prompt
# LOCALIZATION NOTE (telemetryText): %1$S will be replaced by brandFullName,
# LOCALIZATION NOTE (telemetryPrompt): %1$S will be replaced by brandFullName,
# and %2$S by the value of the toolkit.telemetry.server_owner preference.
telemetryText = Would you like to help improve %1$S by automatically reporting memory usage, performance, and responsiveness to %2$S?
telemetryPrompt = Will you help improve %1$S by sending anonymous information about performance, hardware characteristics, feature usage, and browser customizations to %2$S?
telemetryLinkLabel = Learn More
telemetryYesButtonLabel = Yes
telemetryYesButtonAccessKey = Y

Просмотреть файл

@ -7,3 +7,18 @@ confirmNavigationAway.buttonLeaveAccesskey=L
confirmNavigationAway.buttonStay=Stay on Page
confirmNavigationAway.buttonStayAccesskey=S
# LOCALIZATION NOTE (htmlPanel): Used in the Inspector tool's openInspectorUI
# method when registering the HTML panel.
# LOCALIZATION NOTE (htmlPanel.label): This is a lable for a button that
# activates the Web Developer->Inspect UI's HTML Tree Panel.
htmlPanel.label=HTML
# LOCALIZATION NOTE (htmlPanel.tooltiptext): The text that appears when a user
# hovers over the HTML panel's toolbar button.
htmlPanel.tooltiptext=HTML panel
# LOCALIZATION NOTE (htmlPanel.accesskey): The key bound to the HTML panel's
# toolbar button.
htmlPanel.accesskey=H

Просмотреть файл

@ -41,3 +41,9 @@ group.Positioning_and_Page_Flow=Positioning and Page Flow
group.Borders=Borders
group.Lists=Lists
group.Effects_and_Other=Effects and Other
# LOCALIZATION NOTE (style.highlighter.button): These strings are used inside
# html tree of the highlighter for the style inspector button
style.highlighter.button.label=Style
style.highlighter.accesskey=S
style.highlighter.button.tooltip=Inspect element styles

Просмотреть файл

@ -78,6 +78,7 @@ te
th
tr
uk
vi
zh-CN
zh-TW
zu

Просмотреть файл

@ -603,37 +603,18 @@ toolbar[mode="full"] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
#forward-button {
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=toolbar");
-moz-transition: 250ms ease-out;
}
#forward-button[disabled="true"] {
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=toolbar&state=disabled");
}
#forward-button:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=toolbar");
}
toolbar:not([mode=icons]) #forward-button[disabled="true"] {
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=toolbar&state=disabled");
}
toolbar:not([mode=icons]) #forward-button[disabled="true"]:-moz-locale-dir(rtl) {
#forward-button[disabled="true"]:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=toolbar&state=disabled");
}
toolbar[mode=icons] #forward-button[disabled="true"] {
-moz-transform: scale(0);
opacity: 0;
pointer-events: none;
}
toolbar[mode=icons] #forward-button[disabled="true"]:-moz-locale-dir(ltr) {
margin-left: -36px;
}
toolbar[mode=icons] #forward-button[disabled="true"]:-moz-locale-dir(rtl) {
margin-right: -36px;
}
toolbar[mode=icons][iconsize=small] #forward-button[disabled="true"]:-moz-locale-dir(ltr) {
margin-left: -28px;
}
toolbar[mode=icons][iconsize=small] #forward-button[disabled="true"]:-moz-locale-dir(rtl) {
margin-right: -28px;
}
#reload-button {
list-style-image: url("moz-icon://stock/gtk-refresh?size=toolbar");
}
@ -805,7 +786,7 @@ toolbar[iconsize="small"] #forward-button {
.unified-nav-forward[_moz-menuactive] {
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=menu") !important;
}
toolbar[iconsize="small"]:not([mode=icons]) #forward-button[disabled="true"] {
toolbar[iconsize="small"] #forward-button[disabled="true"] {
list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=menu&state=disabled");
}
@ -815,7 +796,7 @@ toolbar[iconsize="small"] #forward-button:-moz-locale-dir(rtl) {
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=menu") !important;
}
toolbar[iconsize="small"]:not([mode=icons]) #forward-button[disabled="true"]:-moz-locale-dir(rtl) {
toolbar[iconsize="small"] #forward-button[disabled="true"]:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=menu&state=disabled");
}
@ -956,11 +937,11 @@ toolbar[iconsize="small"] #feed-button {
#urlbar-icons {
-moz-box-align: center;
-moz-padding-end: 2px;
}
.urlbar-icon {
cursor: pointer;
padding: 0 3px;
}
#urlbar-search-splitter {
@ -1315,83 +1296,37 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
border-top: 1px solid GrayText;
}
/* Go button */
/* Combined go/reload/stop button in location bar */
#go-button {
padding: 3px 2px 2px 2px;
list-style-image: url("chrome://browser/skin/Go-arrow.png");
padding-top: 2px;
padding-bottom: 2px;
}
#go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
-moz-transform: scaleX(-1);
}
/* Combined go/reload/stop button in location bar */
#urlbar > toolbarbutton {
-moz-appearance: none;
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
margin: -1px;
-moz-margin-start: 0;
padding: 0 3px;
background-origin: border-box;
padding: 0;
border: none;
-moz-border-start: 1px solid rgba(0,0,0,.35);
box-shadow: 0 1px 0 rgba(0,0,0,.1) inset,
-1px -1px 1px rgba(255,255,255,.2) inset;
}
#urlbar:-moz-locale-dir(ltr) > toolbarbutton {
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
}
#urlbar:-moz-locale-dir(rtl) > toolbarbutton {
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
#urlbar > toolbarbutton:not([disabled]):active:hover,
#urlbar-reload-button:not(:hover) {
-moz-border-start-style: none;
-moz-padding-start: 4px;
box-shadow: none;
}
#urlbar > toolbarbutton:not([disabled]):active:hover {
box-shadow: 0 0 6.5px rgba(0,0,0,.4) inset,
0 0 2px rgba(0,0,0,.4) inset;
cursor: pointer;
width: 22px;
}
#go-button,
#urlbar-go-button {
-moz-image-region: rect(0px, 56px, 14px, 42px);
background-image: -moz-linear-gradient(rgb(143,219,69), rgb(115,177,57));
list-style-image: url("chrome://browser/skin/Go-arrow.png");
}
#go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon,
#urlbar-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
-moz-transform: scaleX(-1);
}
#urlbar-go-button:hover {
background-image: -moz-linear-gradient(rgb(163,232,92), rgb(137,196,81));
}
#urlbar-reload-button {
-moz-image-region: rect(0px, 14px, 14px, 0px);
}
#urlbar-reload-button:not([disabled]):hover {
-moz-image-region: rect(0px, 28px, 14px, 14px);
background-image: -moz-linear-gradient(rgb(137,183,233), rgb(79,130,195));
list-style-image: url("moz-icon://stock/gtk-refresh?size=menu");
}
#urlbar-stop-button {
-moz-image-region: rect(0px, 42px, 14px, 28px);
background-image: -moz-linear-gradient(rgb(226,99,99), rgb(199,68,68));
}
#urlbar-stop-button:hover {
background-image: -moz-linear-gradient(rgb(237,120,120), rgb(216,92,92));
list-style-image: url("moz-icon://stock/gtk-stop?size=menu");
}
/* Popup blocker button */
@ -1988,3 +1923,12 @@ panel[dimmed="true"] {
box-shadow: 0 0 0 1px black;
outline-color: white;
}
/*
* need a "bumpy" background image for this!
*/
#inspector-horizontal-splitter {
background: none !important;
-moz-appearance: none;
cursor: n-resize;
}

Просмотреть файл

@ -202,6 +202,8 @@ code {
.docType {
position: absolute;
/* position DOCTYPE element above/outside the "nodeBox" that contains it */
/* Note: to be fixed in Bug #688439 */
top: -16px;
font-family: Menlo, Andale Mono, monospace;
padding-left: 8px;
@ -211,7 +213,9 @@ code {
}
.htmlNodeBox {
top: 16px;
/* make room for DOCTYPE element to be rendered above/outside "nodeBox" */
/* Note: to be fixed in Bug #688439 */
margin-top: 16px;
}
.nodeWhiteSpace {

Просмотреть файл

@ -27,7 +27,6 @@ browser.jar:
skin/classic/browser/page-livemarks.png
skin/classic/browser/Privacy-16.png
skin/classic/browser/Privacy-48.png
skin/classic/browser/reload-stop-go.png
skin/classic/browser/searchbar.css (searchbar.css)
skin/classic/browser/section_collapsed.png
skin/classic/browser/section_collapsed-rtl.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Просмотреть файл

@ -658,6 +658,8 @@ html[dir=rtl] #otherresults {
-moz-margin-end: 5px;
position: relative;
top: 2px;
width: 16px;
height: 16px;
}
.inlineMatch > span {

Двоичные данные
browser/themes/pinstripe/browser/Go-arrow.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Просмотреть файл

@ -836,13 +836,10 @@ toolbar[mode="icons"] #zoom-in-button {
}
#urlbar {
-moz-padding-end: 4px;
border-radius: @toolbarbuttonCornerRadius@;
}
#urlbar-container:not([combined]) > #urlbar {
-moz-padding-end: 3px;
}
#identity-box {
background-image: -moz-linear-gradient(hsl(0,0%,98%), hsl(0,0%,92%));
box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset;
@ -910,10 +907,31 @@ toolbar[mode="icons"] #zoom-in-button {
padding: 3px 0 2px;
}
.urlbar-history-dropmarker {
padding: 0 3px;
list-style-image: url("chrome://browser/skin/urlbar-history-dropmarker.png");
-moz-image-region: rect(0px, 11px, 14px, 0px);
}
.urlbar-history-dropmarker[open="true"],
.urlbar-history-dropmarker:hover:active {
-moz-image-region: rect(0px, 22px, 14px, 11px);
background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
}
#urlbar-icons {
-moz-box-align: center;
}
.urlbar-icon {
padding: 2px 3px;
}
.urlbar-icon[open="true"],
.urlbar-icon:hover:active {
background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
}
#urlbar-search-splitter {
min-width: 8px;
width: 8px;
@ -975,9 +993,8 @@ toolbar[mode="icons"] #zoom-in-button {
.ac-result-type-bookmark,
.autocomplete-treebody::-moz-tree-image(bookmark, treecolAutoCompleteImage) {
list-style-image: url("chrome://browser/skin/places/pageStarred.png");
width: 16px;
height: 16px;
list-style-image: url("chrome://browser/skin/places/star-icons.png");
-moz-image-region: rect(0, 32px, 16px, 16px);
}
.ac-result-type-keyword,
@ -991,7 +1008,7 @@ toolbar[mode="icons"] #zoom-in-button {
richlistitem[selected="true"][current="true"] > hbox > .ac-result-type-bookmark,
.autocomplete-treebody::-moz-tree-image(selected, current, bookmark, treecolAutoCompleteImage) {
list-style-image: url("chrome://browser/skin/places/star-icons.png");
-moz-image-region: rect(32px, 16px, 48px, 0px);
-moz-image-region: rect(0, 64px, 16px, 48px);
}
.ac-result-type-tag,
@ -1036,81 +1053,59 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
border-top: 1px solid GrayText;
}
/* ----- GO BUTTON ----- */
#go-button {
list-style-image: url("chrome://browser/skin/Go-arrow.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);
}
#go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
-moz-transform: scaleX(-1);
}
#go-button:hover {
-moz-image-region: rect(0px, 32px, 16px, 16px);
}
#go-button:hover:active {
-moz-image-region: rect(0px, 48px, 16px, 32px);
}
/* ----- COMBINED GO/RELOAD/STOP BUTTON IN LOCATION BAR ----- */
#go-button,
#urlbar > toolbarbutton {
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
margin: 0;
-moz-margin-start: 2px;
padding: 0 3px;
-moz-padding-start: 2px;
-moz-padding-end: 1px;
background-origin: border-box;
border: none;
-moz-border-start: 1px solid rgba(0,0,0,.25);
box-shadow: 0 1px 0 rgba(0,0,0,.1) inset,
-1px -1px 1px rgba(255,255,255,.15) inset;
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
}
#urlbar:-moz-locale-dir(ltr) > toolbarbutton {
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
#urlbar > toolbarbutton:not([disabled]):hover:active {
background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
}
#urlbar:-moz-locale-dir(rtl) > toolbarbutton {
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
#urlbar > toolbarbutton:not([disabled]):active:hover,
#urlbar-reload-button:not(:hover) {
-moz-border-start-style: none;
-moz-padding-start: 4px;
box-shadow: none;
}
#urlbar > toolbarbutton:not([disabled]):active:hover {
box-shadow: @toolbarbuttonPressedInnerShadow@;
#go-button {
padding: 0 3px;
}
#go-button,
#urlbar-go-button {
-moz-image-region: rect(0px, 56px, 14px, 42px);
background-image: -moz-linear-gradient(rgb(184,221,142), rgb(154,201,111) 49%, rgb(130,187,92) 51%, rgb(114,171,79));
-moz-image-region: rect(0, 42px, 14px, 28px);
}
#go-button:hover:active,
#urlbar-go-button:hover:active {
-moz-image-region: rect(14px, 42px, 28px, 28px);
}
#go-button:-moz-locale-dir(rtl),
#urlbar-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
-moz-transform: scaleX(-1);
}
#urlbar-reload-button {
-moz-image-region: rect(0px, 14px, 14px, 0px);
-moz-image-region: rect(0, 14px, 14px, 0);
}
#urlbar-reload-button:not([disabled]):hover {
-moz-image-region: rect(0px, 28px, 14px, 14px);
background-image: -moz-linear-gradient(rgb(162,207,241), rgb(111,178,225) 49%, rgb(91,159,217) 51%, rgb(62,138,200));
#urlbar-reload-button:not([disabled]):hover:active {
-moz-image-region: rect(14px, 14px, 28px, 0);
}
#urlbar-reload-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
-moz-transform: scaleX(-1);
}
#urlbar-stop-button {
-moz-image-region: rect(0px, 42px, 14px, 28px);
background-image: -moz-linear-gradient(rgb(231,162,140), rgb(209,119,100) 49%, rgb(193,92,78) 51%, rgb(173,72,58));
-moz-image-region: rect(0, 28px, 14px, 14px);
}
#urlbar-stop-button:hover:active {
-moz-image-region: rect(14px, 28px, 28px, 14px);
}
/* POPUP BLOCKER BUTTON */
@ -1119,41 +1114,24 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
-moz-image-region: rect(0, 16px, 16px, 0);
}
#page-report-button:hover {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
#page-report-button:hover:active,
#page-report-button[open="true"] {
-moz-image-region: rect(0, 48px, 16px, 32px);
-moz-image-region: rect(0, 32px, 16px, 16px);
}
/* STAR BUTTON */
#star-button {
padding: 1px;
-moz-padding-start: 4px;
list-style-image: url("chrome://browser/skin/places/star-icons.png");
-moz-image-region: rect(0, 16px, 16px, 0);
}
#star-button:hover {
#star-button:hover:active,
#star-button[starred="true"] {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
#star-button:hover:active {
-moz-image-region: rect(0, 48px, 16px, 32px);
}
#star-button[starred="true"] {
-moz-image-region: rect(16px, 16px, 32px, 0);
}
#star-button:hover[starred="true"] {
-moz-image-region: rect(16px, 32px, 32px, 16px);
}
#star-button:hover:active[starred="true"] {
-moz-image-region: rect(16px, 48px, 32px, 32px);
-moz-image-region: rect(0, 48px, 16px, 32px);
}
/* BOOKMARKING PANEL */
@ -2624,3 +2602,13 @@ panel[dimmed="true"] {
#inspector-tools > toolbarbutton[checked]:hover:active {
background-color: hsla(210,8%,5%,.2);
}
/*
* need a "bumpy" background image for this!
*/
#inspector-horizontal-splitter {
background: none !important;
-moz-appearance: none;
cursor: n-resize;
}

Просмотреть файл

@ -202,6 +202,8 @@ code {
.docType {
position: absolute;
/* position DOCTYPE element above/outside the "nodeBox" that contains it */
/* Note: to be fixed in Bug #688439 */
top: -16px;
font-family: Menlo, Andale Mono, monospace;
padding-left: 8px;
@ -211,7 +213,9 @@ code {
}
.htmlNodeBox {
top: 16px;
/* make room for DOCTYPE element to be rendered above/outside "nodeBox" */
/* Note: to be fixed in Bug #688439 */
margin-top: 16px;
}
.nodeWhiteSpace {

Просмотреть файл

@ -14,7 +14,6 @@ browser.jar:
skin/classic/browser/fullscreen-video.css
skin/classic/browser/Geolocation-16.png
skin/classic/browser/Geolocation-64.png
skin/classic/browser/Go-arrow.png
skin/classic/browser/home.png
skin/classic/browser/hud-style-check-box-checked.png
skin/classic/browser/hud-style-check-box-empty.png
@ -45,6 +44,7 @@ browser.jar:
skin/classic/browser/keyhole-circle.png
skin/classic/browser/Toolbar.png
skin/classic/browser/toolbarbutton-dropmarker.png
skin/classic/browser/urlbar-history-dropmarker.png
skin/classic/browser/urlbar-arrow.png
skin/classic/browser/urlbar-popup-blocked.png
skin/classic/browser/feeds/subscribe.css (feeds/subscribe.css)
@ -76,7 +76,6 @@ browser.jar:
skin/classic/browser/places/plus.png (places/plus.png)
skin/classic/browser/places/plus-active.png (places/plus-active.png)
skin/classic/browser/places/starPage.png (places/starPage.png)
skin/classic/browser/places/pageStarred.png (places/pageStarred.png)
skin/classic/browser/places/searching_16.png (places/searching_16.png)
skin/classic/browser/places/starred48.png (places/starred48.png)
skin/classic/browser/places/unstarred48.png (places/unstarred48.png)

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 708 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.3 KiB

После

Ширина:  |  Высота:  |  Размер: 1.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.5 KiB

После

Ширина:  |  Высота:  |  Размер: 912 B

Просмотреть файл

@ -648,10 +648,12 @@ html[dir=rtl] #otherresults {
-moz-margin-end: 5px;
position: relative;
top: 2px;
width: 16px;
height: 16px;
}
.inlineMatch > span {
max-width:200px;
max-width: 200px;
height: 15px;
}

Двоичные данные
browser/themes/pinstripe/browser/urlbar-history-dropmarker.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 389 B

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше