diff options
56 files changed, 338 insertions, 682 deletions
diff --git a/application/palemoon/base/content/browser.css b/application/palemoon/base/content/browser.css index e6a84421b..24cbb9d8e 100644 --- a/application/palemoon/base/content/browser.css +++ b/application/palemoon/base/content/browser.css @@ -280,6 +280,10 @@ panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .a -moz-binding: url("chrome://browser/content/urlbarBindings.xml#urlbar-rich-result-popup"); } +#DateTimePickerPanel[active="true"] { + -moz-binding: url("chrome://global/content/bindings/datetimepopup.xml#datetime-popup"); +} + /* Pale Moon: Address bar: Feeds */ #ub-feed-button > .button-box > .box-inherit > .button-text, #ub-feed-button > .button-box > .button-menu-dropmarker { @@ -542,11 +546,11 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(#nav-bar):not( max-width: 280px; } -.form-validation-anchor { +.popup-anchor { /* should occupy space but not be visible */ opacity: 0; - visibility: hidden; pointer-events: none; + -moz-stack-sizing: ignore; } #addon-progress-notification { diff --git a/application/palemoon/base/content/browser.xul b/application/palemoon/base/content/browser.xul index df152bbaa..8a79890cd 100644 --- a/application/palemoon/base/content/browser.xul +++ b/application/palemoon/base/content/browser.xul @@ -132,6 +132,20 @@ <!-- for url bar autocomplete --> <panel type="autocomplete-richlistbox" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/> + <!-- for date/time picker. consumeoutsideclicks is set to never, so that + clicks on the anchored input box are never consumed. --> + <panel id="DateTimePickerPanel" + type="arrow" + hidden="true" + orient="vertical" + noautofocus="true" + norolluponanchor="true" + consumeoutsideclicks="never" + level="parent" + tabspecific="true"> + <iframe id="dateTimePopupFrame"/> + </panel> + <!-- for invalid form error message --> <panel id="invalid-form-popup" type="arrow" orient="vertical" noautofocus="true" hidden="true" level="parent"> <description/> @@ -946,7 +960,8 @@ flex="1" contenttooltip="aHTMLTooltip" tabcontainer="tabbrowser-tabs" contentcontextmenu="contentAreaContextMenu" - autocompletepopup="PopupAutoComplete"/> + autocompletepopup="PopupAutoComplete" + datetimepicker="DateTimePickerPanel"/> <chatbar id="pinnedchats" layer="true" mousethrough="always" hidden="true"/> <statuspanel id="statusbar-display" inactive="true"/> </vbox> diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index 4b10855a7..eaf3ea4d9 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -30,7 +30,7 @@ <xul:vbox flex="1" class="browserContainer"> <xul:stack flex="1" class="browserStack" anonid="browserStack"> <xul:browser anonid="initialBrowser" type="content-primary" message="true" disablehistory="true" - xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup"/> + xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,datetimepicker"/> </xul:stack> </xul:vbox> </xul:hbox> @@ -138,19 +138,19 @@ ]]></getter> </property> - <property name="formValidationAnchor" readonly="true"> + <property name="popupAnchor" readonly="true"> <getter><![CDATA[ - if (this.mCurrentTab._formValidationAnchor) { - return this.mCurrentTab._formValidationAnchor; + if (this.mCurrentTab._popupAnchor) { + return this.mCurrentTab._popupAnchor; } let stack = this.mCurrentBrowser.parentNode; - // Create an anchor for the form validation popup + // Create an anchor for the popup const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - let formValidationAnchor = document.createElementNS(NS_XUL, "hbox"); - formValidationAnchor.className = "form-validation-anchor"; - formValidationAnchor.hidden = true; - stack.appendChild(formValidationAnchor); - return this.mCurrentTab._formValidationAnchor = formValidationAnchor; + let popupAnchor = document.createElementNS(NS_XUL, "hbox"); + popupAnchor.className = "popup-anchor"; + popupAnchor.hidden = true; + stack.appendChild(popupAnchor); + return this.mCurrentTab._popupAnchor = popupAnchor; ]]></getter> </property> @@ -1451,6 +1451,10 @@ b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup")); b.setAttribute("autoscrollpopup", this._autoScrollPopup.id); + if (this.hasAttribute("datetimepicker")) { + b.setAttribute("datetimepicker", this.getAttribute("datetimepicker")); + } + // Create the browserStack container var stack = document.createElementNS(NS_XUL, "stack"); stack.className = "browserStack"; diff --git a/application/palemoon/components/nsBrowserGlue.js b/application/palemoon/components/nsBrowserGlue.js index cdb0b7522..c4205c2c5 100644 --- a/application/palemoon/components/nsBrowserGlue.js +++ b/application/palemoon/components/nsBrowserGlue.js @@ -35,6 +35,7 @@ Cu.import("resource://gre/modules/Services.jsm"); ["OS", "resource://gre/modules/osfile.jsm"], ["LoginManagerParent", "resource://gre/modules/LoginManagerParent.jsm"], ["FormValidationHandler", "resource:///modules/FormValidationHandler.jsm"], + ["DateTimePickerHelper", "resource://gre/modules/DateTimePickerHelper.jsm"], ].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource)); const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser"; @@ -167,6 +168,7 @@ BrowserGlue.prototype = { } catch (e) { Cu.reportError("Could not end startup crash tracking in quit-application-granted: " + e); } + DateTimePickerHelper.uninit(); break; #ifdef OBSERVE_LASTWINDOW_CLOSE_TOPICS case "browser-lastwindow-close-requested": @@ -496,6 +498,8 @@ BrowserGlue.prototype = { } #endif + DateTimePickerHelper.init(); + this._trackSlowStartup(); }, diff --git a/application/palemoon/installer/Makefile.in b/application/palemoon/installer/Makefile.in index 7cd77bdca..368b16efc 100644 --- a/application/palemoon/installer/Makefile.in +++ b/application/palemoon/installer/Makefile.in @@ -34,9 +34,9 @@ ifdef MOZ_ENABLE_GNOME_COMPONENT DEFINES += -DMOZ_ENABLE_GNOME_COMPONENT=1 endif -ifdef MOZ_WIDGET_GTK +ifneq (,$(filter gtk%,$(MOZ_WIDGET_TOOLKIT))) DEFINES += -DMOZ_GTK=1 -ifdef MOZ_ENABLE_GTK3 +ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3) DEFINES += -DMOZ_GTK3=1 endif endif @@ -131,16 +131,17 @@ AB = $(firstword $(subst -, ,$(AB_CD))) DEFINES += -DAB=$(AB) DEFINES += -DMOZ_ICU_VERSION=$(MOZ_ICU_VERSION) -ifdef MOZ_NATIVE_ICU -DEFINES += -DMOZ_NATIVE_ICU +ifdef MOZ_SYSTEM_ICU +DEFINES += -DMOZ_SYSTEM_ICU endif -ifdef MOZ_SHARED_ICU -DEFINES += -DMOZ_SHARED_ICU +ifdef MOZ_ICU_DATA_ARCHIVE +DEFINES += -DMOZ_ICU_DATA_ARCHIVE endif ifdef MOZ_JEMALLOC3 DEFINES += -DMOZ_JEMALLOC3 endif DEFINES += -DMOZ_ICU_DBG_SUFFIX=$(MOZ_ICU_DBG_SUFFIX) +DEFINES += -DICU_DATA_FILE=$(ICU_DATA_FILE) ifdef CLANG_CXX DEFINES += -DCLANG_CXX endif diff --git a/application/palemoon/modules/FormValidationHandler.jsm b/application/palemoon/modules/FormValidationHandler.jsm index ef7c2108b..387c221d7 100644 --- a/application/palemoon/modules/FormValidationHandler.jsm +++ b/application/palemoon/modules/FormValidationHandler.jsm @@ -122,7 +122,7 @@ var FormValidationHandler = this._panel.hidden = false; let tabBrowser = aWindow.gBrowser; - this._anchor = tabBrowser.formValidationAnchor; + this._anchor = tabBrowser.popupAnchor; this._anchor.left = aPanelData.contentRect.left; this._anchor.top = aPanelData.contentRect.top; this._anchor.width = aPanelData.contentRect.width; diff --git a/docshell/test/unit/test_nsDefaultURIFixup_info.js b/docshell/test/unit/test_nsDefaultURIFixup_info.js index 9e33ea484..c606ac32e 100644 --- a/docshell/test/unit/test_nsDefaultURIFixup_info.js +++ b/docshell/test/unit/test_nsDefaultURIFixup_info.js @@ -426,8 +426,6 @@ var testcases = [ { protocolChange: true, }, { input: "?'.com", - fixedURI: "http:///?%27.com", - alternateURI: "http://www..com/?%27.com", keywordLookup: true, protocolChange: true, }, { @@ -436,14 +434,10 @@ var testcases = [ { protocolChange: true }, { input: "?mozilla", - fixedURI: "http:///?mozilla", - alternateURI: "http://www..com/?mozilla", keywordLookup: true, protocolChange: true, }, { input: "??mozilla", - fixedURI: "http:///??mozilla", - alternateURI: "http://www..com/??mozilla", keywordLookup: true, protocolChange: true, }, { diff --git a/docshell/test/unit/test_nsDefaultURIFixup_search.js b/docshell/test/unit/test_nsDefaultURIFixup_search.js index c00b6a85f..c84452b5d 100644 --- a/docshell/test/unit/test_nsDefaultURIFixup_search.js +++ b/docshell/test/unit/test_nsDefaultURIFixup_search.js @@ -74,7 +74,7 @@ var data = [ }, { wrong: 'user:@example.com:8080/this/is/a/test.html', - fixed: 'http://user:@example.com:8080/this/is/a/test.html', + fixed: 'http://user@example.com:8080/this/is/a/test.html', }, { wrong: '//user:pass@example.com:8080/this/is/a/test.html', diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 15df2b337..a38c38293 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -105,6 +105,7 @@ #include "mozilla/dom/CanvasPath.h" #include "mozilla/dom/HTMLImageElement.h" #include "mozilla/dom/HTMLVideoElement.h" +#include "mozilla/dom/SVGImageElement.h" #include "mozilla/dom/SVGMatrix.h" #include "mozilla/dom/TextMetrics.h" #include "mozilla/dom/SVGMatrix.h" @@ -2477,10 +2478,10 @@ CanvasRenderingContext2D::CreatePattern(const CanvasImageSource& aSource, return nullptr; } - Element* htmlElement; + Element* element; if (aSource.IsHTMLCanvasElement()) { HTMLCanvasElement* canvas = &aSource.GetAsHTMLCanvasElement(); - htmlElement = canvas; + element = canvas; nsIntSize size = canvas->GetSize(); if (size.width == 0 || size.height == 0) { @@ -2505,7 +2506,7 @@ CanvasRenderingContext2D::CreatePattern(const CanvasImageSource& aSource, } RefPtr<CanvasPattern> pat = - new CanvasPattern(this, srcSurf, repeatMode, htmlElement->NodePrincipal(), canvas->IsWriteOnly(), false); + new CanvasPattern(this, srcSurf, repeatMode, element->NodePrincipal(), canvas->IsWriteOnly(), false); return pat.forget(); } @@ -2516,11 +2517,19 @@ CanvasRenderingContext2D::CreatePattern(const CanvasImageSource& aSource, return nullptr; } - htmlElement = img; + element = img; + } else if (aSource.IsSVGImageElement()) { + SVGImageElement* img = &aSource.GetAsSVGImageElement(); + if (img->IntrinsicState().HasState(NS_EVENT_STATE_BROKEN)) { + aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + return nullptr; + } + + element = img; } else if (aSource.IsHTMLVideoElement()) { auto& video = aSource.GetAsHTMLVideoElement(); video.MarkAsContentSource(mozilla::dom::HTMLVideoElement::CallerAPI::CREATE_PATTERN); - htmlElement = &video; + element = &video; } else { // Special case for ImageBitmap ImageBitmap& imgBitmap = aSource.GetAsImageBitmap(); @@ -2559,7 +2568,7 @@ CanvasRenderingContext2D::CreatePattern(const CanvasImageSource& aSource, // The canvas spec says that createPattern should use the first frame // of animated images nsLayoutUtils::SurfaceFromElementResult res = - nsLayoutUtils::SurfaceFromElement(htmlElement, + nsLayoutUtils::SurfaceFromElement(element, nsLayoutUtils::SFE_WANT_FIRST_FRAME, mTarget); if (!res.GetSourceSurface()) { @@ -4949,6 +4958,9 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& aImage, if (aImage.IsHTMLImageElement()) { HTMLImageElement* img = &aImage.GetAsHTMLImageElement(); element = img; + } else if (aImage.IsSVGImageElement()) { + SVGImageElement* img = &aImage.GetAsSVGImageElement(); + element = img; } else { HTMLVideoElement* video = &aImage.GetAsHTMLVideoElement(); video->MarkAsContentSource(mozilla::dom::HTMLVideoElement::CallerAPI::DRAW_IMAGE); diff --git a/dom/canvas/CanvasRenderingContext2D.h b/dom/canvas/CanvasRenderingContext2D.h index c3ee3bdcb..d5dff8f3b 100644 --- a/dom/canvas/CanvasRenderingContext2D.h +++ b/dom/canvas/CanvasRenderingContext2D.h @@ -38,8 +38,8 @@ class SourceSurface; } // namespace gl namespace dom { -class HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElementOrImageBitmap; -typedef HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElementOrImageBitmap CanvasImageSource; +class HTMLImageElementOrSVGImageElementOrHTMLCanvasElementOrHTMLVideoElementOrImageBitmap; +typedef HTMLImageElementOrSVGImageElementOrHTMLCanvasElementOrHTMLVideoElementOrImageBitmap CanvasImageSource; class ImageData; class StringOrCanvasGradientOrCanvasPattern; class OwningStringOrCanvasGradientOrCanvasPattern; diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index f1a54705e..52062c4b9 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -114,15 +114,12 @@ #include <limits> #include "nsIColorPicker.h" -#include "nsIDatePicker.h" #include "nsIStringEnumerator.h" #include "HTMLSplitOnSpacesTokenizer.h" #include "nsIController.h" #include "nsIMIMEInfo.h" #include "nsFrameSelection.h" -#include "nsIConsoleService.h" - // input type=date #include "js/Date.h" @@ -543,8 +540,8 @@ GetDOMFileOrDirectoryPath(const OwningFileOrDirectory& aData, bool HTMLInputElement::ValueAsDateEnabled(JSContext* cx, JSObject* obj) { - return IsExperimentalFormsEnabled() || IsDatePickerEnabled() || - IsInputDateTimeEnabled(); + return IsExperimentalFormsEnabled() || IsInputDateTimeEnabled() || + IsInputDateTimeOthersEnabled(); } NS_IMETHODIMP @@ -746,59 +743,6 @@ nsColorPickerShownCallback::Done(const nsAString& aColor) NS_IMPL_ISUPPORTS(nsColorPickerShownCallback, nsIColorPickerShownCallback) -class DatePickerShownCallback final : public nsIDatePickerShownCallback -{ - ~DatePickerShownCallback() {} -public: - DatePickerShownCallback(HTMLInputElement* aInput, - nsIDatePicker* aDatePicker) - : mInput(aInput) - , mDatePicker(aDatePicker) - {} - - NS_DECL_ISUPPORTS - - NS_IMETHOD Done(const nsAString& aDate) override; - NS_IMETHOD Cancel() override; - -private: - RefPtr<HTMLInputElement> mInput; - nsCOMPtr<nsIDatePicker> mDatePicker; -}; - -NS_IMETHODIMP -DatePickerShownCallback::Cancel() -{ - mInput->PickerClosed(); - return NS_OK; -} - -NS_IMETHODIMP -DatePickerShownCallback::Done(const nsAString& aDate) -{ - nsAutoString oldValue; - - mInput->PickerClosed(); - mInput->GetValue(oldValue); - - if(!oldValue.Equals(aDate)){ - mInput->SetValue(aDate); - nsContentUtils::DispatchTrustedEvent(mInput->OwnerDoc(), - static_cast<nsIDOMHTMLInputElement*>(mInput.get()), - NS_LITERAL_STRING("input"), true, - false); - return nsContentUtils::DispatchTrustedEvent(mInput->OwnerDoc(), - static_cast<nsIDOMHTMLInputElement*>(mInput.get()), - NS_LITERAL_STRING("change"), true, - false); - } - - return NS_OK; -} - -NS_IMPL_ISUPPORTS(DatePickerShownCallback, nsIDatePickerShownCallback) - - bool HTMLInputElement::IsPopupBlocked() const { @@ -824,56 +768,6 @@ HTMLInputElement::IsPopupBlocked() const } nsresult -HTMLInputElement::InitDatePicker() -{ - if (!IsDatePickerEnabled()) { - return NS_OK; - } - - if (mPickerRunning) { - NS_WARNING("Just one nsIDatePicker is allowed"); - return NS_ERROR_FAILURE; - } - - nsCOMPtr<nsIDocument> doc = OwnerDoc(); - - nsCOMPtr<nsPIDOMWindowOuter> win = doc->GetWindow(); - if (!win) { - return NS_ERROR_FAILURE; - } - - if (IsPopupBlocked()) { - win->FirePopupBlockedEvent(doc, nullptr, EmptyString(), EmptyString()); - return NS_OK; - } - - // Get Loc title - nsXPIDLString title; - nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES, - "DatePicker", title); - - nsresult rv; - nsCOMPtr<nsIDatePicker> datePicker = do_CreateInstance("@mozilla.org/datepicker;1", &rv); - if (!datePicker) { - return rv; - } - - nsAutoString initialValue; - GetValueInternal(initialValue); - rv = datePicker->Init(win, title, initialValue); - - nsCOMPtr<nsIDatePickerShownCallback> callback = - new DatePickerShownCallback(this, datePicker); - - rv = datePicker->Open(callback); - if (NS_SUCCEEDED(rv)) { - mPickerRunning = true; - } - - return rv; -} - -nsresult HTMLInputElement::InitColorPicker() { if (mPickerRunning) { @@ -2570,9 +2464,8 @@ HTMLInputElement::ApplyStep(int32_t aStep) bool HTMLInputElement::IsExperimentalMobileType(uint8_t aType) { - return (aType == NS_FORM_INPUT_DATE && - !IsInputDateTimeEnabled() && !IsDatePickerEnabled()) || - (aType == NS_FORM_INPUT_TIME && !IsInputDateTimeEnabled()); + return (aType == NS_FORM_INPUT_DATE || aType == NS_FORM_INPUT_TIME) && + !IsInputDateTimeEnabled(); } bool @@ -4429,9 +4322,6 @@ HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor) if (mType == NS_FORM_INPUT_COLOR) { return InitColorPicker(); } - if (mType == NS_FORM_INPUT_DATE) { - return InitDatePicker(); - } return NS_OK; } @@ -5814,15 +5704,13 @@ HTMLInputElement::ParseTime(const nsAString& aValue, uint32_t* aResult) /* static */ bool HTMLInputElement::IsDateTimeTypeSupported(uint8_t aDateTimeInputType) { - return (aDateTimeInputType == NS_FORM_INPUT_DATE && - (IsInputDateTimeEnabled() || IsExperimentalFormsEnabled() || - IsDatePickerEnabled())) || - (aDateTimeInputType == NS_FORM_INPUT_TIME && + return ((aDateTimeInputType == NS_FORM_INPUT_DATE || + aDateTimeInputType == NS_FORM_INPUT_TIME) && (IsInputDateTimeEnabled() || IsExperimentalFormsEnabled())) || ((aDateTimeInputType == NS_FORM_INPUT_MONTH || aDateTimeInputType == NS_FORM_INPUT_WEEK || aDateTimeInputType == NS_FORM_INPUT_DATETIME_LOCAL) && - IsInputDateTimeEnabled()); + IsInputDateTimeOthersEnabled()); } /* static */ bool @@ -5870,20 +5758,6 @@ HTMLInputElement::IsDirPickerEnabled() } /* static */ bool -HTMLInputElement::IsDatePickerEnabled() -{ - static bool sDatePickerEnabled = false; - static bool sDatePickerPrefCached = false; - if (!sDatePickerPrefCached) { - sDatePickerPrefCached = true; - Preferences::AddBoolVarCache(&sDatePickerEnabled, "dom.forms.datepicker", - false); - } - - return sDatePickerEnabled; -} - -/* static */ bool HTMLInputElement::IsExperimentalFormsEnabled() { static bool sExperimentalFormsEnabled = false; @@ -5913,6 +5787,20 @@ HTMLInputElement::IsInputDateTimeEnabled() } /* static */ bool +HTMLInputElement::IsInputDateTimeOthersEnabled() +{ + static bool sDateTimeOthersEnabled = false; + static bool sDateTimeOthersPrefCached = false; + if (!sDateTimeOthersPrefCached) { + sDateTimeOthersPrefCached = true; + Preferences::AddBoolVarCache(&sDateTimeOthersEnabled, + "dom.forms.datetime.others", false); + } + + return sDateTimeOthersEnabled; +} + +/* static */ bool HTMLInputElement::IsInputNumberEnabled() { static bool sInputNumberEnabled = false; @@ -5954,12 +5842,9 @@ HTMLInputElement::ParseAttribute(int32_t aNamespaceID, bool success = aResult.ParseEnumValue(aValue, kInputTypeTable, false); if (success) { newType = aResult.GetEnumValue(); - if ((IsExperimentalMobileType(newType) && - !IsExperimentalFormsEnabled()) || - (newType == NS_FORM_INPUT_NUMBER && !IsInputNumberEnabled()) || + if ((newType == NS_FORM_INPUT_NUMBER && !IsInputNumberEnabled()) || (newType == NS_FORM_INPUT_COLOR && !IsInputColorEnabled()) || - (IsDateTimeInputType(newType) && - !IsDateTimeTypeSupported(newType))) { + (IsDateTimeInputType(newType) && !IsDateTimeTypeSupported(newType))) { newType = kInputDefaultType->value; aResult.SetTo(newType, &aValue); } diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index adab663c3..98a590443 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -1451,7 +1451,6 @@ protected: }; nsresult InitFilePicker(FilePickerType aType); nsresult InitColorPicker(); - nsresult InitDatePicker(); /** * Use this function before trying to open a picker. @@ -1647,7 +1646,7 @@ private: /** * Checks if aDateTimeInputType should be supported based on "dom.forms.datetime", - * "dom.forms.datepicker" and "dom.experimental_forms". + * and "dom.experimental_forms". */ static bool IsDateTimeTypeSupported(uint8_t aDateTimeInputType); @@ -1674,13 +1673,6 @@ private: IsDirPickerEnabled(); /** - * Checks preference "dom.forms.datepicker" to determine if date picker should - * be supported. - */ - static bool - IsDatePickerEnabled(); - - /** * Checks preference "dom.experimental_forms" to determine if experimental * implementation of input element should be enabled. */ @@ -1688,13 +1680,20 @@ private: IsExperimentalFormsEnabled(); /** - * Checks preference "dom.forms.datetime" to determine if input date/time - * related types should be supported. + * Checks preference "dom.forms.datetime" to determine if input date and time + * should be supported. */ static bool IsInputDateTimeEnabled(); /** + * Checks preference "dom.forms.datetime.others" to determine if input week, + * month and datetime-local should be supported. + */ + static bool + IsInputDateTimeOthersEnabled(); + + /** * Checks preference "dom.forms.number" to determine if input type=number * should be supported. */ diff --git a/dom/html/test/forms/test_input_types_pref.html b/dom/html/test/forms/test_input_types_pref.html index 243836f34..5279d6a2a 100644 --- a/dom/html/test/forms/test_input_types_pref.html +++ b/dom/html/test/forms/test_input_types_pref.html @@ -37,47 +37,63 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=764481 inputType: "color", expectedType: "color" }, { - prefs: [["dom.experimental_forms", false], ["dom.forms.datepicker", false], - ["dom.forms.datetime", false]], + prefs: [["dom.experimental_forms", false], ["dom.forms.datetime", false]], inputType: "date", expectedType: "text" }, { - prefs: [["dom.experimental_forms", true], ["dom.forms.datepicker", false], - ["dom.forms.datetime", false]], + prefs: [["dom.experimental_forms", true], ["dom.forms.datetime", false]], inputType: "date", expectedType: "date" }, { - prefs: [["dom.experimental_forms", false], ["dom.forms.datepicker", true], - ["dom.forms.datetime", false]], + prefs: [["dom.experimental_forms", false], ["dom.forms.datetime", true]], inputType: "date", expectedType: "date" }, { - prefs: [["dom.experimental_forms", false], ["dom.forms.datepicker", false], - ["dom.forms.datetime", true]], - inputType: "date", - expectedType: "date" + prefs: [["dom.experimental_forms", false], ["dom.forms.datetime", false]], + inputType: "time", + expectedType: "text" + }, { + prefs: [["dom.experimental_forms", true], ["dom.forms.datetime", false]], + inputType: "time", + expectedType: "time" + }, { + prefs: [["dom.experimental_forms", false], ["dom.forms.datetime", true]], + inputType: "time", + expectedType: "time" + }, { + prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", false]], + inputType: "month", + expectedType: "text" }, { - prefs: [["dom.forms.datetime", false]], + prefs: [["dom.forms.datetime", true], ["dom.forms.datetime.others", false]], inputType: "month", expectedType: "text" }, { - prefs: [["dom.forms.datetime", true]], + prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", true]], inputType: "month", expectedType: "month" }, { - prefs: [["dom.forms.datetime", false]], + prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", false]], + inputType: "week", + expectedType: "text" + }, { + prefs: [["dom.forms.datetime", true], ["dom.forms.datetime.others", false]], inputType: "week", expectedType: "text" }, { - prefs: [["dom.forms.datetime", true]], + prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", true]], inputType: "week", expectedType: "week" }, { - prefs: [["dom.forms.datetime", false]], + prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", false]], + inputType: "datetime-local", + expectedType: "text" + }, { + prefs: [["dom.forms.datetime", true], ["dom.forms.datetime.others", false]], inputType: "datetime-local", expectedType: "text" }, { - prefs: [["dom.forms.datetime", true]], + prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", true]], inputType: "datetime-local", expectedType: "datetime-local" } diff --git a/dom/html/test/forms/test_valueAsDate_pref.html b/dom/html/test/forms/test_valueAsDate_pref.html index 8518c291b..0369980e4 100644 --- a/dom/html/test/forms/test_valueAsDate_pref.html +++ b/dom/html/test/forms/test_valueAsDate_pref.html @@ -12,8 +12,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=874640 /** Test for Bug 874640 **/ var states = [ - // dom.experimental_forms, dom.forms.datepicker, dom.forms.datetime, expectedValueAsDate - [ 'true', 'true', 'true', 'true' ], + // dom.experimental_forms, dom.forms.datetime, dom.forms.datetime.others, expectedValueAsDate + [ 'true', 'true', ,'true', 'true' ], [ 'true', 'false', 'false', 'true' ], [ 'false', 'true', 'false', 'true' ], [ 'false', 'false', 'true', 'true' ], @@ -33,8 +33,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=874640 SpecialPowers.pushPrefEnv({"set":[ ["dom.experimental_forms", state[0] === 'true'], - ["dom.forms.datepicker", state[1] === 'true'], - ["dom.forms.datetime", state[2] === 'true']]}, + ["dom.forms.datetime", state[1] === 'true'], + ["dom.forms.datetime.others", state[2] === 'true']]}, function() { iframe.src = 'data:text/html,<script>' + 'parent.is("valueAsDate" in document.createElement("input"), ' + diff --git a/dom/html/test/test_bug558788-1.html b/dom/html/test/test_bug558788-1.html index 94b7a5f00..4db61ed73 100644 --- a/dom/html/test/test_bug558788-1.html +++ b/dom/html/test/test_bug558788-1.html @@ -154,13 +154,14 @@ function checkInputURL() sendString("ttp://mozilla.org"); checkValidApplies(element); - for (var i=0; i<13; ++i) { + for (var i=0; i<10; ++i) { synthesizeKey("VK_BACK_SPACE", {}); checkValidApplies(element); } synthesizeKey("VK_BACK_SPACE", {}); - for (var i=0; i<4; ++i) { + // "http://" is now invalid + for (var i=0; i<7; ++i) { checkInvalidApplies(element); synthesizeKey("VK_BACK_SPACE", {}); } diff --git a/dom/ipc/DatePickerParent.cpp b/dom/ipc/DatePickerParent.cpp deleted file mode 100644 index 509944ddd..000000000 --- a/dom/ipc/DatePickerParent.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "DatePickerParent.h" -#include "nsComponentManagerUtils.h" -#include "nsIDocument.h" -#include "nsIDOMWindow.h" -#include "mozilla/Unused.h" -#include "mozilla/dom/Element.h" -#include "mozilla/dom/TabParent.h" - -using mozilla::Unused; -using namespace mozilla::dom; - -NS_IMPL_ISUPPORTS(DatePickerParent::DatePickerShownCallback, - nsIDatePickerShownCallback); - -NS_IMETHODIMP -DatePickerParent::DatePickerShownCallback::Cancel() -{ - if (mDatePickerParent) { - Unused << mDatePickerParent->SendCancel(); - } - return NS_OK; -} - -NS_IMETHODIMP -DatePickerParent::DatePickerShownCallback::Done(const nsAString& aDate) -{ - if (mDatePickerParent) { - Unused << mDatePickerParent->Send__delete__(mDatePickerParent, - nsString(aDate)); - } - return NS_OK; -} - -void -DatePickerParent::DatePickerShownCallback::Destroy() -{ - mDatePickerParent = nullptr; -} - -bool -DatePickerParent::CreateDatePicker() -{ - mPicker = do_CreateInstance("@mozilla.org/datepicker;1"); - if (!mPicker) { - return false; - } - - Element* ownerElement = TabParent::GetFrom(Manager())->GetOwnerElement(); - if (!ownerElement) { - return false; - } - - nsCOMPtr<mozIDOMWindowProxy> window = do_QueryInterface(ownerElement->OwnerDoc()->GetWindow()); - if (!window) { - return false; - } - - return NS_SUCCEEDED(mPicker->Init(window, mTitle, mInitialDate)); -} - -bool -DatePickerParent::RecvOpen() -{ - if (!CreateDatePicker()) { - Unused << Send__delete__(this, mInitialDate); - return true; - } - - mCallback = new DatePickerShownCallback(this); - - mPicker->Open(mCallback); - return true; -}; - -void -DatePickerParent::ActorDestroy(ActorDestroyReason aWhy) -{ - if (mCallback) { - mCallback->Destroy(); - } -} diff --git a/dom/ipc/DatePickerParent.h b/dom/ipc/DatePickerParent.h deleted file mode 100644 index 73b66f96c..000000000 --- a/dom/ipc/DatePickerParent.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_dom_DatePickerParent_h -#define mozilla_dom_DatePickerParent_h - -#include "mozilla/dom/PDatePickerParent.h" -#include "nsIDatePicker.h" - -namespace mozilla { -namespace dom { - -class DatePickerParent : public PDatePickerParent -{ - public: - DatePickerParent(const nsString& aTitle, - const nsString& aInitialDate) - : mTitle(aTitle) - , mInitialDate(aInitialDate) - {} - - virtual bool RecvOpen() override; - virtual void ActorDestroy(ActorDestroyReason aWhy) override; - - class DatePickerShownCallback final - : public nsIDatePickerShownCallback - { - public: - explicit DatePickerShownCallback(DatePickerParent* aDatePickerParnet) - : mDatePickerParent(aDatePickerParnet) - {} - - NS_DECL_ISUPPORTS - NS_DECL_NSIDATEPICKERSHOWNCALLBACK - - void Destroy(); - - private: - ~DatePickerShownCallback() {} - DatePickerParent* mDatePickerParent; - }; - - private: - virtual ~DatePickerParent() {} - - bool CreateDatePicker(); - - RefPtr<DatePickerShownCallback> mCallback; - nsCOMPtr<nsIDatePicker> mPicker; - - nsString mTitle; - nsString mInitialDate; -}; - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_DatePickerParent_h diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index 9dfccbc5c..f09e484ee 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -9,7 +9,6 @@ include protocol PBlob; include protocol PColorPicker; include protocol PContent; include protocol PContentBridge; -include protocol PDatePicker; include protocol PDocAccessible; include protocol PFilePicker; include protocol PIndexedDBPermissionRequest; @@ -116,7 +115,6 @@ nested(upto inside_cpow) sync protocol PBrowser manager PContent or PContentBridge; manages PColorPicker; - manages PDatePicker; manages PDocAccessible; manages PFilePicker; manages PIndexedDBPermissionRequest; @@ -441,12 +439,6 @@ parent: */ async PColorPicker(nsString title, nsString initialColor); - /** - * Create an asynchronous date picker on the parent side, - * but don't open it yet. - */ - async PDatePicker(nsString title, nsString initialDate); - async PFilePicker(nsString aTitle, int16_t aMode); /** diff --git a/dom/ipc/PDatePicker.ipdl b/dom/ipc/PDatePicker.ipdl deleted file mode 100644 index 90a2654bb..000000000 --- a/dom/ipc/PDatePicker.ipdl +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */ -/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -include protocol PBrowser; - -namespace mozilla { -namespace dom { - -protocol PDatePicker -{ - manager PBrowser; - -parent: - async Open(); - -child: - async Cancel(); - - async __delete__(nsString color); -}; - -} // namespace dom -} // namespace mozilla diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index c8a0c6e3f..705799c54 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -96,7 +96,6 @@ #include "LayersLogging.h" #include "nsDOMClassInfoID.h" #include "nsColorPickerProxy.h" -#include "nsDatePickerProxy.h" #include "nsContentPermissionHelper.h" #include "nsPresShell.h" #include "nsIAppsService.h" @@ -2013,21 +2012,6 @@ TabChild::DeallocPColorPickerChild(PColorPickerChild* aColorPicker) return true; } -PDatePickerChild* -TabChild::AllocPDatePickerChild(const nsString&, const nsString&) -{ - NS_RUNTIMEABORT("unused"); - return nullptr; -} - -bool -TabChild::DeallocPDatePickerChild(PDatePickerChild* aDatePicker) -{ - nsDatePickerProxy* picker = static_cast<nsDatePickerProxy*>(aDatePicker); - NS_RELEASE(picker); - return true; -} - PFilePickerChild* TabChild::AllocPFilePickerChild(const nsString&, const int16_t&) { diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 2232ffeaf..d9988a596 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -451,10 +451,6 @@ public: virtual bool DeallocPColorPickerChild(PColorPickerChild* aActor) override; - virtual PDatePickerChild* - AllocPDatePickerChild(const nsString& title, const nsString& initialDate) override; - virtual bool DeallocPDatePickerChild(PDatePickerChild* actor) override; - virtual PFilePickerChild* AllocPFilePickerChild(const nsString& aTitle, const int16_t& aMode) override; diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 8e98de3ce..0f190708f 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -80,7 +80,6 @@ #include "PermissionMessageUtils.h" #include "StructuredCloneData.h" #include "ColorPickerParent.h" -#include "DatePickerParent.h" #include "FilePickerParent.h" #include "TabChild.h" #include "LoadContext.h" @@ -2424,20 +2423,6 @@ TabParent::DeallocPColorPickerParent(PColorPickerParent* actor) return true; } -PDatePickerParent* -TabParent::AllocPDatePickerParent(const nsString& aTitle, - const nsString& aInitialDate) -{ - return new DatePickerParent(aTitle, aInitialDate); -} - -bool -TabParent::DeallocPDatePickerParent(PDatePickerParent* actor) -{ - delete actor; - return true; -} - PRenderFrameParent* TabParent::AllocPRenderFrameParent() { diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 09bb999f3..3624ce320 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -347,10 +347,6 @@ public: virtual bool DeallocPColorPickerParent(PColorPickerParent* aColorPicker) override; - virtual PDatePickerParent* - AllocPDatePickerParent(const nsString& aTitle, const nsString& aInitialDate) override; - virtual bool DeallocPDatePickerParent(PDatePickerParent* aDatePicker) override; - virtual PDocAccessibleParent* AllocPDocAccessibleParent(PDocAccessibleParent*, const uint64_t&, const uint32_t&, const IAccessibleHolder&) override; diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index ff3880bc2..71d193d44 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -55,7 +55,6 @@ UNIFIED_SOURCES += [ 'ContentProcess.cpp', 'ContentProcessManager.cpp', 'CrashReporterParent.cpp', - 'DatePickerParent.cpp', 'FilePickerParent.cpp', 'nsIContentChild.cpp', 'nsIContentParent.cpp', @@ -95,7 +94,6 @@ IPDL_SOURCES += [ 'PContentPermissionRequest.ipdl', 'PCrashReporter.ipdl', 'PCycleCollectWithLogs.ipdl', - 'PDatePicker.ipdl', 'PFilePicker.ipdl', 'PMemoryReportRequest.ipdl', 'PPluginWidget.ipdl', diff --git a/dom/locales/en-US/chrome/layout/HtmlForm.properties b/dom/locales/en-US/chrome/layout/HtmlForm.properties index 621a0b2b3..82274b2bc 100644 --- a/dom/locales/en-US/chrome/layout/HtmlForm.properties +++ b/dom/locales/en-US/chrome/layout/HtmlForm.properties @@ -34,7 +34,6 @@ NoDirSelected=No directory selected. # %S will be a number greater or equal to 2. XFilesSelected=%S files selected. ColorPicker=Choose a color -DatePicker=Choose a date # LOCALIZATION NOTE (AndNMoreFiles): Semi-colon list of plural forms. # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals # This string is shown at the end of the tooltip text for <input type='file' diff --git a/dom/url/tests/test_url.html b/dom/url/tests/test_url.html index d07a752bb..73e75667d 100644 --- a/dom/url/tests/test_url.html +++ b/dom/url/tests/test_url.html @@ -399,6 +399,18 @@ </script> <script> + /** Test for Bug 1275746 **/ + SimpleTest.doesThrow(() => { var url = new URL("http:"); }, "http: is not a valid URL"); + SimpleTest.doesThrow(() => { var url = new URL("http:///"); }, "http: is not a valid URL"); + + var url = new URL("file:"); + is(url.href, "file:///", "Parsing file: should work."); + + url = new URL("file:///"); + is(url.href, "file:///", "Parsing file:/// should work."); + </script> + + <script> var url = new URL("scheme:path/to/file?query#hash"); is(url.href, "scheme:path/to/file?query#hash"); is(url.pathname, "path/to/file"); diff --git a/dom/webidl/CanvasRenderingContext2D.webidl b/dom/webidl/CanvasRenderingContext2D.webidl index 38a30f9e3..1c5564215 100644 --- a/dom/webidl/CanvasRenderingContext2D.webidl +++ b/dom/webidl/CanvasRenderingContext2D.webidl @@ -27,6 +27,9 @@ dictionary HitRegionOptions { }; typedef (HTMLImageElement or + SVGImageElement) HTMLOrSVGImageElement; + +typedef (HTMLOrSVGImageElement or HTMLCanvasElement or HTMLVideoElement or ImageBitmap) CanvasImageSource; diff --git a/editor/libeditor/HTMLEditorDataTransfer.cpp b/editor/libeditor/HTMLEditorDataTransfer.cpp index b9cd8adb9..ed350c0dd 100644 --- a/editor/libeditor/HTMLEditorDataTransfer.cpp +++ b/editor/libeditor/HTMLEditorDataTransfer.cpp @@ -2382,27 +2382,26 @@ HTMLEditor::ReplaceOrphanedStructure( } // If we found substructure, paste it instead of its descendants. - // Only replace with the substructure if all the nodes in the list are - // descendants. - bool shouldReplaceNodes = true; - for (uint32_t i = 0; i < aNodeArray.Length(); i++) { + // Postprocess list to remove any descendants of this node so that we don't + // insert them twice. + uint32_t removedCount = 0; + uint32_t originalLength = aNodeArray.Length(); + for (uint32_t i = 0; i < originalLength; i++) { uint32_t idx = aStartOrEnd == StartOrEnd::start ? - i : (aNodeArray.Length() - i - 1); + (i - removedCount) : (originalLength - i - 1); OwningNonNull<nsINode> endpoint = aNodeArray[idx]; - if (!EditorUtils::IsDescendantOf(endpoint, replaceNode)) { - shouldReplaceNodes = false; - break; + if (endpoint == replaceNode || + EditorUtils::IsDescendantOf(endpoint, replaceNode)) { + aNodeArray.RemoveElementAt(idx); + removedCount++; } } - if (shouldReplaceNodes) { - // Now replace the removed nodes with the structural parent - aNodeArray.Clear(); - if (aStartOrEnd == StartOrEnd::end) { - aNodeArray.AppendElement(*replaceNode); - } else { - aNodeArray.InsertElementAt(0, *replaceNode); - } + // Now replace the removed nodes with the structural parent + if (aStartOrEnd == StartOrEnd::end) { + aNodeArray.AppendElement(*replaceNode); + } else { + aNodeArray.InsertElementAt(0, *replaceNode); } } diff --git a/editor/libeditor/tests/mochitest.ini b/editor/libeditor/tests/mochitest.ini index 9aafa0ac2..4df3f606b 100644 --- a/editor/libeditor/tests/mochitest.ini +++ b/editor/libeditor/tests/mochitest.ini @@ -217,6 +217,9 @@ skip-if = toolkit == 'android' [test_bug1258085.html] [test_bug1268736.html] [test_bug1270235.html] +[test_bug1306532.html] +subsuite = clipboard +skip-if = toolkit == 'android' [test_bug1310912.html] skip-if = toolkit == 'android' # bug 1315898 [test_bug1314790.html] diff --git a/editor/libeditor/tests/test_bug1306532.html b/editor/libeditor/tests/test_bug1306532.html new file mode 100644 index 000000000..1d7b3e7af --- /dev/null +++ b/editor/libeditor/tests/test_bug1306532.html @@ -0,0 +1,64 @@ +<!DOCTYPE HTML> +<html><head> +<title>Test for bug 1306532</title> +<style src="/tests/SimpleTest/test.css" type="text/css"></style> +<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> + +<script class="testbody" type="application/javascript"> + +function runTest() { + // Copy content from table. + var selection = getSelection(); + var startRange = document.createRange(); + startRange.setStart(headingone, 0); + startRange.setEnd(celltwo, 0); + selection.removeAllRanges(); + selection.addRange(startRange); + SpecialPowers.wrap(document).execCommand("copy", false, null); + + // Paste content into "pasteframe" + var pasteContainer = pasteframe.contentDocument.body; + var pasteRange = pasteframe.contentDocument.createRange(); + pasteRange.selectNodeContents(pasteContainer); + pasteRange.collapse(false); + selection.removeAllRanges(); + selection.addRange(pasteRange); + SpecialPowers.wrap(pasteframe.contentDocument).execCommand("paste", false, null); + + is(pasteContainer.querySelector("#headingone").textContent, "Month", "First heading should be 'Month'."); + is(pasteContainer.querySelector("#headingtwo").textContent, "Savings", "Second heading should be 'Savings'."); + is(pasteContainer.querySelector("#cellone").textContent, "January", "First cell should be 'January'."); + is(pasteContainer.querySelector("#celltwo").textContent, "$100", "Second cell should be '$100'."); + + SimpleTest.finish(); +} + +SimpleTest.waitForExplicitFinish(); + +</script> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1306532">Mozilla Bug 1306532</a> +<p id="display"></p> + +<pre id="test"> +</pre> + +<div id="container"> +<table border="1"> + <tr> + <th id="headingone">Month</th> + <th id="headingtwo">Savings</th> + </tr> + <tr> + <td id="cellone">January</td> + <td id="celltwo">$100</td> + </tr> +</table> +</div> + +<iframe onload="runTest();" id="pasteframe" src="data:text/html,<html><body contenteditable='true'>"></iframe> + +</body> +</html> diff --git a/extensions/cookie/test/unit/test_bug526789.js b/extensions/cookie/test/unit/test_bug526789.js index 0eac1d492..624044577 100644 --- a/extensions/cookie/test/unit/test_bug526789.js +++ b/extensions/cookie/test/unit/test_bug526789.js @@ -79,23 +79,11 @@ function run_test() { cm.removeAll(); - // test that setting an empty or '.' http:// host results in a no-op var uri = NetUtil.newURI("http://baz.com/"); - var emptyuri = NetUtil.newURI("http:///"); - var doturi = NetUtil.newURI("http://./"); do_check_eq(uri.asciiHost, "baz.com"); - do_check_eq(emptyuri.asciiHost, ""); - do_check_eq(doturi.asciiHost, "."); - cs.setCookieString(emptyuri, null, "foo2=bar", null); - do_check_eq(getCookieCount(), 0); - cs.setCookieString(doturi, null, "foo3=bar", null); - do_check_eq(getCookieCount(), 0); cs.setCookieString(uri, null, "foo=bar", null); - do_check_eq(getCookieCount(), 1); do_check_eq(cs.getCookieString(uri, null), "foo=bar"); - do_check_eq(cs.getCookieString(emptyuri, null), null); - do_check_eq(cs.getCookieString(doturi, null), null); do_check_eq(cm.countCookiesFromHost(""), 0); do_check_throws(function() { diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 59f8de9ac..e3e23550a 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1179,10 +1179,13 @@ pref("dom.forms.number", true); // platforms which don't have a color picker implemented yet. pref("dom.forms.color", true); -// Support for input type=date, time, month, week and datetime-local. By -// default, disabled. +// Support for input type=date and type=time. By default, disabled. pref("dom.forms.datetime", false); +// Support for input type=month, type=week and type=datetime-local. By default, +// disabled. +pref("dom.forms.datetime.others", false); + // Enable time picker UI. By default, disabled. pref("dom.forms.datetime.timepicker", false); diff --git a/netwerk/base/nsStandardURL.cpp b/netwerk/base/nsStandardURL.cpp index bc1350f28..21c4cf7fd 100644 --- a/netwerk/base/nsStandardURL.cpp +++ b/netwerk/base/nsStandardURL.cpp @@ -781,11 +781,13 @@ nsStandardURL::BuildNormalizedSpec(const char *spec) i = AppendSegmentToBuf(buf, i, spec, username, mUsername, &encUsername, useEncUsername, &diff); ShiftFromPassword(diff); - if (password.mLen >= 0) { + if (password.mLen > 0) { buf[i++] = ':'; i = AppendSegmentToBuf(buf, i, spec, password, mPassword, &encPassword, useEncPassword, &diff); ShiftFromHost(diff); + } else { + mPassword.mLen = -1; } buf[i++] = '@'; } @@ -1483,6 +1485,11 @@ nsStandardURL::SetSpec(const nsACString &input) rv = BuildNormalizedSpec(spec); } + // Make sure that a URLTYPE_AUTHORITY has a non-empty hostname. + if (mURLType == URLTYPE_AUTHORITY && mHost.mLen == -1) { + rv = NS_ERROR_MALFORMED_URI; + } + if (NS_FAILED(rv)) { Clear(); // If parsing the spec has failed, restore the old URL @@ -1616,7 +1623,7 @@ nsStandardURL::SetUserPass(const nsACString &input) usernameLen), esc_Username | esc_AlwaysCopy, buf, ignoredOut); - if (passwordLen >= 0) { + if (passwordLen > 0) { buf.Append(':'); passwordLen = encoder.EncodeSegmentCount(userpass.get(), URLSegment(passwordPos, @@ -1624,6 +1631,8 @@ nsStandardURL::SetUserPass(const nsACString &input) esc_Password | esc_AlwaysCopy, buf, ignoredOut); + } else { + passwordLen = -1; } if (mUsername.mLen < 0) buf.Append('@'); @@ -1654,8 +1663,10 @@ nsStandardURL::SetUserPass(const nsACString &input) // update positions and lengths mUsername.mLen = usernameLen; mPassword.mLen = passwordLen; - if (passwordLen) + if (passwordLen > 0) { mPassword.mPos = mUsername.mPos + mUsername.mLen + 1; + } + return NS_OK; } @@ -3092,20 +3103,26 @@ nsStandardURL::SetFile(nsIFile *file) rv = net_GetURLSpecFromFile(file, url); if (NS_FAILED(rv)) return rv; - SetSpec(url); + uint32_t oldURLType = mURLType; + uint32_t oldDefaultPort = mDefaultPort; + rv = Init(nsIStandardURL::URLTYPE_NO_AUTHORITY, -1, url, nullptr, nullptr); - rv = Init(mURLType, mDefaultPort, url, nullptr, nullptr); + if (NS_FAILED(rv)) { + // Restore the old url type and default port if the call to Init fails. + mURLType = oldURLType; + mDefaultPort = oldDefaultPort; + return rv; + } // must clone |file| since its value is not guaranteed to remain constant - if (NS_SUCCEEDED(rv)) { - InvalidateCache(); - if (NS_FAILED(file->Clone(getter_AddRefs(mFile)))) { - NS_WARNING("nsIFile::Clone failed"); - // failure to clone is not fatal (GetFile will generate mFile) - mFile = nullptr; - } + InvalidateCache(); + if (NS_FAILED(file->Clone(getter_AddRefs(mFile)))) { + NS_WARNING("nsIFile::Clone failed"); + // failure to clone is not fatal (GetFile will generate mFile) + mFile = nullptr; } - return rv; + + return NS_OK; } //---------------------------------------------------------------------------- diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h index d51662db9..35b14a511 100644 --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -489,8 +489,8 @@ private: nsCString mCompatGecko; bool mCompatGeckoEnabled; nsCString mCompatFirefox; - nsCString mCompatFirefoxVersion; bool mCompatFirefoxEnabled; + nsCString mCompatFirefoxVersion; nsXPIDLCString mCompatDevice; nsCString mDeviceModelId; diff --git a/netwerk/test/unit/test_URIs.js b/netwerk/test/unit/test_URIs.js index b68c4f787..1cad7768f 100644 --- a/netwerk/test/unit/test_URIs.js +++ b/netwerk/test/unit/test_URIs.js @@ -92,18 +92,6 @@ var gTests = [ ref: "", relativeURI: "data/text/plain,2", nsIURL: true, nsINestedURI: false }, - { spec: "ftp://", - scheme: "ftp", - prePath: "ftp://", - path: "/", - ref: "", - nsIURL: true, nsINestedURI: false }, - { spec: "ftp:///", - scheme: "ftp", - prePath: "ftp://", - path: "/", - ref: "", - nsIURL: true, nsINestedURI: false }, { spec: "ftp://ftp.mozilla.org/pub/mozilla.org/README", scheme: "ftp", prePath: "ftp://ftp.mozilla.org", @@ -121,7 +109,7 @@ var gTests = [ nsIURL: true, nsINestedURI: false }, { spec: "ftp://foo:@ftp.mozilla.org:100/pub/mozilla.org/README", scheme: "ftp", - prePath: "ftp://foo:@ftp.mozilla.org:100", + prePath: "ftp://foo@ftp.mozilla.org:100", port: 100, username: "foo", password: "", @@ -135,18 +123,6 @@ var gTests = [ path: "//mozilla.org/", ref: "", nsIURL: false, nsINestedURI: false }, - { spec: "http://", - scheme: "http", - prePath: "http://", - path: "/", - ref: "", - nsIURL: true, nsINestedURI: false }, - { spec: "http:///", - scheme: "http", - prePath: "http://", - path: "/", - ref: "", - nsIURL: true, nsINestedURI: false }, { spec: "http://www.example.com/", scheme: "http", prePath: "http://www.example.com", diff --git a/netwerk/test/unit/test_standardurl.js b/netwerk/test/unit/test_standardurl.js index c4d44f41f..4cc2f393e 100644 --- a/netwerk/test/unit/test_standardurl.js +++ b/netwerk/test/unit/test_standardurl.js @@ -251,6 +251,17 @@ add_test(function test_escapeBrackets() run_next_test(); }); +add_test(function test_escapeQuote() +{ + var url = stringToURL("http://example.com/#'"); + do_check_eq(url.spec, "http://example.com/#'"); + do_check_eq(url.ref, "'"); + url.ref = "test'test"; + do_check_eq(url.spec, "http://example.com/#test'test"); + do_check_eq(url.ref, "test'test"); + run_next_test(); +}); + add_test(function test_apostropheEncoding() { // For now, single quote is escaped everywhere _except_ the path. @@ -335,6 +346,14 @@ add_test(function test_backslashReplacement() run_next_test(); }); +add_test(function test_authority_host() +{ + Assert.throws(() => { stringToURL("http:"); }, "TYPE_AUTHORITY should have host"); + Assert.throws(() => { stringToURL("http:///"); }, "TYPE_AUTHORITY should have host"); + + run_next_test(); +}); + add_test(function test_trim_C0_and_space() { var url = stringToURL("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f http://example.com/ \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f "); @@ -453,3 +472,23 @@ add_test(function test_invalidHostChars() { // hostname separators, so there is no way to set them and fail. run_next_test(); }); + +add_test(function test_emptyPassword() { + var url = stringToURL("http://a:@example.com"); + do_check_eq(url.spec, "http://a@example.com/"); + url.password = "pp"; + do_check_eq(url.spec, "http://a:pp@example.com/"); + url.password = ""; + do_check_eq(url.spec, "http://a@example.com/"); + url.userPass = "xxx:"; + do_check_eq(url.spec, "http://xxx@example.com/"); + url.password = "zzzz"; + do_check_eq(url.spec, "http://xxx:zzzz@example.com/"); + url.userPass = "xxxxx:yyyyyy"; + do_check_eq(url.spec, "http://xxxxx:yyyyyy@example.com/"); + url.userPass = "z:"; + do_check_eq(url.spec, "http://z@example.com/"); + url.password = "ppppppppppp"; + do_check_eq(url.spec, "http://z:ppppppppppp@example.com/"); + run_next_test(); +}); diff --git a/services/fxaccounts/tests/xpcshell/test_oauth_grant_client.js b/services/fxaccounts/tests/xpcshell/test_oauth_grant_client.js index 244b79a5e..710a65ee5 100644 --- a/services/fxaccounts/tests/xpcshell/test_oauth_grant_client.js +++ b/services/fxaccounts/tests/xpcshell/test_oauth_grant_client.js @@ -143,7 +143,7 @@ add_test(function serverErrorResponse () { add_test(function networkErrorResponse () { let client = new FxAccountsOAuthGrantClient({ - serverURL: "http://", + serverURL: "http://domain.dummy", client_id: "abc123" }); Services.prefs.setBoolPref("identity.fxaccounts.skipDeviceRegistration", true); diff --git a/services/fxaccounts/tests/xpcshell/test_profile_client.js b/services/fxaccounts/tests/xpcshell/test_profile_client.js index 2243da3aa..20ff6efc6 100644 --- a/services/fxaccounts/tests/xpcshell/test_profile_client.js +++ b/services/fxaccounts/tests/xpcshell/test_profile_client.js @@ -268,7 +268,7 @@ add_test(function server401ResponsePersists () { add_test(function networkErrorResponse () { let client = new FxAccountsProfileClient({ - serverURL: "http://", + serverURL: "http://domain.dummy", fxa: mockFxa, }); client.fetchProfile() diff --git a/testing/profiles/prefs_general.js b/testing/profiles/prefs_general.js index 91218b5f3..ac2c1e077 100644 --- a/testing/profiles/prefs_general.js +++ b/testing/profiles/prefs_general.js @@ -12,6 +12,7 @@ user_pref("dom.experimental_forms", true); // on for testing user_pref("dom.forms.number", true); // on for testing user_pref("dom.forms.color", true); // on for testing user_pref("dom.forms.datetime", true); // on for testing +user_pref("dom.forms.datetime.others", true); // on for testing user_pref("dom.max_script_run_time", 0); // no slow script dialogs user_pref("hangmonitor.timeout", 0); // no hang monitor user_pref("dom.max_chrome_script_run_time", 0); diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 65626d6b8..ca574833b 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -39138,6 +39138,18 @@ "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html" } ], + "2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html" + } + ], "2dcontext/line-styles/canvas_linestyles_linecap_001.htm": [ { "path": "2dcontext/line-styles/canvas_linestyles_linecap_001.htm", diff --git a/testing/web-platform/meta/XMLHttpRequest/open-url-bogus.htm.ini b/testing/web-platform/meta/XMLHttpRequest/open-url-bogus.htm.ini deleted file mode 100644 index ef7b5d910..000000000 --- a/testing/web-platform/meta/XMLHttpRequest/open-url-bogus.htm.ini +++ /dev/null @@ -1,11 +0,0 @@ -[open-url-bogus.htm] - type: testharness - [XMLHttpRequest: open() - bogus URLs (http:)] - expected: FAIL - - [XMLHttpRequest: open() - bogus URLs (ftp:)] - expected: FAIL - - [XMLHttpRequest: open() - bogus URLs (http:////////////)] - expected: FAIL - diff --git a/testing/web-platform/meta/url/url-constructor.html.ini b/testing/web-platform/meta/url/url-constructor.html.ini index 6da03043b..22fddbc15 100644 --- a/testing/web-platform/meta/url/url-constructor.html.ini +++ b/testing/web-platform/meta/url/url-constructor.html.ini @@ -219,6 +219,3 @@ [Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>] expected: FAIL - [Parsing: <http:> against <https://example.org/foo/bar>] - expected: FAIL - diff --git a/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html index b9de85a97..74a00e037 100644 --- a/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html +++ b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html @@ -1,6 +1,6 @@ <!DOCTYPE html> <meta charset="utf-8"> -<link rel=match href=drawimage_html_image_1_ref.html> +<link rel=match href=drawimage_svg_image_1_ref.html> <style> html, body { margin: 0; @@ -13,8 +13,8 @@ var sourceWidth = 100; var sourceHeight = 100; var smoothingEnabled = false; var destCanvas = document.getElementById('dest'); -var sourceImg = document.createElement('img'); -sourceImg.src = '../2x2.png' +var sourceImg = document.createElementNS('http://www.w3.org/2000/svg', 'image'); +sourceImg.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '../2x2.png'); sourceImg.width = sourceWidth; sourceImg.height = sourceHeight; diff --git a/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_ref.html b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1_ref.html index 60545df17..60545df17 100644 --- a/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_ref.html +++ b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1_ref.html diff --git a/toolkit/components/passwordmgr/test/unit/test_logins_search.js b/toolkit/components/passwordmgr/test/unit/test_logins_search.js index 188c75039..730771981 100644 --- a/toolkit/components/passwordmgr/test/unit/test_logins_search.js +++ b/toolkit/components/passwordmgr/test/unit/test_logins_search.js @@ -192,7 +192,6 @@ add_task(function test_search_all_full_case_sensitive() { checkAllSearches({ hostname: "http://www.example.com" }, 1); checkAllSearches({ hostname: "http://www.example.com/" }, 0); - checkAllSearches({ hostname: "http://" }, 0); checkAllSearches({ hostname: "example.com" }, 0); checkAllSearches({ formSubmitURL: "http://www.example.com" }, 2); diff --git a/toolkit/components/places/UnifiedComplete.js b/toolkit/components/places/UnifiedComplete.js index ad3d35aab..acd358b11 100644 --- a/toolkit/components/places/UnifiedComplete.js +++ b/toolkit/components/places/UnifiedComplete.js @@ -1245,7 +1245,7 @@ Search.prototype = { // * If the protocol differs we should not match. For example if the user // searched https we should not return http. try { - let prefixURI = NetUtil.newURI(this._strippedPrefix); + let prefixURI = NetUtil.newURI(this._strippedPrefix + match.token); let finalURI = NetUtil.newURI(match.url); if (prefixURI.scheme != finalURI.scheme) return false; diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index 8cf3a2e32..7f4007c1a 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -949,6 +949,10 @@ nsresult // static nsNavHistory::AsciiHostNameFromHostString(const nsACString& aHostName, nsACString& aAscii) { + aAscii.Truncate(); + if (aHostName.IsEmpty()) { + return NS_OK; + } // To properly generate a uri we must provide a protocol. nsAutoCString fakeURL("http://"); fakeURL.Append(aHostName); diff --git a/toolkit/mozapps/extensions/test/browser/browser-common.ini b/toolkit/mozapps/extensions/test/browser/browser-common.ini index eaab29f75..3e88833ef 100644 --- a/toolkit/mozapps/extensions/test/browser/browser-common.ini +++ b/toolkit/mozapps/extensions/test/browser/browser-common.ini @@ -39,8 +39,6 @@ skip-if = true # Bug 1093190 - Disabled due to leak [browser_discovery.js] skip-if = e10s # Bug ?????? - test times out on try on all platforms, but works locally for markh! [browser_dragdrop.js] -skip-if = buildapp == 'mulet' -[browser_experiments.js] skip-if = e10s [browser_list.js] [browser_metadataTimeout.js] diff --git a/toolkit/mozapps/webextensions/test/browser/browser-common.ini b/toolkit/mozapps/webextensions/test/browser/browser-common.ini index eda266e2f..83920465b 100644 --- a/toolkit/mozapps/webextensions/test/browser/browser-common.ini +++ b/toolkit/mozapps/webextensions/test/browser/browser-common.ini @@ -34,7 +34,6 @@ skip-if = true # Bug 1093190 - Disabled due to leak [browser_discovery.js] [browser_dragdrop.js] skip-if = buildapp == 'mulet' -[browser_experiments.js] [browser_list.js] [browser_metadataTimeout.js] [browser_searching.js] diff --git a/widget/moz.build b/widget/moz.build index 09192179f..f69f2d87c 100644 --- a/widget/moz.build +++ b/widget/moz.build @@ -65,7 +65,6 @@ XPIDL_SOURCES += [ 'nsIClipboardHelper.idl', 'nsIClipboardOwner.idl', 'nsIColorPicker.idl', - 'nsIDatePicker.idl', 'nsIDisplayInfo.idl', 'nsIDragService.idl', 'nsIDragSession.idl', @@ -151,7 +150,6 @@ UNIFIED_SOURCES += [ 'nsClipboardProxy.cpp', 'nsColorPickerProxy.cpp', 'nsContentProcessWidgetFactory.cpp', - 'nsDatePickerProxy.cpp', 'nsDragServiceProxy.cpp', 'nsFilePickerProxy.cpp', 'nsHTMLFormatConverter.cpp', diff --git a/widget/nsContentProcessWidgetFactory.cpp b/widget/nsContentProcessWidgetFactory.cpp index f8eaee250..2f00f1c83 100644 --- a/widget/nsContentProcessWidgetFactory.cpp +++ b/widget/nsContentProcessWidgetFactory.cpp @@ -9,7 +9,6 @@ #include "nsWidgetsCID.h" #include "nsClipboardProxy.h" #include "nsColorPickerProxy.h" -#include "nsDatePickerProxy.h" #include "nsDragServiceProxy.h" #include "nsFilePickerProxy.h" #include "nsScreenManagerProxy.h" @@ -22,7 +21,6 @@ using namespace mozilla::widget; NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardProxy) NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPickerProxy) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsDatePickerProxy) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragServiceProxy) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePickerProxy) NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerProxy) @@ -30,7 +28,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(PuppetBidiKeyboard) NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID); NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID); -NS_DEFINE_NAMED_CID(NS_DATEPICKER_CID); NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID); NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID); NS_DEFINE_NAMED_CID(PUPPETBIDIKEYBOARD_CID); @@ -41,8 +38,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { Module::CONTENT_PROCESS_ONLY }, { &kNS_COLORPICKER_CID, false, nullptr, nsColorPickerProxyConstructor, Module::CONTENT_PROCESS_ONLY }, - { &kNS_DATEPICKER_CID, false, nullptr, nsDatePickerProxyConstructor, - Module::CONTENT_PROCESS_ONLY }, { &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceProxyConstructor, Module::CONTENT_PROCESS_ONLY }, { &kNS_FILEPICKER_CID, false, nullptr, nsFilePickerProxyConstructor, @@ -57,7 +52,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID, Module::CONTENT_PROCESS_ONLY }, { "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, Module::CONTENT_PROCESS_ONLY }, - { "@mozilla.org/datepicker;1", &kNS_DATEPICKER_CID, Module::CONTENT_PROCESS_ONLY }, { "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, Module::CONTENT_PROCESS_ONLY }, { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID, Module::CONTENT_PROCESS_ONLY }, { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::CONTENT_PROCESS_ONLY }, diff --git a/widget/nsDatePickerProxy.cpp b/widget/nsDatePickerProxy.cpp deleted file mode 100644 index e6b88f1be..000000000 --- a/widget/nsDatePickerProxy.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsDatePickerProxy.h" - -#include "mozilla/dom/TabChild.h" - -using namespace mozilla::dom; - -NS_IMPL_ISUPPORTS(nsDatePickerProxy, nsIDatePicker) - -/* void init (in nsIDOMWindow parent, in AString title, in short mode); */ -NS_IMETHODIMP -nsDatePickerProxy::Init(mozIDOMWindowProxy* aParent, const nsAString& aTitle, - const nsAString& aInitialDate) -{ - TabChild* tabChild = TabChild::GetFrom(aParent); - if (!tabChild) { - return NS_ERROR_FAILURE; - } - - tabChild->SendPDatePickerConstructor(this, - nsString(aTitle), - nsString(aInitialDate)); - NS_ADDREF_THIS(); //Released in DeallocPDatePickerChild - return NS_OK; -} - -/* void open (in nsIDatePickerShownCallback aDatePickerShownCallback); */ -NS_IMETHODIMP -nsDatePickerProxy::Open(nsIDatePickerShownCallback* aDatePickerShownCallback) -{ - NS_ENSURE_STATE(!mCallback); - mCallback = aDatePickerShownCallback; - - SendOpen(); - return NS_OK; -} - -bool -nsDatePickerProxy::RecvCancel() -{ - if (mCallback) { - mCallback->Cancel(); - mCallback = nullptr; - } - return true; -} - -bool -nsDatePickerProxy::Recv__delete__(const nsString& aDate) -{ - if (mCallback) { - mCallback->Done(aDate); - mCallback = nullptr; - } - return true; -} diff --git a/widget/nsDatePickerProxy.h b/widget/nsDatePickerProxy.h deleted file mode 100644 index 71475932c..000000000 --- a/widget/nsDatePickerProxy.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsDatePickerProxy_h -#define nsDatePickerProxy_h - -#include "nsIDatePicker.h" - -#include "mozilla/dom/PDatePickerChild.h" - -class nsDatePickerProxy final : public nsIDatePicker, - public mozilla::dom::PDatePickerChild -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIDATEPICKER - - nsDatePickerProxy() {} - - virtual bool RecvCancel() override; - virtual bool Recv__delete__(const nsString& aDate) override; - -private: - ~nsDatePickerProxy() {} - - nsCOMPtr<nsIDatePickerShownCallback> mCallback; - nsString mTitle; - nsString mInitialDate; -}; - -#endif // nsDatePickerProxy_h diff --git a/widget/nsIDatePicker.idl b/widget/nsIDatePicker.idl deleted file mode 100644 index d6be60c95..000000000 --- a/widget/nsIDatePicker.idl +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsISupports.idl" - -interface mozIDOMWindowProxy; - -[scriptable, uuid(13388a28-1b0b-4218-a31b-588f7a4ec26c)] -interface nsIDatePickerShownCallback : nsISupports -{ - /** - * Callback called when the user selects cancel in the date picker - * This callback can not be called after done() is called. - */ - void cancel(); - - /** - * Callback called when the user has finished selecting the date - * - * @param date The new selected date value following the format "YYYY-MM-DD" - */ - void done(in AString date); -}; - -[scriptable, uuid(7becfc64-966b-4d53-87d2-9161f36bd3b3)] -interface nsIDatePicker : nsISupports -{ - /** - * Initialize the date picker widget. The date picker will not be shown until - * open() is called. - * If the initialDate parameter does not follow the format "YYYY-MM-DD" then - * the behavior will be unspecified. - * - * @param parent nsIDOMWindow parent. This dialog will be dependent - * on this parent. parent may be null. - * @param title The title for the date picker widget. - * @param initialDate The date to show when the widget is opened. The - * parameter has to follow the format "YYYY-MM-DD" - */ - void init(in mozIDOMWindowProxy parent, in AString title, in AString initialDate); - - /** - * Opens the date dialog asynchrounously. - * The results are provided via the callback object. - */ - void open(in nsIDatePickerShownCallback callback); -}; diff --git a/widget/nsWidgetsCID.h b/widget/nsWidgetsCID.h index 2589b59e0..54ebe63ab 100644 --- a/widget/nsWidgetsCID.h +++ b/widget/nsWidgetsCID.h @@ -33,11 +33,6 @@ { 0x0f872c8c, 0x3ee6, 0x46bd, \ { 0x92, 0xa2, 0x69, 0x65, 0x2c, 0x6b, 0x47, 0x4e } } -/* 0ca832f8-978a-4dc7-a57d-adb803925d39 */ -#define NS_DATEPICKER_CID \ -{ 0x0ca832f8, 0x978a, 0x4dc7, \ - { 0xa5, 0x7d, 0xad, 0xb8, 0x03, 0x92, 0x5d, 0x39 } } - /* 2d96b3df-c051-11d1-a827-0040959a28c9 */ #define NS_APPSHELL_CID \ { 0x2d96b3df, 0xc051, 0x11d1, \ diff --git a/xpcom/io/nsEscape.cpp b/xpcom/io/nsEscape.cpp index f16edc4ce..117e20d60 100644 --- a/xpcom/io/nsEscape.cpp +++ b/xpcom/io/nsEscape.cpp @@ -346,7 +346,7 @@ static const uint32_t EscapeChars[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x - 0,1023, 0, 512,1023, 0,1023, 112,1023,1023,1023,1023,1023,1023, 953, 784, // 2x !"#$%&'()*+,-./ + 0,1023, 0, 512,1023, 0,1023, 624,1023,1023,1023,1023,1023,1023, 953, 784, // 2x !"#$%&'()*+,-./ 1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008,1008, 0,1008, 0, 768, // 3x 0123456789:;<=>? 1008,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, // 4x @ABCDEFGHIJKLMNO 1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008, 896,1008, 896,1023, // 5x PQRSTUVWXYZ[\]^_ |