Merge mozilla-central into the branch for asynchronous plugin painting on Windows.

This commit is contained in:
Benjamin Smedberg 2010-11-05 15:56:28 -04:00
commit 010fbdcb07
579 changed files with 20971 additions and 15080 deletions

View File

@ -171,7 +171,7 @@ ifdef MOZ_SYMBOLS_EXTRA_BUILDID
EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
endif
SYMBOL_INDEX_NAME = \
export SYMBOL_INDEX_NAME = \
$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)$(EXTRA_BUILDID)-symbols.txt
buildsymbols:

View File

@ -382,7 +382,8 @@ nsAccessNode::ScrollTo(PRUint32 aScrollType)
PRInt16 vPercent, hPercent;
nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent);
return shell->ScrollContentIntoView(content, vPercent, hPercent);
return shell->ScrollContentIntoView(content, vPercent, hPercent,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}
NS_IMETHODIMP

View File

@ -2368,7 +2368,8 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex)
// Scroll into view.
presShell->ScrollContentIntoView(aContent, NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE);
NS_PRESSHELL_SCROLL_ANYWHERE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
// Fire mouse down and mouse up events.
PRBool res = nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, presShell,

View File

@ -82,6 +82,7 @@ endif
endif
ifneq (,$(filter windows, $(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DCAN_DRAW_IN_TITLEBAR=1
DEFINES += -DMENUBAR_CAN_AUTOHIDE=1
endif

View File

@ -104,6 +104,7 @@ body[dir="rtl"] #searchEngineLinks {
}
#searchText {
margin-bottom: 10px;
width: 100%;
}

View File

@ -72,7 +72,6 @@
<img id="searchEngineLogo"/>
<form name="searchForm" onsubmit="onSearchSubmit(event)">
<input type="text" name="searchText" value="" id="searchText" maxLength="256"/>
<br/>
<input type="submit" value="&abouthome.searchEngineButton.label;"/>
<span id="searchEngineLinks">
<a hidden="true" id="searchEngineAdvancedLink">&abouthome.searchEngineLinks.advanced;</a>

View File

@ -0,0 +1,409 @@
# -*- Mode: HTML -*-
# ***** 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 Firefox Application Menu.
#
# The Initial Developer of the Original Code is
# The Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Dão Gottwald <dao@mozilla.com>
# Joshua M. <soapyhamhocks@gmail.com>
# Margaret Leibovic <margaret.leibovic@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 *****
<menupopup id="appmenu-popup"
#ifdef MOZ_SERVICES_SYNC
onpopupshowing="updateEditUIVisibility();gSyncUI.updateUI();">
#else
onpopupshowing="updateEditUIVisibility();">
#endif
<hbox>
<vbox id="appmenuPrimaryPane">
<hbox flex="1"
class="split-menuitem">
<menuitem id="appmenu_newTab"
class="menuitem-tooltip split-menuitem-item"
flex="1"
label="&tabCmd.label;"
command="cmd_newNavigatorTab"
key="key_newNavigatorTab"/>
<menu class="split-menuitem-menu">
<menupopup>
<menuitem id="appmenu_newTab_popup"
label="&tabCmd.label;"
command="cmd_newNavigatorTab"
key="key_newNavigatorTab"/>
<menuitem id="appmenu_newNavigator"
label="&newNavigatorCmd.label;"
command="cmd_newNavigator"
key="key_newNavigator"/>
<menuseparator/>
<menuitem id="appmenu_openFile"
label="&openFileCmd.label;"
command="Browser:OpenFile"
key="openFileKb"/>
</menupopup>
</menu>
</hbox>
<menuitem id="appmenu_privateBrowsing"
class="menuitem-iconic menuitem-iconic-tooltip"
label="&privateBrowsingCmd.start.label;"
startlabel="&privateBrowsingCmd.start.label;"
stoplabel="&privateBrowsingCmd.stop.label;"
command="Tools:PrivateBrowsing"
key="key_privatebrowsing"/>
<menuitem label="&goOfflineCmd.label;"
id="appmenu_offlineModeRecovery"
type="checkbox"
observes="workOfflineMenuitemState"
oncommand="BrowserOffline.toggleOfflineStatus();"/>
<menuseparator class="appmenu-menuseparator"/>
<hbox>
<menuitem id="appmenu-edit-label"
label="&appMenuEdit.label;"
disabled="true"/>
<toolbarbutton id="appmenu-cut"
class="appmenu-edit-button"
command="cmd_cut"
onclick="if (!this.disabled) hidePopup();"
tooltiptext="&cutButton.tooltip;"/>
<toolbarbutton id="appmenu-copy"
class="appmenu-edit-button"
command="cmd_copy"
onclick="if (!this.disabled) hidePopup();"
tooltiptext="&copyButton.tooltip;"/>
<toolbarbutton id="appmenu-paste"
class="appmenu-edit-button"
command="cmd_paste"
onclick="if (!this.disabled) hidePopup();"
tooltiptext="&pasteButton.tooltip;"/>
</hbox>
<menuitem id="appmenu_find"
class="menuitem-tooltip"
label="&appMenuFind.label;"
command="cmd_find"
key="key_find"/>
<menuseparator class="appmenu-menuseparator"/>
<menuitem id="appmenu_savePage"
class="menuitem-tooltip"
label="&savePageCmd.label;"
command="Browser:SavePage"
key="key_savePage"/>
<menuitem id="appmenu_sendLink"
label="&sendPageCmd.label;"
command="Browser:SendLink"/>
<hbox flex="1"
class="split-menuitem">
<menuitem id="appmenu_print"
class="menuitem-iconic menuitem-iconic-tooltip split-menuitem-item"
flex="1"
label="&printCmd.label;"
command="cmd_print"
key="printKb"/>
<menu class="split-menuitem-menu">
<menupopup>
<menuitem id="appmenu_print_popup"
class="menuitem-iconic"
label="&printCmd.label;"
command="cmd_print"
key="printKb"/>
<menuitem id="appmenu_printPreview"
label="&printPreviewCmd.label;"
command="cmd_printPreview"/>
<menuitem id="appmenu_printSetup"
label="&printSetupCmd.label;"
command="cmd_pageSetup"/>
</menupopup>
</menu>
</hbox>
<menuseparator class="appmenu-menuseparator"/>
<menu id="appmenu_webDeveloper"
label="&appMenuWebDeveloper.label;">
<menupopup id="appmenu_webDeveloper_popup">
<menuitem id="appmenu_webConsole"
label="&webConsoleCmd.label;"
oncommand="HUDConsoleUI.toggleHUD();"
key="key_webConsole"/>
<menuitem id="appmenu_pageInspect"
hidden="true"
label="&inspectMenu.label;"
type="checkbox"
command="Tools:Inspect"
key="key_inspect"/>
<menuseparator/>
<menuitem id="appmenu_pageSource"
label="&viewPageSourceCmd.label;"
command="View:PageSource"
key="key_viewSource"/>
<menuseparator/>
#define ID_PREFIX appmenu_developer_
#include browser-charsetmenu.inc
#undef ID_PREFIX
<menuseparator/>
<menuitem label="&goOfflineCmd.label;"
type="checkbox"
observes="workOfflineMenuitemState"
oncommand="BrowserOffline.toggleOfflineStatus();"/>
</menupopup>
</menu>
<menuseparator class="appmenu-menuseparator"/>
#define ID_PREFIX appmenu_
#include browser-charsetmenu.inc
#undef ID_PREFIX
<menuitem id="appmenu_fullScreen"
class="menuitem-tooltip"
label="&fullScreenCmd.label;"
type="checkbox"
observes="View:FullScreen"
key="key_fullScreen"/>
<menuitem id="appmenu-quit"
class="menuitem-iconic"
#ifdef XP_WIN
label="&quitApplicationCmdWin.label;"
#else
label="&quitApplicationCmd.label;"
#endif
command="cmd_quitApplication"/>
</vbox>
<vbox id="appmenuSecondaryPane">
<hbox class="split-menuitem">
<menuitem id="appmenu_bookmarks"
class="menuitem-iconic menuitem-iconic-tooltip split-menuitem-item"
flex="1"
label="&bookmarksMenu.label;"
command="Browser:ShowAllBookmarks"
key="manBookmarkKb"/>
<menu id="appmenu_bookmarksMenu"
class="split-menuitem-menu">
<menupopup id="appmenu_bookmarksPopup"
placespopup="true"
context="placesContext"
openInTabs="children"
oncommand="BookmarksEventHandler.onCommand(event);"
onclick="BookmarksEventHandler.onClick(event);"
onpopupshowing="BookmarksMenuButton.onPopupShowing(event);
if (!this.parentNode._placesView)
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"
tooltip="bhTooltip"
popupsinherittooltip="true">
<menuitem id="appmenu_showAllBookmarks"
label="&showAllBookmarks.label;"
command="Browser:ShowAllBookmarks"
context=""
key="manBookmarkKb"/>
<menuseparator/>
<menuitem id="appmenu_bookmarkThisPage"
class="menuitem-iconic"
label="&bookmarkThisPageCmd.label;"
command="Browser:AddBookmarkAs"
key="addBookmarkAsKb"/>
<menuitem id="appmenu_subscribeToPage"
class="menuitem-iconic"
label="&subscribeToPageMenuitem.label;"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"
observes="singleFeedMenuitemState"/>
<menu id="appmenu_subscribeToPageMenu"
class="menu-iconic"
label="&subscribeToPageMenupopup.label;"
observes="multipleFeedsMenuState">
<menupopup id="appmenu_subscribeToPageMenupopup"
onpopupshowing="return FeedHandler.buildFeedList(event.target);"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"/>
</menu>
<menuseparator/>
<menu id="appmenu_bookmarksToolbar"
placesanonid="toolbar-autohide"
class="menu-iconic bookmark-item"
label="&personalbarCmd.label;"
container="true">
<menupopup id="appmenu_bookmarksToolbarPopup"
placespopup="true"
context="placesContext"
onpopupshowing="if (!this.parentNode._placesView)
new PlacesMenu(event, 'place:folder=TOOLBAR');"/>
</menu>
<menuseparator/>
<!-- Bookmarks menu items -->
<menuseparator builder="end"
class="hide-if-empty-places-result"/>
<menuitem id="appmenu_unsortedBookmarks"
label="&appMenuUnsorted.label;"
oncommand="PlacesCommandHook.showPlacesOrganizer('UnfiledBookmarks');"
class="menuitem-iconic"/>
</menupopup>
</menu>
</hbox>
<hbox class="split-menuitem">
<menuitem id="appmenu_history"
class="menuitem-iconic menuitem-iconic-tooltip split-menuitem-item"
flex="1"
label="&historyMenu.label;"
command="Browser:ShowAllHistory"
key="showAllHistoryKb"/>
<menu id="appmenu_historyMenu"
class="split-menuitem-menu">
<menupopup id="appmenu_historyMenupopup"
placespopup="true"
oncommand="this.parentNode._placesView._onCommand(event);"
onclick="checkForMiddleClick(this, event);"
onpopupshowing="if (!this.parentNode._placesView)
new HistoryMenu(event);"
tooltip="bhTooltip"
popupsinherittooltip="true">
<menuitem id="appmenu_showAllHistory"
label="&showAllHistoryCmd2.label;"
command="Browser:ShowAllHistory"
key="showAllHistoryKb"/>
<menuseparator/>
<menuitem id="appmenu_sanitizeHistory"
label="&clearRecentHistory.label;"
key="key_sanitize"
command="Tools:Sanitize"/>
<menuseparator class="hide-if-empty-places-result"/>
<menuitem id="appmenu_restoreLastSession"
class="restoreLastSession"
label="&historyRestoreLastSession.label;"
oncommand="restoreLastSession();"
disabled="true"/>
<menu id="appmenu_recentlyClosedTabsMenu"
class="recentlyClosedTabsMenu"
label="&historyUndoMenu.label;"
disabled="true">
<menupopup id="appmenu_recentlyClosedTabsMenupopup"
onpopupshowing="document.getElementById('appmenu_historyMenu')._placesView.populateUndoSubmenu();"/>
</menu>
<menu id="appmenu_recentlyClosedWindowsMenu"
class="recentlyClosedWindowsMenu"
label="&historyUndoWindowMenu.label;"
disabled="true">
<menupopup id="appmenu_recentlyClosedWindowsMenupopup"
onpopupshowing="document.getElementById('appmenu_historyMenu')._placesView.populateUndoWindowSubmenu();"/>
</menu>
<menuseparator/>
</menupopup>
</menu>
</hbox>
<menuitem id="appmenu_downloads"
class="menuitem-tooltip"
label="&downloads.label;"
command="Tools:Downloads"
key="key_openDownloads"/>
<spacer id="appmenuSecondaryPane-spacer"/>
<menuitem id="appmenu_addons"
class="menuitem-iconic menuitem-iconic-tooltip"
label="&addons.label;"
command="Tools:Addons"
key="key_openAddons"/>
<hbox class="split-menuitem">
<menuitem id="appmenu_customize"
#ifdef XP_UNIX
label="&preferencesCmdUnix.label;"
#else
label="&preferencesCmd.label;"
#endif
class="split-menuitem-item"
flex="1"
oncommand="openPreferences();"/>
<menu class="split-menuitem-menu"
label="&preferencesCmd.label;">
<menupopup id="appmenu_customizeMenu"
onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('appmenu_toggleTabsOnTop').previousSibling);">
<menuitem id="appmenu_preferences"
#ifdef XP_UNIX
label="&preferencesCmdUnix.label;"
#else
label="&preferencesCmd.label;"
#endif
oncommand="openPreferences();"/>
<menuseparator/>
<menuseparator/>
<menuitem id="appmenu_toggleTabsOnTop"
label="&viewTabsOnTop.label;"
type="checkbox"
command="cmd_ToggleTabsOnTop"/>
<menuitem id="appmenu_toolbarLayout"
label="&appMenuToolbarLayout.label;"
command="cmd_CustomizeToolbars"/>
</menupopup>
</menu>
</hbox>
<hbox class="split-menuitem">
<menuitem id="appmenu_help"
class="split-menuitem-item"
flex="1"
label="&helpMenu.label;"
oncommand="openHelpLink('firefox-help')"/>
<menu class="split-menuitem-menu">
<menupopup id="appmenu_helpMenupopup">
<menuitem id="appmenu_openHelp"
label="&helpMenu.label;"
oncommand="openHelpLink('firefox-help')"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="appmenu_gettingStarted"
label="&appMenuGettingStarted.label;"
oncommand="gBrowser.loadOneTab('http://www.mozilla.com/firefox/central/', {inBackground: false});"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="appmenu_troubleshootingInfo"
label="&helpTroubleshootingInfo.label;"
oncommand="openTroubleshootingPage()"
onclick="checkForMiddleClick(this,event);"/>
<menuitem id="appmenu_feedbackPage"
label="&helpFeedbackPage.label;"
oncommand="openFeedbackPage()"
onclick="checkForMiddleClick(this, event);"/>
<menuseparator/>
<menuitem id="appmenu_safeMode"
accesskey="&appMenuSafeMode.accesskey;"
label="&appMenuSafeMode.label;"
oncommand="safeModeRestart();"/>
<menuseparator/>
<menuitem id="appmenu_about"
label="&aboutProduct.label;"
oncommand="openAboutDialog();"/>
</menupopup>
</menu>
</hbox>
#ifdef MOZ_SERVICES_SYNC
<spacer flex="1"/>
<!-- only one of sync-setup or sync-syncnow will be showing at once -->
<menuitem id="sync-setup-appmenu"
label="&syncSetup.label;"
observes="sync-setup-state"
oncommand="gSyncUI.openSetup()"/>
<menuitem id="sync-syncnowitem-appmenu"
label="&syncSyncNowItem.label;"
observes="sync-syncnow-state"
oncommand="gSyncUI.doSync(event);"/>
#endif
</vbox>
</hbox>
</menupopup>

View File

@ -439,11 +439,17 @@
command="Browser:AddBookmarkAs"
key="addBookmarkAsKb"/>
<menuitem id="subscribeToPageMenuitem"
#ifndef XP_MACOSX
class="menuitem-iconic"
#endif
label="&subscribeToPageMenuitem.label;"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"
observes="singleFeedMenuitemState"/>
<menu id="subscribeToPageMenupopup"
#ifndef XP_MACOSX
class="menu-iconic"
#endif
label="&subscribeToPageMenupopup.label;"
observes="multipleFeedsMenuState">
<menupopup id="subscribeToPageSubmenuMenupopup"

View File

@ -80,7 +80,7 @@ toolbar[printpreview="true"] {
-moz-box-ordinal-group: 10;
}
%ifdef MENUBAR_CAN_AUTOHIDE
%ifdef CAN_DRAW_IN_TITLEBAR
#main-window[inFullscreen] > #titlebar {
display: none;
}

View File

@ -3985,6 +3985,27 @@ var XULBrowserWindow = {
encodeURIComponent);
gURLBar.setOverLink(link);
},
// Called before links are navigated to to allow us to retarget them if needed.
onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
// Don't modify non-default targets or targets that aren't in top-level app
// tab docshells (isAppTab will be false for app tab subframes).
if (originalTarget != "" || !isAppTab)
return originalTarget;
let docURI = linkNode.ownerDocument.documentURIObject;
try {
let docURIDomain = Services.eTLD.getBaseDomain(docURI, 0);
let linkURIDomain = Services.eTLD.getBaseDomain(linkURI, 0);
// External links from within app tabs should always open in new tabs
// instead of replacing the app tab's page (Bug 575561)
if (docURIDomain != linkURIDomain)
return "_blank";
} catch(e) {
// If getBaseDomain fails, we return originalTarget below.
}
return originalTarget;
},
onLinkIconAvailable: function (aIconURL) {
if (gProxyFavIcon && gBrowser.userTypedValue === null)
@ -4702,14 +4723,18 @@ function updateAppButtonDisplay() {
window.menubar.visible &&
document.getElementById("toolbar-menubar").getAttribute("autohide") == "true";
#ifdef CAN_DRAW_IN_TITLEBAR
document.getElementById("titlebar").hidden = !displayAppButton;
if (displayAppButton)
document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1");
else
document.documentElement.removeAttribute("chromemargin");
#endif
}
#endif
#ifdef CAN_DRAW_IN_TITLEBAR
function onTitlebarMaxClick() {
if (window.windowState == window.STATE_MAXIMIZED)
window.restore();

View File

@ -429,7 +429,7 @@
<tooltip id="tabbrowser-tab-tooltip" onpopupshowing="gBrowser.createTooltip(event);"/>
</popupset>
#ifdef MENUBAR_CAN_AUTOHIDE
#ifdef CAN_DRAW_IN_TITLEBAR
<vbox id="titlebar">
<hbox id="titlebar-content">
<hbox id="appmenu-button-container" align="start">
@ -441,371 +441,7 @@
label="&appMenuButton.label;"
#endif
style="-moz-user-focus: ignore;">
<menupopup id="appmenu-popup"
#ifdef MOZ_SERVICES_SYNC
onpopupshowing="updateEditUIVisibility();gSyncUI.updateUI();">
#else
onpopupshowing="updateEditUIVisibility();">
#endif
<hbox>
<vbox id="appmenuPrimaryPane">
<hbox flex="1"
class="split-menuitem">
<menuitem id="appmenu_newTab"
class="menuitem-tooltip split-menuitem-item"
flex="1"
label="&tabCmd.label;"
command="cmd_newNavigatorTab"
key="key_newNavigatorTab"/>
<menu class="split-menuitem-menu">
<menupopup>
<menuitem id="appmenu_newTab_popup"
label="&tabCmd.label;"
command="cmd_newNavigatorTab"
key="key_newNavigatorTab"/>
<menuitem id="appmenu_newNavigator"
label="&newNavigatorCmd.label;"
command="cmd_newNavigator"
key="key_newNavigator"/>
<menuseparator/>
<menuitem id="appmenu_openFile"
label="&openFileCmd.label;"
command="Browser:OpenFile"
key="openFileKb"/>
</menupopup>
</menu>
</hbox>
<menuitem id="appmenu_privateBrowsing"
class="menuitem-iconic menuitem-iconic-tooltip"
label="&privateBrowsingCmd.start.label;"
startlabel="&privateBrowsingCmd.start.label;"
stoplabel="&privateBrowsingCmd.stop.label;"
command="Tools:PrivateBrowsing"
key="key_privatebrowsing"/>
<menuitem label="&goOfflineCmd.label;"
id="appmenu_offlineModeRecovery"
type="checkbox"
observes="workOfflineMenuitemState"
oncommand="BrowserOffline.toggleOfflineStatus();"/>
<menuseparator class="appmenu-menuseparator"/>
<hbox>
<menuitem id="appmenu-edit-label"
label="&appMenuEdit.label;"
disabled="true"/>
<toolbarbutton id="appmenu-cut"
class="appmenu-edit-button"
command="cmd_cut"
onclick="if (!this.disabled) hidePopup();"
tooltiptext="&cutButton.tooltip;"/>
<toolbarbutton id="appmenu-copy"
class="appmenu-edit-button"
command="cmd_copy"
onclick="if (!this.disabled) hidePopup();"
tooltiptext="&copyButton.tooltip;"/>
<toolbarbutton id="appmenu-paste"
class="appmenu-edit-button"
command="cmd_paste"
onclick="if (!this.disabled) hidePopup();"
tooltiptext="&pasteButton.tooltip;"/>
</hbox>
<menuitem id="appmenu_find"
class="menuitem-tooltip"
label="&appMenuFind.label;"
command="cmd_find"
key="key_find"/>
<menuseparator class="appmenu-menuseparator"/>
<menuitem id="appmenu_savePage"
class="menuitem-tooltip"
label="&savePageCmd.label;"
command="Browser:SavePage"
key="key_savePage"/>
<menuitem id="appmenu_sendLink"
label="&sendPageCmd.label;"
command="Browser:SendLink"/>
<hbox flex="1"
class="split-menuitem">
<menuitem id="appmenu_print"
class="menuitem-iconic menuitem-iconic-tooltip split-menuitem-item"
flex="1"
label="&printCmd.label;"
command="cmd_print"
key="printKb"/>
<menu class="split-menuitem-menu">
<menupopup>
<menuitem id="appmenu_print_popup"
class="menuitem-iconic"
label="&printCmd.label;"
command="cmd_print"
key="printKb"/>
<menuitem id="appmenu_printPreview"
label="&printPreviewCmd.label;"
command="cmd_printPreview"/>
<menuitem id="appmenu_printSetup"
label="&printSetupCmd.label;"
command="cmd_pageSetup"/>
</menupopup>
</menu>
</hbox>
<menuseparator class="appmenu-menuseparator"/>
<menu id="appmenu_webDeveloper"
label="&appMenuWebDeveloper.label;">
<menupopup id="appmenu_webDeveloper_popup">
<menuitem id="appmenu_webConsole"
label="&webConsoleCmd.label;"
oncommand="HUDConsoleUI.toggleHUD();"
key="key_webConsole"/>
<menuitem id="appmenu_pageInspect"
hidden="true"
label="&inspectMenu.label;"
type="checkbox"
command="Tools:Inspect"
key="key_inspect"/>
<menuseparator/>
<menuitem id="appmenu_pageSource"
label="&viewPageSourceCmd.label;"
command="View:PageSource"
key="key_viewSource"/>
<menuseparator/>
#define ID_PREFIX appmenu_developer_
#include browser-charsetmenu.inc
#undef ID_PREFIX
<menuseparator/>
<menuitem label="&goOfflineCmd.label;"
type="checkbox"
observes="workOfflineMenuitemState"
oncommand="BrowserOffline.toggleOfflineStatus();"/>
</menupopup>
</menu>
<menuseparator class="appmenu-menuseparator"/>
#define ID_PREFIX appmenu_
#include browser-charsetmenu.inc
#undef ID_PREFIX
<menuitem id="appmenu_fullScreen"
class="menuitem-tooltip"
label="&fullScreenCmd.label;"
type="checkbox"
observes="View:FullScreen"
key="key_fullScreen"/>
<menuitem id="appmenu-quit"
class="menuitem-iconic"
#ifdef XP_WIN
label="&quitApplicationCmdWin.label;"
#else
label="&quitApplicationCmd.label;"
#endif
command="cmd_quitApplication"/>
</vbox>
<vbox id="appmenuSecondaryPane">
<hbox class="split-menuitem">
<menuitem id="appmenu_bookmarks"
class="menuitem-iconic menuitem-iconic-tooltip split-menuitem-item"
flex="1"
label="&bookmarksMenu.label;"
command="Browser:ShowAllBookmarks"
key="manBookmarkKb"/>
<menu id="appmenu_bookmarksMenu"
class="split-menuitem-menu">
<menupopup id="appmenu_bookmarksPopup"
placespopup="true"
context="placesContext"
openInTabs="children"
oncommand="BookmarksEventHandler.onCommand(event);"
onclick="BookmarksEventHandler.onClick(event);"
onpopupshowing="BookmarksMenuButton.onPopupShowing(event);
if (!this.parentNode._placesView)
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"
tooltip="bhTooltip"
popupsinherittooltip="true">
<menuitem id="appmenu_showAllBookmarks"
label="&showAllBookmarks.label;"
command="Browser:ShowAllBookmarks"
context=""
key="manBookmarkKb"/>
<menuseparator/>
<menuitem id="appmenu_bookmarkThisPage"
class="menuitem-iconic"
label="&bookmarkThisPageCmd.label;"
command="Browser:AddBookmarkAs"
key="addBookmarkAsKb"/>
<menuitem id="appmenu_subscribeToPage"
class="menuitem-iconic"
label="&subscribeToPageMenuitem.label;"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"
observes="singleFeedMenuitemState"/>
<menu id="appmenu_subscribeToPageMenu"
class="menu-iconic"
label="&subscribeToPageMenupopup.label;"
observes="multipleFeedsMenuState">
<menupopup id="appmenu_subscribeToPageMenupopup"
onpopupshowing="return FeedHandler.buildFeedList(event.target);"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"/>
</menu>
<menuseparator/>
<menu id="appmenu_bookmarksToolbar"
placesanonid="toolbar-autohide"
class="menu-iconic bookmark-item"
label="&personalbarCmd.label;"
container="true">
<menupopup id="appmenu_bookmarksToolbarPopup"
placespopup="true"
context="placesContext"
onpopupshowing="if (!this.parentNode._placesView)
new PlacesMenu(event, 'place:folder=TOOLBAR');"/>
</menu>
<menuseparator/>
<!-- Bookmarks menu items -->
<menuseparator builder="end"
class="hide-if-empty-places-result"/>
<menuitem id="appmenu_unsortedBookmarks"
label="&appMenuUnsorted.label;"
oncommand="PlacesCommandHook.showPlacesOrganizer('UnfiledBookmarks');"
class="menuitem-iconic"/>
</menupopup>
</menu>
</hbox>
<hbox class="split-menuitem">
<menuitem id="appmenu_history"
class="menuitem-iconic menuitem-iconic-tooltip split-menuitem-item"
flex="1"
label="&historyMenu.label;"
command="Browser:ShowAllHistory"
key="showAllHistoryKb"/>
<menu id="appmenu_historyMenu"
class="split-menuitem-menu">
<menupopup id="appmenu_historyMenupopup"
placespopup="true"
oncommand="this.parentNode._placesView._onCommand(event);"
onclick="checkForMiddleClick(this, event);"
onpopupshowing="if (!this.parentNode._placesView)
new HistoryMenu(event);"
tooltip="bhTooltip"
popupsinherittooltip="true">
<menuitem id="appmenu_showAllHistory"
label="&showAllHistoryCmd2.label;"
command="Browser:ShowAllHistory"
key="showAllHistoryKb"/>
<menuseparator/>
<menuitem id="appmenu_sanitizeHistory"
label="&clearRecentHistory.label;"
key="key_sanitize"
command="Tools:Sanitize"/>
<menuseparator class="hide-if-empty-places-result"/>
<menuitem id="appmenu_restoreLastSession"
class="restoreLastSession"
label="&historyRestoreLastSession.label;"
oncommand="restoreLastSession();"
disabled="true"/>
<menu id="appmenu_recentlyClosedTabsMenu"
class="recentlyClosedTabsMenu"
label="&historyUndoMenu.label;"
disabled="true">
<menupopup id="appmenu_recentlyClosedTabsMenupopup"
onpopupshowing="document.getElementById('appmenu_historyMenu')._placesView.populateUndoSubmenu();"/>
</menu>
<menu id="appmenu_recentlyClosedWindowsMenu"
class="recentlyClosedWindowsMenu"
label="&historyUndoWindowMenu.label;"
disabled="true">
<menupopup id="appmenu_recentlyClosedWindowsMenupopup"
onpopupshowing="document.getElementById('appmenu_historyMenu')._placesView.populateUndoWindowSubmenu();"/>
</menu>
<menuseparator/>
</menupopup>
</menu>
</hbox>
<menuitem id="appmenu_downloads"
class="menuitem-tooltip"
label="&downloads.label;"
command="Tools:Downloads"
key="key_openDownloads"/>
<spacer id="appmenuSecondaryPane-spacer"/>
<menuitem id="appmenu_addons"
class="menuitem-iconic menuitem-iconic-tooltip"
label="&addons.label;"
command="Tools:Addons"
key="key_openAddons"/>
<hbox class="split-menuitem">
<menuitem id="appmenu_customize"
label="&preferencesCmd.label;"
class="split-menuitem-item"
flex="1"
oncommand="openPreferences();"/>
<menu class="split-menuitem-menu"
label="&preferencesCmd.label;">
<menupopup id="appmenu_customizeMenu"
onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('appmenu_toggleTabsOnTop').previousSibling);">
<menuitem id="appmenu_preferences"
#ifdef XP_UNIX
label="&preferencesCmdUnix.label;"
#else
label="&preferencesCmd.label;"
#endif
oncommand="openPreferences();"/>
<menuseparator/>
<menuseparator/>
<menuitem id="appmenu_toggleTabsOnTop"
label="&viewTabsOnTop.label;"
type="checkbox"
command="cmd_ToggleTabsOnTop"/>
<menuitem id="appmenu_toolbarLayout"
label="&appMenuToolbarLayout.label;"
command="cmd_CustomizeToolbars"/>
</menupopup>
</menu>
</hbox>
<hbox class="split-menuitem">
<menuitem id="appmenu_help"
class="split-menuitem-item"
flex="1"
label="&helpMenu.label;"
oncommand="openHelpLink('firefox-help')"/>
<menu class="split-menuitem-menu">
<menupopup id="appmenu_helpMenupopup">
<menuitem id="appmenu_openHelp"
label="&helpMenu.label;"
oncommand="openHelpLink('firefox-help')"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="appmenu_gettingStarted"
label="&appMenuGettingStarted.label;"
oncommand="gBrowser.loadOneTab('http://www.mozilla.com/firefox/central/', {inBackground: false});"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="appmenu_troubleshootingInfo"
label="&helpTroubleshootingInfo.label;"
oncommand="openTroubleshootingPage()"
onclick="checkForMiddleClick(this,event);"/>
<menuitem id="appmenu_feedbackPage"
label="&helpFeedbackPage.label;"
oncommand="openFeedbackPage()"
onclick="checkForMiddleClick(this, event);"/>
<menuseparator/>
<menuitem id="appmenu_safeMode"
accesskey="&appMenuSafeMode.accesskey;"
label="&appMenuSafeMode.label;"
oncommand="safeModeRestart();"/>
<menuseparator/>
<menuitem id="appmenu_about"
label="&aboutProduct.label;"
oncommand="openAboutDialog();"/>
</menupopup>
</menu>
</hbox>
#ifdef MOZ_SERVICES_SYNC
<spacer flex="1"/>
<!-- only one of sync-setup or sync-syncnow will be showing at once -->
<menuitem id="sync-setup-appmenu"
label="&syncSetup.label;"
observes="sync-setup-state"
oncommand="gSyncUI.openSetup()"/>
<menuitem id="sync-syncnowitem-appmenu"
label="&syncSyncNowItem.label;"
observes="sync-syncnow-state"
oncommand="gSyncUI.doSync(event);"/>
#endif
</vbox>
</hbox>
</menupopup>
#include browser-appmenu.inc
</button>
</hbox>
<spacer id="titlebar-spacer" flex="1"/>
@ -826,12 +462,7 @@
#ifdef WINCE
defaulticonsize="small" iconsize="small"
#endif
#ifdef XP_WIN
tabsontop="true"
#endif
#ifdef XP_MACOSX
tabsontop="true"
#endif
persist="tabsontop">
<!-- Menu -->
<toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
@ -1021,11 +652,17 @@
command="Browser:AddBookmarkAs"
key="addBookmarkAsKb"/>
<menuitem id="BMB_subscribeToPageMenuitem"
#ifndef XP_MACOSX
class="menuitem-iconic"
#endif
label="&subscribeToPageMenuitem.label;"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"
observes="singleFeedMenuitemState"/>
<menu id="BMB_subscribeToPageMenupopup"
#ifndef XP_MACOSX
class="menu-iconic"
#endif
label="&subscribeToPageMenupopup.label;"
observes="multipleFeedsMenuState">
<menupopup id="BMB_subscribeToPageSubmenuMenupopup"

View File

@ -191,6 +191,8 @@
this.tabContainer._positionPinnedTabs();
this.tabContainer.adjustTabstrip();
this.getBrowserForTab(aTab).docShell.isAppTab = true;
let event = document.createEvent("Events");
event.initEvent("TabPinned", true, false);
aTab.dispatchEvent(event);
@ -210,6 +212,8 @@
this.tabContainer._positionPinnedTabs();
this.tabContainer.adjustTabstrip();
this.getBrowserForTab(aTab).docShell.isAppTab = false;
let event = document.createEvent("Events");
event.initEvent("TabUnpinned", true, false);
aTab.dispatchEvent(event);

View File

@ -145,6 +145,7 @@ _BROWSER_FILES = \
browser_bug561636.js \
browser_bug562649.js \
browser_bug563588.js \
browser_bug575561.js \
browser_bug577121.js \
browser_bug579872.js \
browser_bug580956.js \
@ -218,6 +219,8 @@ _BROWSER_FILES = \
file_bug550565_favicon.ico \
browser_overLinkInLocationBar.js \
browser_aboutHome.js \
app_bug575561.html \
app_subframe_bug575561.html \
$(NULL)
# compartment-disabled

View File

@ -0,0 +1,16 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=575561
-->
<head>
<title>Test for links in app tabs</title>
</head>
<body>
<a href="http://example.com/browser/browser/base/content/test/dummy_page.html">same domain</a>
<a href="http://test1.example.com/browser/browser/base/content/test/dummy_page.html">same domain (different subdomain)</a>
<a href="http://example.org/browser/browser/base/content/test/dummy_page.html">different domain</a>
<a href="http://example.org/browser/browser/base/content/test/dummy_page.html" target="foo">different domain (with target)</a>
<iframe src="app_subframe_bug575561.html"></iframe>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=575561
-->
<head>
<title>Test for links in app tab subframes</title>
</head>
<body>
<a href="http://example.org/browser/browser/base/content/test/dummy_page.html">different domain</a>
</body>
</html>

View File

@ -33,26 +33,21 @@ function wait_for_install_dialog(aCallback) {
info("Waiting for install dialog");
Services.wm.addListener({
onOpenWindow: function(aXULWindow) {
info("Install dialog opened, waiting for load");
info("Install dialog opened, waiting for focus");
Services.wm.removeListener(this);
var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowInternal);
domwindow.addEventListener("load", function() {
domwindow.removeEventListener("load", arguments.callee, false);
waitForFocus(function() {
info("Saw install dialog");
is(domwindow.document.location.href, XPINSTALL_URL, "Should have seen the right window open");
// Allow other window load listeners to execute before passing to callback
executeSoon(function() {
info("Saw install dialog");
// Override the countdown timer on the accept button
var button = domwindow.document.documentElement.getButton("accept");
button.disabled = false;
// Override the countdown timer on the accept button
var button = domwindow.document.documentElement.getButton("accept");
button.disabled = false;
aCallback(domwindow);
});
}, false);
aCallback(domwindow);
}, domwindow);
},
onCloseWindow: function(aXULWindow) {
@ -597,7 +592,7 @@ var XPInstallObserver = {
};
function test() {
requestLongerTimeout(2);
requestLongerTimeout(4);
waitForExplicitFinish();
Services.prefs.setBoolPref("extensions.logging.enabled", true);

View File

@ -0,0 +1,77 @@
function test() {
waitForExplicitFinish();
// Pinned: Link to the same domain should not open a new tab
// Tests link to http://example.com/browser/browser/base/content/test/dummy_page.html
testLink(0, true, false, function() {
// Pinned: Link to the same domain should not open a new tab
// Tests link to http://test1.example.com/browser/browser/base/content/test/dummy_page.html
testLink(1, true, false, function() {
// Pinned: Link to a different domain should open a new tab
// Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html
testLink(2, true, true, function() {
// Not Pinned: Link to a different domain should not open a new tab
// Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html
testLink(2, false, false, function() {
// Pinned: Targetted link should open a new tab
// Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html with target="foo"
testLink(3, true, true, function() {
// Pinned: Link in a subframe should not open a new tab
// Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html in subframe
testLink(0, true, false, finish, true);
});
});
});
});
});
}
function testLink(aLinkIndex, pinTab, expectNewTab, nextTest, testSubFrame) {
let appTab = gBrowser.addTab("http://example.com/browser/browser/base/content/test/app_bug575561.html", {skipAnimation: true});
if (pinTab)
gBrowser.pinTab(appTab);
gBrowser.selectedTab = appTab;
appTab.linkedBrowser.addEventListener("load", onLoad, true);
let loadCount = 0;
function onLoad() {
loadCount++;
if (loadCount < 2)
return;
appTab.linkedBrowser.removeEventListener("load", onLoad, true);
let browser = gBrowser.getBrowserForTab(appTab);
if (testSubFrame)
browser = browser.contentDocument.getElementsByTagName("iframe")[0];
let links = browser.contentDocument.getElementsByTagName("a");
if (expectNewTab)
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
else
browser.addEventListener("load", onPageLoad, true);
info("Clicking " + links[aLinkIndex].textContent);
EventUtils.sendMouseEvent({type:"click"}, links[aLinkIndex], browser.contentWindow);
function onPageLoad() {
browser.removeEventListener("load", onPageLoad, true);
is(browser.contentDocument.location.href, links[aLinkIndex].href, "Link should not open in a new tab");
executeSoon(function(){
gBrowser.removeTab(appTab);
nextTest();
});
}
function onTabOpen(event) {
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
ok(true, "Link should open a new tab");
executeSoon(function(){
gBrowser.removeTab(appTab);
gBrowser.removeCurrentTab();
nextTest();
});
}
}
}

View File

@ -55,13 +55,28 @@ function test() {
function onTabViewLoadedAndShown() {
window.removeEventListener("tabviewshown", onTabViewLoadedAndShown, false);
ok(TabView.isVisible(), "Tab View is visible. Count: " + tabViewShownCount);
tabViewShownCount++;
// Evidently sometimes isVisible (which is based on the selectedIndex of the
// tabview deck) isn't updated immediately when called from button.doCommand,
// so we add a little timeout here to get outside of the doCommand call.
// If the initial timeout isn't enough, we keep waiting in case it's taking
// longer than expected.
// See bug 594909.
let deck = document.getElementById("tab-view-deck");
function waitForSwitch() {
if (deck.selectedIndex == 1) {
ok(TabView.isVisible(), "Tab View is visible. Count: " + tabViewShownCount);
tabViewShownCount++;
// kick off the series
window.addEventListener("tabviewshown", onTabViewShown, false);
window.addEventListener("tabviewhidden", onTabViewHidden, false);
TabView.toggle();
} else {
setTimeout(waitForSwitch, 10);
}
}
// kick off the series
window.addEventListener("tabviewshown", onTabViewShown, false);
window.addEventListener("tabviewhidden", onTabViewHidden, false);
TabView.toggle();
setTimeout(waitForSwitch, 1);
}
// ----------

View File

@ -272,8 +272,13 @@
if (aTriggeringEvent instanceof MouseEvent) {
// We have a mouse event (from the go button), so use the standard
// UI link behaviors
openUILink(url, aTriggeringEvent, false, false,
true /* allow third party fixup */, postData);
let where = whereToOpenLink(aTriggeringEvent, false, false);
if (where != "current") {
this.handleRevert();
content.focus();
}
openUILinkIn(url, where,
{ allowThirdPartyFixup: true, postData: postData });
return;
}

View File

@ -469,8 +469,10 @@ PrivateBrowsingService.prototype = {
if (aCmdLine.handleFlag("private", false))
; // It has already been handled
else if (aCmdLine.handleFlag("private-toggle", false)) {
if (this._autoStarted) {
throw Cr.NS_ERROR_ABORT;
}
this.privateBrowsingEnabled = !this.privateBrowsingEnabled;
this._autoStarted = false;
this._lastChangedByCommandLine = true;
}
},

View File

@ -2,6 +2,7 @@ af
ak
ar
as
ast
be
bg
bn-BD
@ -18,6 +19,7 @@ en-GB
en-ZA
eo
es-AR
es-CL
es-ES
es-MX
et
@ -27,6 +29,7 @@ fi
fr
fy-NL
ga-IE
gd
gl
gu-IN
he
@ -40,12 +43,14 @@ it
ja
ja-JP-mac
ka
km
kn
ko
ku
lg
lt
lv
mai
mk
ml
mn
@ -71,6 +76,7 @@ sq
sr
sv-SE
ta
ta-LK
te
th
tr

View File

@ -71,7 +71,7 @@ can reach it easily. -->
<!ENTITY personalbarCmd.accesskey "B">
<!ENTITY bookmarksToolbarItem.label "Bookmarks Toolbar Items">
<!ENTITY addonBarCmd.label "Add-on Bar">
<!ENTITY addonBarCmd.accesskey "B">
<!ENTITY addonBarCmd.accesskey "A">
<!ENTITY pageSourceCmd.label "Page Source">
<!ENTITY pageSourceCmd.accesskey "o">

View File

@ -17,10 +17,12 @@ eo
es-AR
es-ES
et
eu
fi
fr
fy-NL
ga-IE
gd
he
hu
hy-AM
@ -34,6 +36,7 @@ ku
lg
lt
lv
mk
nb-NO
nl
nn-NO
@ -42,6 +45,7 @@ pa-IN
pl
pt-BR
pt-PT
rm
ro
ru
sk

View File

@ -233,7 +233,7 @@ menuitem.bookmark-item {
}
/* Stock icons for the menu bar items */
menuitem:not([type]) {
menuitem:not([type]):not(.menuitem-tooltip):not(.menuitem-iconic-tooltip) {
-moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem-iconic");
}
@ -472,6 +472,13 @@ menuitem:not([type]) {
-moz-image-region: rect(0px 48px 16px 32px);
}
#subscribeToPageMenuitem:not([disabled]),
#subscribeToPageMenupopup,
#BMB_subscribeToPageMenuitem:not([disabled]),
#BMB_subscribeToPageMenupopup {
list-style-image: url("chrome://browser/skin/page-livemarks.png");
}
#bookmarksToolbarFolderMenu,
#BMB_bookmarksToolbar {
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");

View File

@ -36,7 +36,7 @@
}
#sanitizeEverythingWarningIcon {
list-style-image: url("chrome://global/skin/icons/warning-large.png");
list-style-image: url("moz-icon://stock/gtk-dialog-warning?size=dialog");
padding: 0;
margin: 0;
}

View File

@ -14,11 +14,11 @@
}
.statusIcon[status="error"] {
list-style-image: url("chrome://global/skin/icons/error-16.png");
list-style-image: url("moz-icon://stock/gtk-dialog-error?size=menu");
}
.statusIcon[status="success"] {
list-style-image: url("chrome://global/skin/icons/information-16.png");
list-style-image: url("moz-icon://stock/gtk-dialog-info?size=menu");
}
/* .data is only used by syncGenericChange.xul, but it seems unnecessary to have

View File

@ -302,14 +302,6 @@
list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric-16.png");
}
#BMB_subscribeToPage:not([disabled]),
#BMB_subscribeToPageMenu,
#appmenu_subscribeToPage:not([disabled]),
#appmenu_subscribeToPageMenu {
list-style-image: url("chrome://browser/skin/feeds/feed-icons-16.png");
-moz-image-region: rect(0px 16px 16px 0px);
}
#BMB_bookmarkThisPage,
#appmenu_bookmarkThisPage {
list-style-image: url("chrome://browser/skin/places/bookmark.png");
@ -1936,6 +1928,15 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
}
/* Bookmarks roots menu-items */
#appmenu_subscribeToPage:not([disabled]),
#appmenu_subscribeToPageMenu,
#subscribeToPageMenuitem:not([disabled]),
#subscribeToPageMenupopup,
#BMB_subscribeToPageMenuitem:not([disabled]),
#BMB_subscribeToPageMenupopup {
list-style-image: url("chrome://browser/skin/feeds/feedIcon16.png");
}
#bookmarksToolbarFolderMenu,
#appmenu_bookmarksToolbar,
#BMB_bookmarksToolbar {

View File

@ -65,4 +65,7 @@
<uses-permission android:name="android.permission.SET_TIME"></uses-permission>
<uses-permission android:name="android.permission.SET_TIME_ZONE"></uses-permission>
</manifest>

View File

@ -51,6 +51,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
@ -59,9 +60,12 @@ import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.Timer;
import java.util.zip.Adler32;
@ -87,6 +91,7 @@ import com.mozilla.SUTAgentAndroid.SUTAgentAndroid;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlarmManager;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.ContextWrapper;
@ -95,12 +100,14 @@ import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
import android.os.Debug;
import android.os.Environment;
import android.os.StatFs;
import android.os.SystemClock;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager;
@ -118,13 +125,13 @@ public class DoCommand {
String currentDir = "/";
String sErrorPrefix = "##AGENT-WARNING## ";
private final String prgVersion = "SUTAgentAndroid Version 0.85";
private final String prgVersion = "SUTAgentAndroid Version 0.87";
public enum Command
{
RUN ("run"),
EXEC ("exec"),
ARUN ("arun"),
ENVRUN ("envrun"),
KILL ("kill"),
PS ("ps"),
DEVINFO ("info"),
@ -173,6 +180,8 @@ public class DoCommand {
UNINST ("uninst"),
TEST ("test"),
VER ("ver"),
TZGET ("tzget"),
TZSET ("tzset"),
UNKNOWN ("unknown");
private final String theCmd;
@ -207,7 +216,7 @@ public class DoCommand {
Command cCmd = null;
Command cSubCmd = null;
String [] Argv = parseCmdLine(theCmdLine);
String [] Argv = parseCmdLine2(theCmdLine);
int Argc = Argv.length;
@ -223,6 +232,17 @@ public class DoCommand {
strReturn = GetClok();
break;
case TZGET:
strReturn = GetTimeZone();
break;
case TZSET:
if (Argc == 2)
strReturn = SetTimeZone(Argv[1]);
else
strReturn = sErrorPrefix + "Wrong number of arguments for settz command!";
break;
case UPDT:
strReturn = StartUpdateOMatic(Argv[1], Argv[2]);
break;
@ -327,16 +347,6 @@ public class DoCommand {
break;
case REBT:
// try {
// reboot(null);
// Power.reboot(null);
// Power.shutdown();
// }
// catch (IOException e)
// {
// TODO Auto-generated catch block
// e.printStackTrace();
// }
RunReboot(cmdOut);
break;
@ -497,6 +507,25 @@ public class DoCommand {
case TEST:
// boolean bRet = false;
/*
Configuration userConfig = new Configuration();
Settings.System.getConfiguration( contextWrapper.getContentResolver(), userConfig );
Calendar cal = Calendar.getInstance( userConfig.locale);
TimeZone ctz = cal.getTimeZone();
String sctzLongName = ctz.getDisplayName();
String pstzName = TimeZone.getDefault().getDisplayName();
*/
String sTimeZoneName = GetTimeZone();
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
TimeZone tz2 = TimeZone.getTimeZone("GMT-08:00");
int nOffset = (-8 * 3600000);
String [] zoneNames = TimeZone.getAvailableIDs(nOffset);
int nNumMatches = zoneNames.length;
TimeZone.setDefault(tz);
String sOldTZ = System.setProperty("persist.sys.timezone", "America/Los_Angeles");
/*
byte[] buffer = new byte [4096];
int nRead = 0;
@ -591,7 +620,7 @@ public class DoCommand {
}
*/
// strReturn = InstallApplication();
strReturn = InstallApp(Argv[1], cmdOut);
// strReturn = InstallApp(Argv[1], cmdOut);
// strReturn = UninstallApplication();
// String sPingCheck = SendPing("www.mozilla.org",null);
@ -653,6 +682,24 @@ public class DoCommand {
*/
break;
case ENVRUN:
if (Argc >= 2)
{
String [] theArgs = new String [Argc - 1];
for (int lcv = 1; lcv < Argc; lcv++)
{
theArgs[lcv - 1] = Argv[lcv];
}
strReturn = StartPrg2(theArgs, cmdOut);
}
else
{
strReturn = sErrorPrefix + "Wrong number of arguments for " + Argv[0] + " command!";
}
break;
case EXEC:
case RUN:
if (Argc >= 2)
@ -828,12 +875,28 @@ public class DoCommand {
}
}
public String [] parseCmdLine(String theCmdLine) {
public String [] parseCmdLine2(String theCmdLine)
{
String cmdString;
String workingString;
String workingString2;
String workingString3;
List<String> lst = new ArrayList<String>();
int nLength = theCmdLine.length();
int nFirstSpace = theCmdLine.indexOf(' ');
int nLength = 0;
int nFirstSpace = -1;
// Null cmd line
if (theCmdLine == null)
{
String [] theArgs = new String [1];
theArgs[0] = new String("");
return(theArgs);
}
else
{
nLength = theCmdLine.length();
nFirstSpace = theCmdLine.indexOf(' ');
}
if (nFirstSpace == -1)
{
@ -843,7 +906,134 @@ public class DoCommand {
}
// Get the command
lst.add(new String(theCmdLine.substring(0, nFirstSpace)));
cmdString = new String(theCmdLine.substring(0, nFirstSpace));
lst.add(cmdString);
// Jump past the command and trim
workingString = (theCmdLine.substring(nFirstSpace + 1, nLength)).trim();
while ((nLength = workingString.length()) > 0)
{
int nEnd = 0;
int nStart = 0;
// if we have a quote
if (workingString.startsWith("\""))
{
// point to the first non quote char
nStart = 1;
// find the matching quote
nEnd = workingString.indexOf('"', nStart);
char prevChar;
while(nEnd != -1)
{
// check to see if the quotation mark has been escaped
prevChar = workingString.charAt(nEnd - 1);
if (prevChar == '\\')
{
// if escaped, point past this quotation mark and find the next
nEnd++;
if (nEnd < nLength)
nEnd = workingString.indexOf('"', nEnd);
else
nEnd = -1;
}
else
break;
}
// there isn't one
if (nEnd == -1)
{
// point at the quote
nStart = 0;
// so find the next space
nEnd = workingString.indexOf(' ', nStart);
// there isn't one of those either
if (nEnd == -1)
nEnd = nLength; // Just grab the rest of the cmdline
}
}
else // no quote so find the next space
{
nEnd = workingString.indexOf(' ', nStart);
// there isn't one of those
if (nEnd == -1)
nEnd = nLength; // Just grab the rest of the cmdline
}
// get the substring
workingString2 = workingString.substring(nStart, nEnd);
// if we have escaped quotes
if (workingString2.contains("\\\""))
{
do
{
// replace escaped quote with embedded quote
workingString3 = workingString2.replace("\\\"", "\"");
workingString2 = workingString3;
}
while(workingString2.contains("\\\""));
}
// add it to the list
lst.add(new String(workingString2));
// if we are dealing with a quote
if (nStart > 0)
nEnd++; // point past the end one
// jump past the substring and trim it
workingString = (workingString.substring(nEnd)).trim();
}
// ok we're done package up the results
int nItems = lst.size();
String [] theArgs = new String [nItems];
for (int lcv = 0; lcv < nItems; lcv++)
{
theArgs[lcv] = lst.get(lcv);
}
return(theArgs);
}
public String [] parseCmdLine(String theCmdLine) {
String cmdString;
String workingString;
String workingString2;
List<String> lst = new ArrayList<String>();
int nLength = 0;
int nFirstSpace = -1;
// Null cmd line
if (theCmdLine == null)
{
String [] theArgs = new String [1];
theArgs[0] = new String("");
return(theArgs);
}
else
{
nLength = theCmdLine.length();
nFirstSpace = theCmdLine.indexOf(' ');
}
if (nFirstSpace == -1)
{
String [] theArgs = new String [1];
theArgs[0] = new String(theCmdLine);
return(theArgs);
}
// Get the command
cmdString = new String(theCmdLine.substring(0, nFirstSpace));
lst.add(cmdString);
// Jump past the command and trim
workingString = (theCmdLine.substring(nFirstSpace + 1, nLength)).trim();
@ -871,6 +1061,11 @@ public class DoCommand {
if (nEnd == -1)
nEnd = nLength; // Just grab the rest of the cmdline
}
else
{
nStart = 0;
nEnd++;
}
}
else // no quote so find the next space
{
@ -887,8 +1082,8 @@ public class DoCommand {
lst.add(new String(workingString2));
// if we are dealing with a quote
if (nStart > 0)
nEnd++; // point past the end one
// if (nStart > 0)
// nEnd++; // point past the end one
// jump past the substring and trim it
workingString = (workingString.substring(nEnd)).trim();
@ -1116,7 +1311,6 @@ public class DoCommand {
public String StatProcess(String string)
{
String sRet = "";
// ActivityManager aMgr = (ActivityManager) SUTAgentAndroid.me.getSystemService(Activity.ACTIVITY_SERVICE);
ActivityManager aMgr = (ActivityManager) contextWrapper.getSystemService(Activity.ACTIVITY_SERVICE);
int [] nPids = new int [1];
@ -1160,7 +1354,6 @@ public class DoCommand {
public String GetAppRoot(String AppName)
{
String sRet = "";
// Context ctx = SUTAgentAndroid.me.getApplicationContext();
Context ctx = contextWrapper.getApplicationContext();
if (ctx != null)
@ -1234,8 +1427,8 @@ public class DoCommand {
try {
digest = java.security.MessageDigest.getInstance("MD5");
}
catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
catch (NoSuchAlgorithmException e)
{
e.printStackTrace();
}
@ -1420,12 +1613,10 @@ public class DoCommand {
}
catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
@ -1534,12 +1725,6 @@ public class DoCommand {
@SuppressWarnings("unused")
boolean bRet = ftp.completePendingCommand();
outStream.flush();
/*
if (ftp.retrieveFile("pub/mozilla.org/firefox/releases/3.6b4/wince-arm/en-US/firefox-3.6b4.cab", outStream))
{
outStream.flush();
}
*/
outStream.close();
strRet = ftp.getReplyString();
reply = ftp.getReplyCode();
@ -1564,7 +1749,6 @@ public class DoCommand {
}
catch (SocketException e)
{
// TODO Auto-generated catch block
sRet = e.getMessage();
strRet = ftp.getReplyString();
reply = ftp.getReplyCode();
@ -1573,7 +1757,6 @@ public class DoCommand {
}
catch (IOException e)
{
// TODO Auto-generated catch block
sRet = e.getMessage();
strRet = ftp.getReplyString();
reply = ftp.getReplyCode();
@ -1652,7 +1835,6 @@ public class DoCommand {
theArgs[2] = "kill";
String sRet = sErrorPrefix + "Unable to kill " + sProcName + "\n";
// ActivityManager aMgr = (ActivityManager) SUTAgentAndroid.me.getSystemService(Activity.ACTIVITY_SERVICE);
ActivityManager aMgr = (ActivityManager) contextWrapper.getSystemService(Activity.ACTIVITY_SERVICE);
List <ActivityManager.RunningAppProcessInfo> lProcesses = aMgr.getRunningAppProcesses();
int lcv = 0;
@ -1661,7 +1843,6 @@ public class DoCommand {
for (lcv = 0; lcv < lProcesses.size(); lcv++)
{
// if (lProcesses.get(lcv).processName.contentEquals(sProcName))
if (lProcesses.get(lcv).processName.contains(sProcName))
{
strProcName = lProcesses.get(lcv).processName;
@ -1684,12 +1865,9 @@ public class DoCommand {
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
// SUTAgentAndroid.me.finishActivity(SUTAgentAndroid.START_PRG);
// Give the messages a chance to be processed
try {
Thread.sleep(2000);
@ -1698,7 +1876,6 @@ public class DoCommand {
{
e.printStackTrace();
}
// aMgr.restartPackage(strProcName);
break;
}
}
@ -1709,7 +1886,6 @@ public class DoCommand {
lProcesses = aMgr.getRunningAppProcesses();
for (lcv = 0; lcv < lProcesses.size(); lcv++)
{
// if (lProcesses.get(lcv).processName.contentEquals(sProcName))
if (lProcesses.get(lcv).processName.contains(sProcName))
{
sRet = sErrorPrefix + "Unable to kill " + nPID + " " + strProcName + "\n";
@ -1724,12 +1900,9 @@ public class DoCommand {
public boolean IsProcessDead(String sProcName)
{
boolean bRet = false;
// ActivityManager aMgr = (ActivityManager) SUTAgentAndroid.me.getSystemService(Activity.ACTIVITY_SERVICE);
ActivityManager aMgr = (ActivityManager) contextWrapper.getSystemService(Activity.ACTIVITY_SERVICE);
List <ActivityManager.ProcessErrorStateInfo> lProcesses = aMgr.getProcessesInErrorState();
int lcv = 0;
// String strProcName = "";
// int nPID = 0;
if (lProcesses != null)
{
@ -1738,8 +1911,6 @@ public class DoCommand {
if (lProcesses.get(lcv).processName.contentEquals(sProcName) &&
lProcesses.get(lcv).condition != ActivityManager.ProcessErrorStateInfo.NO_ERROR)
{
// strProcName = lProcesses.get(lcv).processName;
// nPID = lProcesses.get(lcv).pid;
bRet = true;
break;
}
@ -1752,7 +1923,6 @@ public class DoCommand {
public String GetProcessInfo()
{
String sRet = "";
// ActivityManager aMgr = (ActivityManager) SUTAgentAndroid.me.getSystemService(Activity.ACTIVITY_SERVICE);
ActivityManager aMgr = (ActivityManager) contextWrapper.getSystemService(Activity.ACTIVITY_SERVICE);
List <ActivityManager.RunningAppProcessInfo> lProcesses = aMgr.getRunningAppProcesses();
int nProcs = lProcesses.size();
@ -1817,12 +1987,10 @@ public class DoCommand {
public long GetMemoryConfig()
{
// ActivityManager aMgr = (ActivityManager) SUTAgentAndroid.me.getSystemService(Activity.ACTIVITY_SERVICE);
ActivityManager aMgr = (ActivityManager) contextWrapper.getSystemService(Activity.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo outInfo = new ActivityManager.MemoryInfo();
aMgr.getMemoryInfo(outInfo);
long lMem = outInfo.availMem;
// float fMem = (float) lMem / (float)(1024.0 * 1024.0);
return (lMem);
}
@ -1866,12 +2034,10 @@ public class DoCommand {
}
catch (UnknownHostException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e)
{
// TODO Auto-generated catch block
sRet += "reg exception thrown";
e.printStackTrace();
}
@ -1911,25 +2077,76 @@ public class DoCommand {
}
catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
sRet = e.getLocalizedMessage();
e.printStackTrace();
}
catch (ClientProtocolException e)
{
// TODO Auto-generated catch block
sRet = e.getLocalizedMessage();
e.printStackTrace();
}
catch (IOException e)
{
// TODO Auto-generated catch block
sRet = e.getLocalizedMessage();
e.printStackTrace();
}
return(sRet);
}
public String GetTimeZone()
{
String sRet = "";
TimeZone tz;
tz = TimeZone.getDefault();
Date now = new Date();
sRet = tz.getDisplayName(tz.inDaylightTime(now), TimeZone.LONG);
return(sRet);
}
public String SetTimeZone(String sTimeZone)
{
String sRet = "Unable to set timezone to " + sTimeZone;
TimeZone tz = null;
AlarmManager amgr = null;
if ((sTimeZone.length() > 0) && (sTimeZone.startsWith("GMT")))
{
amgr = (AlarmManager) contextWrapper.getSystemService(Context.ALARM_SERVICE);
if (amgr != null)
amgr.setTimeZone(sTimeZone);
}
else
{
String [] zoneNames = TimeZone.getAvailableIDs();
int nNumMatches = zoneNames.length;
int lcv = 0;
for (lcv = 0; lcv < nNumMatches; lcv++)
{
if (zoneNames[lcv].equalsIgnoreCase(sTimeZone))
break;
}
if (lcv < nNumMatches)
{
amgr = (AlarmManager) contextWrapper.getSystemService(Context.ALARM_SERVICE);
if (amgr != null)
amgr.setTimeZone(zoneNames[lcv]);
}
}
if (amgr != null)
{
tz = TimeZone.getDefault();
Date now = new Date();
sRet = tz.getDisplayName(tz.inDaylightTime(now), TimeZone.LONG);
}
return(sRet);
}
public String GetSystemTime()
{
@ -1943,17 +2160,8 @@ public class DoCommand {
public String SetSystemTime(String sDate, String sTime, OutputStream out)
{
// Debug.waitForDebugger();
String sRet = "";
// Intent prgIntent = new Intent(android.provider.Settings.ACTION_DATE_SETTINGS);
// prgIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// contextWrapper.startActivity(prgIntent);
// 2010/09/22
// 15:41:00
// 0123456789012345678
if (((sDate != null) && (sTime != null)) &&
(sDate.contains("/") || sDate.contains(".")) &&
(sTime.contains(":")))
@ -1966,14 +2174,11 @@ public class DoCommand {
int mins = Integer.parseInt(sTime.substring(3,5));
int secs = Integer.parseInt(sTime.substring(6,8));
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
Calendar cal = new GregorianCalendar(TimeZone.getDefault());
cal.set(year, month - 1, day, hour, mins, secs);
long lMillisecs = cal.getTime().getTime();
// boolean bRet = SystemClock.setCurrentTimeMillis(lMillisecs);
String sM = Long.toString(lMillisecs);
// long lm = 1285175618316L;
String sTest = cal.getTime().toGMTString();
String sMillis = sM.substring(0, sM.length() - 3) + "." + sM.substring(sM.length() - 3);
String [] theArgs = new String [3];
@ -1996,7 +2201,6 @@ public class DoCommand {
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@ -2045,24 +2249,6 @@ public class DoCommand {
return (sRet);
}
/*
private boolean IsProcRunning(Process pProc)
{
boolean bRet = false;
int nExitCode = 0;
try
{
nExitCode = pProc.exitValue();
}
catch (IllegalThreadStateException z)
{
bRet = true;
}
return(bRet);
}
*/
public String NewKillProc(String sProcId, OutputStream out)
{
@ -2107,9 +2293,6 @@ public class DoCommand {
try
{
pProc = Runtime.getRuntime().exec(theArgs);
// sutErr = pProc.getErrorStream(); // Stderr
// sutIn = pProc.getOutputStream(); // Stdin
// sutOut = pProc.getInputStream(); // Stdout
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
outThrd.start();
outThrd.join(5000);
@ -2123,7 +2306,6 @@ public class DoCommand {
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
@ -2133,7 +2315,6 @@ public class DoCommand {
public String GetTmpDir()
{
String sRet = "";
// Context ctx = SUTAgentAndroid.me.getApplicationContext();
Context ctx = contextWrapper.getApplicationContext();
File dir = ctx.getFilesDir();
ctx = null;
@ -2245,7 +2426,6 @@ public class DoCommand {
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
@ -2269,7 +2449,6 @@ public class DoCommand {
outThrd.start();
outThrd.join(60000);
int nRet = pProc.exitValue();
// boolean bRet = outThrd.isAlive();
sRet = "\nuninst complete [" + nRet + "]";
}
catch (IOException e)
@ -2403,7 +2582,6 @@ public class DoCommand {
{
String sRet = "";
// Context ctx = SUTAgentAndroid.me.getApplicationContext();
Context ctx = contextWrapper.getApplicationContext();
PackageManager pm = ctx.getPackageManager();
@ -2435,17 +2613,12 @@ public class DoCommand {
try
{
contextWrapper.startActivity(prgIntent);
// Thread.sleep(5000);
sRet = "exit";
}
catch(ActivityNotFoundException anf)
{
anf.printStackTrace();
}
// catch (InterruptedException e)
// {
// e.printStackTrace();
// }
ctx = null;
return (sRet);
@ -2458,7 +2631,6 @@ public class DoCommand {
String sUrl = "";
String sRedirFileName = "";
// Context ctx = SUTAgentAndroid.me.getApplicationContext();
Context ctx = contextWrapper.getApplicationContext();
PackageManager pm = ctx.getPackageManager();
@ -2486,7 +2658,7 @@ public class DoCommand {
if (sArgs.length > 1)
{
if (sArgs[0].contains("android.browser"))
// if (sArgs[0].contains("android.browser"))
prgIntent.setAction(Intent.ACTION_VIEW);
if (sArgs[0].contains("fennec"))
@ -2530,10 +2702,7 @@ public class DoCommand {
try
{
// ctx.startActivity(prgIntent);
contextWrapper.startActivity(prgIntent);
// SUTAgentAndroid.me.startActivity(prgIntent);
// SUTAgentAndroid.me.startActivityForResult(prgIntent, SUTAgentAndroid.START_PRG);
}
catch(ActivityNotFoundException anf)
{
@ -2551,12 +2720,11 @@ public class DoCommand {
try
{
pProc = Runtime.getRuntime().exec(progArray);
sutErr = pProc.getErrorStream(); // Stderr
sutIn = pProc.getOutputStream(); // Stdin
sutOut = pProc.getInputStream(); // Stdout
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
outThrd.start();
outThrd.join(10000);
int nRetCode = pProc.exitValue();
sRet = "return code [" + nRetCode + "]";
}
catch (IOException e)
{
@ -2564,8 +2732,147 @@ public class DoCommand {
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
sRet = "Timed out!";
}
return (sRet);
}
/*
@SuppressWarnings("unchecked")
public static void set(String key, String value) throws Exception
{
Class[] classes = Collections.class.getDeclaredClasses();
Map env = System.getenv();
for(Class cl : classes)
{
if("java.util.Collections$UnmodifiableMap".equals(cl.getName()))
{
Field field = cl.getDeclaredField("m");
field.setAccessible(true);
Object obj = field.get(env);
Map<String, String> map = (Map<String, String>) obj;
map.put(key, value);
}
}
}
*/
public String StartPrg2(String [] progArray, OutputStream out)
{
String sRet = "";
int nArraySize = 0;
int nArgs = progArray.length - 1; // 1st arg is the environment string
int lcv = 0;
int temp = 0;
String sEnvString = progArray[0];
// Set up command line args stripping off the environment string
String [] theArgs = new String [nArgs];
for (lcv = 0; lcv < nArgs; lcv++)
{
theArgs[lcv] = progArray[lcv + 1];
}
try
{
String [] envStrings = sEnvString.split(",");
Map<String, String> newEnv = new HashMap<String, String>();
for (lcv = 0; lcv < envStrings.length; lcv++)
{
temp = envStrings[lcv].indexOf("=");
if (temp > 0)
{
newEnv.put( envStrings[lcv].substring(0, temp),
envStrings[lcv].substring(temp + 1, envStrings[lcv].length()));
}
}
Map<String, String> sysEnv = System.getenv();
nArraySize = sysEnv.size();
for (Map.Entry<String, String> entry : newEnv.entrySet())
{
if (!sysEnv.containsKey(entry.getKey()))
{
nArraySize++;
}
}
String[] envArray = new String[nArraySize];
int i = 0;
int offset;
String sKey = "";
String sValue = "";
for (Map.Entry<String, String> entry : sysEnv.entrySet())
{
sKey = entry.getKey();
if (newEnv.containsKey(sKey))
{
sValue = newEnv.get(sKey);
if ((offset = sValue.indexOf("$" + sKey)) != -1)
{
envArray[i++] = sKey +
"=" +
sValue.substring(0, offset) +
entry.getValue() +
sValue.substring(offset + sKey.length() + 1);
}
else
envArray[i++] = sKey + "=" + sValue;
newEnv.remove(sKey);
}
else
envArray[i++] = entry.getKey() + "=" + entry.getValue();
}
for (Map.Entry<String, String> entry : newEnv.entrySet())
{
envArray[i++] = entry.getKey() + "=" + entry.getValue();
}
pProc = Runtime.getRuntime().exec(theArgs, envArray);
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
outThrd.start();
outThrd.join(10000);
int nRetCode = pProc.exitValue();
sRet = "return code [" + nRetCode + "]";
}
catch(UnsupportedOperationException e)
{
if (e != null)
e.printStackTrace();
}
catch(ClassCastException e)
{
if (e != null)
e.printStackTrace();
}
catch(IllegalArgumentException e)
{
if (e != null)
e.printStackTrace();
}
catch(NullPointerException e)
{
if (e != null)
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (InterruptedException e)
{
e.printStackTrace();
sRet = "Timed out!";
}
return (sRet);
@ -2603,55 +2910,58 @@ public class DoCommand {
*/
private String PrintUsage()
{
String sRet = "run [executable] [args] - start program no wait\n" +
"exec [executable] [args] - start program wait\n" +
"fire [executable] [args] - start program no wait\n" +
"arun [executable] [args] - start program no wait\n" +
"kill [program name] - kill program no path\n" +
"killall - kill all processes started\n" +
"ps - list of running processes\n" +
"info - list of device info\n" +
" [os] - os version for device\n" +
" [id] - unique identifier for device\n" +
" [uptime] - uptime for device\n" +
" [systime] - current system time on device\n" +
" [screen] - width, height and bits per pixel for device\n" +
" [memory] - physical, free, available, storage memory for device\n" +
" [processes] - list of running processes see 'ps'\n" +
"deadman timeout - set the duration for the deadman timer\n" +
"alrt [on/off] - start or stop sysalert behavior\n" +
"disk [arg] - prints disk space info\n" +
"cp file1 file2 - copy file1 to file2 on device\n" +
"time file - timestamp for file on device\n" +
"hash file - generate hash for file on device\n" +
"cd directory - change cwd on device\n" +
"cat file - cat file on device\n" +
"cwd - display cwd on device\n" +
"mv file1 file2 - move file1 to file2 on device\n" +
"push filename - push file to device\n" +
"rm file - delete file on device\n" +
"rmdr directory - delete directory on device even if not empty\n" +
"mkdr directory - create directory on device\n" +
"dirw directory - tests whether the directory is writable on the device\n" +
"stat processid - stat process on device\n" +
"dead processid - print whether the process is alive or hung on device\n" +
"mems - dump memory stats on device\n" +
"ls - print directory on device\n" +
"tmpd - print temp directory on device\n" +
"ping [hostname/ipaddr] - ping a network device\n" +
"unzp zipfile destdir - unzip the zipfile into the destination dir\n" +
"zip zipfile src - zip the source file/dir into zipfile\n" +
"rebt - reboot device\n" +
"inst /path/filename.apk - install the referenced apk file\n" +
"uninst packagename - uninstall the referenced package\n" +
"updt pkgname pkgfile - unpdate the referenced package\n" +
"clok - the current device time expressed as the number of millisecs since epoch\n" +
"settime date time - sets the device date and time (YYYY/MM/DD HH:MM:SS)\n" +
"rebt - reboot device\n" +
"quit - disconnect SUTAgent\n" +
"exit - close SUTAgent\n" +
"ver - SUTAgent version\n" +
"help - you're reading it";
String sRet =
"run [executable] [args] - start program no wait\n" +
"exec [executable] [args] - start program wait\n" +
"fire [executable] [args] - start program no wait\n" +
"envrun [env pairs] [cmdline] - start program no wait\n" +
"kill [program name] - kill program no path\n" +
"killall - kill all processes started\n" +
"ps - list of running processes\n" +
"info - list of device info\n" +
" [os] - os version for device\n" +
" [id] - unique identifier for device\n" +
" [uptime] - uptime for device\n" +
" [systime] - current system time on device\n" +
" [screen] - width, height and bits per pixel for device\n" +
" [memory] - physical, free, available, storage memory for device\n" +
" [processes] - list of running processes see 'ps'\n" +
"deadman timeout - set the duration for the deadman timer\n" +
"alrt [on/off] - start or stop sysalert behavior\n" +
"disk [arg] - prints disk space info\n" +
"cp file1 file2 - copy file1 to file2 on device\n" +
"time file - timestamp for file on device\n" +
"hash file - generate hash for file on device\n" +
"cd directory - change cwd on device\n" +
"cat file - cat file on device\n" +
"cwd - display cwd on device\n" +
"mv file1 file2 - move file1 to file2 on device\n" +
"push filename - push file to device\n" +
"rm file - delete file on device\n" +
"rmdr directory - delete directory on device even if not empty\n" +
"mkdr directory - create directory on device\n" +
"dirw directory - tests whether the directory is writable on the device\n" +
"stat processid - stat process on device\n" +
"dead processid - print whether the process is alive or hung on device\n" +
"mems - dump memory stats on device\n" +
"ls - print directory on device\n" +
"tmpd - print temp directory on device\n" +
"ping [hostname/ipaddr] - ping a network device\n" +
"unzp zipfile destdir - unzip the zipfile into the destination dir\n" +
"zip zipfile src - zip the source file/dir into zipfile\n" +
"rebt - reboot device\n" +
"inst /path/filename.apk - install the referenced apk file\n" +
"uninst packagename - uninstall the referenced package\n" +
"updt pkgname pkgfile - unpdate the referenced package\n" +
"clok - the current device time expressed as the number of millisecs since epoch\n" +
"settime date time - sets the device date and time (YYYY/MM/DD HH:MM:SS)\n" +
"tzset timezone - sets the device timezone format is GMTxhh:mm x = +/- or a recognized Olsen string\n" +
"tzget - returns the current timezone set on the device\n" +
"rebt - reboot device\n" +
"quit - disconnect SUTAgent\n" +
"exit - close SUTAgent\n" +
"ver - SUTAgent version\n" +
"help - you're reading it";
return (sRet);
}
}

View File

@ -391,7 +391,7 @@ public class SUTAgentAndroid extends Activity
{
sb.append("Overheated ");
sb.append((((float)(nBatteryTemp))/10));
sb.append("(°C)");
sb.append("(C)");
}
else
{

View File

@ -69,8 +69,7 @@
#
#######################################################################
# Defines
#
CVS = cvs
comma := ,
CWD := $(CURDIR)
@ -107,7 +106,6 @@ endif
PERL ?= perl
PYTHON ?= python
RUN_AUTOCONF_LOCALLY = 1
CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
ifdef CONFIG_GUESS_SCRIPT
CONFIG_GUESS = $(shell $(CONFIG_GUESS_SCRIPT))
@ -170,7 +168,6 @@ CONFIGURES += $(TOPSRCDIR)/js/src/configure
#######################################################################
# Rules
#
# The default rule is build
build::
@ -272,7 +269,6 @@ else
CONFIG_STATUS = $(wildcard $(OBJDIR)/config.status)
CONFIG_CACHE = $(wildcard $(OBJDIR)/config.cache)
ifdef RUN_AUTOCONF_LOCALLY
EXTRA_CONFIG_DEPS := \
$(TOPSRCDIR)/aclocal.m4 \
$(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \
@ -282,7 +278,6 @@ EXTRA_CONFIG_DEPS := \
$(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS)
@echo Generating $@ using autoconf
cd $(@D); $(AUTOCONF)
endif
CONFIG_STATUS_DEPS := \
$(wildcard $(CONFIGURES)) \
@ -290,8 +285,7 @@ CONFIG_STATUS_DEPS := \
$(TOPSRCDIR)/.mozconfig.mk \
$(wildcard $(TOPSRCDIR)/nsprpub/configure) \
$(wildcard $(TOPSRCDIR)/config/milestone.txt) \
$(wildcard $(TOPSRCDIR)/config/chrome-versions.sh) \
$(wildcard $(addsuffix confvars.sh,$(wildcard $(TOPSRCDIR)/*/))) \
$(wildcard $(addsuffix confvars.sh,$(wildcard $(TOPSRCDIR)/*/))) \
$(NULL)
# configure uses the program name to determine @srcdir@. Calling it without
@ -303,10 +297,6 @@ else
CONFIGURE = $(TOPSRCDIR)/configure
endif
ifdef MOZ_TOOLS
CONFIGURE = $(TOPSRCDIR)/configure
endif
configure-files: $(CONFIGURES)
configure:: configure-files
@ -417,4 +407,4 @@ echo-variable-%:
# in parallel.
.NOTPARALLEL:
.PHONY: checkout real_checkout depend build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all
.PHONY: checkout real_checkout depend build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all upload sdk

View File

@ -132,6 +132,7 @@ export::
-DMOZ_NATIVE_PNG=$(MOZ_NATIVE_PNG) \
-DMOZ_NATIVE_JPEG=$(MOZ_NATIVE_JPEG) \
-DMOZ_NATIVE_LIBEVENT=$(MOZ_NATIVE_LIBEVENT) \
-DMOZ_NATIVE_LIBVPX=$(MOZ_NATIVE_LIBVPX) \
$(srcdir)/system-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers
$(INSTALL) system_wrappers $(DIST)

View File

@ -101,7 +101,6 @@ MOZ_DEBUG_DISABLE_DEFS = @MOZ_DEBUG_DISABLE_DEFS@
MOZ_DEBUG_FLAGS = @MOZ_DEBUG_FLAGS@
MOZ_DEBUG_LDFLAGS=@MOZ_DEBUG_LDFLAGS@
MOZ_EXTENSIONS = @MOZ_EXTENSIONS@
MOZ_IMG_ENCODERS= @MOZ_IMG_ENCODERS@
MOZ_JSDEBUGGER = @MOZ_JSDEBUGGER@
MOZ_IPC = @MOZ_IPC@
MOZ_IPDL_TESTS = @MOZ_IPDL_TESTS@
@ -232,6 +231,10 @@ MOZ_NATIVE_LIBEVENT = @MOZ_NATIVE_LIBEVENT@
MOZ_LIBEVENT_LIBS = @MOZ_LIBEVENT_LIBS@
MOZ_LIBEVENT_INCLUDES = @MOZ_LIBEVENT_INCLUDES@
MOZ_NATIVE_LIBVPX = @MOZ_NATIVE_LIBVPX@
MOZ_LIBVPX_LIBS = @MOZ_LIBVPX_LIBS@
MOZ_LIBVPX_INCLUDES = @MOZ_LIBVPX_INCLUDES@
MOZ_NATIVE_ZLIB = @SYSTEM_ZLIB@
MOZ_NATIVE_BZ2 = @SYSTEM_BZ2@
MOZ_NATIVE_JPEG = @SYSTEM_JPEG@
@ -696,3 +699,16 @@ ANDROID_TOOLS = @ANDROID_TOOLS@
ANDROID_VERSION = @ANDROID_VERSION@
JS_SHARED_LIBRARY = @JS_SHARED_LIBRARY@
# We only want to do the pymake sanity on Windows, other os's can cope
ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH)))
# Ensure invariants between GNU Make and pymake
# Checked here since we want the sane error in a file that
# actually can be found regardless of path-style.
ifeq (_:,$(.PYMAKE)_$(findstring :,$(srcdir)))
$(error Windows-style srcdir being used with GNU make. Did you mean to run $(topsrcdir)/build/pymake/make.py instead? [see-also: https://developer.mozilla.org/en/Gmake_vs._Pymake])
endif
ifeq (1_a,$(.PYMAKE)_$(firstword a$(subst /, ,$(srcdir))))
$(error MSYS-style srcdir being used with Pymake. Did you mean to run GNU Make instead? [see-also: https://developer.mozilla.org/en/Gmake_vs._Pymake])
endif
endif # Windows

View File

@ -171,8 +171,8 @@ SOLO_FILE ?= $(error Specify a test filename in SOLO_FILE when using check-inter
libs::
$(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS))
$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py \
$(testxpcobjdir)/all-test-dirs.list \
$(addprefix $(relativesrcdir)/,$(XPCSHELL_TESTS))
$(testxpcobjdir)/all-test-dirs.list \
$(addprefix $(relativesrcdir)/,$(XPCSHELL_TESTS))
testxpcsrcdir = $(topsrcdir)/testing/xpcshell
@ -180,39 +180,39 @@ testxpcsrcdir = $(topsrcdir)/testing/xpcshell
# See also testsuite-targets.mk 'xpcshell-tests' target for global execution.
xpcshell-tests:
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/build \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
$(EXTRA_TEST_ARGS) \
$(DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
-I$(topsrcdir)/build \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
$(EXTRA_TEST_ARGS) \
$(DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
# Execute a single test, specified in $(SOLO_FILE), but don't automatically
# start the test. Instead, present the xpcshell prompt so the user can
# attach a debugger and then start the test.
check-interactive:
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/build \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--test-path=$(SOLO_FILE) \
--profile-name=$(MOZ_APP_NAME) \
--interactive \
$(DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
-I$(topsrcdir)/build \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--test-path=$(SOLO_FILE) \
--profile-name=$(MOZ_APP_NAME) \
--interactive \
$(DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
# Execute a single test, specified in $(SOLO_FILE)
check-one:
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/build \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--test-path=$(SOLO_FILE) \
--profile-name=$(MOZ_APP_NAME) \
--verbose \
$(EXTRA_TEST_ARGS) \
$(DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
-I$(topsrcdir)/build \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--test-path=$(SOLO_FILE) \
--profile-name=$(MOZ_APP_NAME) \
--verbose \
$(EXTRA_TEST_ARGS) \
$(DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
endif # XPCSHELL_TESTS
@ -846,7 +846,7 @@ ifdef MODULE_NAME
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME)
endif
endif # BUILD_STATIC_LIBS
else # !IS_COMPONENT
else # !IS_COMPONENT
$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME)
endif # IS_COMPONENT
endif # EXPORT_LIBRARY
@ -874,7 +874,7 @@ endif # _LIBDIRS
endif # _LIBNAME_RELATIVE_PATHS
# Dependancies which, if modified, should cause everything to rebuild
# Dependencies which, if modified, should cause everything to rebuild
GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
##############################################
@ -1198,7 +1198,7 @@ CLEANUP2 := true
endif
SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
endif # EXPAND_FAKELIBS
endif # SHARED_LIBARY_LIBS
endif # SHARED_LIBRARY_LIBS
endif
ifdef MOZILLA_PROBE_LIBS
PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
@ -1578,7 +1578,7 @@ normalizepath = $(foreach p,$(1),$(shell cygpath -m $(p)))
else
# assume MSYS
# We use 'pwd -W' to get DOS form of the path. However, since the given path
# could be a file or a nonexistent path, we cannot call 'pwd -W' directly
# could be a file or a non-existent path, we cannot call 'pwd -W' directly
# on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
# on it, then merge with the rest of the path.
root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")

View File

@ -1051,3 +1051,7 @@ pixman.h
#if MOZ_ENABLE_MEEGOTOUCHSHARE
shareuiinterface.h
#endif
#if MOZ_NATIVE_LIBVPX==1
vpx/vpx_decoder.h
vpx/vp8dx.h
#endif

View File

@ -3408,11 +3408,9 @@ case $target in
*-os2*)
;;
*)
AC_CHECK_LIB(m, atan)
AC_CHECK_LIB(dl, dlopen,
AC_CHECK_HEADER(dlfcn.h,
LIBS="-ldl $LIBS"
AC_DEFINE(HAVE_LIBDL)))
AC_SEARCH_LIBS(dlopen, dl,
AC_CHECK_HEADER(dlfcn.h,
AC_DEFINE(HAVE_DLOPEN)))
;;
esac
@ -4942,7 +4940,6 @@ MOZ_ACTIVEX_SCRIPTING_SUPPORT=
MOZ_BRANDING_DIRECTORY=
MOZ_OFFICIAL_BRANDING=
MOZ_FEEDS=1
MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
MOZ_INSTALLER=1
MOZ_IPC=1
MOZ_JAVAXPCOM=
@ -5994,8 +5991,50 @@ MOZ_ARG_DISABLE_BOOL(webm,
MOZ_WEBM=,
MOZ_WEBM=1)
dnl system libvpx Support
dnl ========================================================
MOZ_ARG_WITH_STRING(system-libvpx,
[ --with-system-libvpx=[PFX]
Use system libvpx [installed at prefix PFX]],
LIBVPX_DIR=$withval)
MOZ_NATIVE_LIBVPX=
MOZ_LIBVPX_INCLUDES=
MOZ_LIBVPX_LIBS=
if test -n "$MOZ_WEBM"; then
AC_DEFINE(MOZ_WEBM)
if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
_SAVE_LIBS=$LIBS
if test "${LIBVPX_DIR}" = "yes"; then
LIBVPX_DIR=/usr
fi
CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
AC_CHECK_HEADER(vpx/vpx_decoder.h,
[if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
fi],
AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
[MOZ_NATIVE_LIBVPX=1
MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
LIBS=$_SAVE_LIBS
fi
fi
AC_SUBST(MOZ_NATIVE_LIBVPX)
AC_SUBST(MOZ_LIBVPX_INCLUDES)
AC_SUBST(MOZ_LIBVPX_LIBS)
if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
MOZ_SYDNEYAUDIO=1
MOZ_MEDIA=1
case "$target_cpu" in
@ -6418,33 +6457,6 @@ for extension in $MOZ_EXTENSIONS; do
fi
done
dnl ========================================================
dnl Image encoders
dnl ========================================================
MOZ_ARG_ENABLE_STRING(image-encoders,
[ --enable-image-encoders[={mod1,mod2,default,all,none}]
Enable specific image encoders],
[ for option in `echo $enableval | sed 's/,/ /g'`; do
if test "$option" = "yes" -o "$option" = "all"; then
addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
elif test "$option" = "no" -o "$option" = "none"; then
MOZ_IMG_ENCODERS=""
addencoder=""
elif test "$option" = "default"; then
addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
elif test `echo "$option" | grep -c \^-` != 0; then
option=`echo $option | sed 's/^-//'`
addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
else
addencoder="$option"
fi
MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
done],
MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
dnl Remove dupes
MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
dnl ========================================================
dnl MathML on by default
dnl ========================================================
@ -8848,7 +8860,6 @@ AC_SUBST(MOZ_DEBUG_FLAGS)
AC_SUBST(MOZ_DEBUG_LDFLAGS)
AC_SUBST(WARNINGS_AS_ERRORS)
AC_SUBST(MOZ_EXTENSIONS)
AC_SUBST(MOZ_IMG_ENCODERS)
AC_SUBST(MOZ_JSDEBUGGER)
AC_SUBST(MOZ_PLUGINS)
AC_SUBST(MOZ_LOG_REFCNT)

View File

@ -0,0 +1,57 @@
/* ***** 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.org code.
*
* The Initial Developer of the Original Code is
* Ms2ger <Ms2ger@gmail.com>.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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 ***** */
#ifndef mozilla_dom_FromParser_h
#define mozilla_dom_FromParser_h
namespace mozilla {
namespace dom {
/**
* Constants for passing as aFromParser
*/
enum FromParser {
NOT_FROM_PARSER = 0,
FROM_PARSER_NETWORK = 1,
FROM_PARSER_DOCUMENT_WRITE = 1 << 1,
FROM_PARSER_FRAGMENT = 1 << 2,
FROM_PARSER_XSLT = 1 << 3
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_FromParser_h

View File

@ -84,8 +84,9 @@ $(NULL)
EXPORTS_NAMESPACES = mozilla/dom
EXPORTS_mozilla/dom = \
Element.h \
$(NULL)
Element.h \
FromParser.h \
$(NULL)
ifndef DISABLE_XFORMS_HOOKS
EXPORTS += nsIXFormsUtilityService.h

View File

@ -42,6 +42,7 @@
#include "nscore.h"
#include "nsCOMPtr.h"
#include "mozilla/dom/FromParser.h"
/**
* Functions to create content, to be used only inside Gecko
@ -56,17 +57,10 @@ class imgIRequest;
class nsNodeInfoManager;
class nsGenericHTMLElement;
/**
* Constants for passing as aFromParser
*/
#define NS_NOT_FROM_PARSER 0
#define NS_FROM_PARSER_NETWORK 1
#define NS_FROM_PARSER_DOCUMENT_WRITE (1 << 1)
#define NS_FROM_PARSER_FRAGMENT (1 << 2)
nsresult
NS_NewElement(nsIContent** aResult, PRInt32 aElementType,
already_AddRefed<nsINodeInfo> aNodeInfo, PRUint32 aFromParser);
already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser);
nsresult
NS_NewXMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo);
@ -109,13 +103,13 @@ NS_NewXMLCDATASection(nsIContent** aInstancePtrResult,
nsresult
NS_NewHTMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
// First argument should be nsHTMLTag, but that adds dependency to parser
// for a bunch of files.
already_AddRefed<nsGenericHTMLElement>
CreateHTMLElement(PRUint32 aNodeType, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
#ifdef MOZ_MATHML
nsresult
@ -134,7 +128,7 @@ NS_TrustedNewXULElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNod
#ifdef MOZ_SVG
nsresult
NS_NewSVGElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
#endif
nsresult

View File

@ -58,7 +58,7 @@ class nsIScriptElement : public nsIScriptLoaderObserver {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTELEMENT_IID)
nsIScriptElement(PRUint32 aFromParser)
nsIScriptElement(mozilla::dom::FromParser aFromParser)
: mLineNumber(0),
mAlreadyStarted(PR_FALSE),
mMalformed(PR_FALSE),
@ -66,7 +66,10 @@ public:
mFrozen(PR_FALSE),
mDefer(PR_FALSE),
mAsync(PR_FALSE),
mParserCreated((PRUint8)aFromParser),
mParserCreated(aFromParser == mozilla::dom::FROM_PARSER_FRAGMENT ?
mozilla::dom::NOT_FROM_PARSER : aFromParser),
// Fragment parser-created scripts (if executable)
// behave like script-created scripts.
mCreatorParser(nsnull)
{
}
@ -120,10 +123,9 @@ public:
}
/**
* Returns a constant defined in nsContentCreatorFunctions.h. Non-zero
* values mean parser-created and zero means not parser-created.
* Returns how the element was created.
*/
PRUint32 GetParserCreated()
mozilla::dom::FromParser GetParserCreated()
{
return mParserCreated;
}
@ -156,7 +158,7 @@ public:
mFrozen = PR_FALSE;
mUri = nsnull;
mCreatorParser = nsnull;
mParserCreated = NS_NOT_FROM_PARSER;
mParserCreated = mozilla::dom::NOT_FROM_PARSER;
}
void SetCreatorParser(nsIParser* aParser)
@ -234,7 +236,7 @@ protected:
/**
* Whether this element was parser-created.
*/
PRUint8 mParserCreated;
mozilla::dom::FromParser mParserCreated;
/**
* The effective src (or null if no src).

View File

@ -380,8 +380,7 @@ CSPRep.prototype = {
},
/**
* Generates string representation of the policy. Should be fairly similar
* to the original.
* Generates canonical string representation of the policy.
*/
toString:
function csp_toString() {
@ -607,8 +606,7 @@ CSPSourceList.prototype = {
},
/**
* Generates string representation of the Source List.
* Should be fairly similar to the original.
* Generates canonical string representation of the Source List.
*/
toString:
function() {
@ -639,7 +637,7 @@ CSPSourceList.prototype = {
},
/**
* Makes a new instance that resembles this object.
* Makes a new deep copy of this object.
* @returns
* a new CSPSourceList
*/
@ -951,7 +949,7 @@ CSPSource.fromString = function(aStr, self, enforceSelfChecks) {
// Allow scheme-only sources! These default to wildcard host/port,
// especially since host and port don't always matter.
// Example: "javascript:" and "data:"
if (!sObj._host) sObj._host = "*";
if (!sObj._host) sObj._host = CSPHost.fromString("*");
if (!sObj._port) sObj._port = "*";
} else {
// some host was defined.
@ -1050,8 +1048,7 @@ CSPSource.prototype = {
},
/**
* Generates string representation of the Source.
* Should be fairly similar to the original.
* Generates canonical string representation of the Source.
*/
toString:
function() {
@ -1069,7 +1066,7 @@ CSPSource.prototype = {
},
/**
* Makes a new instance that resembles this object.
* Makes a new deep copy of this object.
* @returns
* a new CSPSource
*/
@ -1172,13 +1169,28 @@ CSPSource.prototype = {
return null;
}
// NOTE: Both sources must have a host, if they don't, something funny is
// going on. The fromString() factory method should have set the host to
// * if there's no host specified in the input. Regardless, if a host is
// not present either the scheme is hostless or any host should be allowed.
// This means we can use the other source's host as the more restrictive
// host expression, or if neither are present, we can use "*", but the
// error should still be reported.
// host
if (!this._host)
newSource._host = that._host;
else if (!that._host)
newSource._host = this._host;
else // both this and that have hosts
if (this._host && that._host) {
newSource._host = this._host.intersectWith(that._host);
} else if (this._host) {
CSPError("intersecting source with undefined host: " + that.toString());
newSource._host = this._host.clone();
} else if (that._host) {
CSPError("intersecting source with undefined host: " + this.toString());
newSource._host = that._host.clone();
} else {
CSPError("intersecting two sources with undefined hosts: " +
this.toString() + " and " + that.toString());
newSource._host = CSPHost.fromString("*");
}
return newSource;
},
@ -1266,8 +1278,7 @@ CSPHost.fromString = function(aStr) {
CSPHost.prototype = {
/**
* Generates string representation of the Source.
* Should be fairly similar to the original.
* Generates canonical string representation of the Host.
*/
toString:
function() {
@ -1275,7 +1286,7 @@ CSPHost.prototype = {
},
/**
* Makes a new instance that resembles this object.
* Makes a new deep copy of this object.
* @returns
* a new CSPHost
*/
@ -1297,7 +1308,7 @@ CSPHost.prototype = {
*/
permits:
function(aHost) {
if (!aHost) return false;
if (!aHost) aHost = CSPHost.fromString("*");
if (!(aHost instanceof CSPHost)) {
// -- compare CSPHost to String

View File

@ -4803,8 +4803,12 @@ static void ProcessViewportToken(nsIDocument *aDocument,
return;
/* Extract the key and value. */
const nsAString &key = Substring(tail, tip);
const nsAString &value = Substring(++tip, end);
const nsAString &key =
nsContentUtils::TrimWhitespace<nsCRT::IsAsciiSpace>(Substring(tail, tip),
PR_TRUE);
const nsAString &value =
nsContentUtils::TrimWhitespace<nsCRT::IsAsciiSpace>(Substring(++tip, end),
PR_TRUE);
/* Check for known keys. If we find a match, insert the appropriate
* information into the document header. */
@ -4823,7 +4827,9 @@ static void ProcessViewportToken(nsIDocument *aDocument,
aDocument->SetHeaderData(nsGkAtoms::viewport_user_scalable, value);
}
#define IS_SEPARATOR(c) ((c == ' ') || (c == ',') || (c == ';'))
#define IS_SEPARATOR(c) ((c == '=') || (c == ',') || (c == ';') || \
(c == '\t') || (c == '\n') || (c == '\r'))
/* static */
nsresult
nsContentUtils::ProcessViewportInfo(nsIDocument *aDocument,
@ -4839,12 +4845,12 @@ nsContentUtils::ProcessViewportInfo(nsIDocument *aDocument,
viewportInfo.EndReading(end);
/* Read the tip to the first non-separator character. */
while ((tip != end) && IS_SEPARATOR(*tip))
while ((tip != end) && (IS_SEPARATOR(*tip) || nsCRT::IsAsciiSpace(*tip)))
++tip;
/* Read through and find tokens separated by separators. */
while (tip != end) {
/* Synchronize tip and tail. */
tail = tip;
@ -4852,11 +4858,22 @@ nsContentUtils::ProcessViewportInfo(nsIDocument *aDocument,
while ((tip != end) && !IS_SEPARATOR(*tip))
++tip;
/* Allow white spaces that surround the '=' character */
if ((tip != end) && (*tip == '=')) {
++tip;
while ((tip != end) && nsCRT::IsAsciiSpace(*tip))
++tip;
while ((tip != end) && !(IS_SEPARATOR(*tip) || nsCRT::IsAsciiSpace(*tip)))
++tip;
}
/* Our token consists of the characters between tail and tip. */
ProcessViewportToken(aDocument, Substring(tail, tip));
/* Skip separators. */
while ((tip != end) && IS_SEPARATOR(*tip))
while ((tip != end) && (IS_SEPARATOR(*tip) || nsCRT::IsAsciiSpace(*tip)))
++tip;
}

View File

@ -4371,7 +4371,8 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
nsCOMPtr<nsIContent> content;
PRInt32 ns = nodeInfo->NamespaceID();
rv = NS_NewElement(getter_AddRefs(content), ns, nodeInfo.forget(), PR_FALSE);
rv = NS_NewElement(getter_AddRefs(content), ns, nodeInfo.forget(),
NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(content, aReturn);
@ -6848,7 +6849,8 @@ nsDocument::CreateElem(const nsAString& aName, nsIAtom *aPrefix, PRInt32 aNamesp
getter_AddRefs(nodeInfo));
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
return NS_NewElement(aResult, elementType, nodeInfo.forget(), PR_FALSE);
return NS_NewElement(aResult, elementType, nodeInfo.forget(),
NOT_FROM_PARSER);
}
PRBool

View File

@ -653,7 +653,18 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mDocShell);
NS_ASSERTION(baseWindow, "Found a nsIDocShell that isn't a nsIBaseWindow.");
baseWindow->InitWindow(nsnull, view->GetWidget(), 0, 0, 10, 10);
nsIntSize size;
if (!(frame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
// We have a useful size already; use it, since we might get no
// more size updates.
size = GetSubDocumentSize(frame);
} else {
// Pick some default size for now. Using 10x10 because that's what the
// code here used to do.
size.SizeTo(10, 10);
}
baseWindow->InitWindow(nsnull, view->GetWidget(), 0, 0,
size.width, size.height);
// This is kinda whacky, this "Create()" call doesn't really
// create anything, one starts to wonder why this was named
// "Create"...

View File

@ -5325,7 +5325,7 @@ nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
nsIEventStateManager* esm =
aVisitor.mPresContext->EventStateManager();
nsEventStateManager::SetGlobalActiveContent(
nsEventStateManager::SetActiveManager(
static_cast<nsEventStateManager*>(esm), this);
}
}

View File

@ -315,7 +315,7 @@ nsInProcessTabChildGlobal::InitTabChildGlobal()
nsresult rv =
xpc->InitClassesWithNewWrappedGlobal(cx, scopeSupports,
NS_GET_IID(nsISupports),
GetPrincipal(), EmptyCString(),
GetPrincipal(), nsnull,
flags, getter_AddRefs(mGlobal));
NS_ENSURE_SUCCESS(rv, false);

View File

@ -57,6 +57,8 @@
static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#endif
using namespace mozilla::dom;
#ifdef MOZ_SVG
PRBool NS_SVGEnabled();
#endif
@ -227,7 +229,7 @@ NameSpaceManagerImpl::GetNameSpaceID(const nsAString& aURI)
nsresult
NS_NewElement(nsIContent** aResult, PRInt32 aElementType,
already_AddRefed<nsINodeInfo> aNodeInfo, PRUint32 aFromParser)
already_AddRefed<nsINodeInfo> aNodeInfo, FromParser aFromParser)
{
if (aElementType == kNameSpaceID_XHTML) {
return NS_NewHTMLElement(aResult, aNodeInfo, aFromParser);

View File

@ -59,7 +59,7 @@ public:
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
nsScriptElement(PRUint32 aFromParser)
nsScriptElement(mozilla::dom::FromParser aFromParser)
: nsIScriptElement(aFromParser)
{
}

View File

@ -157,6 +157,10 @@ nsScriptLoader::~nsScriptLoader()
mParserBlockingRequest->FireScriptAvailable(NS_ERROR_ABORT);
}
for (PRUint32 i = 0; i < mXSLTRequests.Length(); i++) {
mXSLTRequests[i]->FireScriptAvailable(NS_ERROR_ABORT);
}
for (PRUint32 i = 0; i < mDeferRequests.Length(); i++) {
mDeferRequests[i]->FireScriptAvailable(NS_ERROR_ABORT);
}
@ -577,8 +581,9 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
// a parser-inserted script is being run, we came here by the parser
// running the script, which means the parser is still alive and the
// parse is ongoing.
NS_ASSERTION(mDocument->GetCurrentContentSink(),
"Defer script on a document without an active parser; bug 592366.");
NS_ASSERTION(mDocument->GetCurrentContentSink() ||
aElement->GetParserCreated() == FROM_PARSER_XSLT,
"Non-XSLT Defer script on a document without an active parser; bug 592366.");
mDeferRequests.AppendElement(request);
return NS_OK;
}
@ -591,11 +596,24 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
}
return NS_OK;
}
if (!request->mLoading) {
// The request has already been loaded. If the script comes from the
// network stream, cheat for performance reasons and avoid a trip
// through the event loop.
if (aElement->GetParserCreated() == NS_FROM_PARSER_NETWORK) {
if (aElement->GetParserCreated() == FROM_PARSER_XSLT) {
// Need to maintain order for XSLT-inserted scripts
NS_ASSERTION(!mParserBlockingRequest,
"Parser-blocking scripts and XSLT scripts in the same doc!");
mXSLTRequests.AppendElement(request);
if (!request->mLoading) {
// The script is available already. Run it ASAP when the event
// loop gets a chance to spin.
ProcessPendingRequestsAsync();
}
return NS_ERROR_HTMLPARSER_BLOCK;
}
if (!request->mLoading && ReadyToExecuteScripts()) {
// The request has already been loaded and there are no pending style
// sheets. If the script comes from the network stream, cheat for
// performance reasons and avoid a trip through the event loop.
if (aElement->GetParserCreated() == FROM_PARSER_NETWORK) {
return ProcessRequest(request);
}
// Otherwise, we've got a document.written script, make a trip through
@ -603,14 +621,18 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
// Web page.
NS_ASSERTION(!mParserBlockingRequest,
"There can be only one parser-blocking script at a time");
NS_ASSERTION(mXSLTRequests.IsEmpty(),
"Parser-blocking scripts and XSLT scripts in the same doc!");
mParserBlockingRequest = request;
ProcessPendingRequestsAsync();
return NS_ERROR_HTMLPARSER_BLOCK;
}
// The script hasn't loaded yet and is parser-inserted and non-async.
// It'll be executed when it has loaded.
// The script hasn't loaded yet or there's a style sheet blocking it.
// The script will be run when it loads or the style sheet loads.
NS_ASSERTION(!mParserBlockingRequest,
"There can be only one parser-blocking script at a time");
NS_ASSERTION(mXSLTRequests.IsEmpty(),
"Parser-blocking scripts and XSLT scripts in the same doc!");
mParserBlockingRequest = request;
return NS_ERROR_HTMLPARSER_BLOCK;
}
@ -641,18 +663,28 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
request->mURI = mDocument->GetDocumentURI();
request->mLineNo = aElement->GetScriptLineNumber();
if (aElement->GetParserCreated() == NS_NOT_FROM_PARSER) {
if (aElement->GetParserCreated() == FROM_PARSER_XSLT &&
(!ReadyToExecuteScripts() || !mXSLTRequests.IsEmpty())) {
// Need to maintain order for XSLT-inserted scripts
NS_ASSERTION(!mParserBlockingRequest,
"Parser-blocking scripts and XSLT scripts in the same doc!");
mXSLTRequests.AppendElement(request);
return NS_ERROR_HTMLPARSER_BLOCK;
}
if (aElement->GetParserCreated() == NOT_FROM_PARSER) {
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"A script-inserted script is inserted without an update batch?");
nsContentUtils::AddScriptRunner(new nsScriptRequestProcessor(this,
request));
return NS_OK;
}
if (aElement->GetParserCreated() == NS_FROM_PARSER_NETWORK &&
if (aElement->GetParserCreated() == FROM_PARSER_NETWORK &&
!ReadyToExecuteScripts()) {
NS_ASSERTION(!mParserBlockingRequest,
"There can be only one parser-blocking script at a time");
mParserBlockingRequest = request;
NS_ASSERTION(mXSLTRequests.IsEmpty(),
"Parser-blocking scripts and XSLT scripts in the same doc!");
return NS_ERROR_HTMLPARSER_BLOCK;
}
// We now have a document.written inline script or we have an inline script
@ -856,6 +888,14 @@ nsScriptLoader::ProcessPendingRequests()
ProcessRequest(request);
}
while (ReadyToExecuteScripts() &&
!mXSLTRequests.IsEmpty() &&
!mXSLTRequests[0]->mLoading) {
request.swap(mXSLTRequests[0]);
mXSLTRequests.RemoveElementAt(0);
ProcessRequest(request);
}
PRUint32 i = 0;
while (mEnabled && i < mAsyncRequests.Length()) {
if (!mAsyncRequests[i]->mLoading) {
@ -867,7 +907,7 @@ nsScriptLoader::ProcessPendingRequests()
++i;
}
if (mDocumentParsingDone) {
if (mDocumentParsingDone && mXSLTRequests.IsEmpty()) {
while (!mDeferRequests.IsEmpty() && !mDeferRequests[0]->mLoading) {
request.swap(mDeferRequests[0]);
mDeferRequests.RemoveElementAt(0);
@ -883,7 +923,7 @@ nsScriptLoader::ProcessPendingRequests()
if (mDocumentParsingDone && mDocument &&
!mParserBlockingRequest && mAsyncRequests.IsEmpty() &&
mDeferRequests.IsEmpty()) {
mXSLTRequests.IsEmpty() && mDeferRequests.IsEmpty()) {
// No more pending scripts; time to unblock onload.
// OK to unblock onload synchronously here, since callers must be
// prepared for the world changing anyway.
@ -1053,7 +1093,8 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
aString);
if (NS_FAILED(rv)) {
if (mDeferRequests.RemoveElement(request) ||
mAsyncRequests.RemoveElement(request)) {
mAsyncRequests.RemoveElement(request) ||
mXSLTRequests.RemoveElement(request)) {
FireScriptAvailable(rv, request);
} else if (mParserBlockingRequest == request) {
mParserBlockingRequest = nsnull;
@ -1131,6 +1172,7 @@ nsScriptLoader::PrepareLoadedRequest(nsScriptLoadRequest* aRequest,
// wrong, especially if you see it more than once.
NS_ASSERTION(mDeferRequests.IndexOf(aRequest) >= 0 ||
mAsyncRequests.IndexOf(aRequest) >= 0 ||
mXSLTRequests.IndexOf(aRequest) >= 0 ||
mPreloads.Contains(aRequest, PreloadRequestComparator()) ||
mParserBlockingRequest,
"aRequest should be pending!");
@ -1183,6 +1225,7 @@ nsScriptLoader::ParsingComplete(PRBool aTerminated)
if (aTerminated) {
mDeferRequests.Clear();
mAsyncRequests.Clear();
mXSLTRequests.Clear();
mParserBlockingRequest = nsnull;
}

View File

@ -299,6 +299,7 @@ private:
nsCOMArray<nsIScriptLoaderObserver> mObservers;
nsTArray<nsRefPtr<nsScriptLoadRequest> > mAsyncRequests;
nsTArray<nsRefPtr<nsScriptLoadRequest> > mDeferRequests;
nsTArray<nsRefPtr<nsScriptLoadRequest> > mXSLTRequests;
nsRefPtr<nsScriptLoadRequest> mParserBlockingRequest;
// In mRequests, the additional information here is stored by the element.

View File

@ -431,6 +431,13 @@ _TEST_FILES2 = \
test_bug601803.html \
file_bug601803a.html \
file_bug601803b.html \
test_bug604660.html \
file_bug604660-1.xml \
file_bug604660-2.xsl \
file_bug604660-3.js \
file_bug604660-4.js \
file_bug604660-5.xml \
file_bug604660-6.xsl \
test_bug605982.html \
$(NULL)

View File

@ -0,0 +1,3 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="file_bug604660-2.xsl" ?>
<placeholder/>

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="/">
<html>
<head>
<title>XSLT script execution test</title>
</head>
<body>
<script defer="" src="data:text/javascript,parent.scriptRan(5);"></script>
<script>parent.scriptRan(1);</script>
<script async="" src="data:text/javascript,parent.asyncRan();"></script>
<script src="file_bug604660-3.js"></script>
<script>parent.scriptRan(3);</script>
<script src="file_bug604660-4.js"></script>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1 @@
parent.scriptRan(2);

View File

@ -0,0 +1 @@
parent.scriptRan(4);

View File

@ -0,0 +1,2 @@
<?xml version="1.0"?>
<placeholder/>

View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="/">
<html>
<script>xsltProcessorCreatedScriptRan();</script>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,77 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=604660
-->
<head>
<title>Test for Bug 604660</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=604660">Mozilla Bug 604660</a>
<script>
SimpleTest.waitForExplicitFinish();
var asyncState = false;
var scriptState = 0;
function scriptRan(num) {
++scriptState;
is(scriptState, num, "Scripts ran in the wrong sequence.");
}
function asyncRan() {
asyncState = true;
}
</script>
<p id="display"><iframe src="file_bug604660-1.xml" onload="iframeloaded()";></iframe></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
var xlstProcessorState = false;
function xsltProcessorCreatedScriptRan() {
xlstProcessorState = true;
}
function iframeloaded() {
ok(asyncState, "Async script should have run.");
is(scriptState, 5, "Five scripts should have run.");
var processor = new XSLTProcessor();
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
processor.importStylesheet(this.responseXML);
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
var doc = processor.transformToDocument(this.responseXML);
var target = document.getElementById("display");
target.appendChild(doc.documentElement.firstChild);
ok(!xlstProcessorState, "Scripts created by transformToDocument should not run.");
var fragment = processor.transformToFragment(this.responseXML, document);
target.appendChild(fragment.firstChild.firstChild);
ok(xlstProcessorState, "Scripts created by transformToFragment should run.");
SimpleTest.finish();
}
}
xhr.open("GET", "file_bug604660-5.xml");
xhr.send();
}
}
xhr.open("GET", "file_bug604660-6.xsl");
xhr.send();
}
</script>
</pre>
</body>
</html>

View File

@ -16,24 +16,35 @@
<script class="testbody" type="text/javascript">
var path = "/tests/content/base/test/";
// contains { test_frame_id : expected_result }
var testExpectedResults = { "control1": true,
"control2": true,
"deny": false,
"sameorigin1": true,
"sameorigin2": false
};
var testFramesLoaded = function() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var harness = document.getElementById("harness");
for (var t in testExpectedResults) {
var frame = harness.contentDocument.getElementById(t);
// test if frame loaded by checking for a contentDocument we can access
test = frame.contentDocument.getElementById("test");
is(test != null, testExpectedResults[t], "test "+t);
}
// iframe from same origin, no X-F-O header - should load
var frame = harness.contentDocument.getElementById("control1");
var test1 = frame.contentDocument.getElementById("test").textContent;
is(test1, "control1", "test control1");
// iframe from different origin, no X-F-O header - should load
frame = harness.contentDocument.getElementById("control2");
var test2 = frame.contentDocument.getElementById("test").textContent;
is(test2, "control2", "test control2");
// iframe from same origin, X-F-O: DENY - should not load
frame = harness.contentDocument.getElementById("deny");
var test3 = frame.contentDocument.getElementById("test");
is(test3, null, "test deny");
// iframe from same origin, X-F-O: SAMEORIGIN - should load
frame = harness.contentDocument.getElementById("sameorigin1");
var test4 = frame.contentDocument.getElementById("test").textContent;
is(test4, "sameorigin1", "test sameorigin1");
// iframe from different origin, X-F-O: SAMEORIGIN - should not load
frame = harness.contentDocument.getElementById("sameorigin2");
var test5 = frame.contentDocument.getElementById("test");
is(test5, null, "test sameorigin2");
// call tests to check principal comparison, e.g. a document can open a window
// to a data: or javascript: document which frames an

View File

@ -35,6 +35,7 @@
//load('CSPUtils.jsm');
Components.utils.import('resource://gre/modules/CSPUtils.jsm');
Components.utils.import('resource://gre/modules/NetUtil.jsm');
// load the HTTP server
do_load_httpd_js();
@ -190,6 +191,7 @@ test(
//"funny characters (#) should not work for host.");
do_check_eq(null, CSPSource.fromString("a#2-c.com"));
//print(" --- Stop ignoring errors that print ---\n");
//"failed to parse host with port.");
@ -229,6 +231,16 @@ test(
do_check_true(src.permits("https://foobar.com"));
//"src should reject other hosts"
do_check_false(src.permits("https://a.com"));
src = CSPSource.create("javascript:", "https://foobar.com:443");
//"hostless schemes should be parseable."
var aUri = NetUtil.newURI("javascript:alert('foo');");
do_check_true(src.permits(aUri));
//"src should reject other hosts"
do_check_false(src.permits("https://a.com"));
//"nothing else should be allowed"
do_check_false(src.permits("https://foobar.com"));
});
///////////////////// Test the source list //////////////////////

View File

@ -1639,7 +1639,7 @@ WebGLContext::GetParameter(PRUint32 pname, nsIVariant **retval)
case LOCAL_GL_SCISSOR_BOX: // 4 ints
case LOCAL_GL_VIEWPORT: // 4 ints
{
GLint iv[2] = { 0 };
GLint iv[4] = { 0 };
gl->fGetIntegerv(pname, iv);
wrval->SetAsArray(nsIDataType::VTYPE_INT32, nsnull,
4, static_cast<void*>(iv));

View File

@ -2074,6 +2074,7 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
PRBool dragStarted = DoDefaultDragStart(aPresContext, event, dataTransfer,
targetContent, isSelection);
if (dragStarted) {
sActiveESM = nsnull;
aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
}
}
@ -2935,7 +2936,6 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
if (par)
activeContent = par;
}
SetGlobalActiveContent(this, activeContent);
}
}
else {
@ -2943,11 +2943,12 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// any of our own processing of a drag. Workaround for bug 43258.
StopTrackingDragGesture();
}
SetActiveManager(this, activeContent);
}
break;
case NS_MOUSE_BUTTON_UP:
{
ClearGlobalActiveContent();
ClearGlobalActiveContent(this);
if (IsMouseEventReal(aEvent)) {
if (!mCurrentTarget) {
nsIFrame* targ;
@ -3206,6 +3207,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
targetContent, &status);
}
}
ClearGlobalActiveContent(this);
break;
}
case NS_DRAGDROP_EXIT:
@ -4706,22 +4708,25 @@ nsEventStateManager::DoContentCommandScrollEvent(nsContentCommandEvent* aEvent)
}
void
nsEventStateManager::SetGlobalActiveContent(nsEventStateManager* aNewESM,
nsIContent* aContent)
nsEventStateManager::SetActiveManager(nsEventStateManager* aNewESM,
nsIContent* aContent)
{
if (sActiveESM && aNewESM != sActiveESM) {
sActiveESM->SetContentState(nsnull, NS_EVENT_STATE_ACTIVE);
}
sActiveESM = aNewESM;
if (sActiveESM) {
if (sActiveESM && aContent) {
sActiveESM->SetContentState(aContent, NS_EVENT_STATE_ACTIVE);
}
}
void
nsEventStateManager::ClearGlobalActiveContent()
nsEventStateManager::ClearGlobalActiveContent(nsEventStateManager* aClearer)
{
if (sActiveESM) {
if (aClearer) {
aClearer->SetContentState(nsnull, NS_EVENT_STATE_ACTIVE);
}
if (sActiveESM && aClearer != sActiveESM) {
sActiveESM->SetContentState(nsnull, NS_EVENT_STATE_ACTIVE);
}
sActiveESM = nsnull;

View File

@ -159,8 +159,10 @@ public:
static nsIEventStateManager* GetActiveEventStateManager() { return sActiveESM; }
static void SetGlobalActiveContent(nsEventStateManager* aNewESM,
nsIContent* aContent);
// Sets aNewESM to be the active event state manager, and
// if aContent is non-null, marks the object as active.
static void SetActiveManager(nsEventStateManager* aNewESM,
nsIContent* aContent);
protected:
void UpdateCursor(nsPresContext* aPresContext, nsEvent* aEvent, nsIFrame* aTargetFrame, nsEventStatus* aStatus);
/**
@ -415,7 +417,7 @@ protected:
static nsEventStateManager* sActiveESM;
static void ClearGlobalActiveContent();
static void ClearGlobalActiveContent(nsEventStateManager* aClearer);
// Functions used for click hold context menus
PRBool mClickHoldContextMenu;

View File

@ -51,7 +51,7 @@ class nsHTMLAudioElement : public nsHTMLMediaElement,
{
public:
nsHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLAudioElement();
// nsISupports

View File

@ -71,7 +71,7 @@ public:
};
nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLMediaElement();
/**

View File

@ -46,7 +46,7 @@ class nsHTMLVideoElement : public nsHTMLMediaElement,
{
public:
nsHTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLVideoElement();
// nsISupports

View File

@ -808,7 +808,8 @@ nsGenericHTMLElement::ScrollIntoView(PRBool aTop, PRUint8 optional_argc)
NS_PRESSHELL_SCROLL_BOTTOM;
presShell->ScrollContentIntoView(this, vpercent,
NS_PRESSHELL_SCROLL_ANYWHERE);
NS_PRESSHELL_SCROLL_ANYWHERE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
return NS_OK;
}
@ -2321,6 +2322,10 @@ nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<nsINodeInfo>
nsGenericHTMLFormElement::~nsGenericHTMLFormElement()
{
if (mFieldSet) {
static_cast<nsHTMLFieldSetElement*>(mFieldSet)->RemoveElement(this);
}
// Check that this element doesn't know anything about its form at this point.
NS_ASSERTION(!mForm, "mForm should be null at this point!");
}
@ -2938,13 +2943,20 @@ nsGenericHTMLFormElement::UpdateFieldSet()
static_cast<nsHTMLFieldSetElement*>(parent);
if (!prev || fieldset->GetFirstLegend() != prev) {
if (mFieldSet) {
static_cast<nsHTMLFieldSetElement*>(mFieldSet)->RemoveElement(this);
}
mFieldSet = fieldset;
fieldset->AddElement(this);
return;
}
}
}
// No fieldset found.
if (mFieldSet) {
static_cast<nsHTMLFieldSetElement*>(mFieldSet)->RemoveElement(this);
}
mFieldSet = nsnull;
}

View File

@ -874,6 +874,19 @@ public:
FieldSetDisabledChanged(nsEventStates(), aNotify);
}
/**
* This callback is called by a fieldset on all it's elements when it's being
* destroyed. When called, the elements should check that aFieldset is there
* first parent fieldset and null mFieldset in that case only.
*
* @param aFieldSet The fieldset being removed.
*/
void ForgetFieldSet(nsIContent* aFieldset) {
if (mFieldSet == aFieldset) {
mFieldSet = nsnull;
}
}
/**
* Returns if the control can be disabled.
*/
@ -987,10 +1000,10 @@ class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
{
public:
nsGenericHTMLFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
mozilla::dom::FromParser aFromParser)
: nsGenericHTMLElement(aNodeInfo)
{
mNetworkCreated = aFromParser == NS_FROM_PARSER_NETWORK;
mNetworkCreated = aFromParser == mozilla::dom::FROM_PARSER_NETWORK;
}
virtual ~nsGenericHTMLFrameElement();
@ -1045,25 +1058,6 @@ protected:
//----------------------------------------------------------------------
/**
* A macro to implement the NS_NewHTMLXXXElement() functions.
*/
#define NS_IMPL_NS_NEW_HTML_ELEMENT(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
PRUint32 aFromParser) \
{ \
return new nsHTML##_elementName##Element(aNodeInfo); \
}
#define NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
PRUint32 aFromParser) \
{ \
return new nsHTML##_elementName##Element(aNodeInfo, aFromParser); \
}
/**
* A macro to implement the getter and setter for a given string
* valued content property. The method uses the generic GetAttr and
@ -1073,12 +1067,12 @@ NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
NS_IMETHODIMP \
_class::Get##_method(nsAString& aValue) \
{ \
return GetAttrHelper(nsGkAtoms::_atom, aValue); \
return GetAttrHelper(nsGkAtoms::_atom, aValue); \
} \
NS_IMETHODIMP \
_class::Set##_method(const nsAString& aValue) \
{ \
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
}
/**
@ -1186,6 +1180,27 @@ NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
}
/**
* A macro to implement getter and setter for action and form action content
* attributes. It's very similar to NS_IMPL_URI_ATTR excepted that if the
* content attribute is the empty string, the empty string is returned.
*/
#define NS_IMPL_ACTION_ATTR(_class, _method, _atom) \
NS_IMETHODIMP \
_class::Get##_method(nsAString& aValue) \
{ \
GetAttr(kNameSpaceID_None, nsGkAtoms::_atom, aValue); \
if (aValue.IsEmpty()) { \
return NS_OK; \
} \
return GetURIAttr(nsGkAtoms::_atom, nsnull, aValue); \
} \
NS_IMETHODIMP \
_class::Set##_method(const nsAString& aValue) \
{ \
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
}
/**
* A macro to implement the getter and setter for a given content
* property that needs to set a non-negative integer. The method
@ -1409,26 +1424,46 @@ NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
NS_OFFSET_AND_INTERFACE_TABLE_END
// Element class factory methods
/**
* A macro to declare the NS_NewHTMLXXXElement() functions.
*/
#define NS_DECLARE_NS_NEW_HTML_ELEMENT(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
#define NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(_elementName) \
inline nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
PRUint32 aFromParser = 0) \
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER) \
{ \
return NS_NewHTMLSharedElement(aNodeInfo, aFromParser); \
}
/**
* A macro to implement the NS_NewHTMLXXXElement() functions.
*/
#define NS_IMPL_NS_NEW_HTML_ELEMENT(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
mozilla::dom::FromParser aFromParser) \
{ \
return new nsHTML##_elementName##Element(aNodeInfo); \
}
#define NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
mozilla::dom::FromParser aFromParser) \
{ \
return new nsHTML##_elementName##Element(aNodeInfo, aFromParser); \
}
// Here, we expand 'NS_DECLARE_NS_NEW_HTML_ELEMENT()' by hand.
// (Calling the macro directly (with no args) produces compiler warnings.)
nsGenericHTMLElement*
NS_NewHTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)

View File

@ -68,9 +68,11 @@
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMProgressEvent.h"
using namespace mozilla::dom;
nsGenericHTMLElement*
NS_NewHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
/*
* nsHTMLAudioElement's will be created without a nsINodeInfo passed in
@ -107,7 +109,7 @@ NS_IMPL_ELEMENT_CLONE(nsHTMLAudioElement)
nsHTMLAudioElement::nsHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsHTMLMediaElement(aNodeInfo, aFromParser)
{
}

View File

@ -218,7 +218,7 @@ nsHTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm)
NS_IMPL_STRING_ATTR(nsHTMLButtonElement, AccessKey, accesskey)
NS_IMPL_BOOL_ATTR(nsHTMLButtonElement, Autofocus, autofocus)
NS_IMPL_BOOL_ATTR(nsHTMLButtonElement, Disabled, disabled)
NS_IMPL_STRING_ATTR(nsHTMLButtonElement, FormAction, formaction)
NS_IMPL_ACTION_ATTR(nsHTMLButtonElement, FormAction, formaction)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLButtonElement, FormEnctype, formenctype,
kFormDefaultEnctype->tag)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLButtonElement, FormMethod, formmethod,
@ -439,7 +439,7 @@ nsHTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
if (NS_IS_TRUSTED_EVENT(aVisitor.mEvent)) {
nsIEventStateManager* esm =
aVisitor.mPresContext->EventStateManager();
nsEventStateManager::SetGlobalActiveContent(
nsEventStateManager::SetActiveManager(
static_cast<nsEventStateManager*>(esm), this);
}
nsIFocusManager* fm = nsFocusManager::GetFocusManager();

View File

@ -56,11 +56,12 @@
#define DEFAULT_CANVAS_HEIGHT 150
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
nsGenericHTMLElement*
NS_NewHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
return new nsHTMLCanvasElement(aNodeInfo);
}

View File

@ -38,6 +38,7 @@
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLElement.h"
using namespace mozilla::dom;
class nsHTMLElement : public nsGenericHTMLElement,
public nsIDOMHTMLElement
@ -69,7 +70,7 @@ public:
// (Calling the macro directly (with no args) produces compiler warnings.)
nsGenericHTMLElement*
NS_NewHTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
return new nsHTMLElement(aNodeInfo);
}

View File

@ -58,6 +58,10 @@ nsHTMLFieldSetElement::nsHTMLFieldSetElement(already_AddRefed<nsINodeInfo> aNode
nsHTMLFieldSetElement::~nsHTMLFieldSetElement()
{
PRUint32 length = mDependentElements.Length();
for (PRUint32 i=0; i<length; ++i) {
mDependentElements[i]->ForgetFieldSet(this);
}
}
// nsISupports

View File

@ -41,6 +41,7 @@
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLFieldSetElement.h"
#include "nsIConstraintValidation.h"
#include "nsTPtrArray.h"
class nsHTMLFieldSetElement : public nsGenericHTMLFormElement,
@ -87,6 +88,14 @@ public:
const nsIContent* GetFirstLegend() const { return mFirstLegend; }
void AddElement(nsGenericHTMLFormElement* aElement) {
mDependentElements.AppendElement(aElement);
}
void RemoveElement(nsGenericHTMLFormElement* aElement) {
mDependentElements.RemoveElement(aElement);
}
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLFieldSetElement,
nsGenericHTMLFormElement)
private:
@ -104,6 +113,9 @@ private:
// listed form controls elements.
nsRefPtr<nsContentList> mElements;
// List of elements which have this fieldset as first fieldset ancestor.
nsTPtrArray<nsGenericHTMLFormElement> mDependentElements;
nsIContent* mFirstLegend;
};

View File

@ -83,6 +83,10 @@
#include "nsIConstraintValidation.h"
#include "nsIEventStateManager.h"
#include "nsIDOMHTMLButtonElement.h"
using namespace mozilla::dom;
static const int NS_FORM_CONTROL_LIST_HASHTABLE_SIZE = 16;
static const PRUint8 NS_FORM_AUTOCOMPLETE_ON = 1;
@ -232,12 +236,9 @@ ShouldBeInElements(nsIFormControl* aFormControl)
// construction, destruction
nsGenericHTMLElement*
NS_NewHTMLFormElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
nsHTMLFormElement* it = new nsHTMLFormElement(aNodeInfo);
if (!it) {
return nsnull;
}
nsresult rv = it->Init();
@ -375,7 +376,7 @@ nsHTMLFormElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
}
NS_IMPL_STRING_ATTR(nsHTMLFormElement, AcceptCharset, acceptcharset)
NS_IMPL_STRING_ATTR(nsHTMLFormElement, Action, action)
NS_IMPL_ACTION_ATTR(nsHTMLFormElement, Action, action)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLFormElement, Autocomplete, autocomplete,
kFormDefaultAutocomplete->tag)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLFormElement, Enctype, enctype,
@ -386,17 +387,6 @@ NS_IMPL_BOOL_ATTR(nsHTMLFormElement, NoValidate, novalidate)
NS_IMPL_STRING_ATTR(nsHTMLFormElement, Name, name)
NS_IMPL_STRING_ATTR(nsHTMLFormElement, Target, target)
NS_IMETHODIMP
nsHTMLFormElement::GetMozActionUri(nsAString& aValue)
{
GetAttr(kNameSpaceID_None, nsGkAtoms::action, aValue);
if (aValue.IsEmpty()) {
// Avoid resolving action="" to the base uri, bug 297761.
return NS_OK;
}
return GetURIAttr(nsGkAtoms::action, nsnull, aValue);
}
NS_IMETHODIMP
nsHTMLFormElement::Submit()
{
@ -1431,17 +1421,29 @@ nsHTMLFormElement::GetActionURL(nsIURI** aActionURL,
// from the form element should be used.
//
nsAutoString action;
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aOriginatingElement);
if (formControl && formControl->IsSubmitControl() &&
aOriginatingElement->GetAttr(kNameSpaceID_None, nsGkAtoms::formaction,
action)) {
// Avoid resolving action="" to the base uri, bug 297761.
if (!action.IsEmpty()) {
static_cast<nsGenericHTMLElement*>(aOriginatingElement)->
GetURIAttr(nsGkAtoms::formaction, nsnull, action);
if (aOriginatingElement &&
aOriginatingElement->HasAttr(kNameSpaceID_None, nsGkAtoms::formaction)) {
#ifdef DEBUG
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aOriginatingElement);
NS_ASSERTION(formControl && formControl->IsSubmitControl(),
"The originating element must be a submit form control!");
#endif // DEBUG
nsCOMPtr<nsIDOMHTMLInputElement> inputElement = do_QueryInterface(aOriginatingElement);
if (inputElement) {
inputElement->GetFormAction(action);
} else {
nsCOMPtr<nsIDOMHTMLButtonElement> buttonElement = do_QueryInterface(aOriginatingElement);
if (buttonElement) {
buttonElement->GetFormAction(action);
} else {
NS_ERROR("Originating element must be an input or button element!");
return NS_ERROR_UNEXPECTED;
}
}
} else {
GetMozActionUri(action);
GetAction(action);
}
//

View File

@ -41,13 +41,14 @@
#include "nsIDOMDocument.h"
#include "nsDOMError.h"
using namespace mozilla::dom;
class nsHTMLFrameElement : public nsGenericHTMLFrameElement,
public nsIDOMHTMLFrameElement
{
public:
nsHTMLFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = NS_NOT_FROM_PARSER);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLFrameElement();
// nsISupports
@ -81,7 +82,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Frame)
nsHTMLFrameElement::nsHTMLFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFrameElement(aNodeInfo, aFromParser)
{
}

View File

@ -48,15 +48,17 @@
#include "nsRuleData.h"
#include "nsStyleConsts.h"
class nsHTMLIFrameElement : public nsGenericHTMLFrameElement,
public nsIDOMHTMLIFrameElement
using namespace mozilla::dom;
class nsHTMLIFrameElement : public nsGenericHTMLFrameElement
, public nsIDOMHTMLIFrameElement
#ifdef MOZ_SVG
, public nsIDOMGetSVGDocument
, public nsIDOMGetSVGDocument
#endif
{
public:
nsHTMLIFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = NS_NOT_FROM_PARSER);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLIFrameElement();
// nsISupports
@ -96,7 +98,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(IFrame)
nsHTMLIFrameElement::nsHTMLIFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFrameElement(aNodeInfo, aFromParser)
{
}

View File

@ -76,6 +76,8 @@
#include "nsLayoutUtils.h"
using namespace mozilla::dom;
// XXX nav attrs: suppress
class nsHTMLImageElement : public nsGenericHTMLElement,
@ -154,7 +156,7 @@ protected:
nsGenericHTMLElement*
NS_NewHTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
/*
* nsHTMLImageElement's will be created without a nsINodeInfo passed in

View File

@ -127,6 +127,8 @@
#include "nsHTMLInputElement.h"
using namespace mozilla::dom;
// XXX align=left, hspace, vspace, border? other nav4 attrs
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
@ -612,14 +614,14 @@ static nsresult FireEventForAccessibility(nsIDOMHTMLInputElement* aTarget,
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Input)
nsHTMLInputElement::nsHTMLInputElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mType(kInputDefaultType->value),
mBitField(0)
{
SET_BOOLBIT(mBitField, BF_PARSER_CREATING, aFromParser);
SET_BOOLBIT(mBitField, BF_INHIBIT_RESTORATION,
aFromParser & NS_FROM_PARSER_FRAGMENT);
aFromParser & mozilla::dom::FROM_PARSER_FRAGMENT);
mInputData.mState = new nsTextEditorState(this);
NS_ADDREF(mInputData.mState);
@ -702,10 +704,7 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
*aResult = nsnull;
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
nsHTMLInputElement *it = new nsHTMLInputElement(ni.forget(), PR_FALSE);
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsHTMLInputElement *it = new nsHTMLInputElement(ni.forget(), NOT_FROM_PARSER);
nsCOMPtr<nsINode> kungFuDeathGrip = it;
nsresult rv = CopyInnerTo(it);
@ -962,7 +961,7 @@ NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLInputElement, Autocomplete, autocomplete,
NS_IMPL_BOOL_ATTR(nsHTMLInputElement, Autofocus, autofocus)
//NS_IMPL_BOOL_ATTR(nsHTMLInputElement, Checked, checked)
NS_IMPL_BOOL_ATTR(nsHTMLInputElement, Disabled, disabled)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, FormAction, formaction)
NS_IMPL_ACTION_ATTR(nsHTMLInputElement, FormAction, formaction)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLInputElement, FormEnctype, formenctype,
kFormDefaultEnctype->tag)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLInputElement, FormMethod, formmethod,

View File

@ -123,7 +123,7 @@ public:
using nsIConstraintValidation::GetValidationMessage;
nsHTMLInputElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
virtual ~nsHTMLInputElement();
// nsISupports

View File

@ -121,6 +121,7 @@ static PRLogModuleInfo* gMediaElementEventsLog;
#include "nsIChannelPolicy.h"
#include "nsChannelPolicy.h"
using namespace mozilla::dom;
using namespace mozilla::layers;
// Under certain conditions there may be no-one holding references to
@ -226,7 +227,7 @@ public:
return nsContentUtils::DispatchTrustedEvent(mElement->GetOwnerDoc(),
mSource,
NS_LITERAL_STRING("error"),
PR_TRUE,
PR_FALSE,
PR_TRUE);
}
};
@ -1265,7 +1266,7 @@ NS_IMETHODIMP nsHTMLMediaElement::SetMuted(PRBool aMuted)
}
nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLElement(aNodeInfo),
mCurrentLoadID(0),
mNetworkState(nsIDOMHTMLMediaElement::NETWORK_EMPTY),
@ -2265,7 +2266,7 @@ nsresult nsHTMLMediaElement::DispatchEvent(const nsAString& aName)
return nsContentUtils::DispatchTrustedEvent(GetOwnerDoc(),
static_cast<nsIContent*>(this),
aName,
PR_TRUE,
PR_FALSE,
PR_TRUE);
}

View File

@ -52,20 +52,21 @@
#include "nsIPluginInstance.h"
#include "nsIConstraintValidation.h"
using namespace mozilla::dom;
class nsHTMLObjectElement : public nsGenericHTMLFormElement,
public nsObjectLoadingContent,
public nsIDOMHTMLObjectElement,
public nsIConstraintValidation
class nsHTMLObjectElement : public nsGenericHTMLFormElement
, public nsObjectLoadingContent
, public nsIDOMHTMLObjectElement
, public nsIConstraintValidation
#ifdef MOZ_SVG
, public nsIDOMGetSVGDocument
, public nsIDOMGetSVGDocument
#endif
{
public:
using nsIConstraintValidation::GetValidationMessage;
nsHTMLObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLObjectElement();
// nsISupports
@ -158,12 +159,12 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Object)
nsHTMLObjectElement::nsHTMLObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mIsDoneAddingChildren(!aFromParser)
{
RegisterFreezableElement();
SetIsNetworkCreated(aFromParser == NS_FROM_PARSER_NETWORK);
SetIsNetworkCreated(aFromParser == FROM_PARSER_NETWORK);
// <object> is always barred from constraint validation.
SetBarredFromConstraintValidation(PR_TRUE);

View File

@ -66,13 +66,15 @@
#include "nsContentCreatorFunctions.h"
#include "mozAutoDocUpdate.h"
using namespace mozilla::dom;
/**
* Implementation of &lt;option&gt;
*/
nsGenericHTMLElement*
NS_NewHTMLOptionElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
/*
* nsHTMLOptionElement's will be created without a nsINodeInfo passed in

View File

@ -58,6 +58,8 @@
#include "nsTArray.h"
#include "nsDOMJSUtils.h"
using namespace mozilla::dom;
//
// Helper class used to support <SCRIPT FOR=object EVENT=handler ...>
// style script tags...
@ -308,7 +310,7 @@ class nsHTMLScriptElement : public nsGenericHTMLElement,
{
public:
nsHTMLScriptElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
FromParser aFromParser);
virtual ~nsHTMLScriptElement();
// nsISupports
@ -361,7 +363,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Script)
nsHTMLScriptElement::nsHTMLScriptElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLElement(aNodeInfo)
, nsScriptElement(aFromParser)
{
@ -419,10 +421,8 @@ nsHTMLScriptElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
*aResult = nsnull;
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
nsHTMLScriptElement* it = new nsHTMLScriptElement(ni.forget(), PR_FALSE);
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsHTMLScriptElement* it =
new nsHTMLScriptElement(ni.forget(), NOT_FROM_PARSER);
nsCOMPtr<nsINode> kungFuDeathGrip = it;
nsresult rv = CopyInnerTo(it);

View File

@ -140,13 +140,13 @@ nsSafeOptionListMutation::~nsSafeOptionListMutation()
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Select)
nsHTMLSelectElement::nsHTMLSelectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mOptions(new nsHTMLOptionCollection(this)),
mIsDoneAddingChildren(!aFromParser),
mDisabledChanged(PR_FALSE),
mMutating(PR_FALSE),
mInhibitStateRestoration(!!(aFromParser & NS_FROM_PARSER_FRAGMENT)),
mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT)),
mNonOptionChildren(0),
mOptGroupCount(0),
mSelectedIndex(-1)

View File

@ -244,7 +244,7 @@ public:
using nsIConstraintValidation::GetValidationMessage;
nsHTMLSelectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLSelectElement();
// nsISupports

View File

@ -57,17 +57,19 @@
#undef GetObject
#endif
class nsHTMLSharedObjectElement : public nsGenericHTMLElement,
public nsObjectLoadingContent,
public nsIDOMHTMLAppletElement,
public nsIDOMHTMLEmbedElement
using namespace mozilla::dom;
class nsHTMLSharedObjectElement : public nsGenericHTMLElement
, public nsObjectLoadingContent
, public nsIDOMHTMLAppletElement
, public nsIDOMHTMLEmbedElement
#ifdef MOZ_SVG
, public nsIDOMGetSVGDocument
, public nsIDOMGetSVGDocument
#endif
{
public:
nsHTMLSharedObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLSharedObjectElement();
// nsISupports
@ -178,7 +180,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(SharedObject)
nsHTMLSharedObjectElement::nsHTMLSharedObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLElement(aNodeInfo),
mIsDoneAddingChildren(mNodeInfo->Equals(nsGkAtoms::embed) || !aFromParser)
{

View File

@ -81,6 +81,8 @@
#include "nsTextEditorState.h"
using namespace mozilla::dom;
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
#define NS_NO_CONTENT_DISPATCH (1 << 0)
@ -97,7 +99,7 @@ public:
using nsIConstraintValidation::GetValidationMessage;
nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@ -278,12 +280,12 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(TextArea)
nsHTMLTextAreaElement::nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mValueChanged(PR_FALSE),
mHandlingSelect(PR_FALSE),
mDoneAddingChildren(!aFromParser),
mInhibitStateRestoration(!!(aFromParser & NS_FROM_PARSER_FRAGMENT)),
mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT)),
mDisabledChanged(PR_FALSE),
mState(new nsTextEditorState(this))
{

View File

@ -66,6 +66,8 @@
#include "nsIDOMProgressEvent.h"
#include "nsMediaError.h"
using namespace mozilla::dom;
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Video)
NS_IMPL_ADDREF_INHERITED(nsHTMLVideoElement, nsHTMLMediaElement)
@ -101,7 +103,7 @@ NS_IMETHODIMP nsHTMLVideoElement::GetVideoHeight(PRUint32 *aVideoHeight)
}
nsHTMLVideoElement::nsHTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsHTMLMediaElement(aNodeInfo, aFromParser)
{
}

View File

@ -67,6 +67,8 @@
#include "nsTextEditorState.h"
using namespace mozilla::dom;
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
static NS_DEFINE_CID(kFrameSelectionCID, NS_FRAMESELECTION_CID);
@ -1520,7 +1522,7 @@ nsTextEditorState::CreateRootNode()
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = NS_NewHTMLElement(getter_AddRefs(mRootNode), nodeInfo.forget(),
PR_FALSE);
NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
// Set the necessary classes on the text control. We use class values
@ -1597,7 +1599,7 @@ be called if @placeholder is the empty string when trimmed from line breaks");
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
rv = NS_NewHTMLElement(getter_AddRefs(mPlaceholderDiv), nodeInfo.forget(),
PR_FALSE);
NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
// Create the text node for the placeholder text before doing anything else

View File

@ -236,6 +236,9 @@ _TEST_FILES = \
test_bug600155.html \
test_bug556007.html \
test_bug606817.html \
test_bug297761.html \
file_bug297761.html \
test_bug607145.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<base href="http://www.mozilla.org/">
</head>
<body>
<form action="">
<input type='submit' formaction="">
<button type='submit' formaction=""></button>
<input id='i' type='image' formaction="">
</form>
</body>
</html>

View File

@ -0,0 +1,78 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=297761
-->
<head>
<title>Test for Bug 297761</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/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=297761">Mozilla Bug 297761</a>
<p id="display"></p>
<div id="content">
<iframe src="file_bug297761.html"></iframe>
<iframe src="file_bug297761.html"></iframe>
<iframe src="file_bug297761.html"></iframe>
<iframe src="file_bug297761.html"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 297761 **/
SimpleTest.waitForExplicitFinish();
var nbTests = 4;
var curTest = 0;
function nextTest()
{
if (curTest == 3) {
frames[curTest].document.forms[0].submit();
} else {
var el = null;
if (curTest == 2) {
el = frames[curTest].document.getElementById('i');
} else {
el = frames[curTest].document.forms[0].elements[curTest];
}
el.focus();
el.click();
}
}
function frameLoaded(aFrame)
{
var documentLocation = location.href.replace(/\.html.*/, "\.html");
is(aFrame.contentWindow.location.href.replace(/\?x=0&y=0/, ""),
documentLocation.replace(/test_bug/, "file_bug"),
"form should have been submitted to the document location");
if (++curTest == nbTests) {
SimpleTest.finish();
} else {
nextTest();
}
}
function runTest()
{
// Initialize event handlers.
var frames = document.getElementsByTagName('iframe');
for (var i=0; i<nbTests; ++i) {
frames[i].setAttribute('onload', "frameLoaded(this);");
}
nextTest();
}
addLoadEvent(runTest);
</script>
</pre>
</body>
</html>

View File

@ -22,57 +22,64 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=392567
/** Test for Bug 392567 **/
var dataUrl = "http://mochi.test:8888/tests/content/html/content/test/bug392567.jar";
var jarUrl = "jar:" + dataUrl + "!/index.html";
var httpUrl = location.href.replace(/\.html.*/, "_404");
var previousDir = location.href.replace(/test\/[^\/]*$/, "");
SimpleTest.waitForExplicitFinish();
var form = document.forms.testForm;
var frame = frames.testFrame;
document.getElementById("testFrame").onload = processTestResult;
// List of tests to run, each test consists of form action URL and expected result URL
var tests = [
[jarUrl, jarUrl + "?$PARAMS", null],
[jarUrl + "?jarTest1=jarTest2", jarUrl + "?$PARAMS", null],
[jarUrl + "?jarTest3=jarTest4#jarTest5", jarUrl + "?$PARAMS#jarTest5", null],
["data:text/html,<html></html>", "data:text/html,<html></html>?$PARAMS", null],
["data:text/html,<html>How%20about%20this?</html>", "data:text/html,<html>How%20about%20this?$PARAMS", null],
[httpUrl, httpUrl + "?$PARAMS", null],
[httpUrl + "?httpTest1=httpTest2", httpUrl + "?$PARAMS", null ],
[httpUrl + "?httpTest3=httpTest4#httpTest5", httpUrl + "?$PARAMS#httpTest5", null],
["", jarUrl + "?key=value0", null],
[" ", jarUrl + "?key=value0", document.location],
["../", previousDir + "?$PARAMS", previousDir],
];
var currentTest = -1;
SimpleTest.waitForExplicitFinish();
runNextTest();
function runNextTest() {
currentTest++;
if (currentTest >= tests.length) {
SimpleTest.finish();
function runTests()
{
if (window.location.search.match(/\?key=value/)) {
return;
}
form.setAttribute("action", tests[currentTest][0]);
is(form.action, tests[currentTest][0],
"action IDL attribute should reflect the action content attribute");
is(form.mozActionUri, tests[currentTest][2] ? tests[currentTest][2] : tests[currentTest][0],
"mozActionUri IDL attribute should resolve the action URI");
form.key.value = "value" + currentTest;
form.submit();
var dataUrl = "http://mochi.test:8888/tests/content/html/content/test/bug392567.jar";
var jarUrl = "jar:" + dataUrl + "!/index.html";
var httpUrl = location.href.replace(/\.html.*/, "_404");
var previousDir = location.href.replace(/test\/[^\/]*$/, "");
var documentURL = location.href.replace(/\.html.*/, "\.html");
var form = document.forms.testForm;
var frame = frames.testFrame;
document.getElementById("testFrame").onload = processTestResult;
// List of tests to run, each test consists of form action URL and expected result URL
var tests = [
[jarUrl, jarUrl + "?$PARAMS"],
[jarUrl + "?jarTest1=jarTest2", jarUrl + "?$PARAMS"],
[jarUrl + "?jarTest3=jarTest4#jarTest5", jarUrl + "?$PARAMS#jarTest5"],
["data:text/html,<html></html>", "data:text/html,<html></html>?$PARAMS"],
["data:text/html,<html>How%20about%20this?</html>", "data:text/html,<html>How%20about%20this?$PARAMS"],
[httpUrl, httpUrl + "?$PARAMS"],
[httpUrl + "?httpTest1=httpTest2", httpUrl + "?$PARAMS"],
[httpUrl + "?httpTest3=httpTest4#httpTest5", httpUrl + "?$PARAMS#httpTest5"],
["", documentURL + "?$PARAMS"],
[" ", documentURL + "?$PARAMS"],
["../", previousDir + "?$PARAMS"],
];
var currentTest = -1;
runNextTest();
function runNextTest() {
currentTest++;
if (currentTest >= tests.length) {
SimpleTest.finish();
return;
}
form.setAttribute("action", tests[currentTest][0]);
form.key.value = "value" + currentTest;
form.submit();
}
function processTestResult() {
var expected = tests[currentTest][1].replace(/\$PARAMS/, "key=value" + currentTest);
is(frame.location.href, expected, "Submitting to " + tests[currentTest][0]);
setTimeout(runNextTest, 0);
}
}
function processTestResult() {
var expected = tests[currentTest][1].replace(/\$PARAMS/, "key=value" + currentTest);
is(frame.location.href, expected, "Submitting to " + tests[currentTest][0]);
setTimeout(runNextTest, 0);
}
addLoadEvent(runTests);
</script>
</pre>

View File

@ -14,11 +14,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=430392
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=430392">Mozilla Bug 430392</a>
<p id="display"></p>
<div id="content">
<div contenteditable="true" id="edit">
<span contenteditable="false">A</span> ;
<span contenteditable="false">B</span> ;
<span contenteditable="false">C</span>
</div>
<div contenteditable="true" id="edit"> <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> </div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">

View File

@ -83,41 +83,8 @@ var gTestResults = {
var gPendingLoad = 0; // Has to be set after depending on the frames number.
function checkFormActionAttribute(aElement)
{
ok("formAction" in aElement, "formAction IDL attribute should be available in "
+ aElement);
is(aElement.formAction, "", "formAction IDL attribute should be " +
"undefined by default");
is(aElement.getAttribute('formaction'), null, "formaction content attribute " +
"should be the empty string by default");
aElement.formAction = "foo";
is(aElement.getAttribute('formaction'), "foo", "formaction content attribute " +
"should be 'foo'.");
is(aElement.formAction, "foo", "formAction IDL attribute should reflect " +
"the content attribute");
aElement.setAttribute('formaction', 'bar');
is(aElement.getAttribute('formaction'), "bar", "formaction content attribute " +
"should be 'foo'.");
is(aElement.formAction, "bar", "formAction IDL attribute should reflect " +
"the content attribute");
aElement.removeAttribute('formaction');
is(aElement.formAction, "", "formAction IDL attribute should be " +
"undefined by default");
is(aElement.getAttribute('formaction'), null, "formaction content attribute " +
"should be the empty string by default");
}
function runTests()
{
// First of all, let's check if .formAction and @formaction work correctly.
checkFormActionAttribute(document.createElement('input'));
checkFormActionAttribute(document.createElement('button'));
// We add a load event for the frames which will be called when the forms
// will be submitted.
var frames = [ document.getElementById('frame1'),

View File

@ -0,0 +1,78 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=607145
-->
<head>
<title>Test for Bug 607145</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/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=607145">Mozilla Bug 607145</a>
<p id="display"></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 607145 **/
/**
* This is not really reflecting an URL as the HTML5 specs want to.
* It's how .action is reflected in Gecko (might change later).
*/
function reflectURL(aElement, aAttr)
{
var idl = aAttr;
var attr = aAttr.toLowerCase();
var elmtName = aElement.tagName.toLowerCase();
ok(idl in aElement, idl + " should be available in " + elmtName);
// Default values.
is(aElement[idl], "", "." + idl + " default value should be the empty string");
is(aElement.getAttribute(attr), null,
"@" + attr + " default value should be null");
var previousDir = location.href.replace(/test\/[^\/]*$/, "");
var dir = location.href.replace(/test_bug607145.html[^\/]*$/, "");
var doc = location.href.replace(/\.html.*/, ".html")
var values = [
/* value to set, resolved value */
[ "foo.html", dir + "foo.html" ],
[ "data:text/html,<html></html>", "data:text/html,<html></html>" ],
[ "http://example.org/", "http://example.org/" ],
[ "//example.org/", "http://example.org/" ],
[ "?foo=bar", doc + "?foo=bar" ],
[ "#foo", location.href + "#foo" ],
[ "", "" ], // TODO: doesn't follow the specs, should be location.href.
[ " ", location.href ],
[ "../", previousDir ],
[ "...", dir + "..." ],
// invalid URL
[ "http://a b/", "http://a b/" ], // TODO: doesn't follow the specs, should be "".
];
for each (var value in values) {
aElement[idl] = value[0];
is(aElement[idl], value[1], "." + idl + " value should be " + value[1]);
is(aElement.getAttribute(attr), value[0],
"@" + attr + " value should be " + value[0]);
}
for each (var value in values) {
aElement.setAttribute(attr, value[0]);
is(aElement[idl], value[1], "." + idl + " value should be " + value[1]);
is(aElement.getAttribute(attr), value[0],
"@" + attr + " value should be " + value[0]);
}
}
reflectURL(document.createElement("form"), "action");
reflectURL(document.createElement("input"), "formAction");
reflectURL(document.createElement("button"), "formAction");
</script>
</pre>
</body>
</html>

View File

@ -139,11 +139,12 @@ static PRLogModuleInfo* gSinkLogModuleInfo;
//----------------------------------------------------------------------
typedef nsGenericHTMLElement*
(*contentCreatorCallback)(already_AddRefed<nsINodeInfo>, PRUint32 aFromParser);
(*contentCreatorCallback)(already_AddRefed<nsINodeInfo>,
FromParser aFromParser);
nsGenericHTMLElement*
NS_NewHTMLNOTUSEDElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
NS_NOTREACHED("The element ctor should never be called");
return nsnull;
@ -555,12 +556,12 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
NS_ENSURE_TRUE(nodeInfo, nsnull);
// Make the content object
return CreateHTMLElement(aNodeType, nodeInfo.forget(), PR_TRUE);
return CreateHTMLElement(aNodeType, nodeInfo.forget(), FROM_PARSER_NETWORK);
}
nsresult
NS_NewHTMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
*aResult = nsnull;
@ -583,7 +584,7 @@ NS_NewHTMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
already_AddRefed<nsGenericHTMLElement>
CreateHTMLElement(PRUint32 aNodeType, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
NS_ASSERTION(aNodeType <= NS_HTML_TAG_MAX ||
aNodeType == eHTMLTag_userdefined,
@ -2619,7 +2620,8 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode)
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::link, nsnull, kNameSpaceID_XHTML);
result = NS_NewHTMLElement(getter_AddRefs(element), nodeInfo.forget(), PR_FALSE);
result = NS_NewHTMLElement(getter_AddRefs(element), nodeInfo.forget(),
NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(element));

View File

@ -219,6 +219,27 @@ ReportUseOfDeprecatedMethod(nsHTMLDocument* aDoc, const char* aWarning)
"DOM Events");
}
static nsresult
RemoveFromAgentSheets(nsCOMArray<nsIStyleSheet> &aAgentSheets, const nsAString& url)
{
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), url);
NS_ENSURE_SUCCESS(rv, rv);
for (PRInt32 i = aAgentSheets.Count() - 1; i >= 0; --i) {
nsIStyleSheet* sheet = aAgentSheets[i];
nsIURI* sheetURI = sheet->GetSheetURI();
PRBool equals = PR_FALSE;
uri->Equals(sheetURI, &equals);
if (equals) {
aAgentSheets.RemoveObjectAt(i);
}
}
return NS_OK;
}
nsresult
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult)
{
@ -467,48 +488,6 @@ nsHTMLDocument::TryCacheCharset(nsICachingChannel* aCachingChannel,
return PR_FALSE;
}
PRBool
nsHTMLDocument::TryBookmarkCharset(nsIDocShell* aDocShell,
nsIChannel* aChannel,
PRInt32& aCharsetSource,
nsACString& aCharset)
{
if (kCharsetFromBookmarks <= aCharsetSource) {
return PR_TRUE;
}
if (!aChannel) {
return PR_FALSE;
}
nsCOMPtr<nsICharsetResolver> bookmarksResolver =
do_GetService("@mozilla.org/embeddor.implemented/bookmark-charset-resolver;1");
if (!bookmarksResolver) {
return PR_FALSE;
}
PRBool wantCharset; // ignored for now
nsCAutoString charset;
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(aDocShell));
nsCOMPtr<nsISupports> closure;
nsresult rv = bookmarksResolver->RequestCharset(webNav,
aChannel,
&wantCharset,
getter_AddRefs(closure),
charset);
// FIXME: Bug 337970
NS_ASSERTION(!wantCharset, "resolved charset notification not implemented!");
if (NS_SUCCEEDED(rv) && !charset.IsEmpty()) {
aCharset = charset;
aCharsetSource = kCharsetFromBookmarks;
return PR_TRUE;
}
return PR_FALSE;
}
static PRBool
CheckSameOrigin(nsINode* aNode1, nsINode* aNode2)
{
@ -880,10 +859,6 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
// Use the channel's charset (e.g., charset from HTTP
// "Content-Type" header).
}
else if (!scheme.EqualsLiteral("about") && // don't try to access bookmarks for about:blank
TryBookmarkCharset(docShell, aChannel, charsetSource, charset)) {
// Use the bookmark's charset.
}
else if (cachingChan && !urlSpec.IsEmpty() &&
TryCacheCharset(cachingChan, charsetSource, charset)) {
// Use the cache's charset.
@ -3161,12 +3136,20 @@ nsHTMLDocument::TearingDownEditor(nsIEditor *aEditor)
EditingState oldState = mEditingState;
mEditingState = eTearingDown;
nsCOMPtr<nsIEditorStyleSheets> editorss = do_QueryInterface(aEditor);
if (editorss) {
editorss->RemoveOverrideStyleSheet(NS_LITERAL_STRING("resource://gre/res/contenteditable.css"));
if (oldState == eDesignMode)
editorss->RemoveOverrideStyleSheet(NS_LITERAL_STRING("resource://gre/res/designmode.css"));
}
nsCOMPtr<nsIPresShell> presShell = GetShell();
if (!presShell)
return;
nsCOMArray<nsIStyleSheet> agentSheets;
presShell->GetAgentStyleSheets(agentSheets);
RemoveFromAgentSheets(agentSheets, NS_LITERAL_STRING("resource://gre/res/contenteditable.css"));
if (oldState == eDesignMode)
RemoveFromAgentSheets(agentSheets, NS_LITERAL_STRING("resource://gre/res/designmode.css"));
presShell->SetAgentStyleSheets(agentSheets);
presShell->ReconstructStyleData();
}
}
@ -3292,21 +3275,37 @@ nsHTMLDocument::EditingStateChanged()
if (!editor)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIEditorStyleSheets> editorss = do_QueryInterface(editor, &rv);
nsCOMPtr<nsIPresShell> presShell = GetShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsCOMArray<nsIStyleSheet> agentSheets;
rv = presShell->GetAgentStyleSheets(agentSheets);
NS_ENSURE_SUCCESS(rv, rv);
editorss->AddOverrideStyleSheet(NS_LITERAL_STRING("resource://gre/res/contenteditable.css"));
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_STRING("resource://gre/res/contenteditable.css"));
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsCSSStyleSheet> sheet;
rv = LoadChromeSheetSync(uri, PR_TRUE, getter_AddRefs(sheet));
NS_ENSURE_TRUE(sheet, rv);
rv = agentSheets.AppendObject(sheet);
NS_ENSURE_SUCCESS(rv, rv);
// Should we update the editable state of all the nodes in the document? We
// need to do this when the designMode value changes, as that overrides
// specific states on the elements.
if (designMode) {
// designMode is being turned on (overrides contentEditable).
editorss->AddOverrideStyleSheet(NS_LITERAL_STRING("resource://gre/res/designmode.css"));
rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_STRING("resource://gre/res/designmode.css"));
NS_ENSURE_SUCCESS(rv, rv);
// We need to flush styles here because we're setting an XBL binding in
// designmode.css.
FlushPendingNotifications(Flush_Style);
rv = LoadChromeSheetSync(uri, PR_TRUE, getter_AddRefs(sheet));
NS_ENSURE_TRUE(sheet, rv);
rv = agentSheets.AppendObject(sheet);
NS_ENSURE_SUCCESS(rv, rv);
// Disable scripting and plugins.
rv = editSession->DisableJSAndPlugins(window);
@ -3317,7 +3316,7 @@ nsHTMLDocument::EditingStateChanged()
}
else if (oldState == eDesignMode) {
// designMode is being turned off (contentEditable is still on).
editorss->RemoveOverrideStyleSheet(NS_LITERAL_STRING("resource://gre/res/designmode.css"));
RemoveFromAgentSheets(agentSheets, NS_LITERAL_STRING("resource://gre/res/designmode.css"));
rv = editSession->RestoreJSAndPlugins(window);
NS_ENSURE_SUCCESS(rv, rv);
@ -3328,6 +3327,17 @@ nsHTMLDocument::EditingStateChanged()
// contentEditable is being turned on (and designMode is off).
updateState = PR_FALSE;
}
rv = presShell->SetAgentStyleSheets(agentSheets);
NS_ENSURE_SUCCESS(rv, rv);
presShell->ReconstructStyleData();
if (designMode) {
// We need to flush styles here because we're setting an XBL binding in
// designmode.css.
FlushPendingNotifications(Flush_Style);
}
}
mEditingState = newState;

View File

@ -309,10 +309,6 @@ protected:
static PRBool TryCacheCharset(nsICachingChannel* aCachingChannel,
PRInt32& aCharsetSource,
nsACString& aCharset);
static PRBool TryBookmarkCharset(nsIDocShell* aDocShell,
nsIChannel* aChannel,
PRInt32& aCharsetSource,
nsACString& aCharset);
// aParentDocument could be null.
PRBool TryParentCharset(nsIDocumentCharsetInfo* aDocInfo,
nsIDocument* aParentDocument,

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