From 7c60af6847dedfcef1105fb83dd6033e902d1a13 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Thu, 6 Aug 2009 15:07:13 -0400 Subject: [PATCH 01/11] bug 508210 - Gap between fennec window and soft keyboard r=vlad --- widget/src/windows/nsWindow.cpp | 6 ---- widget/src/windows/nsWindowCE.cpp | 55 +++++++++++++++++++++---------- widget/src/windows/nsWindowCE.h | 2 +- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 8952bdef06f0..3a59866dec9a 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -5606,12 +5606,6 @@ PRBool nsWindow::OnHotKey(WPARAM wParam, LPARAM lParam) void nsWindow::OnSettingsChange(WPARAM wParam, LPARAM lParam) { -#if defined(WINCE_WINDOWS_MOBILE) - if (wParam == SPI_SETSIPINFO) { - nsWindowCE::NotifySoftKbObservers(); - } -#endif - nsWindowGfx::OnSettingsChangeGfx(wParam); } diff --git a/widget/src/windows/nsWindowCE.cpp b/widget/src/windows/nsWindowCE.cpp index 58a3146cc2de..36db779f23e4 100644 --- a/widget/src/windows/nsWindowCE.cpp +++ b/widget/src/windows/nsWindowCE.cpp @@ -78,23 +78,26 @@ TriStateBool nsWindowCE::sShowSIPButton = TRI_UNKNOWN; **************************************************************/ #ifdef WINCE_HAVE_SOFTKB -void nsWindowCE::NotifySoftKbObservers() +void nsWindowCE::NotifySoftKbObservers(LPRECT visRect) { - nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1"); - if (observerService) { + if (!visRect) { SIPINFO sipInfo; - wchar_t rectBuf[256]; memset(&sipInfo, 0, sizeof(SIPINFO)); sipInfo.cbSize = sizeof(SIPINFO); - if (SipGetInfo(&sipInfo)) { - _snwprintf(rectBuf, 256, L"{\"left\": %d, \"top\": %d," - L" \"right\": %d, \"bottom\": %d}", - sipInfo.rcVisibleDesktop.left, - sipInfo.rcVisibleDesktop.top, - sipInfo.rcVisibleDesktop.right, - sipInfo.rcVisibleDesktop.bottom); - observerService->NotifyObservers(nsnull, "softkb-change", rectBuf); - } + if (SipGetInfo(&sipInfo)) + visRect = &(sipInfo.rcVisibleDesktop); + else + return; + } + + + nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1"); + if (observerService) { + wchar_t rectBuf[256]; + _snwprintf(rectBuf, 256, L"{\"left\": %d, \"top\": %d," + L" \"right\": %d, \"bottom\": %d}", + visRect->left, visRect->top, visRect->right, visRect->bottom); + observerService->NotifyObservers(nsnull, "softkb-change", rectBuf); } } @@ -131,10 +134,28 @@ void nsWindowCE::ToggleSoftKB(PRBool show) GetWindowRect(hWndSIP, &sipRect); int sipH = sipRect.bottom - sipRect.top; int sipW = sipRect.right - sipRect.left; - MoveWindow(hWndSIP, (sX - sipW)/2, sY - sipH, sX, sY, TRUE); - } - - NotifySoftKbObservers(); + sipRect.left = (sX - sipW)/2; + sipRect.top = sY - sipH; + sipRect.bottom = sY; + sipRect.right = sipRect.left + sipW; + MoveWindow(hWndSIP, (sX - sipW)/2, sY - sipH, sipW, sipH, TRUE); + SIPINFO sipInfo; + RECT visRect; + visRect.top = 0; + visRect.left = 0; + visRect.bottom = show ? sipRect.top : sY; + visRect.right = sX; + sipInfo.cbSize = sizeof(SIPINFO); + sipInfo.fdwFlags = SIPF_DOCKED | SIPF_LOCKED | (show ? SIPF_ON : SIPF_OFF); + sipInfo.rcSipRect = sipRect; + sipInfo.rcVisibleDesktop = visRect; + sipInfo.dwImDataSize = 0; + sipInfo.pvImData = NULL; + SipSetInfo(&sipInfo); + NotifySoftKbObservers(&visRect); + } else { + NotifySoftKbObservers(); + } } void nsWindowCE::CreateSoftKeyMenuBar(HWND wnd) diff --git a/widget/src/windows/nsWindowCE.h b/widget/src/windows/nsWindowCE.h index aff3630e697a..42bf92923dcf 100644 --- a/widget/src/windows/nsWindowCE.h +++ b/widget/src/windows/nsWindowCE.h @@ -86,7 +86,7 @@ public: #if defined(WINCE_HAVE_SOFTKB) static void ToggleSoftKB(PRBool show); static void CreateSoftKeyMenuBar(HWND wnd); - static void NotifySoftKbObservers(); + static void NotifySoftKbObservers(LPRECT = NULL); static TriStateBool sShowSIPButton; #endif }; From ce8a906e48c28ad920a0b36a94ca567b6930b24e Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Thu, 6 Aug 2009 00:36:54 -0700 Subject: [PATCH 02/11] Bug 508325 - Fix a second instance of the core problem fixed in the first push. Never trust an eyeballed-as-correct patch that you haven't actually built and tested yourself... r=me as trivial bustage fix --- layout/base/nsPresContext.h | 4 ++-- layout/reftests/backgrounds/reftest.list | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 0f5a96385d7b..063c769df69a 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -600,8 +600,8 @@ public: AppUnitsToGfxUnits(aAppRect.height)); } nscoord TwipsToAppUnits(PRInt32 aTwips) const - { return NSToCoordRound(NS_TWIPS_TO_INCHES(aTwips) * - mDeviceContext->AppUnitsPerInch()); } + { return NSCoordSaturatingMultiply(NS_TWIPS_TO_INCHES(aTwips), + mDeviceContext->AppUnitsPerInch()); } // Margin-specific version, since they often need TwipsToAppUnits nsMargin TwipsToAppUnits(const nsIntMargin &marginInTwips) const diff --git a/layout/reftests/backgrounds/reftest.list b/layout/reftests/backgrounds/reftest.list index 6c4375198045..a0c34c549a95 100644 --- a/layout/reftests/backgrounds/reftest.list +++ b/layout/reftests/backgrounds/reftest.list @@ -80,13 +80,13 @@ != background-size-cover-each-box.html background-size-cover-bounding-box.html == background-size-monster-ch.html background-size-monster-ref.html -random == background-size-monster-cm.html background-size-monster-ref.html +== background-size-monster-cm.html background-size-monster-ref.html == background-size-monster-em.html background-size-monster-ref.html == background-size-monster-ex.html background-size-monster-ref.html -random == background-size-monster-inches.html background-size-monster-ref.html -random == background-size-monster-mm.html background-size-monster-ref.html -random == background-size-monster-pc.html background-size-monster-ref.html -random == background-size-monster-pt.html background-size-monster-ref.html +== background-size-monster-inches.html background-size-monster-ref.html +== background-size-monster-mm.html background-size-monster-ref.html +== background-size-monster-pc.html background-size-monster-ref.html +== background-size-monster-pt.html background-size-monster-ref.html == background-size-monster-px.html background-size-monster-ref.html == background-size-monster-rem.html background-size-monster-ref.html From e847bcc870203b6f8ebb76226824c02670c3e6da Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Mon, 3 Aug 2009 21:13:28 -0700 Subject: [PATCH 03/11] Bug 428465 - nsTArray should refuse to compile with T=nsAutoString (or work correctly). r=bsmedberg --- xpcom/string/public/nsTString.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/xpcom/string/public/nsTString.h b/xpcom/string/public/nsTString.h index 915b84bc6f1b..2621de302141 100644 --- a/xpcom/string/public/nsTString.h +++ b/xpcom/string/public/nsTString.h @@ -539,6 +539,34 @@ class NS_STACK_CLASS nsTAutoString_CharT : public nsTFixedString_CharT }; + // + // nsAutoString stores pointers into itself which are invalidated when an + // nsTArray is resized, so nsTArray must not be instantiated with nsAutoString + // elements! + // + template class nsTArrayElementTraits; + template<> + class nsTArrayElementTraits { + public: + template struct Dont_Instantiate_nsTArray_of; + template struct Instead_Use_nsTArray_of;; + + static Dont_Instantiate_nsTArray_of * + Construct(Instead_Use_nsTArray_of *e) { + return 0; + } + template + static Dont_Instantiate_nsTArray_of * + Construct(Instead_Use_nsTArray_of *e, + const A &arg) { + return 0; + } + static Dont_Instantiate_nsTArray_of * + Destruct(Instead_Use_nsTArray_of *e) { + return 0; + } + }; + /** * nsTXPIDLString extends nsTString such that: * From 47019f7663c1e58696be9fc946490a20d6417daa Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Thu, 6 Aug 2009 12:48:58 -0700 Subject: [PATCH 04/11] Remove stray semicolon that Linux gcc hates, r=red --- xpcom/string/public/nsTString.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xpcom/string/public/nsTString.h b/xpcom/string/public/nsTString.h index 2621de302141..7ce2a214a9ed 100644 --- a/xpcom/string/public/nsTString.h +++ b/xpcom/string/public/nsTString.h @@ -549,7 +549,7 @@ class NS_STACK_CLASS nsTAutoString_CharT : public nsTFixedString_CharT class nsTArrayElementTraits { public: template struct Dont_Instantiate_nsTArray_of; - template struct Instead_Use_nsTArray_of;; + template struct Instead_Use_nsTArray_of; static Dont_Instantiate_nsTArray_of * Construct(Instead_Use_nsTArray_of *e) { From 7a2bd91f74d0b621e08bdad7ca344be15d65da38 Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Thu, 6 Aug 2009 16:17:22 -0400 Subject: [PATCH 05/11] another test fix followup from bug 459114 --- js/src/Makefile.in | 1 + .../components/downloads/test/unit/test_bug_401430.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 5bba9ce489bc..8734e33b8d47 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -41,6 +41,7 @@ DEPTH = . topsrcdir = @top_srcdir@ srcdir = @srcdir@ +run_for_side_effects := $(shell echo "MAKE: $(MAKE)") include $(DEPTH)/config/autoconf.mk DIRS = config diff --git a/toolkit/components/downloads/test/unit/test_bug_401430.js b/toolkit/components/downloads/test/unit/test_bug_401430.js index b4ab50e0eb17..2eca122d1207 100644 --- a/toolkit/components/downloads/test/unit/test_bug_401430.js +++ b/toolkit/components/downloads/test/unit/test_bug_401430.js @@ -48,8 +48,7 @@ const resultFileName = "test\u00e3\u041b\u3056" + Date.now() + ".doc"; function checkResult() { // delete the saved file (this doesn't affect the "recent documents" list) - var resultFile = dirSvc.get("ProfD", Ci.nsIFile); - resultFile.append(resultFileName); + var resultFile = do_get_file(resultFileName); resultFile.remove(false); do_check_true(checkRecentDocsFor(resultFileName)); @@ -118,5 +117,9 @@ function run_test() dm.addListener(listener); dm.addListener(getDownloadListener()); - var dl = addDownload({resultFileName: resultFileName}); + // need to save the file to the CWD, because the profile dir is in $TEMP, + // and Windows apparently doesn't like putting things from $TEMP into + // the recent files list. + var dl = addDownload({resultFileName: resultFileName, + targetFile: do_get_file(resultFileName, true)}); } From 1ae091f04f7a22b7b14ad7e646f7df3d0937ecd2 Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Thu, 6 Aug 2009 13:22:01 -0700 Subject: [PATCH 06/11] Add test for bug 502600; cause parser compatibility mode tests to be run with and without the HTML5 parser enabled. r=hsivonen, sr=bz --- .../tests/mochitest/test_compatmode.html | 79 +++++++++++++++++-- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/parser/htmlparser/tests/mochitest/test_compatmode.html b/parser/htmlparser/tests/mochitest/test_compatmode.html index c16777ab7990..2c7b618aeacf 100644 --- a/parser/htmlparser/tests/mochitest/test_compatmode.html +++ b/parser/htmlparser/tests/mochitest/test_compatmode.html @@ -49,23 +49,90 @@ var doctypes = [ 'BackCompat' , '', 'BackCompat' , '', /* end from bug 363883 */ +// from bug 502600 +'BackCompat' , '', ]; -function test(mode,i){ - is(mode,doctypes[i],doctypes[i+1]) +//// +// Restore the original value of the html5.enable pref, +// and finish. +// +function finishTest() { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + prefs.setBoolPref("html5.enable", gOriginalHtml5Pref); + SimpleTest.finish(); } -var results = new Array(); + +//// +// Verify that the iframe's compatibility mode matches +// the expected value. This function is called from the +// test iframe's onload handler. When verifying the +// last test in the group, if there is no original +// value for the html5.enable pref stored in the +// 'gOriginalHtml5Pref' variable, then run the tests +// again in HTML5 mode. Otherwise, finish the test. +// +function test(mode,i){ + is(mode,doctypes[i],doctypes[i+1]); + if (i == doctypes.length - 2) { + if (typeof(gOriginalHtml5Pref) == "undefined") { + doTestHtml5(); + } + else { + finishTest(); + } + } +} + +//// +// Enable the HTML5 parser, then iterate through the tests +// a second time. +// +function doTestHtml5() { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + gOriginalHtml5Pref = prefs.getBoolPref("html5.enable"); + prefs.setBoolPref("html5.enable", true); + + doTest(); +} + +//// +// Insert a hidden iframe into the document, with the src +// containing the test doctype. The iframe's onload +// function is set to call the test's verification step. +// function insert_iframe(doctype,expected) { var elm = document.createElement('iframe'); - elm.setAttribute('src', 'data:text/html,'+doctype+''); + elm.setAttribute('src', 'data:text/html,' + doctype + + ''); elm.setAttribute('style', 'display:none'); document.getElementsByTagName('body')[0].appendChild(elm); } -for (i=0; i < doctypes.length; i+=2) { - insert_iframe(doctypes[i+1],doctypes[i]); +//// +// First iteration of the compatibility mode tests, without +// the HTML5 parser enabled. +// +function doTest() { + for (i=0; i < doctypes.length; i+=2) { + insert_iframe(doctypes[i+1],doctypes[i]); + } } +//// +// Run the compatbility mode tests. First, the tests are run +// without the HTML5 parser enabled. Completing the last test +// then triggers a second iteration, this time with the HTML5 +// parser enabled. +// +var gOriginalHtml5Pref; +SimpleTest.waitForExplicitFinish(); +doTest(); + From 9c62ea448e708e2ebbf44a52f261f5cc924f838a Mon Sep 17 00:00:00 2001 From: Shawn Wilsher Date: Thu, 6 Aug 2009 13:34:46 -0700 Subject: [PATCH 07/11] Bug 508605 - NetUtil.asyncCopy does not handle nsISafeOutputStreams correctly This moves nsISafeOutputStream.idl into xpcom/io and makes nsAStreamCopier handle nsISafeOutputStream correctly (calling finish instead of close). r=bz r=bsmedberg --HG-- rename : netwerk/base/public/nsISafeOutputStream.idl => xpcom/io/nsISafeOutputStream.idl --- netwerk/base/public/Makefile.in | 1 - netwerk/test/unit/test_NetUtil.js | 37 +++++++++++++++++++ xpcom/io/Makefile.in | 1 + .../io}/nsISafeOutputStream.idl | 0 xpcom/io/nsStreamUtils.cpp | 24 +++++++++--- 5 files changed, 57 insertions(+), 6 deletions(-) rename {netwerk/base/public => xpcom/io}/nsISafeOutputStream.idl (100%) diff --git a/netwerk/base/public/Makefile.in b/netwerk/base/public/Makefile.in index 49f150b513fd..f2dbab880524 100644 --- a/netwerk/base/public/Makefile.in +++ b/netwerk/base/public/Makefile.in @@ -72,7 +72,6 @@ XPIDLSRCS = \ nsIAuthPromptAdapterFactory.idl \ nsIAuthPromptCallback.idl \ nsIAsyncStreamCopier.idl \ - nsISafeOutputStream.idl \ nsIBufferedStreams.idl \ nsICancelable.idl \ nsICryptoHash.idl \ diff --git a/netwerk/test/unit/test_NetUtil.js b/netwerk/test/unit/test_NetUtil.js index ffafc3233895..511c4149656f 100644 --- a/netwerk/test/unit/test_NetUtil.js +++ b/netwerk/test/unit/test_NetUtil.js @@ -110,11 +110,48 @@ function test_async_write_file() }); } +function test_async_write_file_nsISafeOutputStream() +{ + do_test_pending(); + + // First, we need an output file to write to. + let file = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties). + get("TmpD", Ci.nsIFile); + file.append("NetUtil-async-test-file.tmp"); + file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666); + + // Then, we need an output stream to our output file. + let ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"]. + createInstance(Ci.nsIFileOutputStream); + ostream.init(file, -1, -1, 0); + + // Finally, we need an input stream to take data from. + const TEST_DATA = "this is a test string"; + let istream = Cc["@mozilla.org/io/string-input-stream;1"]. + createInstance(Ci.nsIStringInputStream); + istream.setData(TEST_DATA, TEST_DATA.length); + + NetUtil.asyncCopy(istream, ostream, function(aResult) { + // Make sure the copy was successful! + do_check_true(Components.isSuccessCode(aResult)); + + // Check the file contents. + do_check_eq(TEST_DATA, getFileContents(file)); + + // Remove the file, and finish the test. + file.remove(false); + do_test_finished(); + run_next_test(); + }); +} + //////////////////////////////////////////////////////////////////////////////// //// Test Runner let tests = [ test_async_write_file, + test_async_write_file_nsISafeOutputStream, ]; let index = 0; diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in index 7dc48c2503ff..778c7d01a814 100644 --- a/xpcom/io/Makefile.in +++ b/xpcom/io/Makefile.in @@ -156,6 +156,7 @@ XPIDLSRCS = \ nsIConverterInputStream.idl \ nsIConverterOutputStream.idl \ nsIIOUtil.idl \ + nsISafeOutputStream.idl \ $(NULL) ifeq ($(MOZ_WIDGET_TOOLKIT),os2) diff --git a/netwerk/base/public/nsISafeOutputStream.idl b/xpcom/io/nsISafeOutputStream.idl similarity index 100% rename from netwerk/base/public/nsISafeOutputStream.idl rename to xpcom/io/nsISafeOutputStream.idl diff --git a/xpcom/io/nsStreamUtils.cpp b/xpcom/io/nsStreamUtils.cpp index bf214d0b98ba..c682cef62d67 100644 --- a/xpcom/io/nsStreamUtils.cpp +++ b/xpcom/io/nsStreamUtils.cpp @@ -41,6 +41,7 @@ #include "nsIPipe.h" #include "nsIEventTarget.h" #include "nsIRunnable.h" +#include "nsISafeOutputStream.h" #include "nsAutoLock.h" #include "nsString.h" @@ -311,12 +312,15 @@ public: cancelStatus = mCancelStatus; } - // ok, copy data from source to sink. + // Copy data from the source to the sink until we hit failure or have + // copied all the data. for (;;) { - PRUint32 n; + // Note: copyFailed will be true if the source or the sink have + // reported an error, or if we failed to write any bytes + // because we have consumed all of our data. PRBool copyFailed = PR_FALSE; if (!canceled) { - n = DoCopy(&sourceCondition, &sinkCondition); + PRUint32 n = DoCopy(&sourceCondition, &sinkCondition); copyFailed = NS_FAILED(sourceCondition) || NS_FAILED(sinkCondition) || n == 0; @@ -366,8 +370,18 @@ public: if (mAsyncSink) mAsyncSink->CloseWithStatus(canceled ? cancelStatus : sourceCondition); - else - mSink->Close(); + else { + // If we have an nsISafeOutputStream, and our + // sourceCondition and sinkCondition are not set to a + // failure state, finish writing. + nsCOMPtr sostream = + do_QueryInterface(mSink); + if (sostream && NS_SUCCEEDED(sourceCondition) && + NS_SUCCEEDED(sinkCondition)) + sostream->Finish(); + else + mSink->Close(); + } } mAsyncSink = nsnull; mSink = nsnull; From 8814f7e7dcda071f4ce4074a3953364e97aad237 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 6 Aug 2009 14:49:56 -0700 Subject: [PATCH 08/11] Revert patch for bug 505123, changeset f1a04b1c0b37. 0.9% SunSpider regression. --- js/src/jsarray.cpp | 2 +- js/src/jsmath.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index a440240c0e60..f4b1039efab6 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -893,7 +893,7 @@ js_PrototypeHasIndexedProperties(JSContext *cx, JSObject *obj) #ifdef JS_TRACER -static JSBool FASTCALL +static inline JSBool FASTCALL dense_grow(JSContext* cx, JSObject* obj, jsint i, jsval v) { /* diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp index 1d1a4170376d..dd6fd51665c1 100644 --- a/js/src/jsmath.cpp +++ b/js/src/jsmath.cpp @@ -179,7 +179,7 @@ math_atan(JSContext *cx, uintN argc, jsval *vp) return js_NewNumberInRootedValue(cx, z, vp); } -static jsdouble JS_FASTCALL +static inline jsdouble JS_FASTCALL math_atan2_kernel(jsdouble x, jsdouble y) { #if defined(_MSC_VER) @@ -227,7 +227,7 @@ math_atan2(JSContext *cx, uintN argc, jsval *vp) return js_NewNumberInRootedValue(cx, math_atan2_kernel (x, y), vp); } -static inline jsdouble +static inline jsdouble JS_FASTCALL math_ceil_kernel(jsdouble x) { #ifdef __APPLE__ From c5699560da69a7f9e5a19c56afaca3b13120d6f5 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Thu, 6 Aug 2009 15:47:11 -0700 Subject: [PATCH 09/11] Back out 9c64449afef8 as it may have caused reftest failures --- layout/base/nsPresContext.h | 4 ++-- layout/reftests/backgrounds/reftest.list | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 063c769df69a..0f5a96385d7b 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -600,8 +600,8 @@ public: AppUnitsToGfxUnits(aAppRect.height)); } nscoord TwipsToAppUnits(PRInt32 aTwips) const - { return NSCoordSaturatingMultiply(NS_TWIPS_TO_INCHES(aTwips), - mDeviceContext->AppUnitsPerInch()); } + { return NSToCoordRound(NS_TWIPS_TO_INCHES(aTwips) * + mDeviceContext->AppUnitsPerInch()); } // Margin-specific version, since they often need TwipsToAppUnits nsMargin TwipsToAppUnits(const nsIntMargin &marginInTwips) const diff --git a/layout/reftests/backgrounds/reftest.list b/layout/reftests/backgrounds/reftest.list index a0c34c549a95..6c4375198045 100644 --- a/layout/reftests/backgrounds/reftest.list +++ b/layout/reftests/backgrounds/reftest.list @@ -80,13 +80,13 @@ != background-size-cover-each-box.html background-size-cover-bounding-box.html == background-size-monster-ch.html background-size-monster-ref.html -== background-size-monster-cm.html background-size-monster-ref.html +random == background-size-monster-cm.html background-size-monster-ref.html == background-size-monster-em.html background-size-monster-ref.html == background-size-monster-ex.html background-size-monster-ref.html -== background-size-monster-inches.html background-size-monster-ref.html -== background-size-monster-mm.html background-size-monster-ref.html -== background-size-monster-pc.html background-size-monster-ref.html -== background-size-monster-pt.html background-size-monster-ref.html +random == background-size-monster-inches.html background-size-monster-ref.html +random == background-size-monster-mm.html background-size-monster-ref.html +random == background-size-monster-pc.html background-size-monster-ref.html +random == background-size-monster-pt.html background-size-monster-ref.html == background-size-monster-px.html background-size-monster-ref.html == background-size-monster-rem.html background-size-monster-ref.html From dd75783c9f90ccc911b8f7afa84ed50271755401 Mon Sep 17 00:00:00 2001 From: Serge Gautherie Date: Fri, 7 Aug 2009 01:43:53 +0200 Subject: [PATCH 10/11] Bug 450450 - mochitest-plain: test_loadflags.html intermittently fails; (Bv1a) Make it more serial, explicit and documented; r=dwitte --- .../cookie/test/file_loadflags_inner.html | 2 +- extensions/cookie/test/file_testcommon.js | 34 ++++----- extensions/cookie/test/file_testloadflags.js | 72 +++++++++---------- extensions/cookie/test/test_loadflags.html | 5 ++ 4 files changed, 59 insertions(+), 54 deletions(-) diff --git a/extensions/cookie/test/file_loadflags_inner.html b/extensions/cookie/test/file_loadflags_inner.html index 6720afd80033..019d5d84d6d4 100644 --- a/extensions/cookie/test/file_loadflags_inner.html +++ b/extensions/cookie/test/file_loadflags_inner.html @@ -7,7 +7,7 @@ document.cookie = "can=has"; // send a message to our test document, to say we're done loading - window.opener.postMessage("message", "http://localhost:8888"); + window.opener.postMessage("f_lf_i msg data", "http://localhost:8888"); } diff --git a/extensions/cookie/test/file_testcommon.js b/extensions/cookie/test/file_testcommon.js index a9ccca2e938d..c6c61075bca0 100644 --- a/extensions/cookie/test/file_testcommon.js +++ b/extensions/cookie/test/file_testcommon.js @@ -1,12 +1,13 @@ -SimpleTest.waitForExplicitFinish(); +var gExpectedCookies; +var gExpectedLoads; -var gPopup = null; +var gPopup; -var gExpectedCookies = 0; -var gExpectedLoads = 0; var gLoads = 0; function setupTest(uri, cookies, loads) { + SimpleTest.waitForExplicitFinish(); + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); Components.classes["@mozilla.org/preferences-service;1"] @@ -20,36 +21,39 @@ function setupTest(uri, cookies, loads) { gExpectedCookies = cookies; gExpectedLoads = loads; + // Listen for MessageEvents. + window.addEventListener("message", messageReceiver, false); + // load a window which contains an iframe; each will attempt to set // cookies from their respective domains. gPopup = window.open(uri, 'hai', 'width=100,height=100'); } -window.addEventListener("message", messageReceiver, false); /** Receives MessageEvents to this window. */ +// Count and check loads. function messageReceiver(evt) { - ok(evt instanceof MessageEvent, "event type", evt); - + is(evt.data, "message", "message data received from popup"); if (evt.data != "message") { + gPopup.close(); window.removeEventListener("message", messageReceiver, false); - ok(false, "message", evt.data); - - gPopup.close(); SimpleTest.finish(); return; } // only run the test when all our children are done loading & setting cookies if (++gLoads == gExpectedLoads) { + gPopup.close(); window.removeEventListener("message", messageReceiver, false); runTest(); } } +// runTest() is run by messageReceiver(). +// Count and check cookies. function runTest() { // set a cookie from a domain of "localhost" document.cookie = "oh=hai"; @@ -58,15 +62,11 @@ function runTest() { var cs = Components.classes["@mozilla.org/cookiemanager;1"] .getService(Components.interfaces.nsICookieManager); - var list = cs.enumerator; var count = 0; - while (list.hasMoreElements()) { - count++; - list.getNext(); - } - is(count, gExpectedCookies, "number of cookies"); + for(var list = cs.enumerator; list.hasMoreElements(); list.getNext()) + ++count; + is(count, gExpectedCookies, "total number of cookies"); cs.removeAll(); - gPopup.close(); SimpleTest.finish(); } diff --git a/extensions/cookie/test/file_testloadflags.js b/extensions/cookie/test/file_testloadflags.js index adce789743c3..f82240f3d126 100644 --- a/extensions/cookie/test/file_testloadflags.js +++ b/extensions/cookie/test/file_testloadflags.js @@ -1,16 +1,17 @@ -SimpleTest.waitForExplicitFinish(); +var gExpectedCookies; +var gExpectedHeaders; +var gExpectedLoads; -var gPopup = null; +var gObs; +var gPopup; -var gExpectedCookies = 0; -var gExpectedLoads = 0; -var gExpectedHeaders = 0; -var gLoads = 0; var gHeaders = 0; +var gLoads = 0; -var o = null; - +// setupTest() is run from 'onload='. function setupTest(uri, domain, cookies, loads, headers) { + SimpleTest.waitForExplicitFinish(); + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); Components.classes["@mozilla.org/preferences-service;1"] @@ -21,26 +22,29 @@ function setupTest(uri, domain, cookies, loads, headers) { .getService(Components.interfaces.nsICookieManager2); cs.removeAll(); cs.add(domain, "", "oh", "hai", false, false, true, Math.pow(2, 62)); - is(cs.countCookiesFromHost(domain), 1, "cookie inited"); - - o = new obs(); + is(cs.countCookiesFromHost(domain), 1, "number of cookies for domain " + domain); gExpectedCookies = cookies; gExpectedLoads = loads; gExpectedHeaders = headers; + gObs = new obs(); + // Listen for MessageEvents. + window.addEventListener("message", messageReceiver, false); + // load a window which contains an iframe; each will attempt to set // cookies from their respective domains. gPopup = window.open(uri, 'hai', 'width=100,height=100'); } +// Count headers. function obs () { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + this.window = window; this.os = Components.classes["@mozilla.org/observer-service;1"] .getService(Components.interfaces.nsIObserverService); this.os.addObserver(this, "http-on-modify-request", false); - this.window = window; } obs.prototype = { @@ -49,11 +53,11 @@ obs.prototype = { this.window.netscape.security .PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var cookie = theSubject.QueryInterface(this.window.Components.interfaces - .nsIHttpChannel) - .getRequestHeader("Cookie"); - this.window.isnot(cookie.indexOf("oh=hai"), -1, "cookie sent"); - gHeaders++; + var channel = theSubject.QueryInterface( + this.window.Components.interfaces.nsIHttpChannel); + this.window.isnot(channel.getRequestHeader("Cookie").indexOf("oh=hai"), -1, + "cookie 'oh=hai' is in header for " + channel.URI.spec); + ++gHeaders; }, remove: function obs_remove() @@ -66,52 +70,48 @@ obs.prototype = { } } -window.addEventListener("message", messageReceiver, false); - /** Receives MessageEvents to this window. */ +// Count and check loads. function messageReceiver(evt) { - ok(evt instanceof MessageEvent, "event type", evt); - - if (evt.data != "message") { + is(evt.data, "f_lf_i msg data", "message data received from popup"); + if (evt.data != "f_lf_i msg data") { + gPopup.close(); window.removeEventListener("message", messageReceiver, false); - ok(false, "message", evt.data); - - o.remove(); - gPopup.close(); + gObs.remove(); SimpleTest.finish(); return; } // only run the test when all our children are done loading & setting cookies if (++gLoads == gExpectedLoads) { + gPopup.close(); window.removeEventListener("message", messageReceiver, false); runTest(); } } +// runTest() is run by messageReceiver(). +// Check headers, and count and check cookies. function runTest() { // set a cookie from a domain of "localhost" document.cookie = "o=noes"; + gObs.remove(); + + is(gHeaders, gExpectedHeaders, "number of observed request headers"); + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var cs = Components.classes["@mozilla.org/cookiemanager;1"] .getService(Components.interfaces.nsICookieManager); - var list = cs.enumerator; var count = 0; - while (list.hasMoreElements()) { - count++; - list.getNext(); - } - is(count, gExpectedCookies, "number of cookies"); + for(var list = cs.enumerator; list.hasMoreElements(); list.getNext()) + ++count; + is(count, gExpectedCookies, "total number of cookies"); cs.removeAll(); - is(gHeaders, gExpectedHeaders, "number of request headers"); - - o.remove(); - gPopup.close(); SimpleTest.finish(); } diff --git a/extensions/cookie/test/test_loadflags.html b/extensions/cookie/test/test_loadflags.html index 1e50680d9265..1e7094a8d97d 100644 --- a/extensions/cookie/test/test_loadflags.html +++ b/extensions/cookie/test/test_loadflags.html @@ -6,6 +6,11 @@ +


From a42d5c5b9096ba8b7b5db3a1e60b2f5732692780 Mon Sep 17 00:00:00 2001
From: Tyler Downer 
Date: Fri, 7 Aug 2009 01:48:54 +0200
Subject: [PATCH 11/11] Bug 471215 - Remove readme to online mo site; r+sr=jst

---
 embedding/config/readme.html | 169 -----------------------------------
 1 file changed, 169 deletions(-)
 delete mode 100644 embedding/config/readme.html

diff --git a/embedding/config/readme.html b/embedding/config/readme.html
deleted file mode 100644
index 5a245554384b..000000000000
--- a/embedding/config/readme.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-  Embedding distribution information
-
-  
-       
-

Introduction

- -

This is the Embedding distribution of Mozilla. It serves as a reference -and smoketest distribution to demonstrate a typical subset of Mozilla -needed to embed it into another application. The distribution contains -sample applications for testing and development purposes.

- -

Please note the phrase typical subset! If you want to use a different - subset then see the customizing the embedding distribution - section below.

- -

Where can I find more information about embedding?

- -

Mozilla.org - http://www.mozilla.org/.

- -

The Embedding project page - http://www.mozilla.org/projects/embedding/. - This page should serve as your main point of information for learning -how to embed Mozilla in your own applications.

- -

The Embedding Frequently Asked Questions (FAQ) page - http://www.mozilla.org/projects/embedding/faq.html

- -

The Embedding newsgroup - news:netscape.public.mozilla.embedding.

- -

The Embedding QA page - http://www.mozilla.org/quality/embed/.

- -

Instructions for building Mozilla (including Embedding) - http://www.mozilla.org/build/.

- -

Instructions for fetching Mozilla source code (including Embedding) - http://www.mozilla.org/source.html.

- -

Contents

- -

The distribution contains, libraries, resources and chrome. All of this - is a subset of Mozilla, repackaged for embedding. The layout follows -the usual Mozilla directory, i.e.

- -
    -
  • ./ - Test applications, launch scripts and core libraries (xpcom, -nspr etc.)
  • -
  • ./components/ - XPCOM components (network, graphics, layout, -content, etc.).
  • -
  • ./chrome/ - chrome files. In embedding most of the chrome has -been re-packaged into a single embed.jar file to make it more manageable.
  • -
  • ./res/ - miscellaneous rendering and parser files.
  • -
  • ./defaults/ - default preference settings
  • - -
- -

Unix

- -

TestGtkEmbed

- -

A simple browser application built using the GTK+ Browser Widget.

- -

GTK+ Browser Widget

- -

A GTK+ widget for embedding Mozilla into GTK+/GNOME applications such as -Galeon. More information -about the widget may be found here http://www.mozilla.org/unix/gtk-embedding.html. -

- -

Windows

- -

MFCEmbed

- -

A complete browser application written in MFC and the Gecko embedding APIs. - This application demonstrates and exercises the functionality necessary -to put together a fully featured browser using Gecko.

- -

Mozilla ActiveX Control

- -

An ActiveX browser control built with the embedding APIs. You may use the - control to embed a browser inside applications written in VB, Delphi -etc. More information about the control including installation instructions -may be found at http://www.iol.ie/~locka/mozilla/mozilla.htm. -

- -

Macintosh

- -

PPEmbed is built as part of the standard Mac embedding build. Work on Fizilla Mach -may also yield a Mac embedding distribution in the future.

- -

Installation and Usage

- -

Unix

- -
    -
  1. Untar the embedding distribution into an empty directory of your - choice.
  2. -
  3. From the command-line, cd into the directory and type - './run-mozilla.sh ./TestGtkEmbed'
  4. - -
- -

Windows

- -
    -
  1. Unzip the embedding distribution into an empty directory of your - choice.
  2. -
  3. Double-click on mfcembed.exe
  4. - -
- -

Customizing the embedding distribution

- -

The embedding distribution is produced by first building the full Mozilla - source and cherry picking files and chrome into a separate embedding -directory. Basically the steps are:

- -
    -
  1. Build Mozilla as usual
  2. -
  3. cd mozilla/embedding/config
  4. -
  5. make
  6. -
- -

Note: When using an objdir, cd into -<objdir>/embedding/config instead, and run make there.

- -

The embedding distribution will appear in mozilla/dist/Embed.

- -

The build process works by reading a file called basebrowser-win (or - basebrowser-unix, basebrowser-mac-macho etc.) and copying the listed files -from mozilla/dist/bin into mozilla/dist/Embed. It then reads a file called -embed-jar.mn and repackages the specified chrome files and directories -into a single embed.jar.
-

- -

This process can be customized in one of two ways:
-

- -
    -
  1. Edit basebrowser-foo (where foo = win, unix etc.) and remove/add the -items you require
  2. -
  3. Create a new file called client-foo and add the items you require. -This file is detected by the build process and will be run after the -contents of basebrowser-foo have been copied.
  4. - -
- The latter is the best probably approach to take since the embedder can -maintain these files without modifying ones in Mozilla. The client-foo -file allows embedders to specify files to be added or removed from the -default embedding distribution. A minus sign in front of a filename -deletes that file. -

For example if you wanted a distribution containing extra character converters, -but not the ActiveX control and not XMLExtras you might define a client-win -like this:

- -
[Embed]
components\ucvja.dll
components\ucvko.dll
components\ucvcn.dll
components\ucvtw.dll
components\ucvtw2.dll
components\ucvibm.dll
-mozctl.dll
-mozctlx.dll
-components\xmlextras.dll
-components\xmlextras.xpt
- -

-
-
- -