-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathgoanna-xulrunner-km-adapt.diff
1243 lines (1169 loc) · 46.2 KB
/
goanna-xulrunner-km-adapt.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/browser/components/build/moz.build b/browser/components/build/moz.build
index f8073907e..eb5ffdf7e 100644
--- a/browser/components/build/moz.build
+++ b/browser/components/build/moz.build
@@ -22,6 +22,11 @@ LOCAL_INCLUDES += [
'../shell',
]
+if CONFIG['JS_SHARED_LIBRARY']:
+ USE_LIBS += [
+ 'js',
+ ]
+
if CONFIG['OS_ARCH'] == 'WINNT':
OS_LIBS += [
'ole32',
diff --git a/browser/confvars.sh b/browser/confvars.sh
index ba760f0aa..39bd02af6 100755
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -17,7 +17,7 @@ MOZ_APP_VERSION=`cat ${_topsrcdir}/$MOZ_BUILD_APP/config/version.txt`
MOZ_EXTENSIONS_DEFAULT=" gio"
MOZ_SERVICES_FXACCOUNTS=1
-MOZ_DISABLE_EXPORT_JS=1
+MOZ_DISABLE_EXPORT_JS=
MOZ_WEBGL_CONFORMANT=1
MOZ_ACTIVITIES=1
MOZ_JSDOWNLOADS=1
diff --git a/caps/nsScriptSecurityManager.cpp b/caps/nsScriptSecurityManager.cpp
index 5cef6cb6a..d830f15eb 100644
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -393,6 +393,8 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx)
{
MOZ_ASSERT(cx == nsContentUtils::GetCurrentJSContext());
nsCOMPtr<nsIPrincipal> subjectPrincipal = nsContentUtils::SubjectPrincipal();
+ if (!subjectPrincipal)
+ return true;
nsCOMPtr<nsIContentSecurityPolicy> csp;
nsresult rv = subjectPrincipal->GetCsp(getter_AddRefs(csp));
NS_ASSERTION(NS_SUCCEEDED(rv), "CSP: Failed to get CSP from principal.");
diff --git a/configure.in b/configure.in
index 1ac85b38f..8f1ecbdf4 100644
--- a/configure.in
+++ b/configure.in
@@ -4231,11 +4231,11 @@
case "$MOZ_WIDGET_TOOLKIT" in
cairo-windows)
MOZ_WIDGET_TOOLKIT=windows
MOZ_PDF_PRINTING=1
- MOZ_INSTRUMENT_EVENT_LOOP=1
+ MOZ_INSTRUMENT_EVENT_LOOP=
if test -n "$GNU_CC"; then
MOZ_FOLD_LIBS=
fi
;;
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index d105d6811..cec5191f5 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -10596,7 +10596,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
// timing attacks to read data from cross-origin iframes. If this widens
// we should add a protocol flag for whether the scheme is allowed in
// frames and use something like nsNetUtil::NS_URIChainHasFlags.
- nsCOMPtr<nsIURI> tempURI = aURI;
+ /*nsCOMPtr<nsIURI> tempURI = aURI;
nsCOMPtr<nsINestedURI> nestedURI = do_QueryInterface(tempURI);
while (nestedURI) {
// view-source should always be an nsINestedURI, loop and check the
@@ -10608,7 +10608,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
}
nestedURI->GetInnerURI(getter_AddRefs(tempURI));
nestedURI = do_QueryInterface(tempURI);
- }
+ }*/
}
// open a channel for the url
diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp
index b809e58b0..562d5371c 100644
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -7197,6 +7197,7 @@ NS_IMETHODIMP
nsGlobalWindow::GetWindowRoot(nsIDOMEventTarget **aWindowRoot)
{
nsCOMPtr<nsPIWindowRoot> root = GetTopWindowRoot();
+ NS_ENSURE_TRUE(root, NS_ERROR_FAILURE);
return CallQueryInterface(root, aWindowRoot);
}
diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp
index dc056d996..24d4246db 100644
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -704,6 +704,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
if (win) {
nsView *view = nsView::GetViewFor(win);
NS_ASSERTION(view, "No view for widget");
+ if (!view) return NS_ERROR_FAILURE;
nsPoint offset = view->GetOffsetTo(nullptr);
if (offset.x || offset.y) {
diff --git a/embedding/browser/nsDocShellTreeOwner.cpp b/embedding/browser/nsDocShellTreeOwner.cpp
index 88283d9d4..cb046b997 100644
--- a/embedding/browser/nsDocShellTreeOwner.cpp
+++ b/embedding/browser/nsDocShellTreeOwner.cpp
@@ -688,7 +688,8 @@ nsDocShellTreeOwner::OnProgressChange(nsIWebProgress* aProgress,
// In the absence of DOM document creation event, this method is the
// most convenient place to install the mouse listener on the
// DOM document.
- return AddChromeListeners();
+ // return AddChromeListeners();
+ return NS_OK;
}
NS_IMETHODIMP
@@ -843,11 +844,14 @@ nsDocShellTreeOwner::AddChromeListeners()
GetDOMEventTarget(mWebBrowser, getter_AddRefs(target));
EventListenerManager* elmP = target->GetOrCreateListenerManager();
- if (elmP) {
- elmP->AddEventListenerByType(this, NS_LITERAL_STRING("dragover"),
- TrustedEventsAtSystemGroupBubble());
- elmP->AddEventListenerByType(this, NS_LITERAL_STRING("drop"),
- TrustedEventsAtSystemGroupBubble());
+ if (target) {
+ EventListenerManager* elmP = target->GetOrCreateListenerManager();
+ if (elmP) {
+ elmP->AddEventListenerByType(this, NS_LITERAL_STRING("dragover"),
+ TrustedEventsAtSystemGroupBubble());
+ elmP->AddEventListenerByType(this, NS_LITERAL_STRING("drop"),
+ TrustedEventsAtSystemGroupBubble());
+ }
}
return rv;
@@ -910,7 +914,7 @@ nsDocShellTreeOwner::HandleEvent(nsIDOMEvent* aEvent)
nsIWebNavigation* webnav = static_cast<nsIWebNavigation *>(mWebBrowser);
nsAutoString link, name;
- if (webnav && NS_SUCCEEDED(handler->DropLink(dragEvent, link, false, name))) {
+ if (webnav && NS_SUCCEEDED(handler->DropLink(dragEvent, name, false, link))) {
if (!link.IsEmpty()) {
webnav->LoadURI(link.get(), 0, nullptr, nullptr, nullptr);
}
diff --git a/embedding/components/printingui/win/nsPrintDialogUtil.cpp b/embedding/components/printingui/win/nsPrintDialogUtil.cpp
index 2370edb44..6634c7f89 100644
--- a/embedding/components/printingui/win/nsPrintDialogUtil.cpp
+++ b/embedding/components/printingui/win/nsPrintDialogUtil.cpp
@@ -1073,7 +1073,7 @@ nsresult NativeShowPrintDialog(HWND aHWnd,
nsresult rv = ShowNativePrintDialog(aHWnd, aPrintSettings);
if (aHWnd) {
- ::DestroyWindow(aHWnd);
+ //::DestroyWindow(aHWnd);
}
return rv;
diff --git a/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp b/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
index e31075e21..d0147c8d6 100644
--- a/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -1228,7 +1228,8 @@ nsresult nsWebBrowserPersist::SaveURIInternal(
if (NS_FAILED(rv) || inputChannel == nullptr)
{
- EndDownload(NS_ERROR_FAILURE);
+ //No point in stopping the download because of a single failure
+ //EndDownload(NS_ERROR_FAILURE);
return NS_ERROR_FAILURE;
}
diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp
index 2533b4807..923b06848 100644
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -1117,7 +1117,8 @@ CompositorD3D11::EndFrame()
rects.push_back(rect);
}
- params.pDirtyRects = &rects.front();
+ if (rects.size())
+ params.pDirtyRects = &rects.front();
chain->Present1(presentInterval, mDisableSequenceForNextFrame ? DXGI_PRESENT_DO_NOT_SEQUENCE : 0, ¶ms);
} else {
mSwapChain->Present(presentInterval, mDisableSequenceForNextFrame ? DXGI_PRESENT_DO_NOT_SEQUENCE : 0);
diff --git a/image/decoders/nsICODecoder.cpp b/image/decoders/nsICODecoder.cpp
index 6d17c5e87..8708d2518 100644
--- a/image/decoders/nsICODecoder.cpp
+++ b/image/decoders/nsICODecoder.cpp
@@ -20,7 +20,7 @@ namespace image {
#define ICONCOUNTOFFSET 4
#define DIRENTRYOFFSET 6
#define BITMAPINFOSIZE 40
-#define PREFICONSIZE 16
+#define PREFICONSIZE 32
// ----------------------------------------
// Actual Data Processing
diff --git a/intl/icu/source/common/Makefile.in b/intl/icu/source/common/Makefile.in
index 59ffb7377..bbc54321c 100644
--- a/intl/icu/source/common/Makefile.in
+++ b/intl/icu/source/common/Makefile.in
@@ -229,3 +229,6 @@ ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
endif
endif
+CFLAGS += -O1 -GL -Gw
+CXXFLAGS += -O1 -GL -Gw
+LDFLAGS += -opt:ref,icf -LARGEADDRESSAWARE -LTCG
diff --git a/intl/icu/source/i18n/Makefile.in b/intl/icu/source/i18n/Makefile.in
index 2fe9b3d8d..8f225ee03 100644
--- a/intl/icu/source/i18n/Makefile.in
+++ b/intl/icu/source/i18n/Makefile.in
@@ -208,3 +208,7 @@ ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
-include $(DEPS)
endif
endif
+
+CFLAGS += -O1 -GL -Gw
+CXXFLAGS += -O1 -GL -Gw
+LDFLAGS += -opt:ref,icf -LARGEADDRESSAWARE -LTCG
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index 6ee59c809..84901bbf2 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -115,6 +115,12 @@ using js::frontend::Parser;
#define JS_ADDRESSOF_VA_LIST(ap) (&(ap))
#endif
+JS_PUBLIC_API(bool)
+JS::JS_RequireArgsAtLeast(JSContext* cx, JS::CallArgs& args,
+const char* fnname, unsigned required) {
+ return args.requireAtLeast(cx, fnname, required);
+}
+
bool
JS::CallArgs::requireAtLeast(JSContext* cx, const char* fnname, unsigned required) const
{
diff --git a/js/src/jsapi.h b/js/src/jsapi.h
index 4f6ae4a97..b6c99db3d 100644
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -37,6 +37,9 @@
namespace JS {
+extern JS_PUBLIC_API(bool)
+ JS_RequireArgsAtLeast(JSContext* cx, JS::CallArgs& args, const char* fnname, unsigned required);
+
class Latin1CharsZ;
class TwoByteChars;
diff --git a/js/xpconnect/idl/moz.build b/js/xpconnect/idl/moz.build
index c1ed1e21c..be265ab7d 100644
--- a/js/xpconnect/idl/moz.build
+++ b/js/xpconnect/idl/moz.build
@@ -7,6 +7,7 @@
XPIDL_SOURCES += [
'mozIJSSubScriptLoader.idl',
'nsIAddonInterposition.idl',
+ 'nsIJSContextStack.idl',
'nsIJSRuntimeService.idl',
'nsIRemoteTagService.idl',
'nsIScriptError.idl',
diff --git a/js/xpconnect/idl/nsIJSContextStack.idl b/js/xpconnect/idl/nsIJSContextStack.idl
new file mode 100644
--- /dev/null
+++ b/js/xpconnect/idl/nsIJSContextStack.idl
@@ -0,0 +1,12 @@
+#include "nsISupports.idl"
+
+[ptr] native JSContext(JSContext);
+
+[uuid(c67d8270-3189-11d3-9885-006008962422)]
+interface nsIJSContextStack : nsISupports
+{
+ JSContext pop();
+ void push(in JSContext cx);
+};
+
+
diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp
index d1e4aa981..166ce1fff 100644
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -41,7 +41,8 @@ NS_IMPL_ISUPPORTS(nsXPConnect,
nsIXPConnect,
nsISupportsWeakReference,
nsIThreadObserver,
- nsIJSRuntimeService)
+ nsIJSRuntimeService,
+ nsIJSContextStack)
nsXPConnect* nsXPConnect::gSelf = nullptr;
bool nsXPConnect::gOnceAliveNowDead = false;
@@ -1012,6 +1013,19 @@ nsXPConnect::AfterProcessNextEvent(nsIThreadInternal* aThread,
return NS_OK;
}
+NS_IMETHODIMP
+nsXPConnect::Push(JSContext *aJSContext)
+{
+ return PushJSContextNoScriptContext(aJSContext) ? NS_OK : NS_ERROR_FAILURE;
+}
+
+NS_IMETHODIMP
+nsXPConnect::Pop(JSContext **aJSContext)
+{
+ PopJSContextNoScriptContext();//*aJSContext = XPCJSRuntime::Get()->GetJSContextStack()->Pop();
+ return NS_OK;
+}
+
NS_IMETHODIMP
nsXPConnect::OnDispatchedEvent(nsIThreadInternal* aThread)
{
@@ -1089,7 +1103,7 @@ namespace xpc {
bool
PushJSContextNoScriptContext(JSContext* aCx)
{
- MOZ_ASSERT_IF(aCx, !GetScriptContextFromJSContext(aCx));
+ //MOZ_ASSERT_IF(aCx, !GetScriptContextFromJSContext(aCx));
return XPCJSRuntime::Get()->GetJSContextStack()->Push(aCx);
}
diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h
index 782aefbac..7670ece43 100644
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -112,6 +112,7 @@
#include "nsIXPConnect.h"
#include "nsIInterfaceInfo.h"
#include "nsIXPCScriptable.h"
+#include "nsIJSContextStack.h"
#include "nsIJSRuntimeService.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
@@ -252,7 +253,8 @@ static inline bool IS_WN_REFLECTOR(JSObject* obj)
class nsXPConnect final : public nsIXPConnect,
public nsIThreadObserver,
public nsSupportsWeakReference,
- public nsIJSRuntimeService
+ public nsIJSRuntimeService,
+ public nsIJSContextStack
{
public:
// all the interface method declarations...
@@ -260,6 +262,7 @@ public:
NS_DECL_NSIXPCONNECT
NS_DECL_NSITHREADOBSERVER
NS_DECL_NSIJSRUNTIMESERVICE
+ NS_DECL_NSIJSCONTEXTSTACK
// non-interface implementation
public:
diff --git a/netwerk/base/ProxyAutoConfig.cpp b/netwerk/base/ProxyAutoConfig.cpp
index 3b2ca9585..cc28d59d9 100644
--- a/netwerk/base/ProxyAutoConfig.cpp
+++ b/netwerk/base/ProxyAutoConfig.cpp
@@ -416,6 +416,9 @@ bool PACDnsResolve(JSContext *cx, unsigned int argc, JS::Value *vp)
return false;
}
+ if (!JS::JS_RequireArgsAtLeast(cx, args, "dnsResolve", 1))
+ return false;
+
JS::Rooted<JSString*> arg1(cx);
if (!JS_ConvertArguments(cx, args, "S", arg1.address()))
return false;
@@ -465,6 +468,9 @@ bool PACProxyAlert(JSContext *cx, unsigned int argc, JS::Value *vp)
{
JS::CallArgs args = CallArgsFromVp(argc, vp);
+ if (!JS::JS_RequireArgsAtLeast(cx, args, "alert", 1))
+ return false;
+
JS::Rooted<JSString*> arg1(cx);
if (!JS_ConvertArguments(cx, args, "S", arg1.address()))
return false;
diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py
index d2c033030..a62894835 100644
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -413,6 +413,19 @@ VARIABLES = {
This variable contains a list of source code files to compile.
Accepts assembler, C, C++, Objective C/C++.
""", None),
+
+ 'SOURCES_NOPCH': (StrictOrderingOnAppendList, list,
+ """Source code files.
+
+ This variable contains a list of source code files not using
+ the precompiled header.
+ """, 'compile'),
+
+ 'PCHHDR': (unicode, unicode,
+ "", None),
+ 'PCHSRC': (unicode, unicode,
+ "", None),
+
'GENERATED_SOURCES': (StrictOrderingOnAppendList, list,
"""Generated source code files.
diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py
index 0896cbefa..c92223626 100644
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -422,6 +422,9 @@ class TreeMetadataEmitter(LoggingMixin):
'DEFFILE',
'WIN32_EXE_LDFLAGS',
'LD_VERSION_SCRIPT',
+ 'SOURCES_NOPCH',
+ 'PCHHDR',
+ 'PCHSRC',
]
for v in varlist:
if v in context and context[v]:
diff --git a/security/nss/coreconf/WIN32.mk b/security/nss/coreconf/WIN32.mk
index be795f0ce..1d68b4ba3 100644
--- a/security/nss/coreconf/WIN32.mk
+++ b/security/nss/coreconf/WIN32.mk
@@ -109,9 +109,9 @@ ifdef NS_USE_GCC
DLLFLAGS += -mwindows -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
ifdef BUILD_OPT
ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
- OPTIMIZER += -Os
+ OPTIMIZER += -Os -GFL -Gw
else
- OPTIMIZER += -O2
+ OPTIMIZER += -O2 -GFL -Gw
endif
DEFINES += -UDEBUG -DNDEBUG
else
diff --git a/security/nss/coreconf/command.mk b/security/nss/coreconf/command.mk
index 5e92748aa..00171f8a3 100644
--- a/security/nss/coreconf/command.mk
+++ b/security/nss/coreconf/command.mk
@@ -11,7 +11,7 @@
AS = $(CC)
ASFLAGS += $(CFLAGS)
CCF = $(CC) $(CFLAGS)
-LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS) $(XLDFLAGS)
+LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS) $(XLDFLAGS) -opt:ref,icf -LARGEADDRESSAWARE -LTCG
CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(WARNING_CFLAGS) $(XP_DEFINE) \
$(DEFINES) $(INCLUDES) $(XCFLAGS)
PERL = perl
diff --git a/security/nss/lib/freebl/Makefile b/security/nss/lib/freebl/Makefile
index 914a0119c..cee757429 100644
--- a/security/nss/lib/freebl/Makefile
+++ b/security/nss/lib/freebl/Makefile
@@ -149,7 +149,7 @@ else
DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE
DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD
ifdef BUILD_OPT
- OPTIMIZER += -Ox # maximum optimization for freebl
+ OPTIMIZER += -Ox -GFL # maximum optimization for freebl
endif
# The Intel AES assembly code requires Visual C++ 2010.
# if $(_MSC_VER) >= 1600 (Visual C++ 2010)
@@ -171,7 +171,7 @@ ifdef NS_USE_GCC
else
# MSVC
ifdef BUILD_OPT
- OPTIMIZER += -Ox # maximum optimization for freebl
+ OPTIMIZER += -Ox -GFL # maximum optimization for freebl
endif
ASFILES = arcfour-amd64-masm.asm mpi_amd64_masm.asm mp_comba_amd64_masm.asm
DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY
diff --git a/toolkit/components/passwordmgr/LoginManagerContent.jsm b/toolkit/components/passwordmgr/LoginManagerContent.jsm
index 973b36a03..559875116 100644
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -200,6 +200,54 @@ var LoginManagerContent = {
messageData);
},
+ doAutocompleteSearch: function({ formOrigin, actionOrigin,
+ searchString, previousResult,
+ rect, requestId, remote }, target) {
+ // Note: previousResult is a regular object, not an
+ // nsIAutoCompleteResult.
+ var result;
+
+ let searchStringLower = searchString.toLowerCase();
+ let logins;
+ if (previousResult &&
+ searchStringLower.startsWith(previousResult.searchString.toLowerCase())) {
+ log("Using previous autocomplete result");
+
+ // We have a list of results for a shorter search string, so just
+ // filter them further based on the new search string.
+ logins = previousResult.logins;
+ } else {
+ log("Creating new autocomplete search result.");
+
+ // Grab the logins from the database.
+ logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
+ }
+
+ let matchingLogins = logins.filter(function(fullMatch) {
+ let match = fullMatch.username;
+
+ // Remove results that are too short, or have different prefix.
+ // Also don't offer empty usernames as possible results.
+ return match && match.toLowerCase().startsWith(searchStringLower);
+ });
+
+ // XXX In the E10S case, we're responsible for showing our own
+ // autocomplete popup here because the autocomplete protocol hasn't
+ // been e10s-ized yet. In the non-e10s case, our caller is responsible
+ // for showing the autocomplete popup (via the regular
+ // nsAutoCompleteController).
+ if (remote) {
+ result = new UserAutoCompleteResult(searchString, matchingLogins);
+ AutoCompleteE10S.showPopupWithResults(target.ownerDocument.defaultView, rect, result);
+ }
+
+ return Promise.resolve(matchingLogins);
+
+ target.messageManager.sendAsyncMessage("RemoteLogins:loginsAutoCompleted",
+ { requestId: requestId,
+ logins: matchingLogins });
+ },
+
_autoCompleteSearchAsync: function(aSearchString, aPreviousResult,
aElement, aRect) {
let doc = aElement.ownerDocument;
@@ -209,7 +257,7 @@ var LoginManagerContent = {
let formOrigin = LoginUtils._getPasswordOrigin(doc.documentURI);
let actionOrigin = LoginUtils._getActionOrigin(form);
- let messageManager = messageManagerFromWindow(win);
+ //let messageManager = messageManagerFromWindow(win);
let remote = (Services.appinfo.processType ===
Services.appinfo.PROCESS_TYPE_CONTENT);
@@ -222,6 +270,7 @@ var LoginManagerContent = {
rect: aRect,
remote: remote };
+ return this.doAutocompleteSearch(messageData);
return this._sendRequest(messageManager, requestData,
"RemoteLogins:autoCompleteLogins",
messageData);
@@ -238,7 +287,7 @@ var LoginManagerContent = {
let form = event.target;
let doc = form.ownerDocument;
- let win = doc.defaultView;
+ /*let win = doc.defaultView;
let messageManager = messageManagerFromWindow(win);
messageManager.sendAsyncMessage("LoginStats:LoginEncountered");
@@ -248,7 +297,49 @@ var LoginManagerContent = {
log("onFormPassword for", form.ownerDocument.documentURI);
this._asyncFindLogins(form, { showMasterPassword: true })
.then(this.loginsFound.bind(this))
- .then(null, Cu.reportError);
+ .then(null, Cu.reportError);*/
+
+ log("onFormPassword for", doc.documentURI);
+
+ // If there are no logins for this site, bail out now.
+ let formOrigin = LoginUtils._getPasswordOrigin(doc.documentURI);
+ if (!Services.logins.countLogins(formOrigin, "", null))
+ return;
+
+ // If we're currently displaying a master password prompt, defer
+ // processing this form until the user handles the prompt.
+ if (Services.logins.uiBusy) {
+ log("deferring onFormPassword for", doc.documentURI);
+ let self = this;
+ let observer = {
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
+
+ observe: function (subject, topic, data) {
+ log("Got deferred onFormPassword notification:", topic);
+ // Only run observer once.
+ Services.obs.removeObserver(this, "passwordmgr-crypto-login");
+ Services.obs.removeObserver(this, "passwordmgr-crypto-loginCanceled");
+ if (topic == "passwordmgr-crypto-loginCanceled")
+ return;
+ self.onFormPassword(event);
+ },
+ handleEvent : function (event) {
+ // Not expected to be called
+ }
+ };
+ // Trickyness follows: We want an observer, but don't want it to
+ // cause leaks. So add the observer with a weak reference, and use
+ // a dummy event listener (a strong reference) to keep it alive
+ // until the form is destroyed.
+ Services.obs.addObserver(observer, "passwordmgr-crypto-login", true);
+ Services.obs.addObserver(observer, "passwordmgr-crypto-loginCanceled", true);
+ form.addEventListener("mozCleverClosureHack", observer);
+ return;
+ }
+
+ let autofillForm = gAutofillForms && !PrivateBrowsingUtils.isWindowPrivate(doc.defaultView);
+
+ this._fillForm(form, autofillForm, false, false, null);
},
loginsFound: function({ form, loginsFound }) {
@@ -296,11 +387,18 @@ var LoginManagerContent = {
var [usernameField, passwordField, ignored] =
this._getFormFields(acForm, false);
if (usernameField == acInputField && passwordField) {
- this._asyncFindLogins(acForm, { showMasterPassword: false })
+ /*this._asyncFindLogins(acForm, { showMasterPassword: false })
.then(({ form, loginsFound }) => {
this._fillForm(form, true, true, true, loginsFound);
})
- .then(null, Cu.reportError);
+ .then(null, Cu.reportError);*/
+
+ // If the user has a master password but itsn't logged in, bail
+ // out now to prevent annoying prompts.
+ if (!Services.logins.isLoggedIn)
+ return;
+
+ this._fillForm(acForm, true, true, true, null);
} else {
// Ignore the event, it's for some input we don't care about.
}
@@ -483,6 +581,13 @@ var LoginManagerContent = {
* our stored password.
*/
_onFormSubmit : function (form) {
+ // For E10S this will need to move.
+ function getPrompter(aWindow) {
+ var prompterSvc = Cc["@mozilla.org/login-manager/prompter;1"].
+ createInstance(Ci.nsILoginManagerPrompter);
+ prompterSvc.init(aWindow);
+ return prompterSvc;
+ }
var doc = form.ownerDocument;
var win = doc.defaultView;
@@ -534,7 +639,7 @@ var LoginManagerContent = {
return;
}
- // Don't try to send DOM nodes over IPC.
+ /* // Don't try to send DOM nodes over IPC.
let mockUsername = usernameField ?
{ name: usernameField.name,
value: usernameField.value } :
@@ -556,7 +661,106 @@ var LoginManagerContent = {
usernameField: mockUsername,
newPasswordField: mockPassword,
oldPasswordField: mockOldPassword },
- { openerWin: opener });
+ { openerWin: opener });*/
+
+ if (!Services.logins.getLoginSavingEnabled(hostname)) {
+ log("(form submission ignored -- saving is disabled for:", hostname, ")");
+ return;
+ }
+
+ var formLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
+ createInstance(Ci.nsILoginInfo);
+ formLogin.init(hostname, formSubmitURL, null,
+ (usernameField ? usernameField.value : ""),
+ newPasswordField.value,
+ (usernameField ? usernameField.name : ""),
+ newPasswordField.name);
+
+ // If we didn't find a username field, but seem to be changing a
+ // password, allow the user to select from a list of applicable
+ // logins to update the password for.
+ if (!usernameField && oldPasswordField) {
+
+ var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
+
+ if (logins.length == 0) {
+ // Could prompt to save this as a new password-only login.
+ // This seems uncommon, and might be wrong, so ignore.
+ log("(no logins for this host -- pwchange ignored)");
+ return;
+ }
+
+ var prompter = getPrompter(win);
+
+ if (logins.length == 1) {
+ var oldLogin = logins[0];
+ formLogin.username = oldLogin.username;
+ formLogin.usernameField = oldLogin.usernameField;
+
+ prompter.promptToChangePassword(oldLogin, formLogin);
+ } else {
+ prompter.promptToChangePasswordWithUsernames(
+ logins, logins.length, formLogin);
+ }
+
+ return;
+ }
+
+
+ // Look for an existing login that matches the form login.
+ var existingLogin = null;
+ var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
+
+ for (var i = 0; i < logins.length; i++) {
+ var same, login = logins[i];
+
+ // If one login has a username but the other doesn't, ignore
+ // the username when comparing and only match if they have the
+ // same password. Otherwise, compare the logins and match even
+ // if the passwords differ.
+ if (!login.username && formLogin.username) {
+ var restoreMe = formLogin.username;
+ formLogin.username = "";
+ same = formLogin.matches(login, false);
+ formLogin.username = restoreMe;
+ } else if (!formLogin.username && login.username) {
+ formLogin.username = login.username;
+ same = formLogin.matches(login, false);
+ formLogin.username = ""; // we know it's always blank.
+ } else {
+ same = formLogin.matches(login, true);
+ }
+
+ if (same) {
+ existingLogin = login;
+ break;
+ }
+ }
+
+ if (existingLogin) {
+ log("Found an existing login matching this form submission");
+
+ // Change password if needed.
+ if (existingLogin.password != formLogin.password) {
+ log("...passwords differ, prompting to change.");
+ prompter = getPrompter(win);
+ prompter.promptToChangePassword(existingLogin, formLogin);
+ } else {
+ // Update the lastUsed timestamp.
+ var propBag = Cc["@mozilla.org/hash-property-bag;1"].
+ createInstance(Ci.nsIWritablePropertyBag);
+ propBag.setProperty("timeLastUsed", Date.now());
+ propBag.setProperty("timesUsedIncrement", 1);
+ Services.logins.modifyLogin(existingLogin, propBag);
+ }
+
+ return;
+ }
+
+
+ // Prompt user to save login (via dialog or notification bar)
+ prompter = getPrompter(win);
+ prompter.promptToSavePassword(formLogin);
},
/*
@@ -598,6 +802,17 @@ var LoginManagerContent = {
autofillResultHist.add(result);
}
+ // Need to get a list of logins if we weren't given them
+ if (foundLogins == null) {
+ var formOrigin =
+ LoginUtils._getPasswordOrigin(form.ownerDocument.documentURI);
+ var actionOrigin = LoginUtils._getActionOrigin(form);
+ foundLogins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
+ log("found", foundLogins.length, "matching logins.");
+ } else {
+ log("reusing logins from last form.");
+ }
+
// Nothing to do if we have no matching logins available.
if (foundLogins.length == 0) {
// We don't log() here since this is a very common case.
@@ -788,8 +1003,8 @@ var LoginManagerContent = {
recordAutofillResult(AUTOFILL_RESULT.FILLED);
let doc = form.ownerDocument;
let win = doc.defaultView;
- let messageManager = messageManagerFromWindow(win);
- messageManager.sendAsyncMessage("LoginStats:LoginFillSuccessful");
+ //let messageManager = messageManagerFromWindow(win);
+ //messageManager.sendAsyncMessage("LoginStats:LoginFillSuccessful");
} else {
let autofillResult = AUTOFILL_RESULT.UNKNOWN_FAILURE;
switch (didntFillReason) {
diff --git a/toolkit/components/places/nsFaviconService.cpp b/toolkit/components/places/nsFaviconService.cpp
index b46f1b1d0..d627fb06d 100644
--- a/toolkit/components/places/nsFaviconService.cpp
+++ b/toolkit/components/places/nsFaviconService.cpp
@@ -36,7 +36,7 @@
#include "imgIContainer.h"
// Default value for mOptimizedIconDimension
-#define OPTIMIZED_FAVICON_DIMENSION 16
+#define OPTIMIZED_FAVICON_DIMENSION 32
#define MAX_FAILED_FAVICONS 256
#define FAVICON_CACHE_REDUCE_COUNT 64
@@ -626,3 +626,88 @@ ExpireFaviconsStatementCallbackNotifier::HandleCompletion(uint16_t aReason)
return NS_OK;
}
+
+NS_IMETHODIMP
+nsFaviconService::GetFaviconForPage(nsIURI* aPageURI, nsIURI** _retval)
+{
+ NS_ENSURE_ARG(aPageURI);
+ NS_ENSURE_ARG_POINTER(_retval);
+
+ nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
+ "SELECT f.id, f.url, length(f.data), f.expiration "
+ "FROM moz_places h "
+ "JOIN moz_favicons f ON h.favicon_id = f.id "
+ "WHERE h.url = :page_url "
+ "LIMIT 1"
+ );
+ NS_ENSURE_STATE(stmt);
+ mozStorageStatementScoper scoper(stmt);
+
+ nsresult rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("page_url"), aPageURI);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ bool hasResult;
+ if (NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)) && hasResult) {
+ nsCString url;
+ rv = stmt->GetUTF8String(1, url);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ return NS_NewURI(_retval, url);
+ }
+ return NS_ERROR_NOT_AVAILABLE;
+}
+
+NS_IMETHODIMP
+nsFaviconService::GetFaviconData(nsIURI* aFaviconURI, nsACString& aMimeType,
+ uint32_t* aDataLen, uint8_t** aData)
+{
+ NS_ENSURE_ARG(aFaviconURI);
+ NS_ENSURE_ARG_POINTER(aDataLen);
+ NS_ENSURE_ARG_POINTER(aData);
+
+ nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
+ "SELECT f.data, f.mime_type FROM moz_favicons f WHERE url = :icon_url"
+ );
+ NS_ENSURE_STATE(stmt);
+ mozStorageStatementScoper scoper(stmt);
+
+ nsresult rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("icon_url"), aFaviconURI);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ bool hasResult = false;
+ if (NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)) && hasResult) {
+ rv = stmt->GetUTF8String(1, aMimeType);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ bool isNull;
+ rv = stmt->GetIsNull(0, &isNull);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+
+ if (!isNull) return stmt->GetBlob(0, aDataLen, aData);
+ }
+
+ stmt = mDB->GetStatement(
+ "SELECT f.data, f.mime_type "
+ "FROM moz_places h "
+ "JOIN moz_favicons f ON h.favicon_id = f.id "
+ "WHERE h.url = :page_url "
+ "LIMIT 1"
+ );
+ NS_ENSURE_STATE(stmt);
+ mozStorageStatementScoper scoper2(stmt);
+
+ rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("page_url"), aFaviconURI);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)) && hasResult) {
+ rv = stmt->GetUTF8String(1, aMimeType);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ bool isNull;
+ rv = stmt->GetIsNull(0, &isNull);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+
+ if (!isNull) return stmt->GetBlob(0, aDataLen, aData);
+ }
+ return NS_ERROR_NOT_AVAILABLE;
+}
diff --git a/toolkit/components/places/nsIFaviconService.idl b/toolkit/components/places/nsIFaviconService.idl
index b70067ed0..93a840814 100644
--- a/toolkit/components/places/nsIFaviconService.idl
+++ b/toolkit/components/places/nsIFaviconService.idl
@@ -86,6 +86,14 @@ interface nsIFaviconService : nsISupports
* The default favicon URI
*/
readonly attribute nsIURI defaultFavicon;
+
+ nsIURI getFaviconForPage(in nsIURI aPageURI);
+
+ void getFaviconData(in nsIURI aFaviconURI,
+ out AUTF8String aMimeType,
+ [optional] out unsigned long aDataLen,
+ [array,retval,size_is(aDataLen)] out octet aData);
+
};
[scriptable, function, uuid(c85e5c82-b70f-4621-9528-beb2aa47fb44)]
diff --git a/toolkit/components/processsingleton/MainProcessSingleton.js b/toolkit/components/processsingleton/MainProcessSingleton.js
index 9ce421395..9b8549e95 100644
--- a/toolkit/components/processsingleton/MainProcessSingleton.js
+++ b/toolkit/components/processsingleton/MainProcessSingleton.js
@@ -79,13 +79,13 @@ MainProcessSingleton.prototype = {
// before other frame scripts.
Services.mm.loadFrameScript("chrome://global/content/browser-content.js", true);
Services.ppmm.addMessageListener("Console:Log", this.logConsoleMessage);
- Services.mm.addMessageListener("Search:AddEngine", this.addSearchEngine);
+ Services.ppmm.addMessageListener("Search:AddEngine", this.addSearchEngine);
break;
}
case "xpcom-shutdown":
Services.ppmm.removeMessageListener("Console:Log", this.logConsoleMessage);
- Services.mm.removeMessageListener("Search:AddEngine", this.addSearchEngine);
+ Services.ppmm.removeMessageListener("Search:AddEngine", this.addSearchEngine);
break;
}
},
diff --git a/toolkit/components/search/nsSidebar.js b/toolkit/components/search/nsSidebar.js
index b2a47cf32..082e80ea5 100644
--- a/toolkit/components/search/nsSidebar.js
+++ b/toolkit/components/search/nsSidebar.js
@@ -16,10 +16,8 @@ function nsSidebar() {
nsSidebar.prototype = {
init: function(window) {
this.window = window;
- this.mm = window.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDocShell)
- .QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIContentFrameMessageManager);
+ this.mm = Components.classes["@mozilla.org/childprocessmessagemanager;1"]
+ .getService(Ci.nsISyncMessageSender);
},
// The suggestedTitle and suggestedCategory parameters are ignored, but remain
@@ -45,7 +43,7 @@ nsSidebar.prototype = {
pageURL: this.window.document.documentURIObject.spec,
engineURL,
type: Ci.nsISearchEngine.DATA_XML
- });
+ },{win:this.window});
},
// This function exists to implement window.external.IsSearchProviderInstalled(),
diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js
index 730515e53..860fa05de 100644
--- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
+++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
@@ -221,6 +221,15 @@ nsUnknownContentTypeDialog.prototype = {
parent = aContext.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
} catch (ex) {}
+ if(!parent) {
+ // K-Meleon hack!!
+ try {
+ var jsb = Components.classes["@kmeleon/jsbridge;1"].getService(Components.interfaces["nsIJSBridge"]);
+ var wb = jsb.Open("about:blank",4); //4=newbgtab
+ parent = wb.contentDOMWindow;
+ } catch (ex) {}
+ }
+
if (parent) {
gDownloadLastDir = new downloadModule.DownloadLastDir(parent);
} else {
@@ -974,6 +983,8 @@ nsUnknownContentTypeDialog.prototype = {
// Unhook dialog from this object.
this.mDialog.dialog = null;
+ this.cleanUp();
+
// Close up dialog by returning true.
return true;
},
@@ -992,10 +1003,24 @@ nsUnknownContentTypeDialog.prototype = {
// Unhook dialog from this object.
this.mDialog.dialog = null;
+ this.cleanUp();
+
// Close up dialog by returning true.
return true;
},
+ cleanUp: function() {
+ // If the window that launched the download is "about:blank"
+ // then we need to close it.
+ let parent;
+ try {
+ parent = aContext.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);