Merge mozilla-central into electrolysis.

This commit is contained in:
Benjamin Smedberg 2009-11-19 12:41:46 -05:00
Родитель 0f5c51eda6 137b13ef55
Коммит d74c6776f3
1070 изменённых файлов: 86503 добавлений и 6766 удалений

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

@ -130,16 +130,6 @@ distclean::
cat unallmakefiles | $(XARGS) rm -f
rm -f unallmakefiles $(DIST_GARBAGE)
ifeq ($(OS_ARCH),WINNT)
rebase:
ifdef MOZILLA_OFFICIAL
echo rebasing $(DIST)
/bin/find $(DIST) -name "*.dll" -a -not -name "msvc*" > rebase.lst
rebase -b 60000000 -R . -G rebase.lst
rm rebase.lst
endif
endif # WINNT
ifeq ($(OS_ARCH),WINNT)
# we want to copy PDB files on Windows
MAKE_SYM_STORE_ARGS := -c
@ -206,19 +196,6 @@ ifdef MOZ_CRASHREPORTER
$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh "$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip"
endif
ifeq ($(OS_ARCH),WINNT)
signnss:
ifdef MOZILLA_OFFICIAL
echo signing NSS libs
cd $(DIST)/bin; ./shlibsign.exe -v -i softokn3.dll
cd $(DIST)/bin; ./shlibsign.exe -v -i freebl3.dll
cd $(DIST)/bin; ./shlibsign.exe -v -i nssdbm3.dll
endif # MOZILLA_OFFICIAL
deliver: rebase signnss
endif # WINNT
ifneq (,$(wildcard $(DIST)/bin/application.ini))
BUILDID = $(shell $(PYTHON) $(srcdir)/config/printconfigsetting.py $(DIST)/bin/application.ini App BuildID)
else

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

@ -362,10 +362,14 @@ nsresult
nsAccessibilityService::GetInfo(nsIFrame* aFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
{
NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!");
if (!aFrame) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIContent> content = aFrame->GetContent();
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
if (!content || !node)
return NS_ERROR_FAILURE;
*aNode = node;
NS_IF_ADDREF(*aNode);
@ -1326,6 +1330,12 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
*aIsHidden = PR_FALSE;
// Frames can be deallocated when we flush layout, or when we call into code
// that can flush layout, either directly, or via DOM manipulation, or some
// CSS styles like :hover. We use the weak frame checks to avoid calling
// methods on a dead frame pointer.
nsWeakFrame weakFrame(*aFrameHint);
#ifdef DEBUG_A11Y
// Please leave this in for now, it's a convenient debugging method
nsAutoString name;
@ -1396,15 +1406,15 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
}
// We have a content node
nsIFrame *frame = *aFrameHint;
#ifdef DEBUG_A11Y
static int frameHintFailed, frameHintTried, frameHintNonexistant, frameHintFailedForText;
++frameHintTried;
#endif
if (!frame || content != frame->GetContent()) {
if (!weakFrame.GetFrame() || content != weakFrame.GetFrame()->GetContent()) {
// Frame hint not correct, get true frame, we try to optimize away from this
frame = aPresShell->GetRealPrimaryFrameFor(content);
if (frame) {
weakFrame = aPresShell->GetRealPrimaryFrameFor(content);
if (weakFrame.GetFrame()) {
#ifdef DEBUG_A11Y_FRAME_OPTIMIZATION
// Frame hint debugging
++frameHintFailed;
@ -1417,18 +1427,18 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
printf("* "); // Aaron's break point
}
#endif
if (frame->GetContent() != content) {
if (weakFrame.GetFrame()->GetContent() != content) {
// Not the main content for this frame!
// For example, this happens because <area> elements return the
// image frame as their primary frame. The main content for the
// image frame is the image content.
// Check if frame is an image frame, and content is <area>
nsIImageFrame *imageFrame = do_QueryFrame(frame);
nsIImageFrame *imageFrame = do_QueryFrame(weakFrame.GetFrame());
nsCOMPtr<nsIDOMHTMLAreaElement> areaElmt = do_QueryInterface(content);
if (imageFrame && areaElmt) {
nsCOMPtr<nsIAccessible> imageAcc;
CreateHTMLImageAccessible(frame, getter_AddRefs(imageAcc));
CreateHTMLImageAccessible(weakFrame.GetFrame(), getter_AddRefs(imageAcc));
if (imageAcc) {
// cache children
PRInt32 childCount;
@ -1440,34 +1450,44 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
return NS_OK;
}
*aFrameHint = frame;
*aFrameHint = weakFrame.GetFrame();
}
}
// Check frame to see if it is hidden
if (!frame || !frame->GetStyleVisibility()->IsVisible()) {
if (!weakFrame.GetFrame() ||
!weakFrame.GetFrame()->GetStyleVisibility()->IsVisible()) {
*aIsHidden = PR_TRUE;
}
if (*aIsHidden)
if (*aIsHidden) {
*aFrameHint = weakFrame.GetFrame();
return NS_OK;
}
/**
* Attempt to create an accessible based on what we know
*/
if (content->IsNodeOfType(nsINode::eTEXT)) {
// --- Create HTML for visible text frames ---
if (frame->IsEmpty()) {
nsIFrame* f = weakFrame.GetFrame();
if (f && f->IsEmpty()) {
nsAutoString renderedWhitespace;
frame->GetRenderedText(&renderedWhitespace, nsnull, nsnull, 0, 1);
f->GetRenderedText(&renderedWhitespace, nsnull, nsnull, 0, 1);
if (renderedWhitespace.IsEmpty()) {
// Really empty -- nothing is rendered
*aIsHidden = PR_TRUE;
*aFrameHint = weakFrame.GetFrame();
return NS_OK;
}
}
frame->GetAccessible(getter_AddRefs(newAcc));
return InitAccessible(newAcc, aAccessible, nsnull);
if (weakFrame.IsAlive()) {
weakFrame.GetFrame()->GetAccessible(getter_AddRefs(newAcc));
}
nsresult rv = InitAccessible(newAcc, aAccessible, nsnull);
*aFrameHint = weakFrame.GetFrame();
return rv;
}
PRBool isHTML = content->IsHTML();
@ -1484,11 +1504,16 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::name, name);
if (!name.IsEmpty()) {
*aIsHidden = PR_TRUE;
*aFrameHint = weakFrame.GetFrame();
return NS_OK;
}
nsresult rv = CreateHyperTextAccessible(frame, getter_AddRefs(newAcc));
NS_ENSURE_SUCCESS(rv, rv);
nsresult rv =
CreateHyperTextAccessible(weakFrame.GetFrame(), getter_AddRefs(newAcc));
if (NS_FAILED(rv)) {
*aFrameHint = weakFrame.GetFrame();
return rv;
}
}
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(aNode);
@ -1497,13 +1522,14 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// Only create accessible for role of "presentation" if it is focusable --
// in that case we need an accessible in case it gets focused, we
// don't want focus ever to be 'lost'
*aFrameHint = weakFrame.GetFrame();
return NS_OK;
}
if (!newAcc && isHTML) { // HTML accessibles
if (weakFrame.IsAlive() && !newAcc && isHTML) { // HTML accessibles
PRBool tryTagNameOrFrame = PR_TRUE;
nsIAtom *frameType = frame->GetType();
nsIAtom *frameType = weakFrame.GetFrame()->GetType();
PRBool partOfHTMLTable =
frameType == nsAccessibilityAtoms::tableCaptionFrame ||
@ -1554,6 +1580,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// presentation if they aren't focusable and have not explicit ARIA
// role (don't create accessibles for them unless they need to fire
// focus events).
*aFrameHint = weakFrame.GetFrame();
return NS_OK;
}
@ -1598,9 +1625,13 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// The method creates accessibles for table related content too therefore
// we do not call it if accessibles for table related content are
// prevented above.
nsresult rv = CreateHTMLAccessibleByMarkup(frame, aWeakShell, aNode,
getter_AddRefs(newAcc));
NS_ENSURE_SUCCESS(rv, rv);
nsresult rv =
CreateHTMLAccessibleByMarkup(weakFrame.GetFrame(), aWeakShell, aNode,
getter_AddRefs(newAcc));
if (NS_FAILED(rv)) {
*aFrameHint = weakFrame.GetFrame();
return rv;
}
if (!newAcc) {
// Do not create accessible object subtrees for non-rendered table
@ -1609,14 +1640,19 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// the table caption would still be created. By setting
// *aIsHidden = PR_TRUE we ensure that no descendant accessibles are
// created.
if (frame->GetType() == nsAccessibilityAtoms::tableCaptionFrame &&
frame->GetRect().IsEmpty()) {
nsIFrame* f = weakFrame.GetFrame();
if (!f) {
f = aPresShell->GetRealPrimaryFrameFor(content);
}
if (f->GetType() == nsAccessibilityAtoms::tableCaptionFrame &&
f->GetRect().IsEmpty()) {
// XXX This is not the ideal place for this code, but right now there
// is no better place:
*aIsHidden = PR_TRUE;
*aFrameHint = weakFrame.GetFrame();
return NS_OK;
}
frame->GetAccessible(getter_AddRefs(newAcc)); // Try using frame to do it
f->GetAccessible(getter_AddRefs(newAcc)); // Try using frame to do it
}
}
}
@ -1625,7 +1661,10 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// Elements may implement nsIAccessibleProvider via XBL. This allows them to
// say what kind of accessible to create.
nsresult rv = GetAccessibleByType(aNode, getter_AddRefs(newAcc));
NS_ENSURE_SUCCESS(rv, rv);
if (NS_FAILED(rv)) {
*aFrameHint = weakFrame.GetFrame();
return rv;
}
}
if (!newAcc) {
@ -1651,7 +1690,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// We don't do this for <body>, <html>, <window>, <dialog> etc. which
// correspond to the doc accessible and will be created in any case
if (!newAcc && content->Tag() != nsAccessibilityAtoms::body && content->GetParent() &&
(frame->IsFocusable() ||
((weakFrame.GetFrame() && weakFrame.GetFrame()->IsFocusable()) ||
(isHTML && nsCoreUtils::HasListener(content, NS_LITERAL_STRING("click"))) ||
HasUniversalAriaProperty(content, aWeakShell) || roleMapEntry ||
HasRelatedContent(content) || nsCoreUtils::IsXLink(content))) {
@ -1660,7 +1699,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// other accessibles can point to it, or so that it can hold a state, etc.
if (isHTML) {
// Interesting HTML container which may have selectable text and/or embedded objects
CreateHyperTextAccessible(frame, getter_AddRefs(newAcc));
CreateHyperTextAccessible(weakFrame.GetFrame(), getter_AddRefs(newAcc));
}
else { // XUL, SVG, MathML etc.
// Interesting generic non-HTML container
@ -1668,7 +1707,9 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
}
}
return InitAccessible(newAcc, aAccessible, roleMapEntry);
nsresult rv = InitAccessible(newAcc, aAccessible, roleMapEntry);
*aFrameHint = weakFrame.GetFrame();
return rv;
}
PRBool

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

@ -46,7 +46,6 @@
#include "nsIContent.h"
#include "nsIDOMXULElement.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsWeakReference.h"
nsAccessibleTreeWalker::nsAccessibleTreeWalker(nsIWeakReference* aPresShell, nsIDOMNode* aNode, PRBool aWalkAnonContent):
@ -59,7 +58,6 @@ nsAccessibleTreeWalker::nsAccessibleTreeWalker(nsIWeakReference* aPresShell, nsI
mState.siblingIndex = eSiblingsUninitialized;
mState.siblingList = nsnull;
mState.isHidden = false;
mState.frame = nsnull;
MOZ_COUNT_CTOR(nsAccessibleTreeWalker);
}
@ -121,12 +119,13 @@ void nsAccessibleTreeWalker::GetKids(nsIDOMNode *aParentNode)
NS_IMETHODIMP nsAccessibleTreeWalker::PopState()
{
nsIFrame *frameParent = mState.frame? mState.frame->GetParent(): nsnull;
nsIFrame *frameParent =
mState.frame.GetFrame() ? mState.frame.GetFrame()->GetParent() : nsnull;
if (mState.prevState) {
WalkState *toBeDeleted = mState.prevState;
mState = *mState.prevState; // deep copy
mState.isHidden = PR_FALSE; // If we were in a child, the parent wasn't hidden
if (!mState.frame) {
if (!mState.frame.GetFrame()) {
mState.frame = frameParent;
}
delete toBeDeleted;
@ -166,8 +165,8 @@ void nsAccessibleTreeWalker::GetNextDOMNode()
mState.domNode = do_QueryInterface(mState.parentContent->GetChildAt(++mState.siblingIndex));
}
else if (mState.siblingIndex == eSiblingsWalkFrames) {
if (mState.frame) {
mState.domNode = do_QueryInterface(mState.frame->GetContent());
if (mState.frame.GetFrame()) {
mState.domNode = do_QueryInterface(mState.frame.GetFrame()->GetContent());
} else {
mState.domNode = nsnull;
}
@ -230,18 +229,20 @@ NS_IMETHODIMP nsAccessibleTreeWalker::GetFirstChild()
void nsAccessibleTreeWalker::UpdateFrame(PRBool aTryFirstChild)
{
if (!mState.frame) {
nsIFrame *curFrame = mState.frame.GetFrame();
if (!curFrame) {
return;
}
if (aTryFirstChild) {
// If the frame implements nsIAnonymousContentCreator interface then go down
// through the frames and obtain anonymous nodes for them.
nsIAnonymousContentCreator* creator = do_QueryFrame(mState.frame);
mState.frame = mState.frame->GetFirstChild(nsnull);
nsIAnonymousContentCreator* creator = do_QueryFrame(curFrame);
nsIFrame *child = curFrame->GetFirstChild(nsnull);
mState.frame = child;
if (creator && mState.frame && mState.siblingIndex < 0) {
mState.domNode = do_QueryInterface(mState.frame->GetContent());
if (creator && child && mState.siblingIndex < 0) {
mState.domNode = do_QueryInterface(child->GetContent());
mState.siblingIndex = eSiblingsWalkFrames;
}
// temporary workaround for Bug 359210. We never want to walk frames.
@ -268,7 +269,7 @@ void nsAccessibleTreeWalker::UpdateFrame(PRBool aTryFirstChild)
#endif
}
else {
mState.frame = mState.frame->GetNextSibling();
mState.frame = curFrame->GetNextSibling();
}
}
@ -285,9 +286,11 @@ PRBool nsAccessibleTreeWalker::GetAccessible()
mState.accessible = nsnull;
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
nsIFrame *frame = mState.frame.GetFrame();
mAccService->GetAccessible(mState.domNode, presShell, mWeakShell,
&mState.frame, &mState.isHidden,
&frame, &mState.isHidden,
getter_AddRefs(mState.accessible));
mState.frame = frame;
return mState.accessible ? PR_TRUE : PR_FALSE;
}

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

@ -39,7 +39,8 @@
#ifndef _nsAccessibleTreeWalker_H_
#define _nsAccessibleTreeWalker_H_
/* For documentation of the accessibility architecture, * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
/* For documentation of the accessibility architecture, see
* http://www.mozilla.org/access/architecture
*/
#include "nsCOMPtr.h"
@ -49,6 +50,7 @@
#include "nsIDOMNodeList.h"
#include "nsIAccessibilityService.h"
#include "nsIWeakReference.h"
#include "nsIFrame.h"
enum { eSiblingsUninitialized = -1, eSiblingsWalkFrames = -2 };
@ -58,7 +60,7 @@ struct WalkState {
nsCOMPtr<nsIDOMNodeList> siblingList;
nsIContent *parentContent; // For walking normal DOM
WalkState *prevState;
nsIFrame *frame; // Helps avoid GetPrimaryFrameFor() calls
nsWeakFrame frame; // Helps avoid GetPrimaryFrameFor() calls
PRInt32 siblingIndex; // Holds a state flag or an index into the siblingList
PRBool isHidden; // Don't enter subtree if hidden
};

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

@ -1157,8 +1157,7 @@ nsXULListCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells)
nsCOMPtr<nsIAccessibleTable> table;
GetTable(getter_AddRefs(table));
if (!table)
return NS_OK;
NS_ENSURE_STATE(table); // we expect to be in a listbox (table)
// Get column header cell from XUL listhead.
nsCOMPtr<nsIAccessible> tableAcc(do_QueryInterface(table));
@ -1209,8 +1208,7 @@ nsXULListCellAccessible::GetRowHeaderCells(nsIArray **aHeaderCells)
nsCOMPtr<nsIAccessibleTable> table;
GetTable(getter_AddRefs(table));
if (!table)
return NS_OK;
NS_ENSURE_STATE(table); // we expect to be in a listbox (table)
// Calculate row header cells from ARIA markup.
return nsAccUtils::GetHeaderCellsFor(table, this,
@ -1229,8 +1227,7 @@ nsXULListCellAccessible::IsSelected(PRBool *aIsSelected)
nsCOMPtr<nsIAccessibleTable> table;
GetTable(getter_AddRefs(table));
if (!table)
return NS_OK;
NS_ENSURE_STATE(table); // we expect to be in a listbox (table)
PRInt32 rowIdx = -1;
GetRowIndex(&rowIdx);
@ -1259,6 +1256,7 @@ nsXULListCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribu
// "table-cell-index" attribute
nsCOMPtr<nsIAccessibleTable> table;
GetTable(getter_AddRefs(table));
NS_ENSURE_STATE(table); // we expect to be in a listbox (table)
PRInt32 rowIdx = -1;
GetRowIndex(&rowIdx);

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

@ -25,9 +25,13 @@
// var gA11yEventDumpID = "eventdump"; // debug stuff
SimpleTest.waitForExplicitFinish();
window.openDialog("chrome://mochikit/content/a11y/accessible/name_nsRootAcc_wnd.xul",
"nsRootAcc_name_test",
"chrome,width=600,height=600");
var w = window.openDialog("chrome://mochikit/content/a11y/accessible/name_nsRootAcc_wnd.xul",
"nsRootAcc_name_test",
"chrome,width=600,height=600");
if (LINUX) {
w.focus();
}
]]>
</script>

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

@ -35,14 +35,24 @@
#
# ***** END LICENSE BLOCK *****
DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(topsrcdir)/config/config.mk
DIRS = base components locales themes fuel app
PARALLEL_DIRS = \
base \
components \
fuel \
locales \
themes \
$(NULL)
DIRS = \
app \
$(NULL)
ifeq ($(OS_ARCH),WINNT)
ifdef MOZ_INSTALLER

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

@ -165,9 +165,7 @@ pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/Ve
pref("extensions.update.interval", 86400); // Check for updates to Extensions and
// Themes every day
// Non-symmetric (not shared by extensions) extension-specific [update] preferences
pref("extensions.getMoreExtensionsURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/%VERSION%/extensions/");
pref("extensions.getMoreThemesURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/%VERSION%/themes/");
pref("extensions.getMorePluginsURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/%VERSION%/plugins/");
pref("extensions.getMoreThemesURL", "https://addons.mozilla.org/%LOCALE%/%APP%/getpersonas");
pref("extensions.dss.enabled", false); // Dynamic Skin Switching
pref("extensions.dss.switchPending", false); // Non-dynamic switch pending after next
// restart.
@ -178,6 +176,8 @@ pref("extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.description", "chrome://
pref("xpinstall.whitelist.add", "addons.mozilla.org");
pref("xpinstall.whitelist.add.36", "getpersonas.com");
pref("lightweightThemes.update.enabled", true);
pref("keyword.enabled", true);
pref("keyword.URL", "chrome://browser-region/locale/region.properties");

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

@ -92,8 +92,8 @@
oncommand="openHelpLink('ieusers');"/>
#endif
<menuitem id="troubleShooting"
accesskey="&helpTroubleshooting.accesskey;"
label="&helpTroubleshooting.label;"
accesskey="&helpTroubleshootingInfo.accesskey;"
label="&helpTroubleshootingInfo.label;"
oncommand="openTroubleshootingPage()"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="releaseNotes"

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

@ -889,12 +889,12 @@ var BookmarksEventHandler = {
// Add "Open (Feed Name)" menuitem if it's a livemark with a siteURI
target._endOptOpenSiteURI = document.createElement("menuitem");
target._endOptOpenSiteURI.className = "openlivemarksite-menuitem";
target._endOptOpenSiteURI.setAttribute("siteURI", siteURIString);
target._endOptOpenSiteURI.setAttribute("targetURI", siteURIString);
target._endOptOpenSiteURI.setAttribute("oncommand",
"openUILink(this.getAttribute('siteURI'), event);");
"openUILink(this.getAttribute('targetURI'), event);");
// If a user middle-clicks this item we serve the oncommand event
// We are using checkForMiddleClick because of Bug 246720
// Note: stopPropagation is needed to avoid serving middle-click
// Note: stopPropagation is needed to avoid serving middle-click
// with BT_onClick that would open all items in tabs
target._endOptOpenSiteURI.setAttribute("onclick",
"checkForMiddleClick(this, event); event.stopPropagation();");
@ -922,6 +922,7 @@ var BookmarksEventHandler = {
fillInBHTooltip: function(aDocument, aEvent) {
var node;
var cropped = false;
var targetURI;
if (aDocument.tooltipNode.localName == "treechildren") {
var tree = aDocument.tooltipNode.parentNode;
@ -933,18 +934,28 @@ var BookmarksEventHandler = {
node = tree.view.nodeForTreeIndex(row.value);
cropped = tbo.isCellCropped(row.value, column.value);
}
else
node = aDocument.tooltipNode.node;
else {
// Check whether the tooltipNode is a Places node.
// In such a case use it, otherwise check for targetURI attribute.
var tooltipNode = aDocument.tooltipNode;
if (tooltipNode.node)
node = tooltipNode.node;
else {
// This is a static non-Places node.
targetURI = tooltipNode.getAttribute("targetURI");
}
}
if (!node)
if (!node && !targetURI)
return false;
var title = node.title;
var url;
// Show node.label as tooltip's title for non-Places nodes.
var title = node ? node.title : tooltipNode.label;
// Show URL only for URI-type nodes.
if (PlacesUtils.nodeIsURI(node))
url = node.uri;
// Show URL only for Places URI-nodes or nodes with a targetURI attribute.
var url;
if (targetURI || PlacesUtils.nodeIsURI(node))
url = targetURI || node.uri;
// Show tooltip for containers only if their title is cropped.
if (!cropped && !url)

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

@ -48,6 +48,7 @@
# Paul OShannessy <paul@oshannessy.com>
# Nils Maier <maierman@web.de>
# Rob Arnold <robarnold@cmu.edu>
# Dietrich Ayala <dietrich@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
@ -152,6 +153,12 @@ XPCOMUtils.defineLazyGetter(this, "Win7Features", function () {
return null;
});
#ifdef MOZ_CRASHREPORTER
XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter",
"@mozilla.org/xre/app-info;1",
"nsICrashReporter");
#endif
/**
* We can avoid adding multiple load event listeners and save some time by adding
* one listener that calls all real handlers.
@ -4318,6 +4325,14 @@ var TabsProgressListener = {
},
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
#ifdef MOZ_CRASHREPORTER
if (!aRequest.URI)
aRequest.QueryInterface(Ci.nsIChannel);
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT) {
gCrashReporter.annotateCrashReport("URL", aRequest.URI.spec);
}
#endif
},
onLocationChange: function (aBrowser, aWebProgress, aRequest, aLocationURI) {
@ -6840,6 +6855,7 @@ let gPrivateBrowsingUI = {
this._observerService = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
this._observerService.addObserver(this, "private-browsing", false);
this._observerService.addObserver(this, "private-browsing-transition-complete", false);
this._privateBrowsingService = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
@ -6850,6 +6866,19 @@ let gPrivateBrowsingUI = {
uninit: function PBUI_unint() {
this._observerService.removeObserver(this, "private-browsing");
this._observerService.removeObserver(this, "private-browsing-transition-complete");
},
get _disableUIOnToggle PBUI__disableUIOnTogle() {
if (this._privateBrowsingService.autoStarted)
return false;
try {
return !gPrefService.getBoolPref("browser.privatebrowsing.keep_current_session");
}
catch (e) {
return true;
}
},
observe: function PBUI_observe(aSubject, aTopic, aData) {
@ -6859,6 +6888,15 @@ let gPrivateBrowsingUI = {
else if (aData == "exit")
this.onExitPrivateBrowsing();
}
else if (aTopic == "private-browsing-transition-complete") {
if (this._disableUIOnToggle) {
// use setTimeout here in order to make the code testable
setTimeout(function() {
document.getElementById("Tools:PrivateBrowsing")
.removeAttribute("disabled");
}, 0);
}
}
},
_shouldEnter: function PBUI__shouldEnter() {
@ -6954,6 +6992,10 @@ let gPrivateBrowsingUI = {
setTimeout(function () {
DownloadMonitorPanel.updateStatus();
}, 0);
if (this._disableUIOnToggle)
document.getElementById("Tools:PrivateBrowsing")
.setAttribute("disabled", "true");
},
onExitPrivateBrowsing: function PBUI_onExitPrivateBrowsing() {
@ -7004,6 +7046,10 @@ let gPrivateBrowsingUI = {
setTimeout(function () {
DownloadMonitorPanel.updateStatus();
}, 0);
if (this._disableUIOnToggle)
document.getElementById("Tools:PrivateBrowsing")
.setAttribute("disabled", "true");
},
_setPBMenuTitle: function PBUI__setPBMenuTitle(aMode) {
@ -7124,9 +7170,11 @@ var LightWeightThemeWebInstaller = {
this._removePreviousNotifications();
var notificationBox = gBrowser.getNotificationBox();
notificationBox.appendNotification(message, "lwtheme-install-request", "",
notificationBox.PRIORITY_INFO_MEDIUM,
buttons);
var notificationBar =
notificationBox.appendNotification(message, "lwtheme-install-request", "",
notificationBox.PRIORITY_INFO_MEDIUM,
buttons);
notificationBar.persistence = 1;
},
_install: function (newTheme) {
@ -7160,10 +7208,13 @@ var LightWeightThemeWebInstaller = {
this._removePreviousNotifications();
var notificationBox = gBrowser.getNotificationBox();
notificationBox.appendNotification(text("message"),
"lwtheme-install-notification", "",
notificationBox.PRIORITY_INFO_MEDIUM,
buttons);
var notificationBar =
notificationBox.appendNotification(text("message"),
"lwtheme-install-notification", "",
notificationBox.PRIORITY_INFO_MEDIUM,
buttons);
notificationBar.persistence = 1;
notificationBar.timeout = Date.now() + 20000; // 20 seconds
},
_removePreviousNotifications: function () {
@ -7232,44 +7283,7 @@ var LightWeightThemeWebInstaller = {
},
_getThemeFromNode: function (node) {
const MANDATORY = ["id", "name", "headerURL"];
const OPTIONAL = ["footerURL", "textcolor", "accentcolor", "iconURL",
"previewURL", "author", "description", "homepageURL"];
try {
var data = JSON.parse(node.getAttribute("data-browsertheme"));
} catch (e) {
return null;
}
if (!data || typeof data != "object")
return null;
for (let prop in data) {
if (!data[prop] ||
typeof data[prop] != "string" ||
MANDATORY.indexOf(prop) == -1 && OPTIONAL.indexOf(prop) == -1) {
delete data[prop];
continue;
}
if (/URL$/.test(prop)) {
try {
data[prop] = makeURLAbsolute(node.baseURI, data[prop]);
if (/^https?:/.test(data[prop]))
continue;
} catch (e) {}
delete data[prop];
}
}
for (let i = 0; i < MANDATORY.length; i++) {
if (!(MANDATORY[i] in data))
return null;
}
return data;
return this._manager.parseTheme(node.getAttribute("data-browsertheme"),
node.baseURI);
}
}

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

@ -53,13 +53,21 @@ let observer = {
throw Components.results.NS_NOINTERFACE;
},
observe: function (aSubject, aTopic, aData) {
gOpenLocationLastURLData = "";
switch (aTopic) {
case "private-browsing":
gOpenLocationLastURLData = "";
break;
case "browser:purge-session-history":
gOpenLocationLastURL.reset();
break;
}
}
};
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.addObserver(observer, "private-browsing", true);
let os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.addObserver(observer, "private-browsing", true);
os.addObserver(observer, "browser:purge-session-history", true);
let gOpenLocationLastURLData = "";
let gOpenLocationLastURL = {

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

@ -85,7 +85,7 @@ pageInfoTreeView.prototype = {
{
this.rows = this.data.push(row);
this.rowCountChanged(this.rows - 1, 1);
if (this.selection.count == 0 && this.rowCount)
if (this.selection.count == 0 && this.rowCount && !gImageElement)
this.selection.select(0);
},

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

@ -40,65 +40,38 @@
* modified by sub-document loads of content from a different domain.
*/
let testPage = 'data:text/html,<body><iframe id="a" src=""></iframe></body>';
function test() {
waitForExplicitFinish();
// The zoom level before the sub-document load. We set this in continueTest
// and then compare it to the current zoom level in finishTest to make sure
// it hasn't changed.
let zoomLevel;
const TEST_PAGE_URL = 'data:text/html,<body><iframe src=""></iframe></body>';
const TEST_IFRAME_URL = "http://test2.example.org/";
// Prepare the test tab
gBrowser.selectedTab = gBrowser.addTab();
let testBrowser = gBrowser.selectedBrowser;
let finishTest = function() {
testBrowser.removeProgressListener(progressListener);
is(ZoomManager.zoom, zoomLevel, "zoom is retained after sub-document load");
gBrowser.removeCurrentTab();
finish();
};
testBrowser.addEventListener("load", function () {
testBrowser.removeEventListener("load", arguments.callee, true);
let progressListener = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
Ci.nsISupportsWeakReference]),
onStateChange: function() {},
onProgressChange: function() {},
onLocationChange: function() {
window.setTimeout(finishTest, 0);
},
onStatusChange: function() {},
onSecurityChange: function() {}
};
let continueTest = function() {
// Change the zoom level and then save it so we can compare it to the level
// after loading the sub-document.
FullZoom.enlarge();
zoomLevel = ZoomManager.zoom;
// Finish the test in a timeout after the sub-document location change
// to give the zoom controller time to respond to it.
testBrowser.addProgressListener(progressListener);
var zoomLevel = ZoomManager.zoom;
// Start the sub-document load.
content.document.getElementById("a").src = "http://test2.example.org/";
};
executeSoon(function () {
testBrowser.addEventListener("load", function (e) {
testBrowser.removeEventListener("load", arguments.callee, true);
// Continue the test after the test page has loaded.
// Note: in order for the sub-document load to trigger a location change
// the way it does under real world usage scenarios, we have to continue
// the test in a timeout for some unknown reason.
let continueListener = function() {
window.setTimeout(continueTest, 0);
// Remove the load listener so it doesn't get called for the sub-document.
testBrowser.removeEventListener("load", continueListener, true);
};
testBrowser.addEventListener("load", continueListener, true);
is(e.target.defaultView.location, TEST_IFRAME_URL, "got the load event for the iframe");
is(ZoomManager.zoom, zoomLevel, "zoom is retained after sub-document load");
// Start the test by loading the test page.
testBrowser.contentWindow.location = testPage;
gBrowser.removeCurrentTab();
finish();
}, true);
content.document.querySelector("iframe").src = TEST_IFRAME_URL;
});
}, true);
content.location = TEST_PAGE_URL;
}

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

@ -31,8 +31,8 @@ function test() {
content.location =
"data:text/html," +
"<img src='about:logo?b' height=300 width=350 alt=2>" +
"<img src='about:logo?a' height=200 width=250>" +
"<img src='about:logo?b' height=200 width=250 alt=1>" +
"<img src='about:logo?b' height=200 width=250 alt=2>" +
"<img src='about:logo?b' height=100 width=150 alt=2 id='test-image'>";
}

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

@ -475,7 +475,7 @@ function buildHelpMenu()
#ifdef MOZ_UPDATER
var updates =
Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService);
getService(Components.interfaces.nsIApplicationUpdateService2);
var um =
Components.classes["@mozilla.org/updates/update-manager;1"].
getService(Components.interfaces.nsIUpdateManager);
@ -483,9 +483,9 @@ function buildHelpMenu()
// Disable the UI if the update enabled pref has been locked by the
// administrator or if we cannot update for some other reason
var checkForUpdates = document.getElementById("checkForUpdates");
var canUpdate = updates.canUpdate;
checkForUpdates.setAttribute("disabled", !canUpdate);
if (!canUpdate)
var canCheckForUpdates = updates.canCheckForUpdates;
checkForUpdates.setAttribute("disabled", !canCheckForUpdates);
if (!canCheckForUpdates)
return;
var strings = document.getElementById("bundle_browser");

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

@ -35,10 +35,10 @@
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
@ -46,44 +46,44 @@ MODULE = browsercomps
XPIDL_MODULE = browsercompsbase
XPIDLSRCS = \
nsIBrowserHandler.idl \
nsIBrowserGlue.idl \
$(NULL)
nsIBrowserGlue.idl \
nsIBrowserHandler.idl \
$(NULL)
EXTRA_PP_COMPONENTS = \
nsBrowserContentHandler.js \
nsBrowserGlue.js \
$(NULL)
nsBrowserContentHandler.js \
nsBrowserGlue.js \
$(NULL)
EXTRA_JS_MODULES = distribution.js
DIRS = \
about \
certerror \
dirprovider \
microsummaries \
preferences \
search \
sessionstore \
shell \
sidebar \
feeds \
places \
privatebrowsing \
$(NULL)
PARALLEL_DIRS = \
about \
certerror \
dirprovider \
feeds \
microsummaries \
places \
preferences \
privatebrowsing \
search \
sessionstore \
shell \
sidebar \
$(NULL)
ifndef WINCE
DIRS += migration
PARALLEL_DIRS += migration
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
ifndef WINCE
DIRS += wintaskbar
PARALLEL_DIRS += wintaskbar
endif
endif
ifdef MOZ_SAFE_BROWSING
DIRS += safebrowsing
PARALLEL_DIRS += safebrowsing
endif
DIRS += build

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

@ -510,8 +510,15 @@
if (window.XULBrowserWindow) {
var nodeItem = event.target.node;
var linkURI;
if (nodeItem && PlacesUtils.nodeIsURI(nodeItem))
window.XULBrowserWindow.setOverLink(nodeItem.uri, null);
linkURI = nodeItem.uri;
else if (node.hasAttribute("targetURI"))
linkURI = node.getAttribute("targetURI");
if (linkURI)
window.XULBrowserWindow.setOverLink(linkURI, null);
}
]]></handler>
<handler event="DOMMenuItemInactive"><![CDATA[

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

@ -1198,7 +1198,7 @@ var PlacesUIUtils = {
}
// Get all items marked as being the left pane folder.
let items = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {});
let items = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
if (items.length > 1) {
// Something went wrong, we cannot have more than one left pane folder,
// remove all left pane folders and continue. We will create a new one.
@ -1223,7 +1223,7 @@ var PlacesUIUtils = {
delete this.leftPaneQueries;
this.leftPaneQueries = {};
let items = as.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO, {});
let items = as.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO);
// While looping through queries we will also check for their validity.
let queriesCount = 0;
for(let i = 0; i < items.length; i++) {

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

@ -74,6 +74,11 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
const STATE_IDLE = 0;
const STATE_TRANSITION_STARTED = 1;
const STATE_WAITING_FOR_RESTORE = 2;
const STATE_RESTORE_FINISHED = 3;
////////////////////////////////////////////////////////////////////////////////
//// PrivateBrowsingService
@ -82,6 +87,7 @@ function PrivateBrowsingService() {
this._obs.addObserver(this, "quit-application-granted", true);
this._obs.addObserver(this, "private-browsing", true);
this._obs.addObserver(this, "command-line-startup", true);
this._obs.addObserver(this, "sessionstore-browser-state-restored", true);
}
PrivateBrowsingService.prototype = {
@ -115,8 +121,8 @@ PrivateBrowsingService.prototype = {
// How to treat the non-private session
_saveSession: true,
// Make sure we don't allow re-enterant changing of the private mode
_alreadyChangingMode: false,
// The current status of the private browsing service
_currentStatus: STATE_IDLE,
// Whether the private browsing mode has been started automatically (ie. always-on)
_autoStarted: false,
@ -234,6 +240,7 @@ PrivateBrowsingService.prototype = {
// if we have transitioned out of private browsing mode and the session is
// to be restored, do it now
if (!this._inPrivateBrowsing) {
this._currentStatus = STATE_WAITING_FOR_RESTORE;
ss.setBrowserState(this._savedBrowserState);
this._savedBrowserState = null;
@ -275,11 +282,35 @@ PrivateBrowsingService.prototype = {
}]
};
// Transition into private browsing mode
this._currentStatus = STATE_WAITING_FOR_RESTORE;
ss.setBrowserState(JSON.stringify(privateBrowsingState));
}
}
},
_notifyIfTransitionComplete: function PBS__notifyIfTransitionComplete() {
switch (this._currentStatus) {
case STATE_TRANSITION_STARTED:
// no session store operation was needed, so just notify of transition completion
case STATE_RESTORE_FINISHED:
// restore has been completed
this._currentStatus = STATE_IDLE;
this._obs.notifyObservers(null, "private-browsing-transition-complete", "");
break;
case STATE_WAITING_FOR_RESTORE:
// too soon to notify...
break;
case STATE_IDLE:
// no need to notify
break;
default:
// unexpected state observed
Cu.reportError("Unexpected private browsing status reached: " +
this._currentStatus);
break;
}
},
_canEnterPrivateBrowsingMode: function PBS__canEnterPrivateBrowsingMode() {
let cancelEnter = Cc["@mozilla.org/supports-PRBool;1"].
createInstance(Ci.nsISupportsPRBool);
@ -382,6 +413,12 @@ PrivateBrowsingService.prototype = {
aSubject.QueryInterface(Ci.nsICommandLine);
this.handle(aSubject);
break;
case "sessionstore-browser-state-restored":
if (this._currentStatus == STATE_WAITING_FOR_RESTORE) {
this._currentStatus = STATE_RESTORE_FINISHED;
this._notifyIfTransitionComplete();
}
break;
}
},
@ -416,11 +453,11 @@ PrivateBrowsingService.prototype = {
// status of the service while it's in the process of another transition.
// So, we detect a reentrant call here and throw an error.
// This is documented in nsIPrivateBrowsingService.idl.
if (this._alreadyChangingMode)
if (this._currentStatus != STATE_IDLE)
throw Cr.NS_ERROR_FAILURE;
try {
this._alreadyChangingMode = true;
this._currentStatus = STATE_TRANSITION_STARTED;
if (val != this._inPrivateBrowsing) {
if (val) {
@ -465,7 +502,7 @@ PrivateBrowsingService.prototype = {
"private browsing mode change request: " + ex.toString());
} finally {
this._windowsToClose = [];
this._alreadyChangingMode = false;
this._notifyIfTransitionComplete();
}
},

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

@ -50,6 +50,7 @@ _BROWSER_TEST_FILES = \
browser_privatebrowsing_certexceptionsui.js \
browser_privatebrowsing_crh.js \
browser_privatebrowsing_downloadmonitor.js \
browser_privatebrowsing_fastswitch.js \
browser_privatebrowsing_findbar.js \
browser_privatebrowsing_forgetthissite.js \
browser_privatebrowsing_geoprompt.js \

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

@ -0,0 +1,90 @@
/* ***** 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 Private Browsing Tests.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ehsan Akhgari <ehsan@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 ***** */
// This test makes sure that users are prevented from toggling the private
// browsing mode too quickly, hence be proctected from symptoms in bug 526194.
function test() {
// initialization
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
let pbCmd = document.getElementById("Tools:PrivateBrowsing");
waitForExplicitFinish();
let observer = {
pass: 1,
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "private-browsing":
setTimeout(function() {
ok(document.getElementById("Tools:PrivateBrowsing").hasAttribute("disabled"),
"The private browsing command should be disabled immediately after the mode switch");
}, 0);
break;
case "private-browsing-transition-complete":
if (this.pass++ == 1) {
setTimeout(function() {
ok(!pbCmd.hasAttribute("disabled"),
"The private browsing command should be re-enabled after entering the private browsing mode");
pb.privateBrowsingEnabled = false;
}, 100);
}
else {
setTimeout(function() {
ok(!pbCmd.hasAttribute("disabled"),
"The private browsing command should be re-enabled after exiting the private browsing mode");
os.removeObserver(observer, "private-browsing");
os.removeObserver(observer, "private-browsing-transition-complete");
finish();
}, 100);
}
break;
}
}
};
os.addObserver(observer, "private-browsing", false);
os.addObserver(observer, "private-browsing-transition-complete", false);
pb.privateBrowsingEnabled = true;
}

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

@ -44,9 +44,6 @@ function do_test() {
getService(Ci.nsIObserverService);
var pb = Cc[PRIVATEBROWSING_CONTRACT_ID].
getService(Ci.nsIPrivateBrowsingService);
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
var expectedQuitting;
var called = 0;
@ -69,7 +66,6 @@ function do_test() {
// finish up the test
if (expectedQuitting) {
os.removeObserver(this, kPrivateBrowsingNotification);
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
do_test_finished();
}
}

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

@ -42,6 +42,7 @@ const Cu = Components.utils;
const kPrivateBrowsingNotification = "private-browsing";
const kPrivateBrowsingCancelVoteNotification = "private-browsing-cancel-vote";
const kPrivateBrowsingTransitionCompleteNotification = "private-browsing-transition-complete";
const kEnter = "enter";
const kExit = "exit";
@ -94,6 +95,11 @@ if (!profileDir) {
dirSvc.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider);
}
// Do not attempt to restore any session since we don't have any windows
Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch).
setBoolPref("browser.privatebrowsing.keep_current_session", true);
/**
* Removes any files that could make our tests fail.
*/

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

@ -0,0 +1,41 @@
/* ***** 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 Private Browsing Tests.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ehsan Akhgari <ehsan@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 ***** */
// Be neat: clear the pref that we have set
Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch).
clearUserPref("browser.privatebrowsing.keep_current_session");

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

@ -45,9 +45,6 @@ function run_test_on_service() {
// initialization
var os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
// the contract ID should be available
do_check_true(PRIVATEBROWSING_CONTRACT_ID in Cc);
@ -220,7 +217,27 @@ function run_test_on_service() {
];
do_check_eq(observer.notifications.join(","), reference_order.join(","));
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
// make sure that the private browsing transition complete notification is
// raised correctly.
observer = {
observe: function(aSubject, aTopic, aData) {
this.notifications.push(aTopic + " " + aData);
},
notifications: []
};
os.addObserver(observer, kPrivateBrowsingNotification, false);
os.addObserver(observer, kPrivateBrowsingTransitionCompleteNotification, false);
pb.privateBrowsingEnabled = true;
pb.privateBrowsingEnabled = false;
os.removeObserver(observer, kPrivateBrowsingNotification);
os.removeObserver(observer, kPrivateBrowsingTransitionCompleteNotification);
reference_order = [
kPrivateBrowsingNotification + " " + kEnter,
kPrivateBrowsingTransitionCompleteNotification + " ",
kPrivateBrowsingNotification + " " + kExit,
kPrivateBrowsingTransitionCompleteNotification + " ",
];
do_check_eq(observer.notifications.join(","), reference_order.join(","));
}
// Support running tests on both the service itself and its wrapper

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

@ -63,28 +63,21 @@ function run_test_on_service() {
// initialization
var pb = Cc[PRIVATEBROWSING_CONTRACT_ID].
getService(Ci.nsIPrivateBrowsingService);
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
try {
// about:privatebrowsing should be available before entering the private mode
do_check_true(is_about_privatebrowsing_available());
// about:privatebrowsing should be available before entering the private mode
do_check_true(is_about_privatebrowsing_available());
// enter the private browsing mode
pb.privateBrowsingEnabled = true;
// enter the private browsing mode
pb.privateBrowsingEnabled = true;
// about:privatebrowsing should be available inside the private mode
do_check_true(is_about_privatebrowsing_available());
// about:privatebrowsing should be available inside the private mode
do_check_true(is_about_privatebrowsing_available());
// exit the private browsing mode
pb.privateBrowsingEnabled = false;
// exit the private browsing mode
pb.privateBrowsingEnabled = false;
// about:privatebrowsing should be available after leaving the private mode
do_check_true(is_about_privatebrowsing_available());
} finally {
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
}
// about:privatebrowsing should be available after leaving the private mode
do_check_true(is_about_privatebrowsing_available());
}
// Support running tests on both the service itself and its wrapper

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

@ -39,10 +39,6 @@
// when entering and leaving the private browsing mode.
function run_test_on_service() {
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
var pb = Cc[PRIVATEBROWSING_CONTRACT_ID].
getService(Ci.nsIPrivateBrowsingService);
@ -108,8 +104,6 @@ function run_test_on_service() {
}
} catch (e) {
do_throw("Unexpected exception while testing HTTP auth manager: " + e);
} finally {
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
}
}

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

@ -43,6 +43,13 @@ function run_test_on_service()
let Cu = Components.utils;
Cu.import("resource:///modules/openLocationLastURL.jsm");
function clearHistory() {
// simulate clearing the private data
Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService).
notifyObservers(null, "browser:purge-session-history", "");
}
let pb = Cc[PRIVATEBROWSING_CONTRACT_ID].
getService(Ci.nsIPrivateBrowsingService);
let pref = Cc["@mozilla.org/preferences-service;1"].
@ -64,6 +71,10 @@ function run_test_on_service()
gOpenLocationLastURL.value = url2;
do_check_eq(gOpenLocationLastURL.value, url2);
clearHistory();
do_check_eq(gOpenLocationLastURL.value, "");
gOpenLocationLastURL.value = url2;
pb.privateBrowsingEnabled = true;
do_check_eq(gOpenLocationLastURL.value, "");
@ -76,6 +87,15 @@ function run_test_on_service()
pb.privateBrowsingEnabled = false;
do_check_eq(gOpenLocationLastURL.value, url2);
pb.privateBrowsingEnabled = true;
gOpenLocationLastURL.value = url1;
do_check_neq(gOpenLocationLastURL.value, "");
clearHistory();
do_check_eq(gOpenLocationLastURL.value, "");
pb.privateBrowsingEnabled = false;
do_check_eq(gOpenLocationLastURL.value, "");
}
// Support running tests on both the service itself and its wrapper

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

@ -44,9 +44,6 @@ function run_test_on_service() {
getService(Ci.nsIPrivateBrowsingService);
var os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
var observer = {
observe: function (aSubject, aTopic, aData) {
@ -66,7 +63,6 @@ function run_test_on_service() {
do_check_eq(observer.events.length, 0);
os.removeObserver(observer, "network:offline-status-changed", false);
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
}
// Support running tests on both the service itself and its wrapper

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

@ -110,6 +110,10 @@ const CAPABILITIES = [
"DNSPrefetch", "Auth"
];
#ifndef XP_WIN
#define BROKEN_WM_Z_ORDER
#endif
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
function debug(aMsg) {
@ -182,6 +186,9 @@ SessionStoreService.prototype = {
// whether we clearing history on shutdown
_clearingOnShutdown: false,
// List of windows that are being closed during setBrowserState.
_closingWindows: [],
#ifndef XP_MACOSX
// whether the last window was closed and should be restored
_restoreLastWindow: false,
@ -336,6 +343,14 @@ SessionStoreService.prototype = {
}, false);
break;
case "domwindowclosed": // catch closed windows
if (this._closingWindows.length > 0) {
let index = this._closingWindows.indexOf(aSubject);
if (index != -1) {
this._closingWindows.splice(index, 1);
if (this._closingWindows.length == 0)
this._sendRestoreCompletedNotifications(true);
}
}
this.onClose(aSubject);
break;
case "quit-application-requested":
@ -900,19 +915,21 @@ SessionStoreService.prototype = {
return;
}
// close all other browser windows
this._forEachBrowserWindow(function(aWindow) {
if (aWindow != window) {
aWindow.close();
}
});
// make sure closed window data isn't kept
this._closedWindows = [];
// determine how many windows are meant to be restored
this._restoreCount = state.windows ? state.windows.length : 0;
var self = this;
// close all other browser windows
this._forEachBrowserWindow(function(aWindow) {
if (aWindow != window) {
self._closingWindows.push(aWindow);
aWindow.close();
}
});
// restore to the given state
this.restoreWindow(window, state, true);
},
@ -1191,15 +1208,16 @@ SessionStoreService.prototype = {
tabData.entries[0] = { url: browser.currentURI.spec };
tabData.index = 1;
}
else if (browser.currentURI.spec == "about:blank" &&
browser.userTypedValue) {
// This can happen if the user opens a lot of tabs simultaneously and we
// try to save state before all of them are properly loaded. If we crash
// then we get a bunch of about:blank tabs which isn't what we want.
tabData.entries[0] = { url: browser.userTypedValue };
tabData.index = 1;
// If there is a userTypedValue set, then either the user has typed something
// in the URL bar, or a new tab was opened with a URI to load. userTypedClear
// is used to indicate whether the tab was in some sort of loading state with
// userTypedValue.
if (browser.userTypedValue) {
tabData.userTypedValue = browser.userTypedValue;
tabData.userTypedClear = browser.userTypedClear;
}
var disallow = [];
for (var i = 0; i < CAPABILITIES.length; i++)
if (!browser.docShell["allow" + CAPABILITIES[i]])
@ -2122,7 +2140,15 @@ SessionStoreService.prototype = {
browser.__SS_restore = this.restoreDocument_proxy;
browser.addEventListener("load", browser.__SS_restore, true);
}
// Handle userTypedValue. Setting userTypedValue seems to update gURLbar
// as needed. Calling loadURI will cancel form filling in restoreDocument_proxy
if (tabData.userTypedValue) {
browser.userTypedValue = tabData.userTypedValue;
if (tabData.userTypedClear)
browser.loadURI(tabData.userTypedValue, null, null, true);
}
aWindow.setTimeout(function(){ _this.restoreHistory(aWindow, aTabs, aTabData, aIdMap); }, 0);
},
@ -2598,7 +2624,7 @@ SessionStoreService.prototype = {
while (windowsEnum.hasMoreElements()) {
var window = windowsEnum.getNext();
if (window.__SSi) {
if (window.__SSi && !window.closed) {
aFunc.call(this, window);
}
}
@ -2609,9 +2635,34 @@ SessionStoreService.prototype = {
* @returns Window reference
*/
_getMostRecentBrowserWindow: function sss_getMostRecentBrowserWindow() {
var windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
return windowMediator.getMostRecentWindow("navigator:browser");
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
if (!win)
return null;
if (!win.closed)
return win;
#ifdef BROKEN_WM_Z_ORDER
win = null;
var windowsEnum = wm.getEnumerator("navigator:browser");
// this is oldest to newest, so this gets a bit ugly
while (windowsEnum.hasMoreElements()) {
let nextWin = windowsEnum.getNext();
if (!nextWin.closed)
win = nextWin;
}
return win;
#else
var windowsEnum = wm.getZOrderDOMWindowEnumerator("navigator:browser", true);
while (windowsEnum.hasMoreElements()) {
win = windowsEnum.getNext();
if (!win.closed)
return win;
}
return null;
#endif
},
/**
@ -2825,16 +2876,17 @@ SessionStoreService.prototype = {
return jsonString;
},
_sendRestoreCompletedNotifications: function sss_sendRestoreCompletedNotifications() {
if (this._restoreCount) {
_sendRestoreCompletedNotifications:
function sss_sendRestoreCompletedNotifications(aOnWindowClose) {
if (this._restoreCount && !aOnWindowClose)
this._restoreCount--;
if (this._restoreCount == 0) {
// This was the last window restored at startup, notify observers.
this._observerService.notifyObservers(null,
this._browserSetState ? NOTIFY_BROWSER_STATE_RESTORED : NOTIFY_WINDOWS_RESTORED,
"");
this._browserSetState = false;
}
if (this._restoreCount == 0 && this._closingWindows.length == 0) {
// This was the last window restored at startup, notify observers.
this._observerService.notifyObservers(null,
this._browserSetState ? NOTIFY_BROWSER_STATE_RESTORED : NOTIFY_WINDOWS_RESTORED,
"");
this._browserSetState = false;
}
},

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

@ -45,9 +45,6 @@ relativesrcdir = browser/components/sessionstore/test/browser
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
# browser_477657.js is disabled, because it's unreliable (bug 482975).
# browser_480148.js is disabled, because it breaks browser_420786.js (see bug 483382).
_BROWSER_TEST_FILES = \
browser_248970_a.js \
browser_248970_b.js \
@ -97,6 +94,8 @@ _BROWSER_TEST_FILES = \
browser_466937_sample.html \
browser_476161.js \
browser_476161_sample.html \
browser_477657.js \
browser_480148.js \
browser_480893.js \
browser_483330.js \
browser_485482.js \
@ -108,6 +107,7 @@ _BROWSER_TEST_FILES = \
browser_493467.js \
browser_495495.js \
browser_514751.js \
browser_522545.js \
browser_526613.js \
$(NULL)

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

@ -104,7 +104,22 @@
* nsSessionStore restore a window next time it gets a chance and will post
* notifications. The latter won't.
*/
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
waitForExplicitFinish();
// Some urls that might be opened in tabs and/or popups
@ -217,9 +232,9 @@ function test() {
newWin.removeEventListener("load", arguments.callee, false);
newWin.gBrowser.addEventListener("load", function(aEvent) {
newWin.gBrowser.removeEventListener("load", arguments.callee, true);
for each (let url in TEST_URLS) {
TEST_URLS.forEach(function (url) {
newWin.gBrowser.addTab(url);
}
});
executeSoon(function() testFn(newWin));
}, true);
@ -498,7 +513,11 @@ function test() {
// Mac tests
testMacNotifications(
function() testNotificationCount(
function() cleanupTestsuite() + finish()
function() {
cleanupTestsuite();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}
)
);
}
@ -510,7 +529,11 @@ function test() {
function() testOpenCloseOnlyPopup(
function() testOpenCloseRestoreFromPopup (
function() testNotificationCount(
function() cleanupTestsuite() + finish()
function() {
cleanupTestsuite();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}
)
)
)

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

@ -35,6 +35,18 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 394759 **/
@ -56,9 +68,8 @@ function test() {
gPrefService.setIntPref("browser.sessionstore.max_windows_undo", max_windows_undo + 1);
let closedWindowCount = ss.getClosedWindowCount();
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", testURL);
let newWin = openDialog(location, "", "chrome,all,dialog=no", testURL);
newWin.addEventListener("load", function(aEvent) {
newWin.removeEventListener("load", arguments.callee, false);
newWin.gBrowser.addEventListener("load", function(aEvent) {
newWin.gBrowser.removeEventListener("load", arguments.callee, true);
@ -87,7 +98,6 @@ function test() {
"The reopened window was removed from Recently Closed Windows");
newWin2.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, false);
newWin2.gBrowser.addEventListener("SSTabRestored", function(aEvent) {
newWin2.gBrowser.removeEventListener("SSTabRestored", arguments.callee, true);
@ -142,18 +152,17 @@ function test() {
let settings = "chrome,dialog=no," +
(winData.isPopup ? "all=no" : "all");
let url = "http://window" + windowsToOpen.length + ".example.com";
let window = openDialog(location, "_blank", settings, url);
window.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
window.gBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
let win = openDialog(location, "", settings, url);
win.addEventListener("load", function(aEvent) {
win.gBrowser.addEventListener("load", function(aEvent) {
win.gBrowser.removeEventListener("load", arguments.callee, true);
// the window _should_ have state with a tab of url, but it doesn't
// always happend before window.close(). addTab ensure we don't treat
// this window as a stateless window
window.gBrowser.addTab();
win.gBrowser.addTab();
executeSoon(function() {
window.close();
win.close();
executeSoon(function() {
openWindowRec(windowsToOpen, expectedResults, recCallback);
});
@ -191,6 +200,12 @@ function test() {
// backup old state
let oldState = ss.getBrowserState();
let oldState_wins = JSON.parse(oldState).windows.length;
if (oldState_wins != 1) {
ok(false, "oldState in test_purge has " + oldState_wins + " windows instead of 1");
info(oldState);
}
// create a new state for testing
const REMEMBER = Date.now(), FORGET = Math.random();
let testState = {
@ -257,30 +272,30 @@ function test() {
let closedWindowData = JSON.parse(ss.getClosedWindowData());
// First set of tests for _closedWindows[0] - tests basics
let window = closedWindowData[0];
is(window.tabs.length, 1, "1 tab was removed");
is(countOpenTabsByTitle(window.tabs, FORGET), 0,
let win = closedWindowData[0];
is(win.tabs.length, 1, "1 tab was removed");
is(countOpenTabsByTitle(win.tabs, FORGET), 0,
"The correct tab was removed");
is(countOpenTabsByTitle(window.tabs, REMEMBER), 1,
is(countOpenTabsByTitle(win.tabs, REMEMBER), 1,
"The correct tab was remembered");
is(window.selected, 1, "Selected tab has changed");
is(window.title, REMEMBER, "The window title was correctly updated");
is(win.selected, 1, "Selected tab has changed");
is(win.title, REMEMBER, "The window title was correctly updated");
// Test more complicated case
window = closedWindowData[1];
is(window.tabs.length, 3, "2 tabs were removed");
is(countOpenTabsByTitle(window.tabs, FORGET), 0,
win = closedWindowData[1];
is(win.tabs.length, 3, "2 tabs were removed");
is(countOpenTabsByTitle(win.tabs, FORGET), 0,
"The correct tabs were removed");
is(countOpenTabsByTitle(window.tabs, REMEMBER), 3,
is(countOpenTabsByTitle(win.tabs, REMEMBER), 3,
"The correct tabs were remembered");
is(window.selected, 3, "Selected tab has changed");
is(window.title, REMEMBER, "The window title was correctly updated");
is(win.selected, 3, "Selected tab has changed");
is(win.title, REMEMBER, "The window title was correctly updated");
// Tests handling of _closedTabs
window = closedWindowData[2];
is(countClosedTabsByTitle(window._closedTabs, REMEMBER), 1,
win = closedWindowData[2];
is(countClosedTabsByTitle(win._closedTabs, REMEMBER), 1,
"The correct number of tabs were removed, and the correct ones");
is(countClosedTabsByTitle(window._closedTabs, FORGET), 0,
is(countClosedTabsByTitle(win._closedTabs, FORGET), 0,
"All tabs to be forgotten were indeed removed");
// restore pre-test state
@ -288,9 +303,13 @@ function test() {
executeSoon(callback);
}
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
test_basic(function() {
is(browserWindowsCount(), 1, "number of browser windows after test_basic");
test_behavior(function() {
is(browserWindowsCount(), 1, "number of browser windows after test_behavior");
test_purge(function() {
is(browserWindowsCount(), 1, "number of browser windows after test_purge");
finish();
});
});

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

@ -37,8 +37,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Private Browsing Test for Bug 394759 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
waitForExplicitFinish();
@ -85,8 +98,6 @@ function test() {
}
function continue_test() {
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
// Ensure Private Browsing mode is disabled.
@ -108,21 +119,14 @@ function continue_test() {
value: "uniq" + (++now) },
];
let loadWasCalled = false;
function openWindowAndTest(aTestIndex, aRunNextTestInPBMode) {
info("Opening new window");
let windowObserver = {
observe: function(aSubject, aTopic, aData) {
if (aTopic === "domwindowopened") {
info("New window has been opened");
let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function onLoad(event) {
function onLoad(event) {
win.removeEventListener("load", onLoad, false);
info("New window has been loaded");
win.gBrowser.addEventListener("load", function(aEvent) {
win.gBrowser.removeEventListener("load", arguments.callee, true);
info("New window browser has been loaded");
loadWasCalled = true;
executeSoon(function() {
// Add a tab.
win.gBrowser.addTab();
@ -172,6 +176,7 @@ function continue_test() {
if (aTestIndex == TESTS.length - 1) {
if (gPrefService.prefHasUserValue("browser.sessionstore.interval"))
gPrefService.clearUserPref("browser.sessionstore.interval");
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}
else {
@ -181,21 +186,10 @@ function continue_test() {
});
});
}, true);
}, false);
}
else if (aTopic === "domwindowclosed") {
info("Window closed");
ww.unregisterNotification(this);
if (!loadWasCalled) {
ok(false, "Window was closed before load could fire!");
finish();
}
}
}
};
ww.registerNotification(windowObserver);
}
// Open a window.
openDialog(location, "_blank", "chrome,all,dialog=no", TESTS[aTestIndex].url);
var win = openDialog(location, "", "chrome,all,dialog=no", TESTS[aTestIndex].url);
win.addEventListener("load", onLoad, false);
}
openWindowAndTest(0, true);

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

@ -45,7 +45,7 @@ function test() {
let tab = gBrowser.addTab(testUrl);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
// enable all stylesheets and verify that they're correctly persisted
Array.forEach(tab.linkedBrowser.contentDocument.styleSheets, function(aSS, aIx) {
pendingCount++;
@ -54,7 +54,7 @@ function test() {
let newTab = gBrowser.duplicateTab(tab);
newTab.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
newTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let states = Array.map(newTab.linkedBrowser.contentDocument.styleSheets,
function(aSS) !aSS.disabled);
let correct = states.indexOf(true) == aIx && states.indexOf(true, aIx + 1) == -1;
@ -74,7 +74,7 @@ function test() {
tab.linkedBrowser.markupDocumentViewer.authorStyleDisabled = true;
let newTab = gBrowser.duplicateTab(tab);
newTab.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
newTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
is(newTab.linkedBrowser.markupDocumentViewer.authorStyleDisabled, true,
"disabled all stylesheets");

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

@ -34,9 +34,22 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
// test that cookies are stored and restored correctly by sessionstore,
// bug 423132.
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
// test setup
waitForExplicitFinish();
@ -101,6 +114,7 @@ function test() {
gPrefService.clearUserPref("browser.sessionstore.interval");
cs.removeAll();
newWin.close();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}, true);
}, false);

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

@ -45,7 +45,7 @@ function test() {
let tab = gBrowser.addTab();
tab.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let tabState = { entries: [] };
let max_entries = gPrefService.getIntPref("browser.sessionhistory.max_entries");
@ -54,7 +54,7 @@ function test() {
ss.setTabState(tab, JSON.stringify(tabState));
tab.addEventListener("SSTabRestored", function(aEvent) {
this.removeEventListener("SSTabRestored", arguments.callee, false);
tab.removeEventListener("SSTabRestored", arguments.callee, false);
tabState = eval("(" + ss.getTabState(tab) + ")");
is(tabState.entries.length, max_entries, "session history filled to the limit");
is(tabState.entries[0].url, baseURL + 0, "... but not more");

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

@ -60,15 +60,15 @@ function test() {
// find the data for the newly added tab and delete it
let state = eval(aSubject.data);
for each (let winData in state.windows) {
for each (let tabData in winData.tabs) {
state.windows.forEach(function (winData) {
winData.tabs.forEach(function (tabData) {
if (tabData.extData && uniqueName in tabData.extData &&
tabData.extData[uniqueName] == uniqueValue) {
delete tabData.extData[uniqueName];
valueWasCleaned = true;
}
}
}
});
});
ok(valueWasCleaned, "found and removed the specific tab value");
aSubject.data = uneval(state);

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

@ -51,7 +51,7 @@ function test() {
"browser/components/sessionstore/test/browser/browser_454908_sample.html";
let tab = gBrowser.addTab(testURL);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let doc = tab.linkedBrowser.contentDocument;
for (let id in fieldValues)
doc.getElementById(id).value = fieldValues[id];
@ -60,7 +60,7 @@ function test() {
tab = undoCloseTab();
tab.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let doc = tab.linkedBrowser.contentDocument;
for (let id in fieldValues) {
let node = doc.getElementById(id);

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

@ -36,56 +36,48 @@
function test() {
/** Test for Bug 459906 **/
waitForExplicitFinish();
let testURL = "http://localhost:8888/browser/" +
"browser/components/sessionstore/test/browser/browser_459906_sample.html";
let uniqueValue = "<b>Unique:</b> " + Date.now();
var frameCount = 0;
let tab = gBrowser.addTab(testURL);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
// wait for all frames to load completely
if (frameCount++ < 2)
return;
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let iframes = tab.linkedBrowser.contentWindow.frames;
iframes[1].document.body.innerHTML = uniqueValue;
frameCount = 0;
let tab2 = gBrowser.duplicateTab(tab);
tab2.linkedBrowser.addEventListener("load", function(aEvent) {
// wait for all frames to load (and reload!) completely
if (frameCount++ < 2)
return;
this.removeEventListener("load", arguments.callee, true);
tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
let pass = 0;
const MAX_PASS = 6;
executeSoon(function() {
info("Checking innerHTML, pass: " + (pass + 1));
let iframes = tab2.linkedBrowser.contentWindow.frames;
if (iframes[1].document.body.innerHTML != uniqueValue &&
++pass <= MAX_PASS) {
setTimeout(arguments.callee, 500);
return;
}
is(iframes[1].document.body.innerHTML, uniqueValue,
"rich textarea's content correctly duplicated");
let innerDomain = null;
try {
innerDomain = iframes[0].document.domain;
}
catch (ex) { /* throws for chrome: documents */ }
is(innerDomain, "localhost", "XSS exploit prevented!");
// clean up
gBrowser.removeTab(tab2);
gBrowser.removeTab(tab);
finish();
});
}, true);

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

@ -8,8 +8,14 @@
<iframe></iframe>
<script type="application/javascript">
frames[0].addEventListener("DOMContentLoaded", function() {
frames[0].removeEventListener("DOMContentLoaded", arguments.callee, false);
var loadCount = 0;
frames[0].addEventListener("DOMContentLoaded", handleLoad, false);
frames[1].addEventListener("DOMContentLoaded", handleLoad, false);
function handleLoad() {
if (++loadCount < 2)
return;
frames[0].removeEventListener("DOMContentLoaded", handleLoad, false);
frames[1].removeEventListener("DOMContentLoaded", handleLoad, false);
frames[0].document.designMode = "on";
frames[0].document.__defineGetter__("designMode", function() {
// inject a cross domain file ...
@ -26,11 +32,11 @@
r.overrideMimeType("text/plain");
r.send(null);
}
return "on";
});
frames[1].document.designMode = "on";
}, false);
};
</script>
</body>

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

@ -35,8 +35,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 461634 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
// test setup
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
@ -65,9 +78,8 @@ function test() {
}
// open a window and add the above closed tab list
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
let newWin = open(location, "", "chrome,all");
newWin.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, false);
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
@ -103,6 +115,7 @@ function test() {
// clean up
newWin.close();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
finish();
}, false);

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

@ -36,37 +36,36 @@
function test() {
/** Test for Bug 461743 **/
waitForExplicitFinish();
let testURL = "http://localhost:8888/browser/" +
"browser/components/sessionstore/test/browser/browser_461743_sample.html";
let frameCount = 0;
let tab = gBrowser.addTab(testURL);
info("New tab added");
tab.linkedBrowser.addEventListener("load", function(aEvent) {
info("New tab loaded");
this.removeEventListener("load", arguments.callee, true);
executeSoon(function() {
let tab2 = gBrowser.duplicateTab(tab);
info("Duplicated tab");
tab2.linkedBrowser.addEventListener("461743", function(aEvent) {
tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true);
is(aEvent.data, "done", "XSS injection was attempted");
executeSoon(function() {
let iframes = tab2.linkedBrowser.contentWindow.frames;
let innerHTML = iframes[1].document.body.innerHTML;
isnot(innerHTML, Components.utils.reportError.toString(),
"chrome access denied!");
// clean up
gBrowser.removeTab(tab2);
gBrowser.removeTab(tab);
finish();
});
}, true, true);
});
// Wait for all frames to load completely.
if (frameCount++ < 2)
return;
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let tab2 = gBrowser.duplicateTab(tab);
tab2.linkedBrowser.addEventListener("461743", function(aEvent) {
tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true);
is(aEvent.data, "done", "XSS injection was attempted");
executeSoon(function() {
let iframes = tab2.linkedBrowser.contentWindow.frames;
let innerHTML = iframes[1].document.body.innerHTML;
isnot(innerHTML, Components.utils.reportError.toString(),
"chrome access denied!");
// Clean up.
gBrowser.removeTab(tab2);
gBrowser.removeTab(tab);
finish();
});
}, true, true);
}, true);
}

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

@ -10,17 +10,25 @@
<script type="application/javascript">
var chromeUrl = "chrome://global/content/mozilla.xhtml";
var exploitUrl = "javascript:try { document.body.innerHTML = Components.utils.reportError; } catch (ex) { }";
window.onload = function() {
var loadCount = 0;
frames[0].addEventListener("DOMContentLoaded", handleLoad, false);
frames[1].addEventListener("DOMContentLoaded", handleLoad, false);
function handleLoad() {
if (++loadCount < 2)
return;
frames[0].removeEventListener("DOMContentLoaded", handleLoad, false);
frames[1].removeEventListener("DOMContentLoaded", handleLoad, false);
var flip = 0;
MutationEvent.prototype.toString = function() {
return flip++ == 0 ? chromeUrl : exploitUrl;
};
var href = Components.lookupMethod(frames[1].location, "href");
var loadChrome = { handleEvent: href };
var loadExploit = { handleEvent: href };
function delay() {
var xhr = new XMLHttpRequest();
xhr.open("GET", location.href, false);
@ -35,12 +43,12 @@
frames[0].document.removeEventListener("DOMNodeInserted", loadExploit, true);
frames[0].document.removeEventListener("DOMNodeInserted", done, true);
}
frames[0].document.addEventListener("DOMNodeInserted", loadChrome, true);
frames[0].document.addEventListener("DOMNodeInserted", delay, true);
frames[0].document.addEventListener("DOMNodeInserted", loadExploit, true);
frames[0].document.addEventListener("DOMNodeInserted", done, true);
frames[0].document.designMode = "on";
};
</script>

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

@ -48,7 +48,7 @@ function test() {
// wait for all frames to load completely
if (frameCount++ < 3)
return;
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
function typeText(aTextField, aValue) {
aTextField.value = aValue;
@ -69,7 +69,7 @@ function test() {
// wait for all frames to load (and reload!) completely
if (frameCount++ < 4)
return;
this.removeEventListener("load", arguments.callee, true);
tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
let win = tab2.linkedBrowser.contentWindow;
isnot(win.frames[0].document.getElementById("original").value, uniqueValue,

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

@ -48,7 +48,7 @@ function test() {
// wait for all frames to load completely
if (frameCount++ < 5)
return;
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
function typeText(aTextField, aValue) {
aTextField.value = aValue;
@ -69,7 +69,7 @@ function test() {
// wait for all frames to load completely
if (frameCount++ < 5)
return;
this.removeEventListener("load", arguments.callee, true);
tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
let doc = tab2.linkedBrowser.contentDocument;
let win = tab2.linkedBrowser.contentWindow;

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

@ -34,8 +34,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 464199 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
// test setup
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
@ -73,9 +86,8 @@ function test() {
aClosedTabList.filter(function(aData) aData.title == aTitle).length;
// open a window and add the above closed tab list
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
let newWin = open(location, "", "chrome,all");
newWin.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, false);
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
@ -103,6 +115,7 @@ function test() {
// clean up
newWin.close();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
if (gPrefService.prefHasUserValue("browser.sessionstore.max_tabs_undo"))
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
finish();

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

@ -34,8 +34,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 465223 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
// test setup
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
@ -49,7 +62,6 @@ function test() {
// open a window and set a value on it
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
newWin.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, false);
ss.setWindowValue(newWin, uniqueKey1, uniqueValue1);
let newState = { windows: [{ tabs:[{ entries: [] }], extData: {} }] };
@ -75,6 +87,7 @@ function test() {
// clean up
newWin.close();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}, false);
}

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

@ -45,14 +45,14 @@ function test() {
let tab = gBrowser.addTab(testURL);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let doc = tab.linkedBrowser.contentDocument;
doc.getElementById("reverse_thief").value = "/home/user/secret2";
doc.getElementById("bystander").value = testPath;
let tab2 = gBrowser.duplicateTab(tab);
tab2.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
doc = tab2.linkedBrowser.contentDocument;
is(doc.getElementById("thief").value, "",
"file path wasn't set to text field value");

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

@ -43,7 +43,7 @@ function test() {
"browser/components/sessionstore/test/browser/browser_476161_sample.html";
let tab = gBrowser.addTab(testURL);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let doc = tab.linkedBrowser.contentDocument;
doc.getElementById("modify1").value += Math.random();
@ -51,7 +51,7 @@ function test() {
let tab2 = gBrowser.duplicateTab(tab);
tab2.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
let doc = tab2.linkedBrowser.contentDocument;
let changed = doc.getElementById("changed").textContent.trim().split();

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

@ -34,15 +34,31 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 477657 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
// Test fails randomly on OS X (bug 482975)
if ("nsILocalFileMac" in Ci)
return;
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
waitForExplicitFinish();
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
newWin.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, false);
let newState = { windows: [{
tabs: [{ entries: [] }],
_closedTabs: [{
@ -88,6 +104,7 @@ function test() {
"the window was explicitly unmaximized");
newWin.close();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}, 0);
}, 0);

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

@ -34,8 +34,24 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 484108 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
waitForExplicitFinish();
// builds the tests state based on a few parameters
function buildTestState(num, selected) {
@ -65,10 +81,6 @@ function test() {
return expected;
}
// test setup
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
waitForExplicitFinish();
// the number of tests we're running
let numTests = 4;
let completedTests = 0;
@ -111,6 +123,7 @@ function test() {
if (++completedTests == numTests) {
this.window.removeEventListener("load", this, false);
this.window.removeEventListener("SSTabRestoring", this, false);
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}
},
@ -153,4 +166,4 @@ function test() {
runTest(4, 13, 11, 6, [10, 7, 8, 9, 11, 12, 0, 1, 2, 3, 4, 5, 6]);
// finish() is run by the last test to finish, so no cleanup down here
}
}

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

@ -46,13 +46,13 @@ function test() {
gBrowser.selectedTab = tab;
let browser = tab.linkedBrowser;
browser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
browser.removeEventListener("load", arguments.callee, true);
let doc = browser.contentDocument;
// click on the "Start New Session" button after about:sessionrestore is loaded
doc.getElementById("errorCancel").click();
browser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
browser.removeEventListener("load", arguments.callee, true);
let doc = browser.contentDocument;
is(doc.URL, "about:blank", "loaded page is about:blank");
@ -64,13 +64,13 @@ function test() {
gPrefService.setIntPref("browser.startup.page", 1);
gBrowser.loadURI("about:sessionrestore");
browser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
browser.removeEventListener("load", arguments.callee, true);
let doc = browser.contentDocument;
// click on the "Start New Session" button after about:sessionrestore is loaded
doc.getElementById("errorCancel").click();
browser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
browser.removeEventListener("load", arguments.callee, true);
let doc = browser.contentDocument;
is(doc.URL, homepage, "loaded page is the homepage");

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

@ -45,14 +45,14 @@ function test() {
"browser/components/sessionstore/test/browser/browser_485482_sample.html";
let tab = gBrowser.addTab(testURL);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
let doc = tab.linkedBrowser.contentDocument;
doc.querySelector("input[type=text]").value = uniqueValue;
doc.querySelector("input[type=checkbox]").checked = true;
let tab2 = gBrowser.duplicateTab(tab);
tab2.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
doc = tab2.linkedBrowser.contentDocument;
is(doc.querySelector("input[type=text]").value, uniqueValue,
"generated XPath expression was valid");

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

@ -44,7 +44,7 @@ function test() {
let tab = gBrowser.addTab();
tab.linkedBrowser.addEventListener("load", function(aEvent) {
this.removeEventListener("load", arguments.callee, true);
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
ss.setTabValue(tab, "bug485563", uniqueValue);
let tabState = eval("(" + ss.getTabState(tab) + ")");
is(tabState.extData["bug485563"], uniqueValue,

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

@ -35,8 +35,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 490040 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
@ -154,6 +167,7 @@ function test() {
else {
if (gPrefService.prefHasUserValue("browser.sessionstore.max_windows_undo"))
gPrefService.clearUserPref("browser.sessionstore.max_windows_undo");
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}
}

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

@ -34,8 +34,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 491168 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
// test setup
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
@ -72,6 +85,7 @@ function test() {
is(window.content.document.referrer, REFERRER2, "document.referrer is still correct after closing and reopening the tab.");
gBrowser.removeTab(newTab);
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}, true);
}, true);

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

@ -35,8 +35,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 491577 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
// test setup
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
@ -149,6 +162,7 @@ function test() {
// clean up
newWin.close();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
if (gPrefService.prefHasUserValue("browser.sessionstore.max_windows_undo"))
gPrefService.clearUserPref("browser.sessionstore.max_windows_undo");
finish();

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

@ -34,8 +34,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 493467 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
@ -66,4 +79,5 @@ function test() {
// leading "allow") to nsSessionStore.js's CAPABILITIES array. Thanks.
gBrowser.removeTab(tab);
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
}

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

@ -34,8 +34,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 495495 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
waitForExplicitFinish();
@ -79,7 +92,10 @@ function test() {
testState(state1, {readOnly: false, enablehistory: "true"}, function() {
testState(state2, {readOnly: true, enablehistory: "false"}, function() {
executeSoon(finish);
executeSoon(function () {
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
});
});
});
});

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

@ -34,8 +34,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 514751 (Wallpaper) **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
@ -81,6 +94,7 @@ function test() {
case "domwindowclosed":
ww.unregisterNotification(this);
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
break;
}

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

@ -0,0 +1,319 @@
/* ***** 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 sessionstore test code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Paul OShannessy <paul@oshannessy.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 browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 522545 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
waitForExplicitFinish();
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
function waitForBrowserState(aState, aSetStateCallback) {
let observer = {
observe: function(aSubject, aTopic, aData) {
os.removeObserver(this, "sessionstore-browser-state-restored");
executeSoon(aSetStateCallback);
}
};
os.addObserver(observer, "sessionstore-browser-state-restored", false);
ss.setBrowserState(JSON.stringify(aState));
}
// This tests the following use case:
// User opens a new tab which gets focus. The user types something into the
// address bar, then crashes or quits.
function test_newTabFocused() {
let state = {
windows: [{
tabs: [
{ entries: [{ url: "about:mozilla" }] },
{ entries: [], userTypedValue: "example.com", userTypedClear: 0 }
],
selected: 2
}]
};
waitForBrowserState(state, function() {
let browser = gBrowser.selectedBrowser;
is(browser.currentURI.spec, "about:blank",
"No history entries still sets currentURI to about:blank");
is(browser.userTypedValue, "example.com",
"userTypedValue was correctly restored");
is(browser.userTypedClear, 0,
"userTypeClear restored as expected");
is(gURLBar.value, "example.com",
"Address bar's value correctly restored");
// Change tabs to make sure address bar value gets updated
gBrowser.selectedTab = gBrowser.tabContainer.getItemAtIndex(0);
is(gURLBar.value, "about:mozilla",
"Address bar's value correctly updated");
runNextTest();
});
}
// This tests the following use case:
// User opens a new tab which gets focus. The user types something into the
// address bar, switches back to the first tab, then crashes or quits.
function test_newTabNotFocused() {
let state = {
windows: [{
tabs: [
{ entries: [{ url: "about:mozilla" }] },
{ entries: [], userTypedValue: "example.org", userTypedClear: 0 }
],
selected: 1
}]
};
waitForBrowserState(state, function() {
let browser = gBrowser.getBrowserAtIndex(1);
is(browser.currentURI.spec, "about:blank",
"No history entries still sets currentURI to about:blank");
is(browser.userTypedValue, "example.org",
"userTypedValue was correctly restored");
is(browser.userTypedClear, 0,
"userTypeClear restored as expected");
is(gURLBar.value, "about:mozilla",
"Address bar's value correctly restored");
// Change tabs to make sure address bar value gets updated
gBrowser.selectedTab = gBrowser.tabContainer.getItemAtIndex(1);
is(gURLBar.value, "example.org",
"Address bar's value correctly updated");
runNextTest();
});
}
// This tests the following use case:
// User is in a tab with session history, then types something in the
// address bar, then crashes or quits.
function test_existingSHEnd_noClear() {
let state = {
windows: [{
tabs: [{
entries: [{ url: "about:mozilla" }, { url: "about:config" }],
index: 2,
userTypedValue: "example.com",
userTypedClear: 0
}]
}]
};
waitForBrowserState(state, function() {
let browser = gBrowser.selectedBrowser;
is(browser.currentURI.spec, "about:config",
"browser.currentURI set to current entry in SH");
is(browser.userTypedValue, "example.com",
"userTypedValue was correctly restored");
is(browser.userTypedClear, 0,
"userTypeClear restored as expected");
is(gURLBar.value, "example.com",
"Address bar's value correctly restored to userTypedValue");
runNextTest();
});
}
// This tests the following use case:
// User is in a tab with session history, presses back at some point, then
// types something in the address bar, then crashes or quits.
function test_existingSHMiddle_noClear() {
let state = {
windows: [{
tabs: [{
entries: [{ url: "about:mozilla" }, { url: "about:config" }],
index: 1,
userTypedValue: "example.org",
userTypedClear: 0
}]
}]
};
waitForBrowserState(state, function() {
let browser = gBrowser.selectedBrowser;
is(browser.currentURI.spec, "about:mozilla",
"browser.currentURI set to current entry in SH");
is(browser.userTypedValue, "example.org",
"userTypedValue was correctly restored");
is(browser.userTypedClear, 0,
"userTypeClear restored as expected");
is(gURLBar.value, "example.org",
"Address bar's value correctly restored to userTypedValue");
runNextTest();
});
}
// This test simulates lots of tabs opening at once and then quitting/crashing.
function test_getBrowserState_lotsOfTabsOpening() {
let uris = [];
for (let i = 0; i < 25; i++)
uris.push("http://example.com/" + i);
// We're listening for the first non-"about:blank" load event, which should
// indicate one of the tabs has loaded and the others haven't. So one should
// be in a non-userTypedValue case, while others should still have
// userTypedValue and userTypedClear set.
gBrowser.addEventListener("load", function(aEvent) {
if (gBrowser.currentURI.spec == "about:blank")
return;
gBrowser.removeEventListener("load", arguments.callee, true);
let state = JSON.parse(ss.getBrowserState());
let hasSH = state.windows[0].tabs.some(function(aTab) {
return !("userTypedValue" in aTab) && aTab.entries[0].url;
});
let hasUTV = state.windows[0].tabs.some(function(aTab) {
return aTab.userTypedValue && aTab.userTypedClear && !aTab.entries.length;
});
ok(hasSH, "At least one tab has it's entry in SH");
ok(hasUTV, "At least one tab has a userTypedValue with userTypedClear with no loaded URL");
runNextTest();
}, true);
gBrowser.loadTabs(uris);
}
// This simulates setting a userTypedValue and ensures that just typing in the
// URL bar doesn't set userTypedClear as well.
function test_getBrowserState_userTypedValue() {
let state = {
windows: [{
tabs: [{ entries: [] }]
}]
};
waitForBrowserState(state, function() {
let browser = gBrowser.selectedBrowser;
// Make sure this tab isn't loading and state is clear before we test.
is(browser.userTypedValue, null, "userTypedValue is empty to start");
is(browser.userTypedClear, 0, "userTypedClear is 0 to start");
gURLBar.value = "mozilla.org";
let event = document.createEvent("Events");
event.initEvent("input", true, false);
gURLBar.dispatchEvent(event);
is(browser.userTypedValue, "mozilla.org",
"userTypedValue was set when changing gURLBar.value");
is(browser.userTypedClear, 0,
"userTypedClear was not changed when changing gURLBar.value");
// Now make sure ss gets these values too
let newState = JSON.parse(ss.getBrowserState());
is(newState.windows[0].tabs[0].userTypedValue, "mozilla.org",
"sessionstore got correct userTypedValue");
is(newState.windows[0].tabs[0].userTypedClear, 0,
"sessionstore got correct userTypedClear");
runNextTest();
});
}
// test_getBrowserState_lotsOfTabsOpening tested userTypedClear in a few cases,
// but not necessarily any that had legitimate URIs in the state of loading
// (eg, "http://example.com"), so this test will cover that case.
function test_userTypedClearLoadURI() {
let state = {
windows: [{
tabs: [
{ entries: [], userTypedValue: "http://example.com", userTypedClear: 2 }
]
}]
};
// Set state here and listen for load event because waitForBrowserState
// doesn't guarantee all the tabs have loaded, so the test could continue
// before we're in a testable state. This is important here because of the
// distinction between "http://example.com" and "http://example.com/".
ss.setBrowserState(JSON.stringify(state));
gBrowser.addEventListener("load", function(aEvent) {
if (gBrowser.currentURI.spec == "about:blank")
return;
gBrowser.removeEventListener("load", arguments.callee, true);
let browser = gBrowser.selectedBrowser;
is(browser.currentURI.spec, "http://example.com/",
"userTypedClear=2 caused userTypedValue to be loaded");
is(browser.userTypedValue, null,
"userTypedValue was null after loading a URI");
is(browser.userTypedClear, 0,
"userTypeClear reset to 0");
is(gURLBar.value, "http://example.com/",
"Address bar's value set after loading URI");
runNextTest();
}, true);
}
let tests = [test_newTabFocused, test_newTabNotFocused,
test_existingSHEnd_noClear, test_existingSHMiddle_noClear,
test_getBrowserState_lotsOfTabsOpening,
test_getBrowserState_userTypedValue, test_userTypedClearLoadURI];
let originalState = ss.getBrowserState();
info(JSON.parse(originalState).windows.length);
info(originalState);
function runNextTest() {
if (tests.length) {
tests.shift().call();
} else {
ss.setBrowserState(originalState);
executeSoon(function () {
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
});
}
}
// Run the tests!
runNextTest();
}

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

@ -49,10 +49,20 @@ function test() {
function browserWindowsCount() {
let count = 0;
let e = wm.getXULWindowEnumerator("navigator:browser");
let e = wm.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
++count;
e.getNext();
let win = e.getNext();
if (!win.closed) {
++count;
if (win != window) {
try {
var tabs = win.gBrowser.mTabs.length;
} catch (e) {
info(e);
}
info("secondary window: " + [win.document.readyState, win.content.location, tabs]);
}
}
}
return count;
@ -82,14 +92,21 @@ function test() {
if (this.pass++ == 1) {
is(browserWindowsCount(), 2, "Two windows should exist at this point");
// executeSoon is needed here in order to let the first window be focused
// (see above)
executeSoon(function() {
ss.setBrowserState(oldState);
});
// let the first window be focused (see above)
function pollMostRecentWindow() {
if (wm.getMostRecentWindow("navigator:browser") == window) {
ss.setBrowserState(oldState);
} else {
info("waiting for the current window to become active");
setTimeout(pollMostRecentWindow, 0);
}
}
window.focus(); //XXX Why is this needed?
pollMostRecentWindow();
}
else {
is(browserWindowsCount(), 1, "Only one window should exist after cleanup");
ok(!window.closed, "Restoring the old state should have left this window open");
os.removeObserver(this, "sessionstore-browser-state-restored");
finish();
}

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

@ -1,22 +1,9 @@
const Ci = Components.interfaces;
const Cc = Components.classes;
const DG_BACKGROUND = "/desktop/gnome/background"
const DG_IMAGE_KEY = DG_BACKGROUND + "/picture_filename";
const DG_OPTION_KEY = DG_BACKGROUND + "/picture_options";
const DG_DRAW_BG_KEY = DG_BACKGROUND + "/draw_background";
var testPage;
function url(spec) {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
return ios.newURI(spec, null, null);
}
function onPageLoad() {
testPage.events.removeListener("load", onPageLoad);
var bs = Cc["@mozilla.org/intl/stringbundle;1"].
getService(Ci.nsIStringBundleService);
var brandName = bs.createBundle("chrome://branding/locale/brand.properties").
@ -49,7 +36,7 @@ function onPageLoad() {
var prevOptionKey = gconf.getString(DG_OPTION_KEY);
var prevDrawBgKey = gconf.getBool(DG_DRAW_BG_KEY);
var image = testPage.document.getElementsByTagName("img")[0];
var image = content.document.images[0];
function checkWallpaper(position, expectedGConfPosition) {
shell.setDesktopBackground(image, position);
@ -72,10 +59,10 @@ function onPageLoad() {
gconf.setBool(DG_DRAW_BG_KEY, prevDrawBgKey);
wpFile.remove(false);
if (wpFileBackup.exists()) {
wpFileBackup.moveTo(null, wpFile.leafName);
}
testPage.close();
if (wpFileBackup.exists())
wpFileBackup.moveTo(null, wpFile.leafName);
gBrowser.removeCurrentTab();
finish();
}
@ -84,15 +71,12 @@ function test() {
getService(Ci.nsIXULRuntime).OS;
// This test is Linux specific for now
if (osString != "Linux") {
finish();
if (osString != "Linux")
return;
}
testPage = Application.activeWindow.open(url("about:blank"));
testPage.events.addListener("load", onPageLoad);
testPage.load(url("about:logo"));
testPage.focus();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", onPageLoad, true);
content.location = "about:logo";
waitForExplicitFinish();
}

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

@ -505,3 +505,8 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/components/FastStartup.js
#endif
#endif
; [OS/2]
#ifdef XP_OS2
@BINPATH@/MozSounds.cmd
#endif

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

@ -585,6 +585,8 @@ res/viewsource.css
res/mathml.css
res/loading-image.png
res/broken-image.png
res/loading-image.gif
res/broken-image.gif
res/html/gopher-audio.gif
res/html/gopher-binary.gif
res/html/gopher-find.gif
@ -638,8 +640,6 @@ init.d/README
redo-prebinding.sh
res/viewer.properties
res/bloatcycle.html
res/broken-image.gif
res/loading-image.gif
components/browsersearch.xpt
components/nsResetPref.js
plugins/Default Plugin.plugin/Contents/Info.plist
@ -653,6 +653,7 @@ plugins/Default Plugin.plugin/Contents/Resources/English.lproj/InfoPlist.strings
../Plug-Ins/PrintPDE.plugin/Contents/Resources/English.lproj/PrintPDE.nib/classes.nib
../Plug-Ins/PrintPDE.plugin/Contents/Resources/English.lproj/PrintPDE.nib/info.nib
../Plug-Ins/PrintPDE.plugin/Contents/Resources/English.lproj/PrintPDE.nib/objects.xib
../Resources/firefox-bin.rsrc
res/cursors/CVS/Entries
res/cursors/CVS/Repository
res/cursors/CVS/Root
@ -748,6 +749,7 @@ components/necko_socket.xpt
components/necko_strconv.xpt
components/necko_viewsource.xpt
components/necko_wifi.xpt
components/oji.xpt
components/parentalcontrols.xpt
components/pipboot.xpt
components/pipnss.xpt
@ -804,6 +806,7 @@ run-mozilla.sh
firefox
dependentlibs.list
components/nsProgressDialog.js
libwidget.rsrc
#endif
#ifdef XP_UNIX
#ifndef XP_MACOSX
@ -812,6 +815,8 @@ chrome/icons/default/default.xpm
dictionaries/PL.dic
dictionaries/PL.aff
libjemalloc.so
icons/mozicon16.xpm
icons/mozicon50.xpm
#endif
#endif
#ifdef XP_WIN
@ -838,3 +843,4 @@ components/brwsrcmp.dll
components/nsUpdateService.js
components/nsUpdateServiceStub.js
#endif
old-homepage-default.properties

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

@ -22,8 +22,8 @@
<!ENTITY helpReleaseNotes.label "Release Notes">
<!ENTITY helpReleaseNotes.accesskey "N">
<!ENTITY helpTroubleshooting.label "Troubleshooting Information">
<!ENTITY helpTroubleshooting.accesskey "T">
<!ENTITY helpTroubleshootingInfo.label "Troubleshooting Information">
<!ENTITY helpTroubleshootingInfo.accesskey "T">
<!ENTITY updateCmd.label "Check for Updates…">

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

@ -2,7 +2,7 @@
<ShortName>Yahoo</ShortName>
<Description>Yahoo Search</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQAJECAP8AAAAAAP///wAAACH5BAEAAAIALAAAAAAQABAAAAIplI+py+0NogQuyBDEnEd2kHkfFWUamEzmpZSfmaIHPHrRguUm/fT+UwAAOw==</Image>
<Image width="16" height="16">data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbgJqAIoCdgCaAnoAnhKCAKYijgCuLpIAskKeALpSpgC+Yq4AzHy8ANqezgDmvt4A7tLqAPz5+wD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKlRFIoABWAKERERE6ADcKMzzu2hOgAAhERK8REWCWBERE36ERMHMEREvo6iEgY6hEn6Pu0mAzqkz/xjMzoDNwpERERDoAMzAKlERIoAAzMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAA//8AAP//AADAOQAAgBkAAAAPAAAACQAAAAkAAAAIAAAACAAAAAgAAIAYAADAOAAA//8AAP//AAD//wAA</Image>
<Url type="application/x-suggestions+json" method="GET"
template="http://ff.search.yahoo.com/gossip?output=fxjson&amp;command={searchTerms}" />
<Url type="text/html" method="GET" template="http://search.yahoo.com/search">

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

@ -1268,7 +1268,9 @@ tabpanels {
}
.tabs-closebutton > .toolbarbutton-icon {
margin: 0;
/* XXX Buttons have padding in widget/ that we don't want here but can't override with good CSS, so we must
use evil CSS to give the impression of smaller content */
margin: -2px;
}
/* Tabbrowser arrowscrollbox arrows */

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

@ -46,25 +46,6 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");
#urlbar:-moz-lwtheme:not([focused="true"]),
.searchbar-textbox:-moz-lwtheme:not([focused="true"]) {
opacity: .85;
}
.tabbrowser-tab:-moz-lwtheme[selected="true"] {
text-shadow: none;
}
.tabbrowser-tabs:-moz-lwtheme {
-moz-appearance: none;
background: none;
border-style: none;
}
.tabbrowser-tab:-moz-lwtheme:not([selected="true"]) {
color: inherit;
}
#menubar-items {
-moz-box-orient: vertical; /* for flex hack */
}
@ -77,7 +58,7 @@
min-height: 24px;
}
#navigator-toolbox:-moz-system-metric(windows-default-theme) {
#navigator-toolbox:-moz-system-metric(windows-default-theme):not(:-moz-lwtheme) {
padding-bottom: 1px; /* uxtheme border drawing fix/hack */
}
@ -229,15 +210,6 @@ toolbar[mode="full"] .toolbarbutton-menubutton-button {
padding: 5px !important;
}
toolbar[iconsize="large"][mode="icons"] .toolbarbutton-1:-moz-system-metric(windows-default-theme),
.toolbarbutton-menubutton-button:-moz-system-metric(windows-default-theme) {
padding: 6px; /* uxtheme border drawing fix/hack */
}
toolbar[iconsize="large"][mode="icons"] .toolbarbutton-1[checked="true"]:-moz-system-metric(windows-default-theme) {
padding: 6px !important; /* uxtheme border drawing fix/hack */
}
#back-button:-moz-locale-dir(rtl) > .toolbarbutton-icon,
#forward-button:-moz-locale-dir(rtl) > .toolbarbutton-icon,
#back-forward-dropmarker:-moz-locale-dir(rtl) > .toolbarbutton-icon {
@ -884,6 +856,11 @@ toolbar[iconsize="small"] #fullscreen-button:hover:active {
min-width: 7em;
}
#urlbar:-moz-lwtheme:not([focused="true"]),
.searchbar-textbox:-moz-lwtheme:not([focused="true"]) {
opacity: .85;
}
#urlbar:-moz-system-metric(windows-default-theme) {
-moz-appearance: none;
border-width: 1px;
@ -1159,6 +1136,12 @@ statusbarpanel#statusbar-display {
background: -moz-dialog url("chrome://browser/skin/tabbrowser/tabbrowser-tabs-bkgnd.png") repeat-x;
}
.tabbrowser-tabs:-moz-lwtheme {
-moz-appearance: none;
background: none;
border-style: none;
}
.tabbrowser-tabs:-moz-system-metric(touch-enabled) {
min-height: .81cm;
}
@ -1168,19 +1151,42 @@ statusbarpanel#statusbar-display {
}
/* Tabs */
.tabbrowser-tab {
.tabbrowser-tab,
.tabbrowser-arrowscrollbox > .scrollbutton-up,
.tabbrowser-arrowscrollbox > .scrollbutton-down,
.tabs-newtab-button,
.tabs-alltabs-button {
-moz-appearance: none;
background: url("chrome://browser/skin/tabbrowser/tab-bkgnd.png") repeat-x;
margin: 3px 0px 4px;
padding: 0px 1px 1px 0px;
border: 2px solid;
border-right-width: 1px;
border-bottom: none;
-moz-border-top-colors: ThreeDShadow rgba(255,255,255,.3);
-moz-border-left-colors: ThreeDShadow rgba(255,255,255,.3);
}
.tabbrowser-tab:-moz-lwtheme-brighttext,
.tabbrowser-arrowscrollbox > .scrollbutton-up:-moz-lwtheme-brighttext,
.tabbrowser-arrowscrollbox > .scrollbutton-down:-moz-lwtheme-brighttext,
.tabs-newtab-button:-moz-lwtheme-brighttext,
.tabs-alltabs-button:-moz-lwtheme-brighttext {
background-color: rgba(0,0,0,.5);
}
.tabbrowser-tab:-moz-lwtheme-darktext,
.tabbrowser-arrowscrollbox > .scrollbutton-up:-moz-lwtheme-darktext,
.tabbrowser-arrowscrollbox > .scrollbutton-down:-moz-lwtheme-darktext,
.tabs-newtab-button:-moz-lwtheme-darktext,
.tabs-alltabs-button:-moz-lwtheme-darktext {
background-color: rgba(255,255,255,.5);
}
.tabbrowser-tab {
padding: 0 1px 1px 0;
-moz-border-radius-topleft: 2px;
-moz-border-radius-topright: 2px;
-moz-border-top-colors: ThreeDShadow rgba(255,255,255,.3);
-moz-border-right-colors: rgba(0,0,0,.1);
-moz-border-left-colors: ThreeDShadow rgba(255,255,255,.3);
}
.tabbrowser-tab:hover,
@ -1207,6 +1213,14 @@ statusbarpanel#statusbar-display {
font-weight: bold;
}
.tabbrowser-tab:-moz-lwtheme[selected="true"] {
text-shadow: none;
}
.tabbrowser-tab:-moz-lwtheme:not([selected="true"]) {
color: inherit;
}
.tabbrowser-tab[busy] > .tab-icon-image {
list-style-image: url("chrome://browser/skin/tabbrowser/progress.png") !important;
-moz-image-region: rect(0, 16px, 16px, 0);
@ -1332,17 +1346,9 @@ tabpanels {
.tabbrowser-arrowscrollbox > .scrollbutton-down,
.tabs-newtab-button,
.tabs-alltabs-button {
-moz-appearance: none;
width: 18px;
margin: 3px 0px 4px;
padding: 0px;
border: 2px solid;
border-right-width: 1px;
border-bottom: none;
-moz-border-top-colors: ThreeDShadow rgba(255,255,255,.3);
padding: 0;
-moz-border-right-colors: ThreeDShadow;
-moz-border-left-colors: ThreeDShadow rgba(255,255,255,.3);
background: url("chrome://browser/skin/tabbrowser/tab-bkgnd.png") repeat-x;
-moz-image-region: rect(0, 11px, 14px, 0);
}
@ -1865,15 +1871,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
-moz-padding-end: 2px;
}
#nav-bar[mode="full"]:not([currentset]):-moz-system-metric(windows-default-theme),
#nav-bar[mode="full"][currentset$=",urlbar-container"]:-moz-system-metric(windows-default-theme),
#nav-bar[mode="full"][currentset$=",search-container"]:-moz-system-metric(windows-default-theme),
#nav-bar[iconsize="large"][mode="icons"]:not([currentset]):-moz-system-metric(windows-default-theme),
#nav-bar[iconsize="large"][mode="icons"][currentset$=",urlbar-container"]:-moz-system-metric(windows-default-theme),
#nav-bar[iconsize="large"][mode="icons"][currentset$=",search-container"]:-moz-system-metric(windows-default-theme) {
-moz-padding-end: 3px;
}
/* ::::: Keyboard UI Panel ::::: */
.KUI-panel {

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

@ -66,6 +66,7 @@ __all__ = [
"log",
"runApp",
"Process",
"addExtraCommonOptions",
"initializeProfile",
"DIST_BIN",
"DEFAULT_APP",
@ -351,6 +352,15 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
prefsFile.write("".join(prefs))
prefsFile.close()
def addExtraCommonOptions(parser):
"Adds command-line options which are common to mochitest and reftest."
parser.add_option("--setpref",
action = "append", type = "string",
default = [],
dest = "extraPrefs", metavar = "PREF=VALUE",
help = "defines an extra user preference")
def fillCertificateDB(profileDir, certPath, utilityPath, xrePath):
pwfilePath = os.path.join(profileDir, ".crtdbpw")
@ -437,15 +447,13 @@ def environment(env = None, xrePath = DIST_BIN, crashreporter = True):
if crashreporter:
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['MOZ_CRASHREPORTER'] = '1'
else:
env['MOZ_CRASHREPORTER_DISABLE'] = '1'
env['GNOME_DISABLE_CRASH_DIALOG'] = "1"
return env
if IS_WIN32:
#XXX: disabled on windows for now, see bug 525370
def readWithTimeout(f, timeout):
return (f.readline(), False)
elif False:
#XXX: figure out what's going wrong with this code!
import ctypes, time, msvcrt
PeekNamedPipe = ctypes.windll.kernel32.PeekNamedPipe
GetLastError = ctypes.windll.kernel32.GetLastError
@ -456,18 +464,24 @@ elif False:
is received within |timeout| seconds, return a blank line.
Returns a tuple (line, did_timeout), where |did_timeout| is True
if the read timed out, and False otherwise."""
if timeout is None:
# shortcut to allow callers to pass in "None" for no timeout.
return (f.readline(), False)
x = msvcrt.get_osfhandle(f.fileno())
l = ctypes.c_long()
buf = ctypes.create_string_buffer('', 1024)
done = time.time() + timeout
while time.time() < done:
if PeekNamedPipe(x, buf, len(buf), None, ctypes.byref(l), None) == 0:
err = GetLastError()
if err == 38 or err == 109: # ERROR_HANDLE_EOF || ERROR_BROKEN_PIPE
return ('', False)
if (l > 0 and '\n' in buf.value):
return (f.readline(), False)
time.sleep(0.1)
if PeekNamedPipe(x, None, 0, None, ctypes.byref(l), None) == 0:
err = GetLastError()
if err == 38 or err == 109: # ERROR_HANDLE_EOF || ERROR_BROKEN_PIPE
return ('', False)
else:
log.error("readWithTimeout got error: %d", err)
if l > 0:
# we're assuming that the output is line-buffered,
# which is not unreasonable
return (f.readline(), False)
time.sleep(0.01)
return ('', True)
else:
def readWithTimeout(f, timeout):
@ -493,7 +507,7 @@ def triggerBreakpad(proc, utilityPath):
crashinject = os.path.normpath(os.path.join(utilityPath, "crashinject.exe"))
if os.path.exists(crashinject) and subprocess.Popen([crashinject, str(proc.pid)]).wait() == 0:
return
#TODO: kill the process such that it triggers Breakpad on OS X
#TODO: kill the process such that it triggers Breakpad on OS X (bug 525296)
log.info("Can't trigger Breakpad, just killing process")
proc.kill()

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

@ -70,9 +70,6 @@ if __name__ == '__main__':
appPath = os.path.join(SCRIPT_DIR, automation.DEFAULT_APP)
status = automation.runApp(url, browserEnv, appPath, PROFILE_DIRECTORY, {},
# the profiling HTML doesn't output anything,
# so let's just set this really high for now.
#FIXME: the POSIX codepath accepts None
# as "no timeout", the Windows codepath
# should too.
timeout = 1800.0)
# so let's just run this without a timeout
timeout = None)
sys.exit(status)

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

@ -1,128 +1,128 @@
/* ***** 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 Crash Injection Utility
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ted Mielczarek <ted.mielczarek@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
* 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 ***** */
/*
* Given a PID, this program attempts to inject a DLL into the process
* with that PID. The DLL it attempts to inject, "crashinjectdll.dll",
* must exist alongside this exe. The DLL will then crash the process.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Windows.h>
int main(int argc, char** argv)
{
if (argc != 2) {
fprintf(stderr, "Usage: crashinject <PID>\n");
return 1;
}
int pid = atoi(argv[1]);
if (pid <= 0) {
fprintf(stderr, "Usage: crashinject <PID>\n");
return 1;
}
// find our DLL to inject
wchar_t filename[_MAX_PATH];
if (GetModuleFileNameW(NULL, filename, sizeof(filename) / sizeof(wchar_t)) == 0)
return 1;
wchar_t* slash = wcsrchr(filename, L'\\');
if (slash == NULL)
return 1;
slash++;
wcscpy(slash, L"crashinjectdll.dll");
// now find our target process
HANDLE targetProc = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_CREATE_THREAD,
FALSE,
pid);
if (targetProc == NULL) {
fprintf(stderr, "Error %d opening target process\n", GetLastError());
return 1;
}
/*
* This is sort of insane, but we're implementing a technique described here:
* http://www.codeproject.com/KB/threads/winspy.aspx#section_2
*
* The gist is to use CreateRemoteThread to create a thread in the other
* process, but cheat and make the thread function kernel32!LoadLibrary,
* so that the only remote data we have to pass to the other process
* is the path to the library we want to load. The library we're loading
* will then do its dirty work inside the other process.
*/
HMODULE hKernel32 = GetModuleHandleW(L"Kernel32");
// allocate some memory to hold the path in the remote process
void* pLibRemote = VirtualAllocEx(targetProc, NULL, sizeof(filename),
MEM_COMMIT, PAGE_READWRITE);
if (pLibRemote == NULL) {
fprintf(stderr, "Error %d in VirtualAllocEx\n", GetLastError());
CloseHandle(targetProc);
return 1;
}
if (!WriteProcessMemory(targetProc, pLibRemote, (void*)filename,
sizeof(filename), NULL)) {
fprintf(stderr, "Error %d in WriteProcessMemory\n", GetLastError());
VirtualFreeEx(targetProc, pLibRemote, sizeof(filename), MEM_RELEASE);
CloseHandle(targetProc);
return 1;
}
// Now create a thread in the target process that will load our DLL
HANDLE hThread = CreateRemoteThread(
targetProc, NULL, 0,
(LPTHREAD_START_ROUTINE)GetProcAddress(hKernel32,
"LoadLibraryW"),
pLibRemote, 0, NULL);
if (hThread == NULL) {
fprintf(stderr, "Error %d in CreateRemoteThread\n", GetLastError());
VirtualFreeEx(targetProc, pLibRemote, sizeof(filename), MEM_RELEASE);
CloseHandle(targetProc);
return 1;
}
WaitForSingleObject(hThread, INFINITE);
// Cleanup, not that it's going to matter at this point
CloseHandle(hThread);
VirtualFreeEx(targetProc, pLibRemote, sizeof(filename), MEM_RELEASE);
CloseHandle(targetProc);
return 0;
}
/* ***** 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 Crash Injection Utility
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ted Mielczarek <ted.mielczarek@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
* 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 ***** */
/*
* Given a PID, this program attempts to inject a DLL into the process
* with that PID. The DLL it attempts to inject, "crashinjectdll.dll",
* must exist alongside this exe. The DLL will then crash the process.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
int main(int argc, char** argv)
{
if (argc != 2) {
fprintf(stderr, "Usage: crashinject <PID>\n");
return 1;
}
int pid = atoi(argv[1]);
if (pid <= 0) {
fprintf(stderr, "Usage: crashinject <PID>\n");
return 1;
}
// find our DLL to inject
wchar_t filename[_MAX_PATH];
if (GetModuleFileNameW(NULL, filename, sizeof(filename) / sizeof(wchar_t)) == 0)
return 1;
wchar_t* slash = wcsrchr(filename, L'\\');
if (slash == NULL)
return 1;
slash++;
wcscpy(slash, L"crashinjectdll.dll");
// now find our target process
HANDLE targetProc = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_CREATE_THREAD,
FALSE,
pid);
if (targetProc == NULL) {
fprintf(stderr, "Error %d opening target process\n", GetLastError());
return 1;
}
/*
* This is sort of insane, but we're implementing a technique described here:
* http://www.codeproject.com/KB/threads/winspy.aspx#section_2
*
* The gist is to use CreateRemoteThread to create a thread in the other
* process, but cheat and make the thread function kernel32!LoadLibrary,
* so that the only remote data we have to pass to the other process
* is the path to the library we want to load. The library we're loading
* will then do its dirty work inside the other process.
*/
HMODULE hKernel32 = GetModuleHandleW(L"Kernel32");
// allocate some memory to hold the path in the remote process
void* pLibRemote = VirtualAllocEx(targetProc, NULL, sizeof(filename),
MEM_COMMIT, PAGE_READWRITE);
if (pLibRemote == NULL) {
fprintf(stderr, "Error %d in VirtualAllocEx\n", GetLastError());
CloseHandle(targetProc);
return 1;
}
if (!WriteProcessMemory(targetProc, pLibRemote, (void*)filename,
sizeof(filename), NULL)) {
fprintf(stderr, "Error %d in WriteProcessMemory\n", GetLastError());
VirtualFreeEx(targetProc, pLibRemote, sizeof(filename), MEM_RELEASE);
CloseHandle(targetProc);
return 1;
}
// Now create a thread in the target process that will load our DLL
HANDLE hThread = CreateRemoteThread(
targetProc, NULL, 0,
(LPTHREAD_START_ROUTINE)GetProcAddress(hKernel32,
"LoadLibraryW"),
pLibRemote, 0, NULL);
if (hThread == NULL) {
fprintf(stderr, "Error %d in CreateRemoteThread\n", GetLastError());
VirtualFreeEx(targetProc, pLibRemote, sizeof(filename), MEM_RELEASE);
CloseHandle(targetProc);
return 1;
}
WaitForSingleObject(hThread, INFINITE);
// Cleanup, not that it's going to matter at this point
CloseHandle(hThread);
VirtualFreeEx(targetProc, pLibRemote, sizeof(filename), MEM_RELEASE);
CloseHandle(targetProc);
return 0;
}

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

@ -1,53 +1,53 @@
# ***** 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 Mozilla core build scripts.
#
# The Initial Developer of the Original Code is
# The Mozilla Foundation
#
# Portions created by the Initial Developer are Copyright (C) 2009
# the Mozilla Foundation <http://www.mozilla.org/>. All Rights Reserved.
#
# Contributor(s):
# Ted Mielczarek <ted.mielczarek@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
# 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 *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = crashinjectdll
DEFFILE = $(srcdir)/crashinjectdll.def
FORCE_SHARED_LIB = 1
USE_STATIC_LIBS = 1
CPPSRCS = crashinjectdll.cpp
include $(topsrcdir)/config/rules.mk
# ***** 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 Mozilla core build scripts.
#
# The Initial Developer of the Original Code is
# The Mozilla Foundation
#
# Portions created by the Initial Developer are Copyright (C) 2009
# the Mozilla Foundation <http://www.mozilla.org/>. All Rights Reserved.
#
# Contributor(s):
# Ted Mielczarek <ted.mielczarek@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
# 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 *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = crashinjectdll
DEFFILE = $(srcdir)/crashinjectdll.def
FORCE_SHARED_LIB = 1
USE_STATIC_LIBS = 1
CPPSRCS = crashinjectdll.cpp
include $(topsrcdir)/config/rules.mk

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

@ -1,34 +1,34 @@
#include <stdio.h>
#include <Windows.h>
// make sure we only ever spawn one thread
DWORD tid = -1;
DWORD WINAPI CrashingThread(
LPVOID lpParameter
)
{
// not a very friendly DLL
volatile int* x = (int *)0x0;
*x = 1;
return 0;
}
BOOL WINAPI DllMain(
HANDLE hinstDLL,
DWORD dwReason,
LPVOID lpvReserved
)
{
if (tid == -1)
// we have to crash on another thread because LoadLibrary() will
// catch memory access errors and return failure to the calling process
CreateThread(
NULL, // default security attributes
0, // use default stack size
CrashingThread , // thread function name
NULL, // argument to thread function
0, // use default creation flags
&tid); // returns the thread identifier
return TRUE;
}
#include <stdio.h>
#include <windows.h>
// make sure we only ever spawn one thread
DWORD tid = -1;
DWORD WINAPI CrashingThread(
LPVOID lpParameter
)
{
// not a very friendly DLL
volatile int* x = (int *)0x0;
*x = 1;
return 0;
}
BOOL WINAPI DllMain(
HANDLE hinstDLL,
DWORD dwReason,
LPVOID lpvReserved
)
{
if (tid == -1)
// we have to crash on another thread because LoadLibrary() will
// catch memory access errors and return failure to the calling process
CreateThread(
NULL, // default security attributes
0, // use default stack size
CrashingThread , // thread function name
NULL, // argument to thread function
0, // use default creation flags
&tid); // returns the thread identifier
return TRUE;
}

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

@ -1,3 +1,3 @@
LIBRARY crashinjectdll
EXPORTS
DllMain
LIBRARY crashinjectdll
EXPORTS
DllMain

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

@ -632,6 +632,10 @@ LIBOSSO_LIBS = @LIBOSSO_LIBS@
LIBHILDONFM_CFLAGS = @LIBHILDONFM_CFLAGS@
LIBHILDONFM_LIBS = @LIBHILDONFM_LIBS@
MOZ_ENABLE_LIBCONIC = @MOZ_ENABLE_LIBCONIC@
LIBCONIC_CFLAGS = @LIBCONIC_CFLAGS@
LIBCONIC_LIBS = @LIBCONIC_LIBS@
MACOS_SDK_DIR = @MACOS_SDK_DIR@
NEXT_ROOT = @NEXT_ROOT@
GCC_VERSION = @GCC_VERSION@

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

@ -555,7 +555,6 @@ pango/pango-break.h
pango/pango-fontmap.h
pango/pango.h
pango/pangoxft.h
pango/pangox.h
pango/pango-utils.h
pango-types.h
pascal.h

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

@ -76,7 +76,7 @@ def lockFile(lockfile, max_wait = 600):
# and read its contents to report the owner PID
f = open(lockfile, "r")
s = os.stat(lockfile)
except OSError, e:
except EnvironmentError, e:
if e.errno != errno.ENOENT:
sys.exit("%s exists but stat() failed: %s" %
(lockfile, e.strerror))

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

@ -1506,6 +1506,25 @@ if test "$GNU_CXX"; then
if test "$ac_has_wno_invalid_offsetof" = "yes"; then
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
fi
AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
ac_has_wno_variadic_macros,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
_SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
AC_TRY_COMPILE([],
[return(0);],
ac_has_wno_variadic_macros="yes",
ac_has_wno_variadic_macros="no")
CXXFLAGS="$_SAVE_CXXFLAGS"
AC_LANG_RESTORE
])
if test "$ac_has_wno_variadic_macros" = "yes"; then
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
fi
else
_DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
fi
@ -4156,12 +4175,16 @@ if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
fi
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
AC_CACHE_CHECK(for __thread keyword for TLS variables,
ac_cv_thread_keyword,
[AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
[return tlsIsMainThread;],
ac_cv_thread_keyword=yes,
ac_cv_thread_keyword=no)])
LDFLAGS=$_SAVE_LDFLAGS
if test "$ac_cv_thread_keyword" = yes; then
AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
fi
@ -6220,6 +6243,28 @@ MOZ_ARG_DISABLE_BOOL(zipwriter,
MOZ_ZIPWRITER=1 )
AC_SUBST(MOZ_ZIPWRITER)
dnl ========================================================
dnl = Disable libconic
dnl ========================================================
MOZ_ENABLE_LIBCONIC=1
MOZ_ARG_DISABLE_BOOL(libconic,
[ --disable-libconic Disable libconic],
MOZ_ENABLE_LIBCONIC=,
MOZ_ENABLE_LIBCONIC=1 )
if test -n "$MOZ_ENABLE_LIBCONIC"; then
PKG_CHECK_MODULES(LIBCONIC, conic,
MOZ_ENABLE_LIBCONIC=1,
MOZ_ENABLE_LIBCONIC=)
fi
if test "$MOZ_ENABLE_LIBCONIC"; then
AC_DEFINE(MOZ_ENABLE_LIBCONIC)
fi
AC_SUBST(MOZ_ENABLE_LIBCONIC)
AC_SUBST(LIBCONIC_CFLAGS)
AC_SUBST(LIBCONIC_LIBS)
dnl ========================================================
dnl = Hildon and OSSO checks
dnl ========================================================

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

@ -48,7 +48,7 @@ interface nsIDOMFile : nsISupports
readonly attribute DOMString name;
readonly attribute unsigned long long size;
readonly attribute DOMString mediaType;
readonly attribute DOMString type;
DOMString getAsText(in DOMString encoding); // raises(FileException) on retrieval
DOMString getAsDataURL(); // raises(FileException) on retrieval

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

@ -50,7 +50,7 @@ interface nsIDOMFileReader : nsISupports
void abort();
const unsigned short INITIAL = 0;
const unsigned short EMPTY = 0;
const unsigned short LOADING = 1;
const unsigned short DONE = 2;
readonly attribute unsigned short readyState;

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

@ -1178,14 +1178,16 @@ public:
enum DocumentTheme {
Doc_Theme_Uninitialized, // not determined yet
Doc_Theme_None,
Doc_Theme_Neutral,
Doc_Theme_Dark,
Doc_Theme_Bright
};
/**
* Returns Doc_Theme_None if there is no lightweight theme specified, Doc_Theme_Dark
* for a dark theme and Doc_Theme_Bright for a light theme. This is used to
* determine the state of the pseudoclasses :-moz-lwtheme and :-moz-lwtheme-text.
* Returns Doc_Theme_None if there is no lightweight theme specified,
* Doc_Theme_Dark for a dark theme, Doc_Theme_Bright for a light theme, and
* Doc_Theme_Neutral for any other theme. This is used to determine the state
* of the pseudoclasses :-moz-lwtheme and :-moz-lwtheme-text.
*/
virtual int GetDocumentLWTheme() { return Doc_Theme_None; }

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

@ -43,11 +43,12 @@
#include "nsIURI.h"
#include "nsCOMPtr.h"
#include "nsIScriptLoaderObserver.h"
#include "nsWeakPtr.h"
#include "nsIParser.h"
// e68ddc48-4055-4ba9-978d-c49d9cf3189a
#define NS_ISCRIPTELEMENT_IID \
{ 0xe68ddc48, 0x4055, 0x4ba9, \
{ 0x97, 0x8d, 0xc4, 0x9d, 0x9c, 0xf3, 0x18, 0x9a } }
{ 0xa28c198e, 0x14f0, 0x42b1, \
{ 0x8f, 0x6b, 0x0e, 0x7f, 0xca, 0xb4, 0xf4, 0xe8 } }
/**
* Internal interface implemented by script elements
@ -60,7 +61,8 @@ public:
: mLineNumber(0),
mIsEvaluated(PR_FALSE),
mMalformed(PR_FALSE),
mDoneAddingChildren(PR_TRUE)
mDoneAddingChildren(PR_TRUE),
mCreatorParser(nsnull)
{
}
@ -122,11 +124,52 @@ public:
mDoneAddingChildren = PR_FALSE;
}
void SetCreatorParser(nsIParser* aParser)
{
mCreatorParser = getter_AddRefs(NS_GetWeakReference(aParser));
}
/**
* Informs the creator parser that the evaluation of this script is starting
*/
void BeginEvaluating()
{
// Once the async attribute is supported, don't do this if this is an
// async script.
nsCOMPtr<nsIParser> parser = do_QueryReferent(mCreatorParser);
if (parser) {
parser->BeginEvaluatingParserInsertedScript();
}
}
/**
* Informs the creator parser that the evaluation of this script is ending
*/
void EndEvaluating()
{
// Once the async attribute is supported, don't do this if this is an
// async script.
nsCOMPtr<nsIParser> parser = do_QueryReferent(mCreatorParser);
if (parser) {
parser->EndEvaluatingParserInsertedScript();
}
}
/**
* Retrieves a pointer to the creator parser if this has one or null if not
*/
already_AddRefed<nsIParser> GetCreatorParser()
{
nsCOMPtr<nsIParser> parser = do_QueryReferent(mCreatorParser);
return parser.forget();
}
protected:
PRUint32 mLineNumber;
PRPackedBool mIsEvaluated;
PRPackedBool mMalformed;
PRPackedBool mDoneAddingChildren;
nsWeakPtr mCreatorParser;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptElement, NS_ISCRIPTELEMENT_IID)

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

@ -125,7 +125,7 @@ nsDOMFile::GetSize(PRUint64 *aFileSize)
}
NS_IMETHODIMP
nsDOMFile::GetMediaType(nsAString &aMediaType)
nsDOMFile::GetType(nsAString &aType)
{
if (!mContentType.Length()) {
nsresult rv;
@ -133,17 +133,17 @@ nsDOMFile::GetMediaType(nsAString &aMediaType)
do_GetService(NS_MIMESERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString mediaType;
rv = mimeService->GetTypeFromFile(mFile, mediaType);
nsCAutoString mimeType;
rv = mimeService->GetTypeFromFile(mFile, mimeType);
if (NS_FAILED(rv)) {
SetDOMStringToNull(aMediaType);
aType.Truncate();
return NS_OK;
}
AppendUTF8toUTF16(mediaType, mContentType);
AppendUTF8toUTF16(mimeType, mContentType);
}
aMediaType = mContentType;
aType = mContentType;
return NS_OK;
}

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

@ -154,7 +154,7 @@ nsDOMFileReader::Notify(const char *aCharset, nsDetectionConfident aConf)
nsDOMFileReader::nsDOMFileReader()
: mFileData(nsnull), mReadCount(0),
mDataLen(0), mDataFormat(0),
mReadyState(nsIDOMFileReader::INITIAL),
mReadyState(nsIDOMFileReader::EMPTY),
mProgressEventWasDelayed(PR_FALSE),
mTimerIsActive(PR_FALSE),
mReadTotal(0), mReadTransferred(0),
@ -319,7 +319,7 @@ nsDOMFileReader::Abort()
DispatchProgressEvent(NS_LITERAL_STRING(ABORT_STR));
DispatchProgressEvent(NS_LITERAL_STRING(LOADEND_STR));
mReadyState = nsIDOMFileReader::INITIAL;
mReadyState = nsIDOMFileReader::EMPTY;
return NS_OK;
}

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

@ -509,6 +509,15 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
!aElement->GetScriptAsync();
mPreloads.RemoveElementAt(i);
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Grabbing existing speculative load for %s (%p). async:%d defer:%d\n",
spec.get(), request.get(), aElement->GetScriptAsync(),
request->mDefer);
}
rv = CheckContentPolicy(mDocument, aElement, request->mURI, type);
if (NS_FAILED(rv)) {
// Note, we're dropping our last ref to request here.
@ -558,6 +567,14 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
request->mIsInline = PR_FALSE;
request->mLoading = PR_TRUE;
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Starting normal load for %s (%p). async:%d defer:%d\n",
spec.get(), request.get(), aElement->GetScriptAsync(),
request->mDefer);
}
rv = StartLoad(request, type);
if (NS_FAILED(rv)) {
return rv;
@ -570,6 +587,10 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
request->mLineNo = aElement->GetScriptLineNumber();
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
printf("Creating inline request (%p).\n", request.get());
}
// If we've got existing pending requests, add ourselves
// to this list.
if (!hadPendingRequests && ReadyToExecuteScripts() &&
@ -609,6 +630,10 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
nsAFlatString* script;
nsAutoString textData;
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
printf("Running request (%p).\n", aRequest);
}
// If there's no script text, we try to get it from the element
if (aRequest->mIsInline) {
// XXX This is inefficient - GetText makes multiple
@ -622,7 +647,9 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
}
FireScriptAvailable(NS_OK, aRequest);
aRequest->mElement->BeginEvaluating();
nsresult rv = EvaluateScript(aRequest, *script);
aRequest->mElement->EndEvaluating();
FireScriptEvaluated(rv, aRequest);
return rv;
@ -957,6 +984,13 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
NS_ASSERTION(request, "null request in stream complete handler");
NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Finished loading %s (%p). status:%d\n", spec.get(), request,
aStatus);
}
nsresult rv = PrepareLoadedRequest(request, aLoader, aStatus, aStringLen,
aString);
if (NS_FAILED(rv)) {
@ -1110,6 +1144,14 @@ nsScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset,
request->mLoading = PR_TRUE;
request->mDefer = PR_FALSE; // This is computed later when we go to execute the
// script.
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Starting speculative load for %s (%p).\n", spec.get(),
request.get());
}
nsresult rv = StartLoad(request, aType);
if (NS_FAILED(rv)) {
return;

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

@ -96,6 +96,7 @@
#include "nsIPromptFactory.h"
#include "nsIWindowWatcher.h"
#include "nsCommaSeparatedTokenizer.h"
#include "nsIConsoleService.h"
#define LOAD_STR "load"
#define ERROR_STR "error"
@ -1757,8 +1758,6 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url,
PRBool async, const nsAString& user,
const nsAString& password, PRUint8 optional_argc)
{
nsresult rv = NS_OK;
if (nsContentUtils::GetCurrentJSContext()) {
// We're (likely) called from JS
@ -2238,6 +2237,25 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
httpChannel->SetReferrer(codebase);
}
// Some extensions override the http protocol handler and provide their own
// implementation. The channels returned from that implementation doesn't
// seem to always implement the nsIUploadChannel2 interface, presumably
// because it's a new interface.
// Eventually we should remove this and simply require that http channels
// implement the new interface.
// See bug 529041
nsCOMPtr<nsIUploadChannel2> uploadChannel2 =
do_QueryInterface(httpChannel);
if (!uploadChannel2) {
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (consoleService) {
consoleService->LogStringMessage(NS_LITERAL_STRING(
"Http channel implementation doesn't support nsIUploadChannel2. An extension has supplied a non-functional http protocol handler. This will break behavior and in future releases not work at all."
).get());
}
}
}
mUploadTransferred = 0;
@ -2379,9 +2397,6 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
}
if (postDataStream) {
nsCOMPtr<nsIUploadChannel2> uploadChannel(do_QueryInterface(httpChannel));
NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel");
// If no content type header was set by the client, we set it to
// application/xml.
nsCAutoString contentType;
@ -2437,7 +2452,25 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
// We want to use a newer version of the upload channel that won't
// ignore the necessary headers for an empty Content-Type.
rv = uploadChannel->ExplicitSetUploadStream(postDataStream, contentType, -1, method, PR_FALSE);
nsCOMPtr<nsIUploadChannel2> uploadChannel2(do_QueryInterface(httpChannel));
// This assertion will fire if buggy extensions are installed
NS_ASSERTION(uploadChannel2, "http must support nsIUploadChannel");
if (uploadChannel2) {
uploadChannel2->ExplicitSetUploadStream(postDataStream, contentType,
-1, method, PR_FALSE);
}
else {
// http channel doesn't support the new nsIUploadChannel2. Emulate
// as best we can using nsIUploadChannel
if (contentType.IsEmpty()) {
contentType.AssignLiteral("application/octet-stream");
}
nsCOMPtr<nsIUploadChannel> uploadChannel =
do_QueryInterface(httpChannel);
uploadChannel->SetUploadStream(postDataStream, contentType, -1);
// Reset the method to its original value
httpChannel->SetRequestMethod(method);
}
}
}

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

@ -262,6 +262,7 @@ _TEST_FILES = test_bug5141.html \
bug461735-redirect1.sjs \
bug461735-redirect2.sjs \
bug461735-post-redirect.js \
test_bug513194.html \
test_bug461735.html \
test_bug380418.html \
test_bug465767.html \
@ -337,5 +338,9 @@ _TEST_FILES = test_bug5141.html \
# test_bug444546.html \
# bug444546.sjs \
# Disabled due to making the harness time out
# test_bug503473.html \
# file_bug503473-frame.sjs \
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

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

@ -0,0 +1,23 @@
function handleRequest(request, response) {
response.processAsync();
response.setStatusLine(request.httpVersion, 200, "OK");
response.setHeader("Content-Type", "text/html; charset=utf-8", false);
response.setHeader("Cache-Control", "no-cache", false);
response.write(
'<!DOCTYPE html>' +
'<div></div>' +
'<script>' +
'function doWrite() {' +
' document.write("<p></p>");' +
' parent.done();' +
' document.close();' +
'}' +
'setTimeout(doWrite, 1);' +
'</script>'
);
response.bodyOutputStream.flush();
// leave the stream open
}

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

@ -4,6 +4,13 @@
<!-- Async script that isn't preloaded -->
<script async src="file_bug503481.sjs?blockOn=R&body=runFirst();"></script>
<script>
function enableLogs(b) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("content.scriptloader.logloads", b);
}
enableLogs(true);
firstRan = false;
secondRan = false;
thirdRan = false;
@ -37,6 +44,7 @@ function done() {
parent.is(forthRan, true, "forth should have run by onload");
parent.is(fifthRan, true, "fifth should have run by onload");
parent.is(sixthRan, true, "sixth should have run by onload");
enableLogs(false);
parent.SimpleTest.finish();
}

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

@ -0,0 +1,46 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=503473
-->
<head>
<title>Test for Bug 503473</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=503473">Mozilla Bug 503473</a>
<p id="display"></p>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 503473 **/
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var gOriginalHtml5Pref = prefs.getBoolPref("html5.enable");
prefs.setBoolPref("html5.enable", true);
SimpleTest.waitForExplicitFinish();
function done() {
var iframe = document.getElementById("iframe");
var divs = iframe.contentWindow.document.getElementsByTagName("div").length;
is(divs, 0, "Div wasn't blown away.")
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
prefs.setBoolPref("html5.enable", gOriginalHtml5Pref);
SimpleTest.finish();
}
</script>
</pre>
<div id="content" style="display: none">
<iframe id='iframe' src="file_bug503473-frame.sjs">
</iframe>
</div>
</body>
</html>

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

@ -0,0 +1,72 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=513194
-->
<head>
<title>Test for Bug 513194</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
var consoleService =
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
var consoleListener = {
seenError: false,
observe: function(message) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (this.seenError) {
ok(false, "Seen too many errors!");
}
this.seenError = true;
ok(message.message.indexOf("Unknown property") > -1,
"Wrong message");
},
finish: function() {
ok(this.seenError , "Didn't get message.");
SimpleTest.finish();
},
QueryInterface: function(iid) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (iid.equals(Ci.nsIConsoleListener) ||
iid.equals(Ci.nsISupports)) {
return this;
}
throw Cr.NS_NOINTERFACE;
}
};
consoleService.reset();
consoleService.registerListener(consoleListener);
SimpleTest.waitForExplicitFinish();
document.write("<style>qux { foo: bar; }<\/style>");
function done() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
consoleListener.finish();
consoleService.unregisterListener(consoleListener);
}
setTimeout(done, 1);
</script>
</pre>
</body>
</html>

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

@ -27,6 +27,10 @@ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
// Write a test file > 8192 characters
is(FileReader.EMPTY, 0, "correct EMPTY value");
is(FileReader.LOADING, 1, "correct LOADING value");
is(FileReader.DONE, 2, "correct DONE value");
var testData = "asdfblahqwer";
for (var i = 0; i < 10; i++) {
testData = testData + testData;
@ -62,8 +66,10 @@ var domFileBinary2 = utf16File.getAsBinary();
var domFileBinary3 = utf32File.getAsBinary();
var request1 = new FileReader();
is(request1.readyState, FileReader.EMPTY, "correct initial readyState");
request1.onload = handleTextISO1;
request1.readAsText(file, "iso-8859-1");
is(request1.readyState, FileReader.LOADING, "correct loading readyState");
var request2 = new FileReader();
request2.onload = handleTextUTF8;
@ -89,8 +95,10 @@ request6.readAsText(utf32File, "UTF-32");
//Test binary data accessor
var request7 = new FileReader();
is(request7.readyState, FileReader.EMPTY, "correct initial readyState");
request7.onload = handleDataBinary;
request7.readAsBinaryString(file);
is(request7.readyState, FileReader.LOADING, "correct loading readyState");
var request71 = new FileReader();
request71.onload = handleDataBinary16;
@ -172,6 +180,7 @@ function handleCancel(event) {
}
function handleTextISO1(event) {
is(event.target.readyState, FileReader.DONE, "correct final readyState");
var fileAsText = event.target.result;
var error = event.target.error;
is(error, null, "error code set to null for successful data accesses");
@ -232,6 +241,7 @@ function handleDataURI2(event) {
}
function handleDataBinary(event) {
is(event.target.readyState, FileReader.DONE, "correct final readyState");
var fileAsBinary = event.target.result;
is(domFileBinary.length, fileAsBinary.length, "binary data async length should match dom file binary");
is(domFileBinary, fileAsBinary, "binary data async string result should match dom file binary");

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

@ -298,54 +298,6 @@ WebGLContext::GetCanvas(nsIDOMHTMLCanvasElement **aCanvas)
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIWebGLBuffer currentArrayBufferBinding; */
NS_IMETHODIMP
WebGLContext::GetCurrentArrayBufferBinding(nsIWebGLBuffer **aCurrentArrayBufferBinding)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIWebGLBuffer currentElementArrayBufferBinding; */
NS_IMETHODIMP
WebGLContext::GetCurrentElementArrayBufferBinding(nsIWebGLBuffer **aCurrentElementArrayBufferBinding)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIWebGLFramebuffer currentFramebufferBinding; */
NS_IMETHODIMP
WebGLContext::GetCurrentFramebufferBinding(nsIWebGLFramebuffer **aCurrentFramebufferBinding)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIWebGLRenderbuffer currentRenderbufferBinding; */
NS_IMETHODIMP
WebGLContext::GetCurrentRenderbufferBinding(nsIWebGLRenderbuffer **aCurrentRenderbufferBinding)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIWebGLTexture currentTextureBinding2D; */
NS_IMETHODIMP
WebGLContext::GetCurrentTextureBinding2D(nsIWebGLTexture **aCurrentTextureBinding2D)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIWebGLTexture currentTextureBindingCubeMap; */
NS_IMETHODIMP
WebGLContext::GetCurrentTextureBindingCubeMap(nsIWebGLTexture **aCurrentTextureBindingCubeMap)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIWebGLProgram currentProgram; */
NS_IMETHODIMP
WebGLContext::GetCurrentProgram(nsIWebGLProgram **aCurrentProgram)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void present (); */
NS_IMETHODIMP
@ -1509,6 +1461,34 @@ WebGLContext::GetBufferParameteri(GLenum target, GLenum pname, GLint *retval)
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetBufferParameter(GLenum target, GLenum pname)
{
NativeJSContext js;
if (NS_FAILED(js.error))
return js.error;
MakeContextCurrent();
switch (pname) {
case LOCAL_GL_BUFFER_SIZE:
case LOCAL_GL_BUFFER_USAGE:
case LOCAL_GL_BUFFER_ACCESS:
case LOCAL_GL_BUFFER_MAPPED:
{
PRInt32 iv = 0;
gl->fGetBufferParameteriv(target, pname, (GLint*) &iv);
js.SetRetVal(iv);
}
break;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetFramebufferAttachmentParameteri(GLenum target, GLenum attachment, GLenum pname, GLint *retval)
{
@ -1546,6 +1526,43 @@ WebGLContext::GetFramebufferAttachmentParameteri(GLenum target, GLenum attachmen
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname)
{
NativeJSContext js;
if (NS_FAILED(js.error))
return js.error;
MakeContextCurrent();
switch (attachment) {
case LOCAL_GL_COLOR_ATTACHMENT0:
case LOCAL_GL_DEPTH_ATTACHMENT:
case LOCAL_GL_STENCIL_ATTACHMENT:
break;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
switch (pname) {
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
{
PRInt32 iv = 0;
gl->fGetFramebufferAttachmentParameteriv(target, attachment, pname, (GLint*) &iv);
js.SetRetVal(iv);
}
break;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetRenderbufferParameteri(GLenum target, GLenum pname, GLint *retval)
{
@ -1579,6 +1596,39 @@ WebGLContext::GetRenderbufferParameteri(GLenum target, GLenum pname, GLint *retv
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetRenderbufferParameter(GLenum target, GLenum pname)
{
NativeJSContext js;
if (NS_FAILED(js.error))
return js.error;
MakeContextCurrent();
switch (pname) {
case LOCAL_GL_RENDERBUFFER_WIDTH:
case LOCAL_GL_RENDERBUFFER_HEIGHT:
case LOCAL_GL_RENDERBUFFER_INTERNAL_FORMAT:
case LOCAL_GL_RENDERBUFFER_RED_SIZE:
case LOCAL_GL_RENDERBUFFER_GREEN_SIZE:
case LOCAL_GL_RENDERBUFFER_BLUE_SIZE:
case LOCAL_GL_RENDERBUFFER_ALPHA_SIZE:
case LOCAL_GL_RENDERBUFFER_DEPTH_SIZE:
case LOCAL_GL_RENDERBUFFER_STENCIL_SIZE:
{
PRInt32 iv = 0;
gl->fGetRenderbufferParameteriv(target, pname, (GLint*) &iv);
js.SetRetVal(iv);
}
break;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::CreateBuffer(nsIWebGLBuffer **retval)
{
@ -1664,6 +1714,45 @@ WebGLContext::GetProgrami(nsIWebGLProgram *prog, PRUint32 pname, GLint *retval)
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetProgramParameter(nsIWebGLProgram *prog, PRUint32 pname)
{
if (!prog || static_cast<WebGLProgram*>(prog)->Deleted())
return ErrorMessage("%s: program is null or deleted!", __FUNCTION__);
GLuint program = static_cast<WebGLProgram*>(prog)->GLName();
NativeJSContext js;
if (NS_FAILED(js.error))
return js.error;
MakeContextCurrent();
switch (pname) {
case LOCAL_GL_CURRENT_PROGRAM:
case LOCAL_GL_DELETE_STATUS:
case LOCAL_GL_LINK_STATUS:
case LOCAL_GL_VALIDATE_STATUS:
case LOCAL_GL_ATTACHED_SHADERS:
case LOCAL_GL_INFO_LOG_LENGTH:
case LOCAL_GL_ACTIVE_UNIFORMS:
case LOCAL_GL_ACTIVE_UNIFORM_MAX_LENGTH:
case LOCAL_GL_ACTIVE_ATTRIBUTES:
case LOCAL_GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
{
PRInt32 iv = 0;
gl->fGetProgramiv(program, pname, (GLint*) &iv);
js.SetRetVal(iv);
}
break;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetProgramInfoLog(nsIWebGLProgram *prog, nsAString& retval)
{
@ -1863,35 +1952,6 @@ WebGLContext::GetTexParameterf(GLenum target, GLenum pname, GLfloat *retval)
return NS_OK;
}
/* nsICanvasArray getTexParameterfv (in GLenum target, in GLenum pname); */
NS_IMETHODIMP
WebGLContext::GetTexParameterfv(GLenum target, GLenum pname, nsICanvasArray **retval)
{
NativeJSContext js;
if (NS_FAILED(js.error))
return js.error;
MakeContextCurrent();
switch (pname) {
case LOCAL_GL_TEXTURE_MIN_FILTER:
case LOCAL_GL_TEXTURE_MAG_FILTER:
case LOCAL_GL_TEXTURE_WRAP_S:
case LOCAL_GL_TEXTURE_WRAP_T:
{
float fv = 0;
gl->fGetTexParameterfv(target, pname, (GLfloat*) &fv);
js.SetRetVal(&fv, 1);
}
break;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetTexParameteri(GLenum target, GLenum pname, GLint *retval)
{
@ -1920,9 +1980,8 @@ WebGLContext::GetTexParameteri(GLenum target, GLenum pname, GLint *retval)
return NS_OK;
}
/* nsICanvasArray getTexParameteriv (in GLenum target, in GLenum pname); */
NS_IMETHODIMP
WebGLContext::GetTexParameteriv(GLenum target, GLenum pname, nsICanvasArray **retval)
WebGLContext::GetTexParameter(GLenum target, GLenum pname)
{
NativeJSContext js;
if (NS_FAILED(js.error))
@ -1936,9 +1995,9 @@ WebGLContext::GetTexParameteriv(GLenum target, GLenum pname, nsICanvasArray **re
case LOCAL_GL_TEXTURE_WRAP_S:
case LOCAL_GL_TEXTURE_WRAP_T:
{
PRInt32 iv = 0;
gl->fGetTexParameteriv(target, pname, (GLint*) &iv);
js.SetRetVal(&iv, 1);
float fv = 0;
gl->fGetTexParameterfv(target, pname, (GLfloat*) &fv);
js.SetRetVal(fv);
}
break;
@ -1950,8 +2009,9 @@ WebGLContext::GetTexParameteriv(GLenum target, GLenum pname, nsICanvasArray **re
}
/* XXX fix */
/* any getUniform(in WebGLProgram program, in WebGLUniformLocation location) raises(DOMException); */
NS_IMETHODIMP
WebGLContext::GetUniformf(nsIWebGLProgram *prog, GLint location, GLfloat *retval)
WebGLContext::GetUniform(nsIWebGLProgram *prog, GLint location)
{
if (!prog || static_cast<WebGLProgram*>(prog)->Deleted())
return ErrorMessage("%s: program is null or deleted!", __FUNCTION__);
@ -1998,25 +2058,6 @@ WebGLContext::GetUniformf(nsIWebGLProgram *prog, GLint location, GLfloat *retval
return NS_OK;
}
/* nsICanvasArray getUniformfv (in nsIWebGLProgram program, in GLint location); */
NS_IMETHODIMP
WebGLContext::GetUniformfv(nsIWebGLProgram *program, GLint location, nsICanvasArray **retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* GLint getUniformi (in nsIWebGLProgram program, in GLint location); */
NS_IMETHODIMP
WebGLContext::GetUniformi(nsIWebGLProgram *program, GLint location, GLint *retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsICanvasArray getUniformiv (in nsIWebGLProgram program, in GLint location); */
NS_IMETHODIMP
WebGLContext::GetUniformiv(nsIWebGLProgram *program, GLint location, nsICanvasArray **retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
WebGLContext::GetUniformLocation(nsIWebGLProgram *prog, const nsAString& name, GLint *retval)
@ -2032,55 +2073,7 @@ WebGLContext::GetUniformLocation(nsIWebGLProgram *prog, const nsAString& name, G
}
NS_IMETHODIMP
WebGLContext::GetVertexAttribf(GLuint index, GLenum pname, GLfloat *retval)
{
NativeJSContext js;
if (NS_FAILED(js.error))
return js.error;
MakeContextCurrent();
switch (pname) {
// int
case LOCAL_GL_VERTEX_ATTRIB_ARRAY_SIZE:
case LOCAL_GL_VERTEX_ATTRIB_ARRAY_STRIDE:
case LOCAL_GL_VERTEX_ATTRIB_ARRAY_TYPE:
case LOCAL_GL_VERTEX_ATTRIB_ARRAY_ENABLED:
case LOCAL_GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
case LOCAL_GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
{
PRInt32 iv = 0;
gl->fGetVertexAttribiv(index, pname, (GLint*) &iv);
*retval = (GLfloat) iv;
}
break;
case LOCAL_GL_CURRENT_VERTEX_ATTRIB:
{
GLfloat fv[4] = { 0 };
gl->fGetVertexAttribfv(index, LOCAL_GL_CURRENT_VERTEX_ATTRIB, &fv[0]);
js.SetRetVal(fv, 4);
}
break;
// not supported; doesn't make sense to return a pointer unless we have some kind of buffer object abstraction
case LOCAL_GL_VERTEX_ATTRIB_ARRAY_POINTER:
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetVertexAttribfv(GLuint index, GLenum pname, nsICanvasArray **retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
WebGLContext::GetVertexAttribi(GLuint index, GLenum pname, GLint *retval)
WebGLContext::GetVertexAttrib(GLuint index, GLenum pname)
{
NativeJSContext js;
if (NS_FAILED(js.error))
@ -2121,12 +2114,6 @@ WebGLContext::GetVertexAttribi(GLuint index, GLenum pname, GLint *retval)
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetVertexAttribiv(GLuint index, GLenum pname, nsICanvasArray **retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* GLuint getVertexAttribOffset (in GLuint index, in GLenum pname); */
NS_IMETHODIMP
WebGLContext::GetVertexAttribOffset(GLuint index, GLenum pname, GLuint *retval)
@ -2744,11 +2731,38 @@ WebGLContext::GetShaderi(nsIWebGLShader *shobj, GLenum pname, GLint *_retval)
return NS_OK;
}
/* nsICanvasIntArray getShaderiv (in nsIWebGLShader shader, in GLenum pname); */
NS_IMETHODIMP
WebGLContext::GetShaderiv(nsIWebGLShader *shader, GLenum pname, nsICanvasIntArray **retval)
WebGLContext::GetShaderParameter(nsIWebGLShader *shobj, GLenum pname)
{
return NS_ERROR_NOT_IMPLEMENTED;
if (!shobj || static_cast<WebGLShader*>(shobj)->Deleted())
return ErrorMessage("%s: shader is null or deleted!", __FUNCTION__);
GLuint shader = static_cast<WebGLShader*>(shobj)->GLName();
NativeJSContext js;
if (NS_FAILED(js.error))
return js.error;
MakeContextCurrent();
switch (pname) {
case LOCAL_GL_SHADER_TYPE:
case LOCAL_GL_DELETE_STATUS:
case LOCAL_GL_COMPILE_STATUS:
case LOCAL_GL_INFO_LOG_LENGTH:
case LOCAL_GL_SHADER_SOURCE_LENGTH:
{
PRInt32 iv = 0;
gl->fGetShaderiv(shader, pname, (GLint*) &iv);
js.SetRetVal(iv);
}
break;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_OK;
}
NS_IMETHODIMP
@ -2960,9 +2974,7 @@ WebGLContext::TexSubImage2D()
&argTarget, &argLevel, &argX, &argY,
&argWidth, &argHeight, &argFormat, &argType,
&argPixelsObj) ||
!argPixelsObj ||
!::JS_IsArrayObject(js.ctx, argPixelsObj) ||
!::JS_GetArrayLength(js.ctx, argPixelsObj, &argPixelsLen))
!argPixelsObj)
{
return ErrorMessage("texSubImage2D: argument error");
return NS_ERROR_DOM_SYNTAX_ERR;
@ -3043,12 +3055,17 @@ WebGLContext::TexSubImage2D()
return NS_ERROR_DOM_SYNTAX_ERR;
}
SimpleBuffer sbuffer(bufferType, bufferSize, js.ctx, argPixelsObj, argPixelsLen);
if (!sbuffer.Valid())
return NS_ERROR_FAILURE;
nsCOMPtr<nsICanvasArray> arrayObj;
nsresult rv;
rv = nsContentUtils::XPConnect()->WrapJS(js.ctx, argPixelsObj, NS_GET_IID(nsISupports), getter_AddRefs(arrayObj));
arrayObj = do_QueryInterface(arrayObj, &rv);
if (NS_FAILED(rv) || !arrayObj) {
return ErrorMessage("texSubImage2D: pixels arg is not a WebGL array");
}
MakeContextCurrent();
gl->fTexSubImage2D (argTarget, argLevel, argX, argY, argWidth, argHeight, argFormat, argType, (void *) sbuffer.data);
gl->fTexSubImage2D (argTarget, argLevel, argX, argY, argWidth, argHeight, argFormat, argType, arrayObj->NativePointer());
}
return NS_OK;
}
@ -3115,9 +3132,7 @@ WebGLContext::TexImage2D()
&argTarget, &argLevel, &argInternalFormat, &argWidth,
&argHeight, &argBorder, &argFormat, &argType,
&argPixelsObj) ||
!argPixelsObj ||
!::JS_IsArrayObject(js.ctx, argPixelsObj) ||
!::JS_GetArrayLength(js.ctx, argPixelsObj, &argPixelsLen))
!argPixelsObj)
{
return ErrorMessage("texImage2D: argument error");
return NS_ERROR_DOM_SYNTAX_ERR;
@ -3225,12 +3240,17 @@ WebGLContext::TexImage2D()
return NS_ERROR_DOM_SYNTAX_ERR;
}
SimpleBuffer sbuffer(bufferType, bufferSize, js.ctx, argPixelsObj, argPixelsLen);
if (!sbuffer.Valid())
return NS_ERROR_FAILURE;
nsCOMPtr<nsICanvasArray> arrayObj;
nsresult rv;
rv = nsContentUtils::XPConnect()->WrapJS(js.ctx, argPixelsObj, NS_GET_IID(nsISupports), getter_AddRefs(arrayObj));
arrayObj = do_QueryInterface(arrayObj, &rv);
if (NS_FAILED(rv) || !arrayObj) {
return ErrorMessage("texImage2D: pixels arg is not a WebGL array");
}
MakeContextCurrent();
gl->fTexImage2D (argTarget, argLevel, argInternalFormat, argWidth, argHeight, argBorder, argFormat, argType, (void *) sbuffer.data);
gl->fTexImage2D (argTarget, argLevel, argInternalFormat, argWidth, argHeight, argBorder, argFormat, argType, arrayObj->NativePointer());
}
}
return NS_OK;

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

@ -955,6 +955,10 @@ nsCanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *docShell, gfxASur
mThebes->NewPath();
// always force a redraw, because if the surface dimensions were reset
// then the surface became cleared, and we need to redraw everything.
Redraw();
return NS_OK;
}

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

@ -374,8 +374,7 @@ nsDOMUIEvent::GetIsChar(PRBool* aIsChar)
NS_METHOD nsDOMUIEvent::GetCompositionReply(nsTextEventReply** aReply)
{
if((mEvent->message == NS_COMPOSITION_START) ||
(mEvent->message == NS_COMPOSITION_QUERY))
if((mEvent->message == NS_COMPOSITION_START))
{
*aReply = &(static_cast<nsCompositionEvent*>(mEvent)->theReply);
return NS_OK;

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

@ -211,9 +211,7 @@ static const EventDispatchData sCompositionEvents[] = {
{ NS_COMPOSITION_START,
HANDLER(&nsIDOMCompositionListener::HandleStartComposition) },
{ NS_COMPOSITION_END,
HANDLER(&nsIDOMCompositionListener::HandleEndComposition) },
{ NS_COMPOSITION_QUERY,
HANDLER(&nsIDOMCompositionListener::HandleQueryComposition) }
HANDLER(&nsIDOMCompositionListener::HandleEndComposition) }
};
static const EventDispatchData sTextEvents[] = {

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

@ -499,6 +499,9 @@ nsIMEStateManager::OnTextStateFocus(nsPresContext* aPresContext,
nsCOMPtr<nsIWidget> widget;
nsresult rv = vm->GetRootWidget(getter_AddRefs(widget));
NS_ENSURE_SUCCESS(rv, NS_ERROR_NOT_AVAILABLE);
if (!widget) {
return NS_OK; // Sometimes, there are no widgets.
}
rv = widget->OnIMEFocusChange(PR_TRUE);
if (rv == NS_ERROR_NOT_IMPLEMENTED)

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