updated on Tue Jan 10 04:01:21 UTC 2012
[aur-mirror.git] / xulrunner-thai / xulrunner-1.8.0.2.patch
blob3cb0c4f64ed6013e3fc54630271cec3848842342
1 diff -uprN --exclude=CVS mozilla/build/autoconf/mozconfig2client-mk mozilla.new/build/autoconf/mozconfig2client-mk
2 --- mozilla/build/autoconf/mozconfig2client-mk 2004-04-18 16:17:09.000000000 +0200
3 +++ mozilla.new/build/autoconf/mozconfig2client-mk 2006-02-24 11:16:26.000000000 +0100
4 @@ -58,6 +58,10 @@ ac_add_options() {
5 echo "# $* is used by configure (not client.mk)" >> $tmp_file
8 +ac_add_app_options() {
9 + echo "# $* is used by configure (not client.mk)" >> $tmp_file
12 mk_add_options() {
13 for _opt
15 diff -uprN --exclude=CVS mozilla/build/autoconf/mozconfig2configurator mozilla.new/build/autoconf/mozconfig2configurator
16 --- mozilla/build/autoconf/mozconfig2configurator 2004-04-18 16:17:09.000000000 +0200
17 +++ mozilla.new/build/autoconf/mozconfig2configurator 1970-01-01 01:00:00.000000000 +0100
18 @@ -1,87 +0,0 @@
19 -#! /bin/sh
21 -# ***** BEGIN LICENSE BLOCK *****
22 -# Version: MPL 1.1/GPL 2.0/LGPL 2.1
24 -# The contents of this file are subject to the Mozilla Public License Version
25 -# 1.1 (the "License"); you may not use this file except in compliance with
26 -# the License. You may obtain a copy of the License at
27 -# http://www.mozilla.org/MPL/
29 -# Software distributed under the License is distributed on an "AS IS" basis,
30 -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
31 -# for the specific language governing rights and limitations under the
32 -# License.
34 -# The Original Code is mozilla.org code.
36 -# The Initial Developer of the Original Code is
37 -# Netscape Communications Corporation.
38 -# Portions created by the Initial Developer are Copyright (C) 1999
39 -# the Initial Developer. All Rights Reserved.
41 -# Contributor(s):
42 -# Stephen Lamm (slamm@netscape.com)
44 -# Alternatively, the contents of this file may be used under the terms of
45 -# either of the GNU General Public License Version 2 or later (the "GPL"),
46 -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
47 -# in which case the provisions of the GPL or the LGPL are applicable instead
48 -# of those above. If you wish to allow use of your version of this file only
49 -# under the terms of either the GPL or the LGPL, and not to allow others to
50 -# use your version of this file under the terms of the MPL, indicate your
51 -# decision by deleting the provisions above and replace them with the notice
52 -# and other provisions required by the GPL or the LGPL. If you do not delete
53 -# the provisions above, a recipient may use your version of this file under
54 -# the terms of any one of the MPL, the GPL or the LGPL.
56 -# ***** END LICENSE BLOCK *****
58 -# mozconfig2configurator - Translates .mozconfig into options for
59 -# the online configurator,
61 -# http://webtools.mozilla.org/build/config.cgi
62 -#
63 -# This is called by the 'webconfig' target of mozilla/client.mk
66 -ac_add_options() {
67 - for _opt
68 - do
69 - # Escape special url characters
70 - _opt=`echo $_opt | sed -e 's/%/%25/g;s/ /%20/g;s/&/%26/g;'`
71 - case "$_opt" in
72 - --*-*= ) url="$url$_opt&" ;;
73 - --*-* ) url="$url$_opt=yes&" ;;
74 - esac
75 - done
78 -mk_add_options() {
79 - for _opt
80 - do
81 - # Escape special url characters
82 - # Escape special url characters
83 - _opt=`echo $_opt | sed -e 's/%/%25/g;s/ /%20/g;s/&/%26/g;'`
84 - url="$url$_opt&"
85 - done
89 -# main
92 -# find-mozconfig.sh
93 -# In params: $MOZCONFIG $HOME ($MOZ_MYCONFIG)
94 -scriptdir=`dirname $0`
95 -MOZCONFIG=`$scriptdir/mozconfig-find $topsrcdir`
97 -if [ "$MOZCONFIG" ]
98 -then
99 - url="http://webtools.mozilla.org/build/config.cgi?"
100 - . $MOZCONFIG
102 - # Drop the last character of $url
103 - echo `expr "$url" : "\(.*\)."`
106 diff -uprN --exclude=CVS mozilla/build/autoconf/mozconfig2configure mozilla.new/build/autoconf/mozconfig2configure
107 --- mozilla/build/autoconf/mozconfig2configure 2005-06-29 05:51:42.000000000 +0200
108 +++ mozilla.new/build/autoconf/mozconfig2configure 2006-02-24 11:16:26.000000000 +0100
109 @@ -76,6 +76,14 @@ ac_add_options() {
110 done
113 +ac_add_app_options() {
114 + APP=$1
115 + shift;
116 + if [ "$APP" == "$MOZ_BUILD_APP" ]; then
117 + ac_add_options "$*";
118 + fi
121 mk_add_options() {
122 # These options are for client.mk
123 # configure can safely ignore them.
124 diff -uprN --exclude=CVS mozilla/build/macosx/universal/fix-buildconfig mozilla.new/build/macosx/universal/fix-buildconfig
125 --- mozilla/build/macosx/universal/fix-buildconfig 1970-01-01 01:00:00.000000000 +0100
126 +++ mozilla.new/build/macosx/universal/fix-buildconfig 2006-02-22 05:02:32.000000000 +0100
127 @@ -0,0 +1,142 @@
128 +#!/usr/bin/perl
129 +# ***** BEGIN LICENSE BLOCK *****
130 +# Version: MPL 1.1/GPL 2.0/LGPL 2.1
132 +# The contents of this file are subject to the Mozilla Public License Version
133 +# 1.1 (the "License"); you may not use this file except in compliance with
134 +# the License. You may obtain a copy of the License at
135 +# http://www.mozilla.org/MPL/
137 +# Software distributed under the License is distributed on an "AS IS" basis,
138 +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
139 +# for the specific language governing rights and limitations under the
140 +# License.
142 +# The Original Code is the Mozilla Mac OS X Universal Binary Packaging System
144 +# The Initial Developer of the Original Code is Google Inc.
145 +# Portions created by the Initial Developer are Copyright (C) 2006
146 +# the Initial Developer. All Rights Reserved.
148 +# Contributor(s):
149 +# Mark Mentovai <mark@moxienet.com> (Original Author)
151 +# Alternatively, the contents of this file may be used under the terms of
152 +# either the GNU General Public License Version 2 or later (the "GPL"), or
153 +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
154 +# in which case the provisions of the GPL or the LGPL are applicable instead
155 +# of those above. If you wish to allow use of your version of this file only
156 +# under the terms of either the GPL or the LGPL, and not to allow others to
157 +# use your version of this file under the terms of the MPL, indicate your
158 +# decision by deleting the provisions above and replace them with the notice
159 +# and other provisions required by the GPL or the LGPL. If you do not delete
160 +# the provisions above, a recipient may use your version of this file under
161 +# the terms of any one of the MPL, the GPL or the LGPL.
163 +# ***** END LICENSE BLOCK *****
165 +use strict;
166 +use warnings;
168 +use Archive::Zip(':ERROR_CODES');
170 +my ($BUILDCONFIG);
172 +sub fixBuildconfig($$);
174 +$BUILDCONFIG = 'content/global/buildconfig.html';
176 +if (scalar(@ARGV) != 2) {
177 + print STDERR ("usage: fix-buildconfig <zipfile1> <zipfile2>\n");
178 + exit(1);
181 +if (!fixBuildconfig($ARGV[0], $ARGV[1])) {
182 + exit(1);
185 +exit(0);
187 +sub fixBuildconfig($$) {
188 + my ($zipPath1, $zipPath2);
189 + ($zipPath1, $zipPath2) = @_;
191 + my ($ze, $zip1, $zip2);
193 + $zip1 = Archive::Zip->new();
194 + if (($ze = $zip1->read($zipPath1)) != AZ_OK) {
195 + print STDERR ($0.': could not read "'.$zipPath1.'": error '.$ze."\n");
196 + return 0;
198 + $zip2 = Archive::Zip->new();
199 + if (($ze = $zip2->read($zipPath2)) != AZ_OK) {
200 + print STDERR ($0.': could not read "'.$zipPath2.'": error '.$ze."\n");
201 + return 0;
204 + my ($contents1, $contents2);
205 + if (!defined($contents1 = $zip1->contents($BUILDCONFIG))) {
206 + print STDERR ($0.': could not get "'.$BUILDCONFIG.'" from "'.$zipPath1.'"'.
207 + "\n");
208 + return 0;
210 + if (!defined($contents2 = $zip2->contents($BUILDCONFIG))) {
211 + print STDERR ($0.': could not get "'.$BUILDCONFIG.'" from "'.$zipPath2.'"'.
212 + "\n");
213 + return 0;
216 + my (@lines1, @lines2);
217 + @lines1 = split(/\n/, $contents1);
218 + @lines2 = split(/\n/, $contents2);
220 + my ($line, @linesNew);
221 + @linesNew = ();
223 + # Copy everything from the first file up to the end of its <body>.
224 + while ($line = shift(@lines1)) {
225 + if ($line eq '</body>') {
226 + last;
228 + push(@linesNew, $line);
231 + # Insert a <hr> between the two files.
232 + push (@linesNew, '<hr> </hr>');
234 + # Copy the second file's content beginning after its leading <h1> and <p>.
235 + while ($line = shift(@lines2)) {
236 + if ($line eq '<p> </p>') {
237 + last;
240 + while ($line = shift(@lines2)) {
241 + push(@linesNew, $line);
244 + my ($contentsNew);
245 + $contentsNew = join("\n", @linesNew);
247 + if (!defined($zip1->contents($BUILDCONFIG, $contentsNew))) {
248 + print STDERR ($0.': could not set "'.$BUILDCONFIG.'" to "'.$zipPath1.'"'.
249 + "\n");
250 + return 0;
252 + if (!defined($zip2->contents($BUILDCONFIG, $contentsNew))) {
253 + print STDERR ($0.': could not set "'.$BUILDCONFIG.'" to "'.$zipPath2.'"'.
254 + "\n");
255 + return 0;
259 + if (($ze = $zip1->overwrite()) != AZ_OK) {
260 + print STDERR ($0.': could not write "'.$zipPath1.'": error '.$ze."\n");
261 + return 0;
263 + if (($ze = $zip2->overwrite()) != AZ_OK) {
264 + print STDERR ($0.': could not write "'.$zipPath2.'": error '.$ze."\n");
265 + return 0;
268 + return 1;
270 diff -uprN --exclude=CVS mozilla/build/macosx/universal/flight.mk mozilla.new/build/macosx/universal/flight.mk
271 --- mozilla/build/macosx/universal/flight.mk 1970-01-01 01:00:00.000000000 +0100
272 +++ mozilla.new/build/macosx/universal/flight.mk 2006-02-22 18:32:41.000000000 +0100
273 @@ -0,0 +1,105 @@
274 +# ***** BEGIN LICENSE BLOCK *****
275 +# Version: MPL 1.1/GPL 2.0/LGPL 2.1
277 +# The contents of this file are subject to the Mozilla Public License Version
278 +# 1.1 (the "License"); you may not use this file except in compliance with
279 +# the License. You may obtain a copy of the License at
280 +# http://www.mozilla.org/MPL/
282 +# Software distributed under the License is distributed on an "AS IS" basis,
283 +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
284 +# for the specific language governing rights and limitations under the
285 +# License.
287 +# The Original Code is the Mozilla Mac OS X Universal Binary Packaging System
289 +# The Initial Developer of the Original Code is Google Inc.
290 +# Portions created by the Initial Developer are Copyright (C) 2006
291 +# the Initial Developer. All Rights Reserved.
293 +# Contributor(s):
294 +# Mark Mentovai <mark@moxienet.com> (Original Author)
296 +# Alternatively, the contents of this file may be used under the terms of
297 +# either the GNU General Public License Version 2 or later (the "GPL"), or
298 +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
299 +# in which case the provisions of the GPL or the LGPL are applicable instead
300 +# of those above. If you wish to allow use of your version of this file only
301 +# under the terms of either the GPL or the LGPL, and not to allow others to
302 +# use your version of this file under the terms of the MPL, indicate your
303 +# decision by deleting the provisions above and replace them with the notice
304 +# and other provisions required by the GPL or the LGPL. If you do not delete
305 +# the provisions above, a recipient may use your version of this file under
306 +# the terms of any one of the MPL, the GPL or the LGPL.
308 +# ***** END LICENSE BLOCK *****
310 +# BE CAREFUL! This makefile handles a postflight_all rule for a
311 +# multi-project build, so DON'T rely on anything that might differ between
312 +# the two OBJDIRs.
314 +ifndef OBJDIR
315 +OBJDIR_PPC = $(MOZ_OBJDIR)/ppc
316 +OBJDIR_X86 = $(MOZ_OBJDIR)/i386
317 +DIST_PPC = $(OBJDIR_PPC)/dist
318 +DIST_X86 = $(OBJDIR_X86)/dist
319 +DIST_UNI = $(DIST_PPC)/universal
320 +OBJDIR = $(OBJDIR_PPC)
321 +endif
323 +include $(OBJDIR)/config/autoconf.mk
325 +DIST = $(OBJDIR)/dist
327 +ifeq ($(MOZ_BUILD_APP),macbrowser)
328 +INSTALLER_DIR = camino/installer
329 +MOZ_PKG_APPNAME = camino
330 +APPNAME_BASE = Camino
331 +BUILDCONFIG_JAR = Contents/MacOS/chrome/embed.jar
332 +else
333 +ifeq ($(MOZ_BUILD_APP),suite)
334 +INSTALLER_DIR = xpinstall/packager
335 +else
336 +INSTALLER_DIR = $(MOZ_BUILD_APP)/installer
337 +endif
338 +MOZ_PKG_APPNAME = $(MOZ_APP_NAME)
339 +APPNAME_BASE = $(MOZ_APP_DISPLAYNAME)
340 +BUILDCONFIG_JAR = Contents/MacOS/chrome/toolkit.jar
341 +endif
343 +ifdef MOZ_DEBUG
344 +APPNAME = $(APPNAME_BASE)Debug
345 +else
346 +APPNAME = $(APPNAME_BASE)
347 +endif
349 +postflight_all:
350 +# Build the universal package out of only the bits that would be released.
351 +# Call the packager to set this up. Set UNIVERSAL_BINARY= to avoid producing
352 +# a universal binary too early, before the unified bits have been staged.
353 +# Set MAKE_PACKAGE= to avoid building a dmg. Set SIGN_NSS= to skip shlibsign.
354 + $(MAKE) -C $(OBJDIR_PPC)/$(INSTALLER_DIR) \
355 + UNIVERSAL_BINARY= MAKE_PACKAGE= SIGN_NSS=
356 + $(MAKE) -C $(OBJDIR_X86)/$(INSTALLER_DIR) \
357 + UNIVERSAL_BINARY= MAKE_PACKAGE= SIGN_NSS=
358 +# Remove .chk files that may have been copied from the NSS build. These will
359 +# cause unify to warn or fail if present. New .chk files that are
360 +# appropriate for the merged libraries will be generated when the universal
361 +# dmg is built.
362 + rm -f $(DIST_PPC)/$(MOZ_PKG_APPNAME)/$(APPNAME).app/Contents/MacOS/*.chk \
363 + $(DIST_X86)/$(MOZ_PKG_APPNAME)/$(APPNAME).app/Contents/MacOS/*.chk
364 +# The only difference betewen the two trees now should be the
365 +# about:buildconfig page. Fix it up.
366 + $(TOPSRCDIR)/build/macosx/universal/fix-buildconfig \
367 + $(DIST_PPC)/$(MOZ_PKG_APPNAME)/$(APPNAME).app/$(BUILDCONFIG_JAR) \
368 + $(DIST_X86)/$(MOZ_PKG_APPNAME)/$(APPNAME).app/$(BUILDCONFIG_JAR)
369 + mkdir -p $(DIST_UNI)/$(MOZ_PKG_APPNAME)
370 + rm -f $(DIST_X86)/universal
371 + ln -s $(DIST_UNI) $(DIST_X86)/universal
372 + rm -rf $(DIST_UNI)/$(MOZ_PKG_APPNAME)/$(APPNAME).app
373 + $(TOPSRCDIR)/build/macosx/universal/unify \
374 + $(DIST_PPC)/$(MOZ_PKG_APPNAME)/$(APPNAME).app \
375 + $(DIST_X86)/$(MOZ_PKG_APPNAME)/$(APPNAME).app \
376 + $(DIST_UNI)/$(MOZ_PKG_APPNAME)/$(APPNAME).app
377 +# A universal .dmg can now be produced by making in either architecture's
378 +# INSTALLER_DIR.
379 diff -uprN --exclude=CVS mozilla/build/macosx/universal/mozconfig mozilla.new/build/macosx/universal/mozconfig
380 --- mozilla/build/macosx/universal/mozconfig 1970-01-01 01:00:00.000000000 +0100
381 +++ mozilla.new/build/macosx/universal/mozconfig 2006-02-22 18:32:41.000000000 +0100
382 @@ -0,0 +1,102 @@
383 +# ***** BEGIN LICENSE BLOCK *****
384 +# Version: MPL 1.1/GPL 2.0/LGPL 2.1
386 +# The contents of this file are subject to the Mozilla Public License Version
387 +# 1.1 (the "License"); you may not use this file except in compliance with
388 +# the License. You may obtain a copy of the License at
389 +# http://www.mozilla.org/MPL/
391 +# Software distributed under the License is distributed on an "AS IS" basis,
392 +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
393 +# for the specific language governing rights and limitations under the
394 +# License.
396 +# The Original Code is the Mozilla Mac OS X Universal Binary Packaging System
398 +# The Initial Developer of the Original Code is Google Inc.
399 +# Portions created by the Initial Developer are Copyright (C) 2006
400 +# the Initial Developer. All Rights Reserved.
402 +# Contributor(s):
403 +# Mark Mentovai <mark@moxienet.com> (Original Author)
405 +# Alternatively, the contents of this file may be used under the terms of
406 +# either the GNU General Public License Version 2 or later (the "GPL"), or
407 +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
408 +# in which case the provisions of the GPL or the LGPL are applicable instead
409 +# of those above. If you wish to allow use of your version of this file only
410 +# under the terms of either the GPL or the LGPL, and not to allow others to
411 +# use your version of this file under the terms of the MPL, indicate your
412 +# decision by deleting the provisions above and replace them with the notice
413 +# and other provisions required by the GPL or the LGPL. If you do not delete
414 +# the provisions above, a recipient may use your version of this file under
415 +# the terms of any one of the MPL, the GPL or the LGPL.
417 +# ***** END LICENSE BLOCK *****
419 +# As used here, arguments in $MOZ_BUILD_PROJECTS are suitable as arguments
420 +# to gcc's -arch parameter.
421 +mk_add_options MOZ_BUILD_PROJECTS="ppc i386"
423 +mk_add_options MOZ_UNIFY_BDATE=1
425 +mk_add_options MOZ_POSTFLIGHT_ALL+=build/macosx/universal/flight.mk
427 +DARWIN_VERSION=`uname -r`
428 +ac_add_app_options ppc --target=powerpc-apple-darwin$DARWIN_VERSION
429 +ac_add_app_options i386 --target=i386-apple-darwin$DARWIN_VERSION
431 +# ppc builds run on older systems. The minimum SDK for x86 is 10.4u.
432 +ac_add_app_options ppc --with-macos-sdk=/Developer/SDKs/MacOSX10.2.8.sdk
433 +ac_add_app_options i386 --with-macos-sdk=/Developer/SDKs/MacOSX10.4u.sdk
435 +# $MOZ_BUILD_APP is only defined when sourced by configure. That's not a
436 +# problem, because the variables it affects only need to be set for
437 +# configure.
438 +if test -n "$MOZ_BUILD_APP" ; then
439 + TARGET_CPU=$MOZ_BUILD_APP
441 + # When compiling C++, Apple gcc 4.0 produces output that requires a minimum
442 + # of 10.3.9. Use 4.0 for the x86 build, which has a higher minimum than
443 + # that. Use 3.3 for ppc, which must run on older systems. This will
444 + # completely override the compiler selected with the gcc_select command.
445 + if test "$TARGET_CPU" = "ppc" ; then
446 + GCC_VERSION=3.3
447 + else
448 + GCC_VERSION=4.0
449 + fi
451 + # It's not strictly necessary to specify -arch during native builds, but it
452 + # makes the merged about:buildconfig easier to follow, and it reduces
453 + # conditionalized differences between builds.
454 + CC="gcc-$GCC_VERSION -arch $TARGET_CPU"
455 + CXX="g++-$GCC_VERSION -arch $TARGET_CPU"
457 + # $HOST_CXX is presently unused. $HOST_CC will only be used during a cross
458 + # compile. Always use the 4.0 compiler, since it will always be present and
459 + # will always work.
460 + HOST_CC=gcc-4.0
461 + HOST_CXX=g++-4.0
463 + # These must be set for cross builds, and don't hurt straight builds.
464 + RANLIB=ranlib
465 + AR=ar
466 + AS=$CC
467 + LD=ld
468 + STRIP="strip -x -S"
470 + NATIVE_CPU=`uname -p`
471 + if test "$NATIVE_CPU" = "powerpc" ; then
472 + NATIVE_CPU=ppc
473 + fi
475 + # Let configure know that we mean business.
476 + if test "$NATIVE_CPU" != "$TARGET_CPU" ; then
477 + CROSS_COMPILE=1
478 + fi
480 + # Each per-CPU build should be entirely oblivious to the fact that a
481 + # universal binary will be produced. The exception is packager.mk, which
482 + # needs to know to look for universal bits when building the .dmg.
483 + UNIVERSAL_BINARY=1
485 diff -uprN --exclude=CVS mozilla/build/macosx/universal/unify mozilla.new/build/macosx/universal/unify
486 --- mozilla/build/macosx/universal/unify 1970-01-01 01:00:00.000000000 +0100
487 +++ mozilla.new/build/macosx/universal/unify 2006-02-22 05:02:06.000000000 +0100
488 @@ -0,0 +1,1308 @@
489 +#!/usr/bin/perl
490 +# ***** BEGIN LICENSE BLOCK *****
491 +# Version: MPL 1.1/GPL 2.0/LGPL 2.1
493 +# The contents of this file are subject to the Mozilla Public License Version
494 +# 1.1 (the "License"); you may not use this file except in compliance with
495 +# the License. You may obtain a copy of the License at
496 +# http://www.mozilla.org/MPL/
498 +# Software distributed under the License is distributed on an "AS IS" basis,
499 +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
500 +# for the specific language governing rights and limitations under the
501 +# License.
503 +# The Original Code is the Mozilla Mac OS X Universal Binary Packaging System
505 +# The Initial Developer of the Original Code is Google Inc.
506 +# Portions created by the Initial Developer are Copyright (C) 2006
507 +# the Initial Developer. All Rights Reserved.
509 +# Contributor(s):
510 +# Mark Mentovai <mark@moxienet.com> (Original Author)
512 +# Alternatively, the contents of this file may be used under the terms of
513 +# either the GNU General Public License Version 2 or later (the "GPL"), or
514 +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
515 +# in which case the provisions of the GPL or the LGPL are applicable instead
516 +# of those above. If you wish to allow use of your version of this file only
517 +# under the terms of either the GPL or the LGPL, and not to allow others to
518 +# use your version of this file under the terms of the MPL, indicate your
519 +# decision by deleting the provisions above and replace them with the notice
520 +# and other provisions required by the GPL or the LGPL. If you do not delete
521 +# the provisions above, a recipient may use your version of this file under
522 +# the terms of any one of the MPL, the GPL or the LGPL.
524 +# ***** END LICENSE BLOCK *****
526 +use strict;
527 +use warnings;
529 +=pod
531 +=head1 NAME
533 +B<unify> - Mac OS X universal binary packager
535 +=head1 SYNOPSIS
537 +B<unify>
538 +I<ppc-path>
539 +I<x86-path>
540 +I<universal-path>
541 +[B<--dry-run>]
542 +[B<--only-one> I<action>]
543 +[B<--verbosity> I<level>]
545 +=head1 DESCRIPTION
547 +I<unify> merges any two architecture-specific files or directory trees
548 +into a single file or tree suitable for use on either architecture as a
549 +"fat" or "universal binary."
551 +Architecture-specific Mach-O files will be merged into fat Mach-O files
552 +using L<lipo(1)>. Non-Mach-O files in the architecture-specific trees
553 +are compared to ensure that they are equivalent before copying. Symbolic
554 +links are permitted in the architecture-specific trees and will cause
555 +identical links to be created in the merged tree, provided that the source
556 +links have identical targets. Directories are processed recursively.
558 +If the architecture-specific source trees contain zip archives (including
559 +jar files) that are not identical according to a byte-for-byte check, they
560 +are still assumed to be equivalent if both archives contain exactly the
561 +same members with identical checksums and sizes.
563 +Behavior when one architecture-specific tree contains files that the other
564 +does not is controlled by the B<--only-one> option.
566 +If Mach-O files cannot be merged using L<lipo(1)>, zip archives are not
567 +equivalent, regular files are not identical, or any other error occurs,
568 +B<unify> will fail with an exit status of 1. Diagnostic messages are
569 +typically printed to stderr; this behavior can be controlled with the
570 +B<--verbosity> option.
572 +=head1 OPTIONS
574 +=over 5
576 +=item I<ppc-path>
578 +=item I<x86-path>
580 +The paths to directory trees containing PowerPC and x86 builds,
581 +respectively. I<ppc-path> and I<x86-path> are permitted to contain files
582 +that are already "fat," and only the appropriate architecture's images will
583 +be used.
585 +I<ppc-path> and I<x86-path> are also permitted to both be files, in which
586 +case B<unify> operates solely on those files, and produces an appropriate
587 +merged file at I<target-path>.
589 +=item I<target-path>
591 +The path to the merged file or directory tree. This path will be created,
592 +and it must not exist prior to running B<unify>.
594 +=item B<--dry-run>
596 +When specified, the commands that would be executed are printed, without
597 +actually executing them. Note that B<--dry-run> and the equivalent
598 +B<--verbosity> level during "wet" runs may print equivalent commands when
599 +no commands are in fact executed: certain operations are handled internally
600 +within B<unify>, and an approximation of a command that performs a similar
601 +task is printed.
603 +=item B<--only-one> I<action>
605 +Controls handling of files that are only present in one of the two source
606 +trees. I<action> may be:
607 + skip - These files are skipped.
608 + copy - These files are copied from the tree in which they exist.
609 + fail - When this condition occurs, it is treated as an error.
611 +The default I<action> is copy.
613 +=item B<--verbosity> I<level>
615 +Adjusts the level of loudness of B<unify>. The possible values for
616 +I<level> are:
617 + 0 - B<unify> never prints anything.
618 + (Other programs that B<unify> calls may still print messages.)
619 + 1 - Fatal error messages are printed to stderr.
620 + 2 - Nonfatal warnings are printed to stderr.
621 + 3 - Commands are printed to stdout as they are executed.
623 +The default I<level> is 2.
625 +=back
627 +=head1 EXAMPLES
629 +=over 5
631 +=item Create a universal .app bundle from two architecture-specific .app
632 +bundles:
634 +unify --only-one copy ppc/dist/firefox/Firefox.app
635 + x86/dist/firefox/Firefox.app universal/Firefox.app
636 + --verbosity 3
638 +=item Merge two identical architecture-specific trees:
640 +unify --only-one fail /usr/local /nfs/x86/usr/local
641 + /tmp/usrlocal.fat
643 +=back
645 +=head1 REQUIREMENTS
647 +The only esoteric requirement of B<unify> is that the L<lipo(1)> command
648 +be available. It is present on Mac OS X systems at least as early as
649 +10.3.9, and probably earlier. Mac OS X 10.4 ("Tiger") or later are
650 +recommended.
652 +=head1 LICENSE
654 +MPL 1.1/GPL 2.0/LGPL 2.1. Your choice
656 +=head1 AUTHOR
658 +The software was initially written by Mark Mentovai; copyright 2006
659 +Google Inc.
661 +=head1 SEE ALSO
663 +L<cmp(1)>, L<ditto(1)>, L<lipo(1)>
665 +=cut
667 +use Archive::Zip(':ERROR_CODES');
668 +use Errno;
669 +use File::Compare;
670 +use File::Copy;
671 +use Getopt::Long;
673 +my (%gConfig, $gDryRun, $gOnlyOne, $gVerbosity);
675 +sub argumentEscape(@);
676 +sub command(@);
677 +sub compareZipArchives($$);
678 +sub complain($$@);
679 +sub copyIfIdentical($$$);
680 +sub makeUniversal($$$);
681 +sub makeUniversalDirectory($$$);
682 +sub makeUniversalInternal($$$$);
683 +sub makeUniversalFile($$$);
684 +sub usage();
685 +sub readZipCRCs($);
688 + package FileAttrCache;
690 + sub new($$);
692 + sub isFat($);
693 + sub isMachO($);
694 + sub isZip($);
695 + sub lIsDir($);
696 + sub lIsRegularFile($);
697 + sub lIsSymLink($);
698 + sub lstat($);
699 + sub lstatType($);
700 + sub magic($);
701 + sub path($);
702 + sub stat($);
703 + sub statSize($);
706 +%gConfig = (
707 + 'cmd_lipo' => 'lipo',
708 + 'cmd_rm' => 'rm',
711 +$gDryRun = 0;
712 +$gOnlyOne = 'copy';
713 +$gVerbosity = 2;
715 +Getopt::Long::Configure('pass_through');
716 +GetOptions('dry-run' => \$gDryRun,
717 + 'only-one=s' => \$gOnlyOne,
718 + 'verbosity=i' => \$gVerbosity,
719 + 'config=s' => \%gConfig); # "hidden" option not in usage()
721 +if (scalar(@ARGV) != 3 || $gVerbosity < 0 || $gVerbosity > 3 ||
722 + ($gOnlyOne ne 'skip' && $gOnlyOne ne 'copy' && $gOnlyOne ne 'fail')) {
723 + usage();
724 + exit(1);
727 +if (!makeUniversal($ARGV[0],$ARGV[1],$ARGV[2])) {
728 + # makeUniversal or something it called will have printed an error.
729 + exit(1);
732 +exit(0);
734 +# argumentEscape(@arguments)
736 +# Takes a list of @arguments and makes them shell-safe.
737 +sub argumentEscape(@) {
738 + my (@arguments);
739 + @arguments = @_;
741 + my ($argument, @argumentsOut);
742 + foreach $argument (@arguments) {
743 + $argument =~ s%([^A-Za-z0-9_\-/.=+,])%\\$1%g;
744 + push(@argumentsOut, $argument);
747 + return @argumentsOut;
750 +# command(@arguments)
752 +# Runs the specified command by calling system(@arguments). If $gDryRun
753 +# is true, the command is printed but not executed, and 0 is returned.
754 +# if $gVerbosity is greater than 1, the command is printed before being
755 +# executed. When the command is executed, the system() return value will
756 +# be returned. stdout and stderr are left connected for command output.
757 +sub command(@) {
758 + my (@arguments);
759 + @arguments = @_;
760 + if ($gVerbosity >= 3 || $gDryRun) {
761 + print(join(' ', argumentEscape(@arguments))."\n");
763 + if ($gDryRun) {
764 + return 0;
766 + return system(@arguments);
769 +# compareZipArchives($zip1, $zip2)
771 +# Given two pathnames to zip archives, determines whether or not they are
772 +# functionally identical. Returns true if they are, false if they differ in
773 +# some substantial way, and undef if an error occurs. If the zip files
774 +# differ, diagnostic messages are printed indicating how they differ.
776 +# Zip files will differ if any of the members are different as defined by
777 +# readZipCRCs, which consider CRCs, sizes, and file types as stored in the
778 +# file header. Timestamps are not considered. Zip files also differ if one
779 +# file contains members that the other one does not. $gOnlyOne has no
780 +# effect on this behavior.
781 +sub compareZipArchives($$) {
782 + my ($zip1, $zip2);
783 + ($zip1, $zip2) = @_;
785 + my ($CRCHash1, $CRCHash2);
786 + if (!defined($CRCHash1 = readZipCRCs($zip1))) {
787 + # readZipCRCs printed an error.
788 + return undef;
790 + if (!defined($CRCHash2 = readZipCRCs($zip2))) {
791 + # readZipCRCs printed an error.
792 + return undef;
795 + my (@diffCRCs, @onlyInZip1);
796 + @diffCRCs = ();
797 + @onlyInZip1 = ();
799 + my ($memberName);
800 + foreach $memberName (keys(%$CRCHash1)) {
801 + if (!exists($$CRCHash2{$memberName})) {
802 + # The member is present in $zip1 but not $zip2.
803 + push(@onlyInZip1, $memberName);
805 + elsif ($$CRCHash1{$memberName} ne $$CRCHash2{$memberName}) {
806 + # The member is present in both archives but its CRC or some other
807 + # other critical attribute isn't identical.
808 + push(@diffCRCs, $memberName);
810 + delete($$CRCHash2{$memberName});
813 + # If any members remain in %CRCHash2, it's because they're not present
814 + # in $zip1.
815 + my (@onlyInZip2);
816 + @onlyInZip2 = keys(%$CRCHash2);
818 + if (scalar(@onlyInZip1) + scalar(@onlyInZip2) + scalar(@diffCRCs)) {
819 + complain(1, 'compareZipArchives: zip archives differ:',
820 + $zip1,
821 + $zip2);
822 + if (scalar(@onlyInZip1)) {
823 + complain(1, 'compareZipArchives: members only in former:',
824 + @onlyInZip1);
826 + if (scalar(@onlyInZip2)) {
827 + complain(1, 'compareZipArchives: members only in latter:',
828 + @onlyInZip2);
830 + if (scalar(@diffCRCs)) {
831 + complain(1, 'compareZipArchives: members differ:',
832 + @diffCRCs);
834 + return 0;
837 + return 1;
840 +# complain($severity, $message, @list)
842 +# Prints $message to stderr if $gVerbosity allows it for severity level
843 +# $severity. @list is a list of words that will be shell-escaped and printed
844 +# after $message, one per line, intended to be used, for example, to list
845 +# arguments to a call that failed.
847 +# Expected severity levels are 1 for hard errors and 2 for non-fatal warnings.
849 +# Always returns false as a convenience, so callers can return complain's
850 +# return value when it is used to signal errors.
851 +sub complain($$@) {
852 + my ($severity, $message, @list);
853 + ($severity, $message, @list) = @_;
855 + if ($gVerbosity >= $severity) {
856 + print STDERR ($0.': '.$message."\n");
858 + my ($item);
859 + while ($item = shift(@list)) {
860 + print STDERR (' '.(argumentEscape($item))[0].
861 + (scalar(@list)?',':'')."\n");
865 + return 0;
868 +# copyIfIdentical($source1, $source2, $target)
870 +# $source1 and $source2 are FileAttrCache objects that are compared, and if
871 +# identical, copied to path string $target. The comparison is initially
872 +# done as a byte-for-byte comparison, but if the files differ and appear to
873 +# be zip archives, compareZipArchives is called to determine whether
874 +# files that are not byte-for-byte identical are equivalent archives.
876 +# Returns true on success, false for files that are not identical or
877 +# equivalent archives, and undef if an error occurs.
879 +# One of $source1 and $source2 is permitted to be undef. In this event,
880 +# whichever source is defined is copied directly to $target without performing
881 +# any comparisons. This enables the $gOnlyOne = 'copy' mode, which is
882 +# driven by makeUniversalDirectory and makeUniversalInternal.
883 +sub copyIfIdentical($$$) {
884 + my ($source1, $source2, $target);
885 + ($source1, $source2, $target) = @_;
887 + if (!defined($source1)) {
888 + # If there's only one source file, make it the first file. Order
889 + # isn't important here, and this makes it possible to use
890 + # defined($source2) as the switch, and to always copy from $source1.
891 + $source1 = $source2;
892 + $source2 = undef;
895 + if (defined($source2)) {
896 + # Only do the comparisons if there are two source files. If there's
897 + # only one source file, skip the comparisons and go straight to the
898 + # copy operation.
899 + if ($gVerbosity >= 3 || $gDryRun) {
900 + print('cmp -s '.
901 + join(' ',argumentEscape($source1->path(), $source2->path()))."\n");
903 + my ($comparison);
904 + if (!defined($comparison = compare($source1->path(), $source2->path())) ||
905 + $comparison == -1) {
906 + return complain(1, 'copyIfIdentical: compare: '.$!.' while comparing:',
907 + $source1->path(),
908 + $source2->path());
910 + elsif ($comparison != 0) {
911 + my ($zip1, $zip2);
912 + if (defined($zip1 = $source1->isZip()) &&
913 + defined($zip2 = $source2->isZip()) &&
914 + $zip1 && $zip2) {
915 + my ($zipComparison);
916 + if (!defined($zipComparison = compareZipArchives($source1->path(),
917 + $source2->path)) ||
918 + !$zipComparison) {
919 + # An error occurred or the zip files aren't sufficiently identical.
920 + # compareZipArchives will have printed an error message.
921 + return 0;
923 + # The zip files were compared successfully, and they both contain
924 + # all of the same members, and all of their members' CRCs are
925 + # identical. For the purposes of this script, the zip files can be
926 + # treated as identical, so reset $comparison.
927 + $comparison = 0;
930 + if ($comparison != 0) {
931 + return complain(1, 'copyIfIdentical: files differ:',
932 + $source1->path(),
933 + $source2->path());
937 + if ($gVerbosity >= 3 || $gDryRun) {
938 + print('cp '.
939 + join(' ',argumentEscape($source1->path(), $target))."\n");
941 + if (!$gDryRun && !copy($source1->path(), $target)) {
942 + return complain(1, 'copyIfIdentical: copy: '.$!.' while copying',
943 + $source1->path(),
944 + $target);
947 + return 1;
950 +# makeUniversal($pathPPC, $pathX86, $pathTarget)
952 +# The top-level call. $pathPPC, $pathX86, and $pathTarget are strings
953 +# identifying the ppc and x86 files or directories to merge and the location
954 +# to merge them to. Returns false on failure and true on success.
955 +sub makeUniversal($$$) {
956 + my ($pathTarget, $pathPPC, $pathX86);
957 + ($pathPPC, $pathX86, $pathTarget) = @_;
959 + my ($filePPC, $fileX86);
960 + $filePPC = FileAttrCache->new($pathPPC);
961 + $fileX86 = FileAttrCache->new($pathX86);
963 + return makeUniversalInternal(1, $filePPC, $fileX86, $pathTarget);
966 +# makeUniversalDirectory($dirPPC, $dirX86, $dirTarget)
968 +# This is part of the heart of recursion. $dirPPC and $dirX86 are
969 +# FileAttrCache objects designating the source ppc and x86 directories to
970 +# merge into a universal directory at $dirTarget, a string. For each file
971 +# in $dirPPC and $dirX86, makeUniversalInternal is called.
972 +# makeUniversalInternal will call back into makeUniversalDirectory for
973 +# directories, thus completing the recursion. If a failure is encountered
974 +# in ths function or in makeUniversalInternal or anything that it calls,
975 +# false is returned, otherwise, true is returned.
977 +# If there are files present in one source directory but not both, the
978 +# value of $gOnlyOne controls the behavior. If $gOnlyOne is 'copy', the
979 +# single source file is copied into $pathTarget. If it is 'skip', it is
980 +# skipped. If it is 'fail', such files will trigger makeUniversalDirectory
981 +# to fail.
983 +# If either source directory is undef, it is treated as having no files.
984 +# This facilitates deep recursion when entire directories are only present
985 +# in one source when $gOnlyOne = 'copy'.
986 +sub makeUniversalDirectory($$$) {
987 + my ($dirPPC, $dirX86, $dirTarget);
988 + ($dirPPC, $dirX86, $dirTarget) = @_;
990 + my ($dh, @filesPPC, @filesX86);
992 + @filesPPC = ();
993 + if (defined($dirPPC)) {
994 + if (!opendir($dh, $dirPPC->path())) {
995 + return complain(1, 'makeUniversalDirectory: opendir ppc: '.$!.' for:',
996 + $dirPPC->path());
998 + @filesPPC = readdir($dh);
999 + closedir($dh);
1002 + @filesX86 = ();
1003 + if (defined($dirX86)) {
1004 + if (!opendir($dh, $dirX86->path())) {
1005 + return complain(1, 'makeUniversalDirectory: opendir x86: '.$!.' for:',
1006 + $dirX86->path());
1008 + @filesX86 = readdir($dh);
1009 + closedir($dh);
1012 + my (%common, $file, %onlyPPC, %onlyX86);
1014 + %onlyPPC = ();
1015 + foreach $file (@filesPPC) {
1016 + if ($file eq '.' || $file eq '..') {
1017 + next;
1019 + $onlyPPC{$file}=1;
1022 + %common = ();
1023 + %onlyX86 = ();
1024 + foreach $file (@filesX86) {
1025 + if ($file eq '.' || $file eq '..') {
1026 + next;
1028 + if ($onlyPPC{$file}) {
1029 + delete $onlyPPC{$file};
1030 + $common{$file}=1;
1032 + else {
1033 + $onlyX86{$file}=1;
1037 + # First, handle files common to both.
1038 + foreach $file (sort(keys(%common))) {
1039 + if (!makeUniversalInternal(0,
1040 + FileAttrCache->new($dirPPC->path().'/'.$file),
1041 + FileAttrCache->new($dirX86->path().'/'.$file),
1042 + $dirTarget.'/'.$file)) {
1043 + # makeUniversalInternal will have printed an error.
1044 + return 0;
1048 + # Handle files found only in a single directory here. There are three
1049 + # options, dictated by $gOnlyOne: fail if files are only present in
1050 + # one directory, skip any files only present in one directory, or copy
1051 + # these files straight over to the target directory. In any event,
1052 + # a message will be printed indicating that the file trees don't match
1053 + # exactly.
1054 + if (keys(%onlyPPC)) {
1055 + complain(($gOnlyOne eq 'fail' ? 1 : 2),
1056 + ($gOnlyOne ne 'fail' ? 'warning: ' : '').
1057 + 'makeUniversalDirectory: only in ppc '.
1058 + (argumentEscape($dirPPC->path()))[0].':',
1059 + argumentEscape(keys(%onlyPPC)));
1062 + if (keys(%onlyX86)) {
1063 + complain(($gOnlyOne eq 'fail' ? 1 : 2),
1064 + ($gOnlyOne ne 'fail' ? 'warning: ' : '').
1065 + 'makeUniversalDirectory: only in x86 '.
1066 + (argumentEscape($dirX86->path()))[0].':',
1067 + argumentEscape(keys(%onlyX86)));
1070 + if ($gOnlyOne eq 'fail' && (keys(%onlyPPC) || keys(%onlyX86))) {
1071 + # Error message(s) printed above.
1072 + return 0;
1075 + if ($gOnlyOne eq 'copy') {
1076 + foreach $file (sort(keys(%onlyPPC))) {
1077 + if (!makeUniversalInternal(0,
1078 + FileAttrCache->new($dirPPC->path().'/'.$file),
1079 + undef,
1080 + $dirTarget.'/'.$file)) {
1081 + # makeUniversalInternal will have printed an error.
1082 + return 0;
1086 + foreach $file (sort(keys(%onlyX86))) {
1087 + if (!makeUniversalInternal(0,
1088 + undef,
1089 + FileAttrCache->new($dirX86->path().'/'.$file),
1090 + $dirTarget.'/'.$file)) {
1091 + # makeUniversalInternal will have printed an error.
1092 + return 0;
1097 + return 1;
1100 +# makeUniversalFile($sourcePPC, $sourceX86, $targetPath)
1102 +# Creates a universal file at pathname $targetPath based on a ppc image at
1103 +# $sourcePPC and an x86 image at $sourceX86. $sourcePPC and $sourceX86 are
1104 +# both FileAttrCache objects. Returns true on success and false on failure.
1105 +# On failure, diagnostics will be printed to stderr.
1107 +# The source files may be either thin Mach-O images of the appropriate
1108 +# architecture, or fat Mach-O files that contain images of the appropriate
1109 +# architecture.
1111 +# This function wraps the lipo utility, see lipo(1).
1112 +sub makeUniversalFile($$$) {
1113 + my ($sourcePPC, $sourceX86, $targetPath, @tempThinFiles, $thinPPC, $thinX86);
1114 + ($sourcePPC, $sourceX86, $targetPath) = @_;
1115 + $thinPPC = $sourcePPC;
1116 + $thinX86 = $sourceX86;
1118 + @tempThinFiles = ();
1120 + # The source files might already be fat. They should be thinned out to only
1121 + # contain a single architecture.
1123 + my ($isFatPPC, $isFatX86);
1125 + if(!defined($isFatPPC = $sourcePPC->isFat())) {
1126 + # isFat printed its own error
1127 + return 0;
1129 + elsif($isFatPPC) {
1130 + $thinPPC = FileAttrCache->new($targetPath.'.ppc');
1131 + push(@tempThinFiles, $thinPPC->path());
1132 + if (command($gConfig{'cmd_lipo'}, '-thin', 'ppc',
1133 + $sourcePPC->path(), '-output', $thinPPC->path()) != 0) {
1134 + unlink(@tempThinFiles);
1135 + return complain(1, 'lipo thin ppc failed for:',
1136 + $sourcePPC->path(),
1137 + $thinPPC->path());
1141 + if(!defined($isFatX86 = $sourceX86->isFat())) {
1142 + # isFat printed its own error
1143 + unlink(@tempThinFiles);
1144 + return 0;
1146 + elsif($isFatX86) {
1147 + $thinX86 = FileAttrCache->new($targetPath.'.x86');
1148 + push(@tempThinFiles, $thinX86->path());
1149 + if (command($gConfig{'cmd_lipo'}, '-thin', 'i386',
1150 + $sourceX86->path(), '-output', $thinX86->path()) != 0) {
1151 + unlink(@tempThinFiles);
1152 + return complain(1, 'lipo thin x86 failed for:',
1153 + $sourceX86->path(),
1154 + $thinX86->path());
1158 + # The image for each architecture in the fat file will be aligned on
1159 + # a specific boundary, default 4096 bytes, see lipo(1) -segalign.
1160 + # Since there's no tail-padding, the fat file will consume the least
1161 + # space on disk if the image that comes last exceeds the segment size
1162 + # by the smallest amount.
1164 + # This saves an average of 1kB per fat file over the naive approach of
1165 + # always putting one architecture first: average savings is 2kB per
1166 + # file, but the naive approach would have gotten it right half of the
1167 + # time.
1169 + my ($sizePPC, $sizeX86, $thinPPCForStat, $thinX86ForStat);
1171 + if (!$gDryRun) {
1172 + $thinPPCForStat = $thinPPC;
1173 + $thinX86ForStat = $thinX86;
1175 + else {
1176 + # Normally, fat source files will have been converted into temporary
1177 + # thin files. During a dry run, that doesn't happen, so fake it up
1178 + # a little bit by always using the source file, fat or thin, for the
1179 + # stat.
1180 + $thinPPCForStat = $sourcePPC;
1181 + $thinX86ForStat = $sourceX86;
1184 + if (!defined($sizePPC = $thinPPCForStat->statSize())) {
1185 + unlink(@tempThinFiles);
1186 + return complain(1, 'stat ppc: '.$!.' for:',
1187 + $thinPPCForStat->path());
1189 + if (!defined($sizeX86 = $thinX86ForStat->statSize())) {
1190 + unlink(@tempThinFiles);
1191 + return complain(1, 'stat x86: '.$!.' for:',
1192 + $thinX86ForStat->path());
1195 + $sizePPC = $sizePPC % 4096;
1196 + $sizeX86 = $sizeX86 % 4096;
1198 + my (@thinFiles);
1200 + if ($sizePPC == 0) {
1201 + # PPC image ends on an alignment boundary, there will be no padding before
1202 + # starting the x86 image.
1203 + @thinFiles = ($thinPPC->path(), $thinX86->path());
1205 + elsif ($sizeX86 == 0 || $sizeX86 > $sizePPC) {
1206 + # x86 image ends on an alignment boundary, there will be no padding before
1207 + # starting the PPC image, or the x86 image exceeds its alignment boundary
1208 + # by more than the PPC image, so there will be less padding if the x86
1209 + # comes first.
1210 + @thinFiles = ($thinX86->path(), $thinPPC->path());
1212 + else {
1213 + # PPC image exceeds its alignment boundary by more than the x86 image, so
1214 + # there will be less padding if the PPC comes first.
1215 + @thinFiles = ($thinPPC->path(), $thinX86->path());
1218 + # Create the fat file.
1219 + if (command($gConfig{'cmd_lipo'}, '-create', @thinFiles,
1220 + '-output', $targetPath) != 0) {
1221 + unlink(@tempThinFiles);
1222 + return complain(1, 'lipo create fat failed for:',
1223 + @thinFiles,
1224 + $targetPath);
1227 + unlink(@tempThinFiles);
1229 + return 1;
1232 +# makeUniversalInternal($isToplevel, $filePPC, $fileX86, $fileTargetPath)
1234 +# Given FileAttrCache objects $filePPC and $fileX86, compares filetypes
1235 +# and performs the appropriate action to produce a universal file at
1236 +# path string $fileTargetPath. $isToplevel should be true if this is
1237 +# the recursive base and false otherwise; this controls cleanup behavior
1238 +# (cleanup is only performed at the base, because cleanup itself is
1239 +# recursive).
1241 +# This handles regular files by determining whether they are Mach-O files
1242 +# and calling makeUniversalFile if so and copyIfIdentical otherwise. Symbolic
1243 +# links are handled directly in this function by ensuring that the source link
1244 +# targets are identical and creating a new link with the same target
1245 +# at $fileTargetPath. Directories are handled by calling
1246 +# makeUniversalDirectory.
1248 +# One of $filePPC and $fileX86 is permitted to be undef. In that case,
1249 +# the defined source file is copied directly to the target if a regular
1250 +# file, and symlinked appropriately if a symbolic link. This facilitates
1251 +# use of $gOnlyOne = 'copy', although no $gOnlyOne checks are made in this
1252 +# function, they are all handled in makeUniversalDirectory.
1254 +# Returns true on success. Returns false on failure, including failures
1255 +# in other functions called.
1256 +sub makeUniversalInternal($$$$) {
1257 + my ($filePPC, $fileTargetPath, $fileX86, $isToplevel);
1258 + ($isToplevel, $filePPC, $fileX86, $fileTargetPath) = @_;
1260 + my ($typePPC, $typeX86);
1261 + if (defined($filePPC) && !defined($typePPC = $filePPC->lstatType())) {
1262 + return complain(1, 'makeUniversal: lstat ppc: '.$!.' for:',
1263 + $filePPC->path());
1265 + if (defined($fileX86) && !defined($typeX86 = $fileX86->lstatType())) {
1266 + return complain(1, 'makeUniversal: lstat x86: '.$!.' for:',
1267 + $fileX86->path());
1270 + if (defined($filePPC) && defined($fileX86) && $typePPC != $typeX86) {
1271 + return complain(1, 'makeUniversal: incompatible types:',
1272 + $filePPC->path(),
1273 + $fileX86->path());
1276 + # $aSourceFile will contain a FileAttrCache object that will return
1277 + # the correct type data. It's used because it's possible for one of
1278 + # the two source files to be undefined (indicating a straight copy).
1279 + my ($aSourceFile);
1280 + if (defined($filePPC)) {
1281 + $aSourceFile = $filePPC;
1283 + else {
1284 + $aSourceFile = $fileX86;
1287 + if ($aSourceFile->lIsDir()) {
1288 + if ($gVerbosity >= 3 || $gDryRun) {
1289 + print('mkdir '.(argumentEscape($fileTargetPath))[0]."\n");
1291 + if (!$gDryRun && !mkdir($fileTargetPath)) {
1292 + return complain(1, 'makeUniversal: mkdir: '.$!.' for:',
1293 + $fileTargetPath);
1296 + my ($rv);
1298 + if (!($rv = makeUniversalDirectory($filePPC, $fileX86, $fileTargetPath))) {
1299 + # makeUniversalDirectory printed an error.
1300 + if ($isToplevel) {
1301 + command($gConfig{'cmd_rm'},'-rf','--',$fileTargetPath);
1304 + else {
1305 + # Touch the directory when leaving it. If unify is being run on an
1306 + # .app bundle, the .app might show up without an icon because the
1307 + # system might have found the .app before it was completely built.
1308 + # Touching it dirties it in LaunchServices' mind.
1309 + if ($gVerbosity >= 3) {
1310 + print('touch '.(argumentEscape($fileTargetPath))[0]."\n");
1312 + utime(undef, undef, $fileTargetPath);
1315 + return $rv;
1317 + elsif ($aSourceFile->lIsSymLink()) {
1318 + my ($linkPPC, $linkX86);
1319 + if (defined($filePPC) && !defined($linkPPC=readlink($filePPC->path()))) {
1320 + return complain(1, 'makeUniversal: readlink ppc: '.$!.' for:',
1321 + $filePPC->path());
1323 + if (defined($fileX86) && !defined($linkX86=readlink($fileX86->path()))) {
1324 + return complain(1, 'makeUniversal: readlink x86: '.$!.' for:',
1325 + $fileX86->path());
1327 + if (defined($filePPC) && defined($fileX86) && $linkPPC ne $linkX86) {
1328 + return complain(1, 'makeUniversal: symbolic links differ:',
1329 + $filePPC->path(),
1330 + $fileX86->path());
1333 + # $aLink here serves the same purpose as $aSourceFile in the enclosing
1334 + # block: it refers to the target of the symbolic link, whether there
1335 + # is one valid source or two.
1336 + my ($aLink);
1337 + if (defined($linkPPC)) {
1338 + $aLink = $linkPPC;
1340 + else {
1341 + $aLink = $linkX86;
1344 + if ($gVerbosity >= 3 || $gDryRun) {
1345 + print('ln -s '.
1346 + join(' ',argumentEscape($aLink, $fileTargetPath))."\n");
1348 + if (!$gDryRun && !symlink($aLink, $fileTargetPath)) {
1349 + return complain(1, 'makeUniversal: symlink: '.$!.' for:',
1350 + $aLink,
1351 + $fileTargetPath);
1354 + return 1;
1356 + elsif($aSourceFile->lIsRegularFile()) {
1357 + # Unlike mkdir and symlink, neither makeUniversalFile nor copyIfIdentical
1358 + # care if the target file already exists, and they can't be made to care
1359 + # without writing lipo and cp equivalents that open files with
1360 + # O_CREAT|O_EXCL. Since this script is supposed to be short and sweet,
1361 + # that's not going to happen. The next best thing is to check to make
1362 + # sure the target file doesn't already exist before calling lipo or cp.
1363 + # It's open to a race, but this script isn't expected to run in hostile
1364 + # race-prone environments, and since it's expected to be called on
1365 + # directories and not files, the parent directory's mkdir addresses the
1366 + # race situation anyway.
1368 + my ($fileTarget);
1369 + $fileTarget = FileAttrCache->new($fileTargetPath);
1370 + $! = 0;
1371 + if ($fileTarget->lstat()) {
1372 + $! = Errno::EEXIST;
1374 + if ($! != Errno::ENOENT) {
1375 + return complain(1, 'makeUniversal: new file: '.$!.' for:',
1376 + $fileTargetPath);
1379 + my ($machPPC, $machX86);
1380 + if (!defined($filePPC) || !defined($fileX86)) {
1381 + # One of the source files isn't present. The right thing to do is
1382 + # to just copy what does exist straight over, so skip Mach-O checks.
1383 + $machPPC = 0;
1384 + $machX86 = 0;
1386 + else {
1387 + if (!defined($machPPC=$filePPC->isMachO())) {
1388 + return complain(1, 'makeUniversal: isFileMachO ppc failed for:',
1389 + $filePPC->path());
1391 + if (!defined($machX86=$fileX86->isMachO())) {
1392 + return complain(1, 'makeUniversal: isFileMachO x86 failed for:',
1393 + $fileX86->path());
1397 + if ($machPPC != $machX86) {
1398 + return complain(1, 'makeUniversal: variant Mach-O attributes:',
1399 + $filePPC->path(),
1400 + $fileX86->path());
1403 + my($rv);
1405 + if ($machPPC) {
1406 + # makeUniversalFile will print an error if it fails.
1407 + $rv = makeUniversalFile($filePPC, $fileX86, $fileTargetPath);
1409 + else {
1410 + # Regular file. copyIfIdentical will print an error if it fails.
1411 + $rv = copyIfIdentical($filePPC, $fileX86, $fileTargetPath);
1414 + if (!$rv) {
1415 + unlink($fileTargetPath);
1418 + return $rv;
1420 + else {
1421 + # Special file, don't know how to handle.
1422 + return complain(1, 'makeUniversal: cannot handle special file:',
1423 + $filePPC->path(),
1424 + $fileX86->path());
1427 + # Not reached.
1428 + return undef;
1431 +# usage()
1433 +# Give the user a hand.
1434 +sub usage() {
1435 + print STDERR (
1436 +"usage: unify <ppc-path> <x86-path> <universal-path>\n".
1437 +" [--dry-run] (print what would be done)\n".
1438 +" [--only-one <action>] (skip, copy, fail; default=copy)\n".
1439 +" [--verbosity <level>] (0, 1, 2, 3; default=2)\n");
1440 + return;
1443 +# readZipCRCs($zipFile)
1445 +# $zipFile is the pathname to a zip file whose directory will be read.
1446 +# A reference to a hash is returned, with the member pathnames from the
1447 +# zip file as keys, and reasonably unique identifiers as values. The
1448 +# format of the values is not specified exactly, but does include the
1449 +# member CRCs and sizes and differentiates between files and directories.
1450 +# It specifically does not distinguish between modification times. On
1451 +# failure, prints a message and returns undef.
1452 +sub readZipCRCs($) {
1453 + my ($zipFile);
1454 + ($zipFile) = @_;
1456 + my ($ze, $zip);
1457 + $zip = Archive::Zip->new();
1459 + if (($ze = $zip->read($zipFile)) != AZ_OK) {
1460 + complain(1, 'readZipCRCs: read error '.$ze.' for:',
1461 + $zipFile);
1462 + return undef;
1465 + my ($member, %memberCRCs, @memberList);
1466 + %memberCRCs = ();
1467 + @memberList = $zip->members();
1469 + foreach $member (@memberList) {
1470 + # Take a few of the attributes that identify the file and stuff them into
1471 + # the members hash. Directories will show up with size 0 and crc32 0,
1472 + # so isDirectory() is used to distinguish them from empty files.
1473 + $memberCRCs{$member->fileName()} = join(',', $member->isDirectory() ? 1 : 0,
1474 + $member->uncompressedSize(),
1475 + $member->crc32String());
1478 + return {%memberCRCs};
1482 + # FileAttrCache allows various attributes about a file to be cached
1483 + # so that if they are needed again after first use, no system calls
1484 + # will be made and the program won't need to hit the disk.
1486 + package FileAttrCache;
1488 + use Fcntl(':DEFAULT', ':mode');
1490 + # FileAttrCache->new($path)
1492 + # Creates a new FileAttrCache object for the file at path $path and
1493 + # returns it. The cache is not primed at creation time, values are
1494 + # fetched lazily as they are needed.
1495 + sub new($$) {
1496 + my ($class, $path, $proto, $this);
1497 + ($proto, $path) = @_;
1498 + if (!($class = ref($proto))) {
1499 + $class = $proto;
1501 + $this = {
1502 + 'path' => $path,
1503 + 'lstat' => undef,
1504 + 'lstatErrno' => 0,
1505 + 'lstatInit' => 0,
1506 + 'magic' => undef,
1507 + 'magicErrno' => 0,
1508 + 'magicErrMsg' => undef,
1509 + 'magicInit' => 0,
1510 + 'stat' => undef,
1511 + 'statErrno' => 0,
1512 + 'statInit' => 0,
1513 + };
1514 + bless($this, $class);
1515 + return($this);
1518 + # $FileAttrCache->isFat()
1520 + # Returns true if the file is a fat Mach-O file, false if it's not, and
1521 + # undef if an error occurs. See /usr/include/mach-o/fat.h.
1522 + sub isFat($) {
1523 + my ($magic, $this);
1524 + ($this) = @_;
1526 + # magic() caches, there's no separate cache because isFat() doesn't hit
1527 + # the disk other than by calling magic().
1529 + if (!defined($magic = $this->magic())) {
1530 + return undef;
1533 + if ($magic == 0xcafebabe) {
1534 + return 1;
1537 + return 0;
1540 + # $FileAttrCache->isMachO()
1542 + # Returns true if the file is a Mach-O image (including a fat file), false
1543 + # if it's not, and undef if an error occurs. See
1544 + # /usr/include/mach-o/loader.h and /usr/include/mach-o/fat.h.
1545 + sub isMachO($) {
1546 + my ($magic, $this);
1547 + ($this) = @_;
1549 + # magic() caches, there's no separate cache because isMachO() doesn't hit
1550 + # the disk other than by calling magic().
1552 + if (!defined($magic = $this->magic())) {
1553 + return undef;
1556 + # Accept Mach-O fat files or Mach-O thin files of either endianness.
1557 + if ($magic == 0xfeedface ||
1558 + $magic == 0xcefaedfe ||
1559 + $magic == 0xcafebabe) {
1560 + return 1;
1563 + return 0;
1566 + # $FileAttrCache->isZip()
1568 + # Returns true if the file is a zip file, false if it's not, and undef if
1569 + # an error occurs. See http://www.pkware.com/business_and_developers/developer/popups/appnote.txt .
1570 + sub isZip($) {
1571 + my ($magic, $this);
1572 + ($this) = @_;
1574 + # magic() caches, there's no separate cache because isFat() doesn't hit
1575 + # the disk other than by calling magic().
1577 + if (!defined($magic = $this->magic())) {
1578 + return undef;
1581 + if ($magic == 0x504b0304) {
1582 + return 1;
1585 + return 0;
1588 + # $FileAttrCache->lIsDir()
1590 + # Wraps $FileAttrCache->lstat(), returning true if the file is a directory,
1591 + # false if it isn't, or undef if an error occurs. Because lstat is used,
1592 + # this will return false even if the file is a symlink pointing to a
1593 + # directory. On error, $! is set to lstat's errno.
1594 + sub lIsDir($) {
1595 + my ($type, $this);
1596 + ($this) = @_;
1598 + if (!defined($type = $this->lstatType())) {
1599 + return undef;
1602 + return S_ISDIR($type);
1605 + # $FileAttrCache->lIsRegularFile()
1607 + # Wraps $FileAttrCache->lstat(), returning true if the file is a regular,
1608 + # file, false if it isn't, or undef if an error occurs. Because lstat is
1609 + # used, this will return false even if the file is a symlink pointing to a
1610 + # regular file. On error, $! is set to lstat's errno.
1611 + sub lIsRegularFile($) {
1612 + my ($type, $this);
1613 + ($this) = @_;
1615 + if (!defined($type = $this->lstatType())) {
1616 + return undef;
1619 + return S_ISREG($type);
1622 + # $FileAttrCache->lIsSymLink()
1624 + # Wraps $FileAttrCache->lstat(), returning true if the file is a symbolic,
1625 + # link, false if it isn't, or undef if an error occurs. On error, $! is
1626 + # set to lstat's errno.
1627 + sub lIsSymLink($) {
1628 + my ($type, $this);
1629 + ($this) = @_;
1631 + if (!defined($type = $this->lstatType())) {
1632 + return undef;
1635 + return S_ISLNK($type);
1638 + # $FileAttrCache->lstat()
1640 + # Wraps the lstat system call, providing a cache to speed up multiple
1641 + # lstat calls for the same file. See lstat(2) and lstat in perlfunc(1).
1642 + sub lstat($) {
1643 + my (@stat, $this);
1644 + ($this) = @_;
1646 + # Use the cached lstat result.
1647 + if ($$this{'lstatInit'}) {
1648 + if (defined($$this{'lstatErrno'})) {
1649 + $! = $$this{'lstatErrno'};
1651 + return @{$$this{'lstat'}};
1653 + $$this{'lstatInit'} = 1;
1655 + if (!(@stat = CORE::lstat($$this{'path'}))) {
1656 + $$this{'lstatErrno'} = $!;
1659 + $$this{'lstat'} = [@stat];
1660 + return @stat;
1663 + # $FileAttrCache->lstatType()
1665 + # Wraps $FileAttrCache->lstat(), returning the type bits from the st_mode
1666 + # field, or undef if an error occurs. On error, $! is set to lstat's
1667 + # errno.
1668 + sub lstatType($) {
1669 + my (@stat, $this);
1670 + ($this) = @_;
1672 + if (!(@stat = $this->lstat())) {
1673 + return undef;
1676 + return S_IFMT($stat[2]);
1679 + # $FileAttrCache->magic()
1681 + # Returns the "magic number" for the file by reading its first four bytes
1682 + # as a big-endian unsigned 32-bit integer and returning the result. If an
1683 + # error occurs, returns undef and prints diagnostic messages to stderr. If
1684 + # the file is shorter than 32 bits, returns -1. A cache is provided to
1685 + # speed multiple magic calls for the same file.
1686 + sub magic($) {
1687 + my ($this);
1688 + ($this) = @_;
1690 + # Use the cached magic result.
1691 + if ($$this{'magicInit'}) {
1692 + if (defined($$this{'magicErrno'})) {
1693 + if (defined($$this{'magicErrMsg'})) {
1694 + complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
1695 + $$this{'path'});
1697 + $! = $$this{'magicErrno'};
1699 + return $$this{'magic'};
1702 + $$this{'magicInit'} = 1;
1704 + my ($fh);
1705 + if (!sysopen($fh, $$this{'path'}, O_RDONLY)) {
1706 + $$this{'magicErrno'} = $!;
1707 + $$this{'magicErrMsg'} = 'open "'.$$this{'path'}.'": '.$!;
1708 + complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
1709 + $$this{'path'});
1710 + return undef;
1713 + $! = 0;
1714 + my ($bytes, $magic);
1715 + if (!defined($bytes = sysread($fh, $magic, 4))) {
1716 + $$this{'magicErrno'} = $!;
1717 + $$this{'magicErrMsg'} = 'read "'.$$this{'path'}.'": '.$!;
1718 + complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
1719 + $$this{'path'});
1720 + close($fh);
1721 + return undef;
1724 + close($fh);
1726 + if ($bytes != 4) {
1727 + # The file is too short, didn't read a magic number. This isn't really
1728 + # an error. Return an unlikely value.
1729 + $$this{'magic'} = -1;
1730 + return -1;
1733 + $$this{'magic'} = unpack('N', $magic);
1734 + return $$this{'magic'};
1737 + # $FileAttrCache->path()
1739 + # Returns the file's pathname.
1740 + sub path($) {
1741 + my ($this);
1742 + ($this) = @_;
1743 + return $$this{'path'};
1746 + # $FileAttrCache->stat()
1748 + # Wraps the stat system call, providing a cache to speed up multiple
1749 + # stat calls for the same file. If lstat() has already been called and
1750 + # the file is not a symbolic link, the cached lstat() result will be used.
1751 + # See stat(2) and lstat in perlfunc(1).
1752 + sub stat($) {
1753 + my (@stat, $this);
1754 + ($this) = @_;
1756 + # Use the cached stat result.
1757 + if ($$this{'statInit'}) {
1758 + if (defined($$this{'statErrno'})) {
1759 + $! = $$this{'statErrno'};
1761 + return @{$$this{'stat'}};
1764 + $$this{'statInit'} = 1;
1766 + # If lstat has already been called, and the file isn't a symbolic link,
1767 + # use the cached lstat result.
1768 + if ($$this{'lstatInit'} && !$$this{'lstatErrno'} &&
1769 + !S_ISLNK(${$$this{'lstat'}}[2])) {
1770 + $$this{'stat'} = $$this{'lstat'};
1771 + return @{$$this{'stat'}};
1774 + if (!(@stat = CORE::stat($$this{'path'}))) {
1775 + $$this{'statErrno'} = $!;
1778 + $$this{'stat'} = [@stat];
1779 + return @stat;
1782 + # $FileAttrCache->statSize()
1784 + # Wraps $FileAttrCache->stat(), returning the st_size field, or undef
1785 + # undef if an error occurs. On error, $! is set to stat's errno.
1786 + sub statSize($) {
1787 + my (@stat, $this);
1788 + ($this) = @_;
1790 + if (!(@stat = $this->lstat())) {
1791 + return undef;
1794 + return $stat[7];
1797 diff -uprN --exclude=CVS mozilla/caps/include/nsScriptSecurityManager.h mozilla.new/caps/include/nsScriptSecurityManager.h
1798 --- mozilla/caps/include/nsScriptSecurityManager.h 2005-07-22 22:49:11.000000000 +0200
1799 +++ mozilla.new/caps/include/nsScriptSecurityManager.h 2006-02-24 11:16:26.000000000 +0100
1800 @@ -65,6 +65,7 @@ class nsIXPConnect;
1801 class nsIStringBundle;
1802 class nsSystemPrincipal;
1803 struct ClassPolicy;
1804 +class DomainPolicy;
1806 #if defined(DEBUG_mstoltz) || defined(DEBUG_caillon)
1807 #define DEBUG_CAPS_HACKER
1808 @@ -208,6 +209,10 @@ struct ClassPolicy : public PLDHashEntry
1810 char* key;
1811 PLDHashTable* mPolicy;
1813 + // Note: the DomainPolicy owns us, so if if dies we will too. Hence no
1814 + // need to refcount it here (and in fact, we'd probably leak if we tried).
1815 + DomainPolicy* mDomainWeAreWildcardFor;
1818 PR_STATIC_CALLBACK(void)
1819 @@ -222,6 +227,13 @@ ClearClassPolicyEntry(PLDHashTable *tabl
1820 PL_DHashTableDestroy(cp->mPolicy);
1823 +// Note: actual impl is going to be after the DomainPolicy class definition,
1824 +// since we need to access members of DomainPolicy in the impl
1825 +PR_STATIC_CALLBACK(void)
1826 +MoveClassPolicyEntry(PLDHashTable *table,
1827 + const PLDHashEntryHdr *from,
1828 + PLDHashEntryHdr *to);
1830 PR_STATIC_CALLBACK(PRBool)
1831 InitClassPolicyEntry(PLDHashTable *table,
1832 PLDHashEntryHdr *entry,
1833 @@ -241,6 +253,7 @@ InitClassPolicyEntry(PLDHashTable *table
1836 ClassPolicy* cp = (ClassPolicy*)entry;
1837 + cp->mDomainWeAreWildcardFor = nsnull;
1838 cp->key = PL_strdup((const char*)key);
1839 if (!cp->key)
1840 return PR_FALSE;
1841 @@ -279,7 +292,7 @@ public:
1842 PL_DHashGetKeyStub,
1843 PL_DHashStringKey,
1844 PL_DHashMatchStringKey,
1845 - PL_DHashMoveEntryStub,
1846 + MoveClassPolicyEntry,
1847 ClearClassPolicyEntry,
1848 PL_DHashFinalizeStub,
1849 InitClassPolicyEntry
1850 @@ -336,6 +349,23 @@ private:
1854 +PR_STATIC_CALLBACK(void)
1855 +MoveClassPolicyEntry(PLDHashTable *table,
1856 + const PLDHashEntryHdr *from,
1857 + PLDHashEntryHdr *to)
1859 + memcpy(to, from, table->entrySize);
1861 + // Now update the mDefaultPolicy pointer that points to us, if any.
1862 + ClassPolicy* cp = NS_STATIC_CAST(ClassPolicy*, to);
1863 + if (cp->mDomainWeAreWildcardFor) {
1864 + NS_ASSERTION(cp->mDomainWeAreWildcardFor->mWildcardPolicy ==
1865 + NS_STATIC_CAST(const ClassPolicy*, from),
1866 + "Unexpected wildcard policy on mDomainWeAreWildcardFor");
1867 + cp->mDomainWeAreWildcardFor->mWildcardPolicy = cp;
1871 /////////////////////////////
1872 // nsScriptSecurityManager //
1873 /////////////////////////////
1874 diff -uprN --exclude=CVS mozilla/caps/src/nsScriptSecurityManager.cpp mozilla.new/caps/src/nsScriptSecurityManager.cpp
1875 --- mozilla/caps/src/nsScriptSecurityManager.cpp 2005-10-25 02:40:48.000000000 +0200
1876 +++ mozilla.new/caps/src/nsScriptSecurityManager.cpp 2006-02-24 11:16:26.000000000 +0100
1877 @@ -1555,6 +1555,13 @@ nsScriptSecurityManager::CanExecuteScrip
1878 //-- See if the current window allows JS execution
1879 nsIScriptContext *scriptContext = GetScriptContext(cx);
1880 if (!scriptContext) return NS_ERROR_FAILURE;
1882 + if (!scriptContext->GetScriptsEnabled()) {
1883 + // No scripting on this context, folks
1884 + *result = PR_FALSE;
1885 + return NS_OK;
1888 nsIScriptGlobalObject *globalObject = scriptContext->GetGlobalObject();
1889 if (!globalObject) return NS_ERROR_FAILURE;
1891 @@ -3304,9 +3311,15 @@ nsScriptSecurityManager::InitDomainPolic
1893 // If this is the wildcard class (class '*'), save it in mWildcardPolicy
1894 // (we leave it stored in the hashtable too to take care of the cleanup)
1895 - if ((*start == '*') && (end == start + 1))
1896 + if ((*start == '*') && (end == start + 1)) {
1897 aDomainPolicy->mWildcardPolicy = cpolicy;
1899 + // Make sure that cpolicy knows about aDomainPolicy so it can reset
1900 + // the mWildcardPolicy pointer as needed if it gets moved in the
1901 + // hashtable.
1902 + cpolicy->mDomainWeAreWildcardFor = aDomainPolicy;
1905 // Get the property name
1906 start = end + 1;
1907 end = PL_strchr(start, '.');
1908 diff -uprN --exclude=CVS mozilla/client.mk mozilla.new/client.mk
1909 --- mozilla/client.mk 2005-12-09 20:47:25.000000000 +0100
1910 +++ mozilla.new/client.mk 2006-02-24 11:15:14.000000000 +0100
1911 @@ -22,6 +22,7 @@
1912 # Stephen Lamm
1913 # Benjamin Smedberg <bsmedberg@covad.net>
1914 # Chase Phillips <chase@mozilla.org>
1915 +# Mark Mentovai <mark@moxienet.com>
1917 # Alternatively, the contents of this file may be used under the terms of
1918 # either the GNU General Public License Version 2 or later (the "GPL"), or
1919 @@ -79,6 +80,8 @@
1920 # See http://www.mozilla.org/build/ for more information.
1922 # Options:
1923 +# MOZ_BUILD_PROJECTS - Build multiple projects in subdirectories
1924 +# of MOZ_OBJDIR
1925 # MOZ_OBJDIR - Destination object directory
1926 # MOZ_CO_DATE - Date tag to use for checkout (default: none)
1927 # MOZ_CO_LOCALES_DATE - Date tag to use for locale checkout
1928 @@ -90,6 +93,12 @@
1929 # MOZ_CO_LOCALES - localizations to pull (MOZ_CO_LOCALES="de-DE,pt-BR")
1930 # MOZ_LOCALE_DIRS - directories which contain localizations
1931 # LOCALES_CVSROOT - CVSROOT to use to pull localizations
1932 +# MOZ_PREFLIGHT_ALL } - Makefiles to run before any project in
1933 +# MOZ_PREFLIGHT } MOZ_BUILD_PROJECTS, before each project, after
1934 +# MOZ_POSTFLIGHT } each project, and after all projects; these
1935 +# MOZ_POSTFLIGHT_ALL } variables contain space-separated lists
1936 +# MOZ_UNIFY_BDATE - Set to use the same bdate for each project in
1937 +# MOZ_BUILD_PROJECTS
1940 AVAILABLE_PROJECTS = \
1941 @@ -279,6 +288,7 @@ SH := /bin/sh
1942 ifndef MAKE
1943 MAKE := gmake
1944 endif
1945 +PERL ?= perl
1947 CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
1948 ifdef CONFIG_GUESS_SCRIPT
1949 @@ -364,14 +374,32 @@ else
1950 CVS_FLAGS := $(MOZ_CVS_FLAGS)
1951 endif
1953 +ifdef MOZ_BUILD_PROJECTS
1955 +ifndef MOZ_OBJDIR
1956 + $(error When MOZ_BUILD_PROJECTS is set, you must set MOZ_OBJDIR)
1957 +endif
1958 +ifdef MOZ_CURRENT_PROJECT
1959 + OBJDIR = $(MOZ_OBJDIR)/$(MOZ_CURRENT_PROJECT)
1960 + MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
1961 + BUILD_PROJECT_ARG = MOZ_BUILD_APP=$(MOZ_CURRENT_PROJECT)
1962 +else
1963 + OBJDIR = $(error Cannot find the OBJDIR when MOZ_CURRENT_PROJECT is not set.)
1964 + MOZ_MAKE = $(error Cannot build in the OBJDIR when MOZ_CURRENT_PROJECT is not set.)
1965 +endif
1967 +else # MOZ_BUILD_PROJECTS
1969 ifdef MOZ_OBJDIR
1970 - OBJDIR := $(MOZ_OBJDIR)
1971 - MOZ_MAKE := $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
1972 + OBJDIR = $(MOZ_OBJDIR)
1973 + MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
1974 else
1975 OBJDIR := $(TOPSRCDIR)
1976 MOZ_MAKE := $(MAKE) $(MOZ_MAKE_FLAGS)
1977 endif
1979 +endif # MOZ_BUILD_PROJECTS
1981 ####################################
1982 # CVS defines for NSS
1984 @@ -669,26 +697,6 @@ ifdef RUN_AUTOCONF_LOCALLY
1985 cd $(TOPSRCDIR)/directory/c-sdk && $(AUTOCONF)
1986 endif
1988 -####################################
1989 -# Web configure
1991 -WEBCONFIG_FILE := $(HOME)/.mozconfig
1993 -MOZCONFIG2CONFIGURATOR := build/autoconf/mozconfig2configurator
1994 -webconfig:
1995 - @cd $(TOPSRCDIR); \
1996 - url=`$(MOZCONFIG2CONFIGURATOR) $(TOPSRCDIR)`; \
1997 - echo Running mozilla with the following url: ;\
1998 - echo ;\
1999 - echo $$url ;\
2000 - mozilla -remote "openURL($$url)" || \
2001 - netscape -remote "openURL($$url)" || \
2002 - mozilla $$url || \
2003 - netscape $$url ;\
2004 - echo ;\
2005 - echo 1. Fill out the form on the browser. ;\
2006 - echo 2. Save the results to $(WEBCONFIG_FILE)
2008 #####################################################
2009 # First Checkout
2011 @@ -701,12 +709,61 @@ else
2012 #####################################################
2013 # After First Checkout
2015 +#####################################################
2016 +# Build date unification
2018 +ifdef MOZ_UNIFY_BDATE
2019 +ifndef MOZ_BUILD_DATE
2020 +ifdef MOZ_BUILD_PROJECTS
2021 +MOZ_BUILD_DATE = $(shell $(PERL) -I$(TOPSRCDIR)/config $(TOPSRCDIR)/config/bdate.pl)
2022 +export MOZ_BUILD_DATE
2023 +endif
2024 +endif
2025 +endif
2027 +#####################################################
2028 +# Preflight, before building any project
2030 +build profiledbuild alldep preflight_all::
2031 +ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_PREFLIGHT_ALL),,1))
2032 +# Don't run preflight_all for individual projects in multi-project builds
2033 +# (when MOZ_CURRENT_PROJECT is set.)
2034 +ifndef MOZ_BUILD_PROJECTS
2035 +# Building a single project, OBJDIR is usable.
2036 + set -e; \
2037 + for mkfile in $(MOZ_PREFLIGHT_ALL); do \
2038 + $(MAKE) -f $$mkfile preflight_all TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
2039 + done
2040 +else
2041 +# OBJDIR refers to the project-specific OBJDIR, which is not available at
2042 +# this point when building multiple projects. Only MOZ_OBJDIR is available.
2043 + set -e; \
2044 + for mkfile in $(MOZ_PREFLIGHT_ALL); do \
2045 + $(MAKE) -f $$mkfile preflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS="$(MOZ_BUILD_PROJECTS)"; \
2046 + done
2047 +endif
2048 +endif
2050 +# If we're building multiple projects, but haven't specified which project,
2051 +# loop through them.
2053 +ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_BUILD_PROJECTS),,1))
2054 +configure depend build profiledbuild install export libs clean realclean distclean alldep preflight postflight::
2055 + set -e; \
2056 + for app in $(MOZ_BUILD_PROJECTS); do \
2057 + $(MAKE) -f $(TOPSRCDIR)/client.mk $@ MOZ_CURRENT_PROJECT=$$app; \
2058 + done
2060 +else
2062 +# MOZ_CURRENT_PROJECT: either doing a single-project build, or building an
2063 +# individual project in a multi-project build.
2065 ####################################
2066 # Configure
2068 -CONFIG_STATUS := $(wildcard $(OBJDIR)/config.status)
2069 -CONFIG_CACHE := $(wildcard $(OBJDIR)/config.cache)
2070 +CONFIG_STATUS = $(wildcard $(OBJDIR)/config.status)
2071 +CONFIG_CACHE = $(wildcard $(OBJDIR)/config.cache)
2073 ifdef RUN_AUTOCONF_LOCALLY
2074 EXTRA_CONFIG_DEPS := \
2075 @@ -735,20 +792,23 @@ CONFIG_STATUS_DEPS := \
2076 # $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full
2077 # path of $(TOPSRCDIR).
2078 ifeq ($(TOPSRCDIR),$(OBJDIR))
2079 - CONFIGURE := ./configure
2080 + CONFIGURE = ./configure
2081 else
2082 - CONFIGURE := $(TOPSRCDIR)/configure
2083 + CONFIGURE = $(TOPSRCDIR)/configure
2084 endif
2086 ifdef MOZ_TOOLS
2087 - CONFIGURE := $(TOPSRCDIR)/configure
2088 + CONFIGURE = $(TOPSRCDIR)/configure
2089 endif
2091 -configure:
2092 +configure::
2093 +ifdef MOZ_BUILD_PROJECTS
2094 + @if test ! -d $(MOZ_OBJDIR); then $(MKDIR) $(MOZ_OBJDIR); else true; fi
2095 +endif
2096 @if test ! -d $(OBJDIR); then $(MKDIR) $(OBJDIR); else true; fi
2097 @echo cd $(OBJDIR);
2098 @echo $(CONFIGURE) $(CONFIGURE_ARGS)
2099 - @cd $(OBJDIR) && $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \
2100 + @cd $(OBJDIR) && $(BUILD_PROJECT_ARG) $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \
2101 || ( echo "*** Fix above errors and then restart with\
2102 \"$(MAKE) -f client.mk build\"" && exit 1 )
2103 @touch $(OBJDIR)/Makefile
2104 @@ -756,7 +816,7 @@ configure:
2105 $(OBJDIR)/Makefile $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS)
2106 @$(MAKE) -f $(TOPSRCDIR)/client.mk configure
2108 -ifdef CONFIG_STATUS
2109 +ifneq (,$(CONFIG_STATUS))
2110 $(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in
2111 cd $(OBJDIR); \
2112 CONFIG_FILES=config/autoconf.mk ./config.status
2113 @@ -770,6 +830,17 @@ depend:: $(OBJDIR)/Makefile $(OBJDIR)/co
2114 $(MOZ_MAKE) export && $(MOZ_MAKE) depend
2116 ####################################
2117 +# Preflight
2119 +build profiledbuild alldep preflight::
2120 +ifdef MOZ_PREFLIGHT
2121 + set -e; \
2122 + for mkfile in $(MOZ_PREFLIGHT); do \
2123 + $(MAKE) -f $$mkfile preflight TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
2124 + done
2125 +endif
2127 +####################################
2128 # Build it
2130 build:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
2131 @@ -797,11 +868,44 @@ profiledbuild:: $(OBJDIR)/Makefile $(OBJ
2132 install export libs clean realclean distclean alldep:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
2133 $(MOZ_MAKE) $@
2135 +####################################
2136 +# Postflight
2138 +build profiledbuild alldep postflight::
2139 +ifdef MOZ_POSTFLIGHT
2140 + set -e; \
2141 + for mkfile in $(MOZ_POSTFLIGHT); do \
2142 + $(MAKE) -f $$mkfile postflight TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
2143 + done
2144 +endif
2146 +endif # MOZ_CURRENT_PROJECT
2148 +####################################
2149 +# Postflight, after building all projects
2151 +build profiledbuild alldep postflight_all::
2152 +ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_POSTFLIGHT_ALL),,1))
2153 +# Don't run postflight_all for individual projects in multi-project builds
2154 +# (when MOZ_CURRENT_PROJECT is set.)
2155 +ifndef MOZ_BUILD_PROJECTS
2156 +# Building a single project, OBJDIR is usable.
2157 + set -e; \
2158 + for mkfile in $(MOZ_POSTFLIGHT_ALL); do \
2159 + $(MAKE) -f $$mkfile postflight_all TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
2160 + done
2161 +else
2162 +# OBJDIR refers to the project-specific OBJDIR, which is not available at
2163 +# this point when building multiple projects. Only MOZ_OBJDIR is available.
2164 + set -e; \
2165 + for mkfile in $(MOZ_POSTFLIGHT_ALL); do \
2166 + $(MAKE) -f $$mkfile postflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS="$(MOZ_BUILD_PROJECTS)"; \
2167 + done
2168 +endif
2169 +endif
2171 cleansrcdir:
2172 @cd $(TOPSRCDIR); \
2173 - if [ -f webshell/embed/gtk/Makefile ]; then \
2174 - $(MAKE) -C webshell/embed/gtk distclean; \
2175 - fi; \
2176 if [ -f Makefile ]; then \
2177 $(MAKE) distclean ; \
2178 else \
2179 @@ -818,4 +922,4 @@ endif
2180 echo_objdir:
2181 @echo $(OBJDIR)
2183 -.PHONY: checkout real_checkout depend build export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure
2184 +.PHONY: checkout real_checkout depend build export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all
2185 diff -uprN --exclude=CVS mozilla/config/asdecode.cpp mozilla.new/config/asdecode.cpp
2186 --- mozilla/config/asdecode.cpp 2005-06-10 16:16:18.000000000 +0200
2187 +++ mozilla.new/config/asdecode.cpp 1970-01-01 01:00:00.000000000 +0100
2188 @@ -1,164 +0,0 @@
2189 -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2190 -/* ***** BEGIN LICENSE BLOCK *****
2191 - * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2193 - * The contents of this file are subject to the Mozilla Public License Version
2194 - * 1.1 (the "License"); you may not use this file except in compliance with
2195 - * the License. You may obtain a copy of the License at
2196 - * http://www.mozilla.org/MPL/
2198 - * Software distributed under the License is distributed on an "AS IS" basis,
2199 - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2200 - * for the specific language governing rights and limitations under the
2201 - * License.
2203 - * The Original Code is the AppleSingle decoder.
2205 - * The Initial Developer of the Original Code is
2206 - * Netscape Communications Corporation.
2207 - * Portions created by the Initial Developer are Copyright (C) 2002
2208 - * the Initial Developer. All Rights Reserved.
2210 - * Contributor(s):
2211 - * Patrick Beard <beard@netscape.com> (Original author)
2212 - * Brian Ryner <bryner@brianryner.com>
2214 - * Alternatively, the contents of this file may be used under the terms of
2215 - * either the GNU General Public License Version 2 or later (the "GPL"), or
2216 - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2217 - * in which case the provisions of the GPL or the LGPL are applicable instead
2218 - * of those above. If you wish to allow use of your version of this file only
2219 - * under the terms of either the GPL or the LGPL, and not to allow others to
2220 - * use your version of this file under the terms of the MPL, indicate your
2221 - * decision by deleting the provisions above and replace them with the notice
2222 - * and other provisions required by the GPL or the LGPL. If you do not delete
2223 - * the provisions above, a recipient may use your version of this file under
2224 - * the terms of any one of the MPL, the GPL or the LGPL.
2226 - * ***** END LICENSE BLOCK ***** */
2228 -#include <cstdio>
2229 -#include <cstdlib>
2230 -#include <cstring>
2231 -#include <stdlib.h>
2232 -#include <libkern/OSByteOrder.h>
2234 -#define EXIT_IF_FALSE(x) \
2235 - do { \
2236 - if (!(x)) { \
2237 - printf("Assertion failure: %s\n" \
2238 - " at %s line %d\n", \
2239 - #x, __FILE__, __LINE__); \
2240 - exit(1); \
2241 - } \
2242 - } while (0)
2244 -// decodes a file into data and resource forks.
2246 -static int read_int(FILE* f)
2248 - int result;
2249 - EXIT_IF_FALSE(fread(&result, sizeof(result), 1, f) == 1);
2250 - result = OSSwapBigToHostInt32(result);
2251 - return result;
2254 -static void copy_range(FILE* input, size_t offset, size_t length,
2255 - const char* output_name)
2257 - FILE* output = fopen(output_name, "wb");
2258 - EXIT_IF_FALSE(output != NULL);
2259 - fseek(input, offset, SEEK_SET);
2260 - while (length != 0) {
2261 - char buffer[4096];
2262 - size_t amount = (length > sizeof(buffer) ? sizeof(buffer) : length);
2263 - EXIT_IF_FALSE(fread(buffer, 1, amount, input) == amount);
2264 - fwrite(buffer, 1, amount, output);
2265 - length -= amount;
2267 - fclose(output);
2270 -int main(int argc, char** argv)
2272 - if (argc < 3) {
2273 - printf("usage: %s input output\n", argv[0]);
2274 - exit(1);
2277 - FILE* input = fopen(argv[1], "rb");
2278 - if (input == NULL) {
2279 - printf("%s: can't open file `%s'\n", argv[0], argv[1]);
2280 - exit(2);
2283 - struct header {
2284 - int magic_number;
2285 - int version_number;
2286 - char filler[16];
2287 - } header;
2289 - EXIT_IF_FALSE(fread(&header, sizeof(header), 1, input) == 1);
2290 - header.magic_number = OSSwapBigToHostInt32(header.magic_number);
2291 - header.version_number = OSSwapBigToHostInt32(header.version_number);
2292 - EXIT_IF_FALSE(header.magic_number == 0x00051600);
2293 - EXIT_IF_FALSE(header.version_number <= 0x00020000);
2294 - // printf("sizeof(header) == %d\n", sizeof(header));
2296 - short entry_count;
2297 - EXIT_IF_FALSE(fread(&entry_count, sizeof(entry_count), 1, input) == 1);
2298 - entry_count = OSSwapHostToBigInt16(entry_count);
2300 - struct entry {
2301 - unsigned int id;
2302 - unsigned int offset;
2303 - unsigned int length;
2304 - };
2306 - entry* entries = new entry[entry_count];
2307 - EXIT_IF_FALSE(fread(entries, sizeof(entry), entry_count, input) == entry_count);
2309 - entry* data_entry = NULL;
2310 - entry* rez_entry = NULL;
2312 - for (int i = 0; i < entry_count; i++) {
2313 - entry *swap = &entries[i];
2314 - swap->id = OSSwapBigToHostInt32(swap->id);
2315 - swap->offset = OSSwapBigToHostInt32(swap->offset);
2316 - swap->length = OSSwapBigToHostInt32(swap->length);
2318 - entry& entry = entries[i];
2319 - switch (entry.id) {
2320 - case 1:
2321 - // data fork.
2322 - data_entry = &entry;
2323 - break;
2324 - case 2:
2325 - rez_entry = &entry;
2326 - break;
2330 - const char* data_name = argv[2];
2331 - if (data_entry && data_entry->length) {
2332 - copy_range(input, data_entry->offset, data_entry->length, data_name);
2333 - } else {
2334 - // always create the data fork, even if the file doesn't have one.
2335 - FILE* tmp = fopen(data_name, "wb");
2336 - EXIT_IF_FALSE(tmp);
2337 - fclose(tmp);
2340 - if (rez_entry && rez_entry->length) {
2341 - char rez_name[512];
2342 - strcpy(rez_name, data_name);
2343 - strcat(rez_name, "/rsrc");
2344 - copy_range(input, rez_entry->offset, rez_entry->length, rez_name);
2347 - delete[] entries;
2349 - fclose(input);
2351 - return 0;
2353 diff -uprN --exclude=CVS mozilla/config/autoconf.mk.in mozilla.new/config/autoconf.mk.in
2354 --- mozilla/config/autoconf.mk.in 2006-01-09 06:48:36.000000000 +0100
2355 +++ mozilla.new/config/autoconf.mk.in 2006-02-24 11:16:26.000000000 +0100
2356 @@ -555,6 +555,7 @@ NEXT_ROOT = @NEXT_ROOT@
2357 GCC_VERSION = @GCC_VERSION@
2358 XCODEBUILD_VERSION= @XCODEBUILD_VERSION@
2359 HAS_XCODE_2_1 = @HAS_XCODE_2_1@
2360 +UNIVERSAL_BINARY= @UNIVERSAL_BINARY@
2362 VISIBILITY_FLAGS = @VISIBILITY_FLAGS@
2363 WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@
2364 diff -uprN --exclude=CVS mozilla/config/config.mk mozilla.new/config/config.mk
2365 --- mozilla/config/config.mk 2006-01-09 06:48:36.000000000 +0100
2366 +++ mozilla.new/config/config.mk 2006-02-24 11:16:26.000000000 +0100
2367 @@ -687,6 +687,9 @@ else # NEXT_ROOT
2368 PBBUILD = $(PBBUILD_BIN)
2369 endif # NEXT_ROOT
2370 PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build
2371 +ifdef CROSS_COMPILE
2372 +PBBUILD_SETTINGS += ARCHS="$(OS_TEST)"
2373 +endif # CROSS_COMPILE
2374 ifdef MACOS_SDK_DIR
2375 PBBUILD_SETTINGS += SDKROOT="$(MACOS_SDK_DIR)"
2376 endif # MACOS_SDK_DIR
2377 diff -uprN --exclude=CVS mozilla/config/Makefile.in mozilla.new/config/Makefile.in
2378 --- mozilla/config/Makefile.in 2005-07-21 15:33:40.000000000 +0200
2379 +++ mozilla.new/config/Makefile.in 2006-02-24 11:16:26.000000000 +0100
2380 @@ -68,13 +68,6 @@ TARGETS += elf-dynstr-gc
2381 endif
2382 endif
2384 -ifeq ($(OS_ARCH), Darwin)
2385 -# XXX Setting CPP_PROG_LINK is ugly, but it works (it makes nsinstall
2386 -# link with $(CXX)). asdecode should really be in its own directory.
2387 -CPP_PROG_LINK = 1
2388 -SIMPLE_PROGRAMS += asdecode
2389 -endif
2391 # IMPORTANT: Disable NSBUILDROOT for this directory only, otherwise we have
2392 # a recursive rule for finding nsinstall and the Perl scripts.
2393 ifdef NSBUILDROOT
2394 diff -uprN --exclude=CVS mozilla/config/rules.mk mozilla.new/config/rules.mk
2395 --- mozilla/config/rules.mk 2005-10-11 01:16:39.000000000 +0200
2396 +++ mozilla.new/config/rules.mk 2006-02-24 11:16:26.000000000 +0100
2397 @@ -1604,6 +1604,33 @@ endif
2399 ifneq ($(XPI_PKGNAME),)
2400 libs realchrome::
2401 +ifdef STRIP_XPI
2402 + @echo "Stripping $(XPI_PKGNAME) package directory..."
2403 + @echo $(FINAL_TARGET)
2404 + @cd $(FINAL_TARGET) && find . ! -type d \
2405 + ! -name "*.js" \
2406 + ! -name "*.xpt" \
2407 + ! -name "*.gif" \
2408 + ! -name "*.jpg" \
2409 + ! -name "*.png" \
2410 + ! -name "*.xpm" \
2411 + ! -name "*.txt" \
2412 + ! -name "*.rdf" \
2413 + ! -name "*.sh" \
2414 + ! -name "*.properties" \
2415 + ! -name "*.dtd" \
2416 + ! -name "*.html" \
2417 + ! -name "*.xul" \
2418 + ! -name "*.css" \
2419 + ! -name "*.xml" \
2420 + ! -name "*.jar" \
2421 + ! -name "*.dat" \
2422 + ! -name "*.tbl" \
2423 + ! -name "*.src" \
2424 + ! -name "*.reg" \
2425 + $(PLATFORM_EXCLUDE_LIST) \
2426 + -exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
2427 +endif
2428 @echo "Packaging $(XPI_PKGNAME).xpi..."
2429 cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
2430 endif
2431 diff -uprN --exclude=CVS mozilla/content/base/public/nsIDocument.h mozilla.new/content/base/public/nsIDocument.h
2432 --- mozilla/content/base/public/nsIDocument.h 2005-08-24 23:53:36.000000000 +0200
2433 +++ mozilla.new/content/base/public/nsIDocument.h 2006-02-24 11:16:39.000000000 +0100
2434 @@ -444,9 +444,9 @@ public:
2438 - * Get the channel that was passed to StartDocumentLoad for this
2439 + * Get the channel that was passed to StartDocumentLoad or Reset for this
2440 * document. Note that this may be null in some cases (eg if
2441 - * StartDocumentLoad was never called)
2442 + * StartDocumentLoad or Reset were never called)
2444 virtual nsIChannel* GetChannel() const = 0;
2446 @@ -568,7 +568,12 @@ public:
2447 return mNodeInfoManager;
2450 + /**
2451 + * Reset the document using the given channel and loadgroup. This works
2452 + * like ResetToURI, but also sets the document's channel to aChannel.
2453 + */
2454 virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) = 0;
2457 * Reset this document to aURI and aLoadGroup. aURI must not be null.
2459 diff -uprN --exclude=CVS mozilla/content/base/src/nsDataDocumentContentPolicy.cpp mozilla.new/content/base/src/nsDataDocumentContentPolicy.cpp
2460 --- mozilla/content/base/src/nsDataDocumentContentPolicy.cpp 2005-04-11 02:29:35.000000000 +0200
2461 +++ mozilla.new/content/base/src/nsDataDocumentContentPolicy.cpp 2006-02-24 11:16:39.000000000 +0100
2462 @@ -53,30 +53,27 @@ nsDataDocumentContentPolicy::ShouldLoad(
2463 PRInt16 *aDecision)
2465 *aDecision = nsIContentPolicy::ACCEPT;
2466 - if (aContentType == nsIContentPolicy::TYPE_IMAGE ||
2467 - aContentType == nsIContentPolicy::TYPE_STYLESHEET ||
2468 - aContentType == nsIContentPolicy::TYPE_SCRIPT) {
2469 - // Look for the document. In most cases, aRequestingContext is a
2470 - // content node.
2471 - nsCOMPtr<nsIDocument> doc;
2472 - nsCOMPtr<nsIContent> content = do_QueryInterface(aRequestingContext);
2473 - if (content) {
2474 - doc = content->GetOwnerDoc();
2475 - } else {
2476 - doc = do_QueryInterface(aRequestingContext);
2477 - if (!doc) {
2478 - nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(aRequestingContext);
2479 - if (window) {
2480 - nsCOMPtr<nsIDOMDocument> domDoc;
2481 - window->GetDocument(getter_AddRefs(domDoc));
2482 - doc = do_QueryInterface(domDoc);
2484 + // Look for the document. In most cases, aRequestingContext is a
2485 + // content node.
2486 + nsCOMPtr<nsIDocument> doc;
2487 + nsCOMPtr<nsIContent> content = do_QueryInterface(aRequestingContext);
2488 + if (content) {
2489 + doc = content->GetOwnerDoc();
2490 + } else {
2491 + doc = do_QueryInterface(aRequestingContext);
2492 + if (!doc) {
2493 + nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(aRequestingContext);
2494 + if (window) {
2495 + nsCOMPtr<nsIDOMDocument> domDoc;
2496 + window->GetDocument(getter_AddRefs(domDoc));
2497 + doc = do_QueryInterface(domDoc);
2500 - if (doc && doc->IsLoadedAsData()) {
2501 - *aDecision = nsIContentPolicy::REJECT_TYPE;
2504 + if (doc && doc->IsLoadedAsData()) {
2505 + *aDecision = nsIContentPolicy::REJECT_TYPE;
2508 return NS_OK;
2511 diff -uprN --exclude=CVS mozilla/content/base/src/nsDocument.cpp mozilla.new/content/base/src/nsDocument.cpp
2512 --- mozilla/content/base/src/nsDocument.cpp 2005-10-13 23:50:01.000000000 +0200
2513 +++ mozilla.new/content/base/src/nsDocument.cpp 2006-02-24 11:16:39.000000000 +0100
2514 @@ -138,6 +138,16 @@ static NS_DEFINE_CID(kDOMEventGroupCID,
2515 #include "nsDateTimeFormatCID.h"
2516 #include "nsIDateTimeFormat.h"
2518 +#ifdef MOZ_LOGGING
2519 +// so we can get logging even in release builds
2520 +#define FORCE_PR_LOG 1
2521 +#endif
2522 +#include "prlog.h"
2524 +#ifdef PR_LOGGING
2525 +static PRLogModuleInfo* gDocumentLeakPRLog;
2526 +#endif
2528 static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID);
2529 static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
2531 @@ -702,10 +712,24 @@ nsDocument::nsDocument()
2532 : nsIDocument(),
2533 mVisible(PR_TRUE)
2535 +#ifdef PR_LOGGING
2536 + if (!gDocumentLeakPRLog)
2537 + gDocumentLeakPRLog = PR_NewLogModule("DocumentLeak");
2539 + if (gDocumentLeakPRLog)
2540 + PR_LOG(gDocumentLeakPRLog, PR_LOG_DEBUG,
2541 + ("DOCUMENT %p created", this));
2542 +#endif
2545 nsDocument::~nsDocument()
2547 +#ifdef PR_LOGGING
2548 + if (gDocumentLeakPRLog)
2549 + PR_LOG(gDocumentLeakPRLog, PR_LOG_DEBUG,
2550 + ("DOCUMENT %p destroyed", this));
2551 +#endif
2553 mInDestructor = PR_TRUE;
2555 // XXX Inform any remaining observers that we are going away.
2556 @@ -936,12 +960,23 @@ nsDocument::Reset(nsIChannel* aChannel,
2558 mPrincipal = do_QueryInterface(owner);
2561 + mChannel = aChannel;
2564 void
2565 nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup)
2567 NS_PRECONDITION(aURI, "Null URI passed to ResetToURI");
2569 +#ifdef PR_LOGGING
2570 + if (gDocumentLeakPRLog && PR_LOG_TEST(gDocumentLeakPRLog, PR_LOG_DEBUG)) {
2571 + nsCAutoString spec;
2572 + aURI->GetSpec(spec);
2573 + PR_LogPrint("DOCUMENT %p ResetToURI %s", this, spec.get());
2575 +#endif
2577 mDocumentTitle.SetIsVoid(PR_TRUE);
2579 mPrincipal = nsnull;
2580 @@ -1146,6 +1181,17 @@ nsDocument::StartDocumentLoad(const char
2581 nsIStreamListener **aDocListener,
2582 PRBool aReset, nsIContentSink* aSink)
2584 +#ifdef PR_LOGGING
2585 + if (gDocumentLeakPRLog && PR_LOG_TEST(gDocumentLeakPRLog, PR_LOG_DEBUG)) {
2586 + nsCOMPtr<nsIURI> uri;
2587 + aChannel->GetURI(getter_AddRefs(uri));
2588 + nsCAutoString spec;
2589 + if (uri)
2590 + uri->GetSpec(spec);
2591 + PR_LogPrint("DOCUMENT %p StartDocumentLoad %s", this, spec.get());
2593 +#endif
2595 if (aReset) {
2596 Reset(aChannel, aLoadGroup);
2598 @@ -3151,7 +3197,8 @@ nsDocument::SetTitle(const nsAString& aT
2599 NS_IMETHODIMP
2600 nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
2602 - NS_ENSURE_ARG(aElement);
2603 + nsCOMPtr<nsIContent> content(do_QueryInterface(aElement));
2604 + NS_ENSURE_TRUE(content, NS_ERROR_UNEXPECTED);
2606 nsresult rv;
2608 @@ -3180,7 +3227,6 @@ nsDocument::GetBoxObjectFor(nsIDOMElemen
2609 nsCOMPtr<nsIAtom> tag;
2610 nsCOMPtr<nsIXBLService> xblService =
2611 do_GetService("@mozilla.org/xbl;1", &rv);
2612 - nsCOMPtr<nsIContent> content(do_QueryInterface(aElement));
2613 xblService->ResolveTag(content, &namespaceID, getter_AddRefs(tag));
2615 nsCAutoString contractID("@mozilla.org/layout/xul-boxobject");
2616 diff -uprN --exclude=CVS mozilla/content/base/src/nsFrameLoader.cpp mozilla.new/content/base/src/nsFrameLoader.cpp
2617 --- mozilla/content/base/src/nsFrameLoader.cpp 2005-08-22 17:46:13.000000000 +0200
2618 +++ mozilla.new/content/base/src/nsFrameLoader.cpp 2006-03-03 07:14:05.000000000 +0100
2619 @@ -121,28 +121,24 @@ nsFrameLoader::LoadFrame()
2620 mDocShell->CreateLoadInfo(getter_AddRefs(loadInfo));
2621 NS_ENSURE_TRUE(loadInfo, NS_ERROR_FAILURE);
2623 - // Check for security
2624 + // Check for security. The fun part is trying to figure out what principals
2625 + // to use. The way I figure it, if we're doing a LoadFrame() accidentally
2626 + // (eg someone created a frame/iframe node, we're being parsed, XUL iframes
2627 + // are being reframed, etc.) then we definitely want to use the node
2628 + // principal of mOwnerContent for security checks. If, on the other hand,
2629 + // someone's setting the src on our owner content, or created it via script,
2630 + // or whatever, then they can clearly access it... and we should still use
2631 + // the principal of mOwnerContent. I don't think that leads to privilege
2632 + // escalation, and it's reasonably guaranteed to not lead to XSS issues
2633 + // (since caller can already access mOwnerContent in this case. So just use
2634 + // the principal of mOwnerContent no matter what. If script wants to run
2635 + // things with its own permissions, which differ from those of mOwnerContent
2636 + // (which means the script is privileged in some way) it should set
2637 + // window.location instead.
2638 nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
2640 - // Get referring URL
2641 - nsCOMPtr<nsIURI> referrer;
2642 - nsCOMPtr<nsIPrincipal> principal;
2643 - rv = secMan->GetSubjectPrincipal(getter_AddRefs(principal));
2644 - NS_ENSURE_SUCCESS(rv, rv);
2646 - // If we were called from script, get the referring URL from the script
2648 - if (principal) {
2649 - // Pass the script principal to the docshell
2651 - loadInfo->SetOwner(principal);
2652 - } else {
2653 - // We're not being called form script, tell the docshell
2654 - // to inherit an owner from the current document.
2656 - loadInfo->SetInheritOwner(PR_TRUE);
2657 - principal = doc->GetPrincipal();
2659 + // Get our principal
2660 + nsIPrincipal* principal = doc->GetPrincipal();
2662 if (!principal) {
2663 return NS_ERROR_FAILURE;
2664 @@ -155,15 +151,36 @@ nsFrameLoader::LoadFrame()
2665 return rv; // We're not
2668 - rv = principal->GetURI(getter_AddRefs(referrer));
2669 - NS_ENSURE_SUCCESS(rv, rv);
2671 - loadInfo->SetReferrer(referrer);
2673 // Bail out if this is an infinite recursion scenario
2674 rv = CheckForRecursiveLoad(uri);
2675 NS_ENSURE_SUCCESS(rv, rv);
2677 + // Is our principal the system principal?
2678 + nsCOMPtr<nsIPrincipal> sysPrin;
2679 + rv = secMan->GetSystemPrincipal(getter_AddRefs(sysPrin));
2680 + NS_ENSURE_SUCCESS(rv, rv);
2682 + if (principal == sysPrin) {
2683 + // We're a chrome node. Belt and braces -- inherit the principal for this
2684 + // load instead of just forcing the system principal. That way if we have
2685 + // something loaded already the principal used will be that of what we
2686 + // already have loaded.
2687 + loadInfo->SetInheritOwner(PR_TRUE);
2689 + // Also, in this case we don't set a referrer, just in case.
2690 + } else {
2691 + // We'll use our principal, not that of the document loaded inside us.
2692 + // This is very important; needed to prevent XSS attacks on documents
2693 + // loaded in subframes!
2694 + loadInfo->SetOwner(principal);
2696 + nsCOMPtr<nsIURI> referrer;
2697 + rv = principal->GetURI(getter_AddRefs(referrer));
2698 + NS_ENSURE_SUCCESS(rv, rv);
2700 + loadInfo->SetReferrer(referrer);
2703 // Kick off the load...
2704 rv = mDocShell->LoadURI(uri, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE,
2705 PR_FALSE);
2706 diff -uprN --exclude=CVS mozilla/content/events/src/nsDOMMouseEvent.cpp mozilla.new/content/events/src/nsDOMMouseEvent.cpp
2707 --- mozilla/content/events/src/nsDOMMouseEvent.cpp 2005-04-29 01:47:55.000000000 +0200
2708 +++ mozilla.new/content/events/src/nsDOMMouseEvent.cpp 2006-02-24 11:16:39.000000000 +0100
2709 @@ -181,7 +181,7 @@ nsDOMMouseEvent::GetButton(PRUint16* aBu
2710 break;
2711 default:
2712 // This event doesn't have a mouse button associated with it
2713 - *aButton = (PRUint16)-1;
2714 + *aButton = (PRUint16)0;
2715 break;
2718 diff -uprN --exclude=CVS mozilla/content/events/src/nsDOMTextEvent.cpp mozilla.new/content/events/src/nsDOMTextEvent.cpp
2719 --- mozilla/content/events/src/nsDOMTextEvent.cpp 2005-04-29 01:47:55.000000000 +0200
2720 +++ mozilla.new/content/events/src/nsDOMTextEvent.cpp 2006-02-24 11:16:39.000000000 +0100
2721 @@ -1,4 +1,5 @@
2722 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2723 +/* vim: set ts=2 sw=2 et tw=78: */
2724 /* ***** BEGIN LICENSE BLOCK *****
2725 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2727 @@ -58,7 +59,7 @@ nsDOMTextEvent::nsDOMTextEvent(nsPresCon
2729 // extract the IME composition string
2731 - nsTextEvent *te = NS_STATIC_CAST(nsTextEvent*, aEvent);
2732 + nsTextEvent *te = NS_STATIC_CAST(nsTextEvent*, mEvent);
2733 mText = te->theText;
2736 @@ -68,20 +69,20 @@ nsDOMTextEvent::nsDOMTextEvent(nsPresCon
2738 nsIPrivateTextRange** tempTextRangeList = new nsIPrivateTextRange*[te->rangeCount];
2739 if (tempTextRangeList) {
2740 - PRUint16 i;
2741 + PRUint16 i;
2743 - for(i = 0; i < te->rangeCount; i++) {
2744 - nsPrivateTextRange* tempPrivateTextRange = new
2745 - nsPrivateTextRange(te->rangeArray[i].mStartOffset,
2746 - te->rangeArray[i].mEndOffset,
2747 - te->rangeArray[i].mRangeType);
2748 + for(i = 0; i < te->rangeCount; i++) {
2749 + nsPrivateTextRange* tempPrivateTextRange = new
2750 + nsPrivateTextRange(te->rangeArray[i].mStartOffset,
2751 + te->rangeArray[i].mEndOffset,
2752 + te->rangeArray[i].mRangeType);
2754 - if (tempPrivateTextRange) {
2755 - NS_ADDREF(tempPrivateTextRange);
2756 + if (tempPrivateTextRange) {
2757 + NS_ADDREF(tempPrivateTextRange);
2759 - tempTextRangeList[i] = (nsIPrivateTextRange*)tempPrivateTextRange;
2761 + tempTextRangeList[i] = (nsIPrivateTextRange*)tempPrivateTextRange;
2766 // We need to create mTextRange even rangeCount is 0.
2767 diff -uprN --exclude=CVS mozilla/content/events/src/nsEventStateManager.cpp mozilla.new/content/events/src/nsEventStateManager.cpp
2768 --- mozilla/content/events/src/nsEventStateManager.cpp 2006-01-11 23:05:25.000000000 +0100
2769 +++ mozilla.new/content/events/src/nsEventStateManager.cpp 2006-02-24 11:16:39.000000000 +0100
2770 @@ -3270,6 +3270,11 @@ nsEventStateManager::ShiftFocusInternal(
2771 PRBool selectionWithFocus;
2772 MoveFocusToCaret(PR_FALSE, &selectionWithFocus);
2773 ignoreTabIndex = !selectionWithFocus;
2774 + // Refresh |selectionFrame| since MoveFocusToCaret() could have
2775 + // destroyed it. (bug 308086)
2776 + GetDocSelectionLocation(getter_AddRefs(selectionContent),
2777 + getter_AddRefs(endSelectionContent),
2778 + &selectionFrame, &selectionOffset);
2782 diff -uprN --exclude=CVS mozilla/content/html/content/src/nsHTMLInputElement.cpp mozilla.new/content/html/content/src/nsHTMLInputElement.cpp
2783 --- mozilla/content/html/content/src/nsHTMLInputElement.cpp 2005-09-28 11:49:17.000000000 +0200
2784 +++ mozilla.new/content/html/content/src/nsHTMLInputElement.cpp 2006-03-03 07:14:07.000000000 +0100
2785 @@ -1297,6 +1297,13 @@ nsHTMLInputElement::HandleDOMEvent(nsPre
2789 + // Don't allow mutation events which are targeted somewhere inside
2790 + // <input>, except if they are dispatched to the element itself.
2791 + if (!(NS_EVENT_FLAG_INIT & aFlags) &&
2792 + aEvent->eventStructType == NS_MUTATION_EVENT) {
2793 + return NS_OK;
2797 // Web pages expect the value of a radio button or checkbox to be set
2798 // *before* onclick and DOMActivate fire, and they expect that if they set
2799 @@ -1775,8 +1782,14 @@ nsHTMLInputElement::ParseAttribute(nsIAt
2800 return PR_FALSE;
2803 - mType = aResult.GetEnumValue();
2804 - if (mType == NS_FORM_INPUT_FILE) {
2805 + // Make sure to do the check for newType being NS_FORM_INPUT_FILE and the
2806 + // corresponding SetValueInternal() call _before_ we set mType. That way
2807 + // the logic in SetValueInternal() will work right (that logic makes
2808 + // assumptions about our frame based on mType, but we won't have had time
2809 + // to recreate frames yet -- that happens later in the SetAttr()
2810 + // process).
2811 + PRInt8 newType = aResult.GetEnumValue();
2812 + if (newType == NS_FORM_INPUT_FILE) {
2813 // If the type is being changed to file, set the element value
2814 // to the empty string. This is for security.
2815 // Call SetValueInternal so that this doesn't accidentally get caught
2816 @@ -1784,6 +1797,8 @@ nsHTMLInputElement::ParseAttribute(nsIAt
2817 SetValueInternal(EmptyString(), nsnull);
2820 + mType = newType;
2822 return PR_TRUE;
2824 if (aAttribute == nsHTMLAtoms::width) {
2825 diff -uprN --exclude=CVS mozilla/content/html/document/src/nsHTMLDocument.cpp mozilla.new/content/html/document/src/nsHTMLDocument.cpp
2826 --- mozilla/content/html/document/src/nsHTMLDocument.cpp 2006-01-09 06:48:52.000000000 +0100
2827 +++ mozilla.new/content/html/document/src/nsHTMLDocument.cpp 2006-02-24 11:16:39.000000000 +0100
2828 @@ -279,7 +279,8 @@ IdAndNameHashInitEntry(PLDHashTable *tab
2830 nsHTMLDocument::nsHTMLDocument()
2831 : mCompatMode(eCompatibility_NavQuirks),
2832 - mTexttype(IBMBIDI_TEXTTYPE_LOGICAL)
2833 + mTexttype(IBMBIDI_TEXTTYPE_LOGICAL),
2834 + mDefaultNamespaceID(kNameSpaceID_None)
2837 // NOTE! nsDocument::operator new() zeroes out all members, so don't
2838 @@ -314,6 +315,12 @@ nsHTMLDocument::Init()
2839 nsresult rv = nsDocument::Init();
2840 NS_ENSURE_SUCCESS(rv, rv);
2842 + // Now reset the case-sensitivity of the CSSLoader, since we default
2843 + // to being HTML, not XHTML. Also, reset the compatibility mode to
2844 + // match our compat mode.
2845 + CSSLoader()->SetCaseSensitive(IsXHTML());
2846 + CSSLoader()->SetCompatibilityMode(mCompatMode);
2848 static PLDHashTableOps hash_table_ops =
2850 PL_DHashAllocTable,
2851 diff -uprN --exclude=CVS mozilla/content/html/document/src/nsHTMLDocument.h mozilla.new/content/html/document/src/nsHTMLDocument.h
2852 --- mozilla/content/html/document/src/nsHTMLDocument.h 2005-06-20 18:18:35.000000000 +0200
2853 +++ mozilla.new/content/html/document/src/nsHTMLDocument.h 2006-02-24 11:16:39.000000000 +0100
2854 @@ -331,6 +331,8 @@ protected:
2856 // kNameSpaceID_None for good ol' HTML documents, and
2857 // kNameSpaceID_XHTML for spiffy new XHTML documents.
2858 + // XXXbz should this be reset if someone manually calls
2859 + // SetContentType() on this document?
2860 PRInt32 mDefaultNamespaceID;
2863 diff -uprN --exclude=CVS mozilla/content/html/document/src/nsWyciwygProtocolHandler.cpp mozilla.new/content/html/document/src/nsWyciwygProtocolHandler.cpp
2864 --- mozilla/content/html/document/src/nsWyciwygProtocolHandler.cpp 2004-04-17 23:52:17.000000000 +0200
2865 +++ mozilla.new/content/html/document/src/nsWyciwygProtocolHandler.cpp 2006-02-24 11:16:39.000000000 +0100
2866 @@ -109,6 +109,7 @@ nsWyciwygProtocolHandler::NewURI(const n
2867 NS_IMETHODIMP
2868 nsWyciwygProtocolHandler::NewChannel(nsIURI* url, nsIChannel* *result)
2870 + NS_ENSURE_ARG_POINTER(url);
2871 nsresult rv;
2873 nsWyciwygChannel* channel = new nsWyciwygChannel();
2874 diff -uprN --exclude=CVS mozilla/content/xul/content/src/nsXULElement.cpp mozilla.new/content/xul/content/src/nsXULElement.cpp
2875 --- mozilla/content/xul/content/src/nsXULElement.cpp 2005-09-26 15:30:08.000000000 +0200
2876 +++ mozilla.new/content/xul/content/src/nsXULElement.cpp 2006-03-03 07:14:10.000000000 +0100
2877 @@ -1033,8 +1033,9 @@ nsXULElement::UnbindFromTree(PRBool aDee
2878 PRBool
2879 nsXULElement::IsNativeAnonymous() const
2881 - // XXX Workarond for bug 280541
2882 - return PR_FALSE;
2883 + // XXX Workaround for bug 280541, wallpaper for bug 326644
2884 + return Tag() == nsXULAtoms::popupgroup &&
2885 + nsGenericElement::IsNativeAnonymous();
2888 PRUint32
2889 diff -uprN --exclude=CVS mozilla/content/xul/document/src/nsXULDocument.cpp mozilla.new/content/xul/document/src/nsXULDocument.cpp
2890 --- mozilla/content/xul/document/src/nsXULDocument.cpp 2006-01-11 23:05:27.000000000 +0100
2891 +++ mozilla.new/content/xul/document/src/nsXULDocument.cpp 2006-03-03 07:14:11.000000000 +0100
2892 @@ -149,6 +149,8 @@ const nsForwardReference::Phase nsForwar
2893 nsForwardReference::eDone
2896 +const PRUint32 kMaxAttrNameLength = 512;
2897 +const PRUint32 kMaxAttributeLength = 4096;
2899 //----------------------------------------------------------------------
2901 @@ -483,6 +485,7 @@ NS_INTERFACE_MAP_BEGIN(nsXULDocument)
2902 NS_INTERFACE_MAP_ENTRY(nsIXULDocument)
2903 NS_INTERFACE_MAP_ENTRY(nsIDOMXULDocument)
2904 NS_INTERFACE_MAP_ENTRY(nsIStreamLoaderObserver)
2905 + NS_INTERFACE_MAP_ENTRY(nsIDOMXULDocument2)
2906 NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XULDocument)
2907 NS_INTERFACE_MAP_END_INHERITING(nsXMLDocument)
2909 @@ -1522,6 +1525,14 @@ nsXULDocument::Persist(nsIContent* aElem
2910 rv = aAttribute->GetUTF8String(&attrstr);
2911 if (NS_FAILED(rv)) return rv;
2913 + // Don't bother with unreasonable attributes. We clamp long values,
2914 + // but truncating attribute names turns it into a different attribute
2915 + // so there's no point in persisting anything at all
2916 + if (!attrstr || strlen(attrstr) > kMaxAttrNameLength) {
2917 + NS_WARNING("Can't persist, Attribute name too long");
2918 + return NS_ERROR_ILLEGAL_VALUE;
2921 nsCOMPtr<nsIRDFResource> attr;
2922 rv = gRDFService->GetResource(nsDependentCString(attrstr),
2923 getter_AddRefs(attr));
2924 @@ -1532,6 +1543,14 @@ nsXULDocument::Persist(nsIContent* aElem
2925 rv = aElement->GetAttr(kNameSpaceID_None, aAttribute, valuestr);
2926 if (NS_FAILED(rv)) return rv;
2928 + // prevent over-long attributes that choke the parser (bug 319846)
2929 + // (can't simply Truncate without testing, it's implemented
2930 + // using SetLength and will grow a short string)
2931 + if (valuestr.Length() > kMaxAttributeLength) {
2932 + NS_WARNING("Truncating persisted attribute value");
2933 + valuestr.Truncate(kMaxAttributeLength);
2936 PRBool novalue = (rv != NS_CONTENT_ATTR_HAS_VALUE);
2938 // See if there was an old value...
2939 @@ -1699,14 +1718,8 @@ nsXULDocument::GetHeight(PRInt32* aHeigh
2940 NS_IMETHODIMP
2941 nsXULDocument::GetPopupNode(nsIDOMNode** aNode)
2943 - nsresult rv;
2945 - // get focus controller
2946 - nsCOMPtr<nsIFocusController> focusController;
2947 - GetFocusController(getter_AddRefs(focusController));
2948 - NS_ENSURE_TRUE(focusController, NS_ERROR_FAILURE);
2949 - // get popup node
2950 - rv = focusController->GetPopupNode(aNode); // addref happens here
2951 + // Get popup node.
2952 + nsresult rv = TrustedGetPopupNode(aNode); // addref happens here
2954 if (NS_SUCCEEDED(rv) && *aNode && !nsContentUtils::CanCallerAccess(*aNode)) {
2955 NS_RELEASE(*aNode);
2956 @@ -1717,6 +1730,18 @@ nsXULDocument::GetPopupNode(nsIDOMNode**
2959 NS_IMETHODIMP
2960 +nsXULDocument::TrustedGetPopupNode(nsIDOMNode** aNode)
2962 + // Get the focus controller.
2963 + nsCOMPtr<nsIFocusController> focusController;
2964 + GetFocusController(getter_AddRefs(focusController));
2965 + NS_ENSURE_TRUE(focusController, NS_ERROR_FAILURE);
2967 + // Get the popup node.
2968 + return focusController->GetPopupNode(aNode); // addref happens here
2971 +NS_IMETHODIMP
2972 nsXULDocument::SetPopupNode(nsIDOMNode* aNode)
2974 nsresult rv;
2975 @@ -1743,6 +1768,13 @@ nsXULDocument::GetTooltipNode(nsIDOMNode
2978 NS_IMETHODIMP
2979 +nsXULDocument::TrustedGetTooltipNode(nsIDOMNode** aNode)
2981 + NS_IF_ADDREF(*aNode = mTooltipNode);
2982 + return NS_OK;
2985 +NS_IMETHODIMP
2986 nsXULDocument::SetTooltipNode(nsIDOMNode* aNode)
2988 mTooltipNode = aNode;
2989 @@ -3183,14 +3215,15 @@ nsXULDocument::ResumeWalk()
2990 // XXXldb This is where we should really be setting the chromehidden
2991 // attribute.
2993 - PRBool didInitialReflow = PR_TRUE;
2994 - nsIPresShell *shell = GetShellAt(0);
2995 - if (shell)
2996 - shell->GetDidInitialReflow(&didInitialReflow);
2998 - if (!didInitialReflow) {
2999 - // Everything after this point we only want to do once we're
3000 - // certain that we've been embedded in a presentation shell.
3001 + if (!mDocumentLoaded) {
3002 + // Make sure we don't reenter here from StartLayout(). Note that
3003 + // setting mDocumentLoaded to true here means that if StartLayout()
3004 + // causes ResumeWalk() to be reentered, we'll take the other branch of
3005 + // the |if (!mDocumentLoaded)| check above and since
3006 + // mInitialLayoutComplete will be false will follow the else branch
3007 + // there too. See the big comment there for how such reentry can
3008 + // happen.
3009 + mDocumentLoaded = PR_TRUE;
3011 nsAutoString title;
3012 mRootContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::title, title);
3013 @@ -3253,6 +3286,8 @@ nsXULDocument::ResumeWalk()
3014 // whether or not the overlay prototype is in the XUL cache. The
3015 // most likely effect of this bug is odd UI initialization due to
3016 // methods and properties that do not work.
3017 + // XXXbz really, we shouldn't be firing binding constructors
3018 + // until after StartLayout returns!
3020 NS_ENSURE_TRUE(mPendingOverlayLoadNotifications.IsInitialized() || mPendingOverlayLoadNotifications.Init(),
3021 NS_ERROR_OUT_OF_MEMORY);
3022 diff -uprN --exclude=CVS mozilla/content/xul/document/src/nsXULDocument.h mozilla.new/content/xul/document/src/nsXULDocument.h
3023 --- mozilla/content/xul/document/src/nsXULDocument.h 2005-08-29 21:56:09.000000000 +0200
3024 +++ mozilla.new/content/xul/document/src/nsXULDocument.h 2006-02-24 11:16:40.000000000 +0100
3025 @@ -1,4 +1,5 @@
3026 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3027 +/* vim: set ts=4 sw=4 et tw=78: */
3028 /* ***** BEGIN LICENSE BLOCK *****
3029 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3031 @@ -82,7 +83,7 @@ struct PRLogModuleInfo;
3033 class nsXULDocument : public nsXMLDocument,
3034 public nsIXULDocument,
3035 - public nsIDOMXULDocument,
3036 + public nsIDOMXULDocument2,
3037 public nsIStreamLoaderObserver
3039 public:
3040 @@ -161,6 +162,7 @@ public:
3042 // nsIDOMXULDocument interface
3043 NS_DECL_NSIDOMXULDOCUMENT
3044 + NS_DECL_NSIDOMXULDOCUMENT2
3046 // nsIDOMNSDocument
3047 NS_IMETHOD GetContentType(nsAString& aContentType);
3048 @@ -269,6 +271,7 @@ protected:
3049 PRPackedBool mIsFastLoad;
3050 PRPackedBool mApplyingPersistedAttrs;
3051 PRPackedBool mIsWritingFastLoad;
3052 + PRPackedBool mDocumentLoaded;
3053 nsCOMPtr<nsIDOMXULCommandDispatcher> mCommandDispatcher; // [OWNER] of the focus tracker
3055 // Maintains the template builders that have been attached to
3056 diff -uprN --exclude=CVS mozilla/directory/c-sdk/config/autoconf.mk.in mozilla.new/directory/c-sdk/config/autoconf.mk.in
3057 --- mozilla/directory/c-sdk/config/autoconf.mk.in 2005-06-02 19:35:00.000000000 +0200
3058 +++ mozilla.new/directory/c-sdk/config/autoconf.mk.in 2006-02-24 11:15:31.000000000 +0100
3059 @@ -115,3 +115,8 @@ endif
3061 MOZILLA_CLIENT = 1
3062 VPATH = $(srcdir)
3064 +NEXT_ROOT = @NEXT_ROOT@
3065 +ifdef NEXT_ROOT
3066 +export NEXT_ROOT
3067 +endif
3068 diff -uprN --exclude=CVS mozilla/directory/c-sdk/configure mozilla.new/directory/c-sdk/configure
3069 --- mozilla/directory/c-sdk/configure 2005-06-09 10:17:46.000000000 +0200
3070 +++ mozilla.new/directory/c-sdk/configure 2006-02-24 11:15:30.000000000 +0100
3071 @@ -46,6 +46,8 @@ ac_help="$ac_help
3072 --with-nspr-exec-prefix=PFX
3073 Exec prefix where NSPR is installed"
3074 ac_help="$ac_help
3075 + --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)"
3076 +ac_help="$ac_help
3077 --enable-strip Enable stripping of shared libs and programs"
3078 ac_help="$ac_help
3079 --with-pthreads Use system pthreads library as thread subsystem"
3080 @@ -621,7 +623,7 @@ else { echo "configure: error: can not r
3083 echo $ac_n "checking host system type""... $ac_c" 1>&6
3084 -echo "configure:625: checking host system type" >&5
3085 +echo "configure:627: checking host system type" >&5
3087 host_alias=$host
3088 case "$host_alias" in
3089 @@ -642,7 +644,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
3090 echo "$ac_t""$host" 1>&6
3092 echo $ac_n "checking target system type""... $ac_c" 1>&6
3093 -echo "configure:646: checking target system type" >&5
3094 +echo "configure:648: checking target system type" >&5
3096 target_alias=$target
3097 case "$target_alias" in
3098 @@ -660,7 +662,7 @@ target_os=`echo $target | sed 's/^\([^-]
3099 echo "$ac_t""$target" 1>&6
3101 echo $ac_n "checking build system type""... $ac_c" 1>&6
3102 -echo "configure:664: checking build system type" >&5
3103 +echo "configure:666: checking build system type" >&5
3105 build_alias=$build
3106 case "$build_alias" in
3107 @@ -720,7 +722,7 @@ do
3108 # Extract the first word of "$ac_prog", so it can be a program name with args.
3109 set dummy $ac_prog; ac_word=$2
3110 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3111 -echo "configure:724: checking for $ac_word" >&5
3112 +echo "configure:726: checking for $ac_word" >&5
3113 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
3114 echo $ac_n "(cached) $ac_c" 1>&6
3115 else
3116 @@ -963,7 +965,7 @@ fi
3117 # Extract the first word of "nspr-config", so it can be a program name with args.
3118 set dummy nspr-config; ac_word=$2
3119 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3120 -echo "configure:967: checking for $ac_word" >&5
3121 +echo "configure:969: checking for $ac_word" >&5
3122 if eval "test \"`echo '$''{'ac_cv_path_NSPR_CONFIG'+set}'`\" = set"; then
3123 echo $ac_n "(cached) $ac_c" 1>&6
3124 else
3125 @@ -998,7 +1000,7 @@ fi
3127 min_nspr_version=4.0.0
3128 echo $ac_n "checking for NSPR - version >= $min_nspr_version (skipping)""... $ac_c" 1>&6
3129 -echo "configure:1002: checking for NSPR - version >= $min_nspr_version (skipping)" >&5
3130 +echo "configure:1004: checking for NSPR - version >= $min_nspr_version (skipping)" >&5
3132 no_nspr=""
3133 if test "$NSPR_CONFIG" = "no"; then
3134 @@ -1129,7 +1131,7 @@ if test -z "$SKIP_PATH_CHECKS"; then
3135 # Extract the first word of "$WHOAMI whoami", so it can be a program name with args.
3136 set dummy $WHOAMI whoami; ac_word=$2
3137 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3138 -echo "configure:1133: checking for $ac_word" >&5
3139 +echo "configure:1135: checking for $ac_word" >&5
3140 if eval "test \"`echo '$''{'ac_cv_path_WHOAMI'+set}'`\" = set"; then
3141 echo $ac_n "(cached) $ac_c" 1>&6
3142 else
3143 @@ -1204,13 +1206,13 @@ if test "$target" != "$host"; then
3144 _SAVE_LDFLAGS="$LDFLAGS"
3146 echo $ac_n "checking for $host compiler""... $ac_c" 1>&6
3147 -echo "configure:1208: checking for $host compiler" >&5
3148 +echo "configure:1210: checking for $host compiler" >&5
3149 for ac_prog in gcc cc /usr/ucb/cc
3151 # Extract the first word of "$ac_prog", so it can be a program name with args.
3152 set dummy $ac_prog; ac_word=$2
3153 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3154 -echo "configure:1214: checking for $ac_word" >&5
3155 +echo "configure:1216: checking for $ac_word" >&5
3156 if eval "test \"`echo '$''{'ac_cv_prog_HOST_CC'+set}'`\" = set"; then
3157 echo $ac_n "(cached) $ac_c" 1>&6
3158 else
3159 @@ -1251,41 +1253,25 @@ test -n "$HOST_CC" || HOST_CC=""""
3160 HOST_LDFLAGS="$LDFLAGS"
3163 - CC="$HOST_CC"
3164 - CFLAGS="$HOST_CFLAGS"
3165 - LDFLAGS="$HOST_LDFLAGS"
3167 - echo $ac_n "checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6
3168 -echo "configure:1260: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
3169 - cat > conftest.$ac_ext <<EOF
3170 -#line 1262 "configure"
3171 -#include "confdefs.h"
3173 -int main() {
3174 -return(0);
3175 -; return 0; }
3176 -EOF
3177 -if { (eval echo configure:1269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3178 - rm -rf conftest*
3179 - ac_cv_prog_host_cc_works=1 echo "$ac_t""yes" 1>&6
3180 -else
3181 - echo "configure: failed program was:" >&5
3182 - cat conftest.$ac_ext >&5
3183 - rm -rf conftest*
3184 - { echo "configure: error: installation or configuration problem: $host compiler $HOST_CC cannot create executables." 1>&2; exit 1; }
3186 -rm -f conftest*
3188 CC=$_SAVE_CC
3189 CFLAGS=$_SAVE_CFLAGS
3190 LDFLAGS=$_SAVE_LDFLAGS
3192 + case "$build:$target" in
3193 + powerpc-apple-darwin8*:i?86-apple-darwin*)
3194 + _SAVE_CFLAGS=$CFLAGS
3195 + _SAVE_CXXFLAGS=$CXXLAGS
3196 + CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
3197 + CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
3198 + ;;
3199 + esac
3201 for ac_prog in $CC "${target_alias}-gcc" "${target}-gcc"
3203 # Extract the first word of "$ac_prog", so it can be a program name with args.
3204 set dummy $ac_prog; ac_word=$2
3205 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3206 -echo "configure:1289: checking for $ac_word" >&5
3207 +echo "configure:1275: checking for $ac_word" >&5
3208 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
3209 echo $ac_n "(cached) $ac_c" 1>&6
3210 else
3211 @@ -1319,7 +1305,7 @@ test -n "$CC" || CC="echo"
3212 # Extract the first word of "gcc", so it can be a program name with args.
3213 set dummy gcc; ac_word=$2
3214 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3215 -echo "configure:1323: checking for $ac_word" >&5
3216 +echo "configure:1309: checking for $ac_word" >&5
3217 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
3218 echo $ac_n "(cached) $ac_c" 1>&6
3219 else
3220 @@ -1349,7 +1335,7 @@ if test -z "$CC"; then
3221 # Extract the first word of "cc", so it can be a program name with args.
3222 set dummy cc; ac_word=$2
3223 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3224 -echo "configure:1353: checking for $ac_word" >&5
3225 +echo "configure:1339: checking for $ac_word" >&5
3226 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
3227 echo $ac_n "(cached) $ac_c" 1>&6
3228 else
3229 @@ -1400,7 +1386,7 @@ fi
3230 # Extract the first word of "cl", so it can be a program name with args.
3231 set dummy cl; ac_word=$2
3232 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3233 -echo "configure:1404: checking for $ac_word" >&5
3234 +echo "configure:1390: checking for $ac_word" >&5
3235 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
3236 echo $ac_n "(cached) $ac_c" 1>&6
3237 else
3238 @@ -1432,7 +1418,7 @@ fi
3241 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
3242 -echo "configure:1436: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
3243 +echo "configure:1422: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
3245 ac_ext=c
3246 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
3247 @@ -1443,12 +1429,12 @@ cross_compiling=$ac_cv_prog_cc_cross
3249 cat > conftest.$ac_ext << EOF
3251 -#line 1447 "configure"
3252 +#line 1433 "configure"
3253 #include "confdefs.h"
3255 main(){return(0);}
3257 -if { (eval echo configure:1452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3258 +if { (eval echo configure:1438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3259 ac_cv_prog_cc_works=yes
3260 # If we can't run a trivial program, we are probably using a cross compiler.
3261 if (./conftest; exit) 2>/dev/null; then
3262 @@ -1474,12 +1460,12 @@ if test $ac_cv_prog_cc_works = no; then
3263 { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
3265 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
3266 -echo "configure:1478: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
3267 +echo "configure:1464: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
3268 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
3269 cross_compiling=$ac_cv_prog_cc_cross
3271 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
3272 -echo "configure:1483: checking whether we are using GNU C" >&5
3273 +echo "configure:1469: checking whether we are using GNU C" >&5
3274 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
3275 echo $ac_n "(cached) $ac_c" 1>&6
3276 else
3277 @@ -1488,7 +1474,7 @@ else
3278 yes;
3279 #endif
3281 -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
3282 +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1478: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
3283 ac_cv_prog_gcc=yes
3284 else
3285 ac_cv_prog_gcc=no
3286 @@ -1507,7 +1493,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
3287 ac_save_CFLAGS="$CFLAGS"
3288 CFLAGS=
3289 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
3290 -echo "configure:1511: checking whether ${CC-cc} accepts -g" >&5
3291 +echo "configure:1497: checking whether ${CC-cc} accepts -g" >&5
3292 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
3293 echo $ac_n "(cached) $ac_c" 1>&6
3294 else
3295 @@ -1543,7 +1529,7 @@ do
3296 # Extract the first word of "$ac_prog", so it can be a program name with args.
3297 set dummy $ac_prog; ac_word=$2
3298 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3299 -echo "configure:1547: checking for $ac_word" >&5
3300 +echo "configure:1533: checking for $ac_word" >&5
3301 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
3302 echo $ac_n "(cached) $ac_c" 1>&6
3303 else
3304 @@ -1579,7 +1565,7 @@ do
3305 # Extract the first word of "$ac_prog", so it can be a program name with args.
3306 set dummy $ac_prog; ac_word=$2
3307 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3308 -echo "configure:1583: checking for $ac_word" >&5
3309 +echo "configure:1569: checking for $ac_word" >&5
3310 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
3311 echo $ac_n "(cached) $ac_c" 1>&6
3312 else
3313 @@ -1611,7 +1597,7 @@ test -n "$CXX" || CXX="gcc"
3316 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
3317 -echo "configure:1615: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
3318 +echo "configure:1601: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
3320 ac_ext=C
3321 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
3322 @@ -1622,12 +1608,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
3324 cat > conftest.$ac_ext << EOF
3326 -#line 1626 "configure"
3327 +#line 1612 "configure"
3328 #include "confdefs.h"
3330 int main(){return(0);}
3332 -if { (eval echo configure:1631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3333 +if { (eval echo configure:1617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3334 ac_cv_prog_cxx_works=yes
3335 # If we can't run a trivial program, we are probably using a cross compiler.
3336 if (./conftest; exit) 2>/dev/null; then
3337 @@ -1653,12 +1639,12 @@ if test $ac_cv_prog_cxx_works = no; then
3338 { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
3340 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
3341 -echo "configure:1657: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
3342 +echo "configure:1643: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
3343 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
3344 cross_compiling=$ac_cv_prog_cxx_cross
3346 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
3347 -echo "configure:1662: checking whether we are using GNU C++" >&5
3348 +echo "configure:1648: checking whether we are using GNU C++" >&5
3349 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
3350 echo $ac_n "(cached) $ac_c" 1>&6
3351 else
3352 @@ -1667,7 +1653,7 @@ else
3353 yes;
3354 #endif
3356 -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
3357 +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1657: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
3358 ac_cv_prog_gxx=yes
3359 else
3360 ac_cv_prog_gxx=no
3361 @@ -1686,7 +1672,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
3362 ac_save_CXXFLAGS="$CXXFLAGS"
3363 CXXFLAGS=
3364 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
3365 -echo "configure:1690: checking whether ${CXX-g++} accepts -g" >&5
3366 +echo "configure:1676: checking whether ${CXX-g++} accepts -g" >&5
3367 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
3368 echo $ac_n "(cached) $ac_c" 1>&6
3369 else
3370 @@ -1717,63 +1703,20 @@ else
3374 -for ac_declaration in \
3375 - ''\
3376 - '#include <stdlib.h>' \
3377 - 'extern "C" void std::exit (int) throw (); using std::exit;' \
3378 - 'extern "C" void std::exit (int); using std::exit;' \
3379 - 'extern "C" void exit (int) throw ();' \
3380 - 'extern "C" void exit (int);' \
3381 - 'void exit (int);'
3383 - cat > conftest.$ac_ext <<EOF
3384 -#line 1731 "configure"
3385 -#include "confdefs.h"
3386 -#include <stdlib.h>
3387 -$ac_declaration
3388 -int main() {
3389 -exit (42);
3390 -; return 0; }
3391 -EOF
3392 -if { (eval echo configure:1739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3394 -else
3395 - echo "configure: failed program was:" >&5
3396 - cat conftest.$ac_ext >&5
3397 - rm -rf conftest*
3398 - continue
3400 -rm -f conftest*
3401 - cat > conftest.$ac_ext <<EOF
3402 -#line 1749 "configure"
3403 -#include "confdefs.h"
3404 -$ac_declaration
3405 -int main() {
3406 -exit (42);
3407 -; return 0; }
3408 -EOF
3409 -if { (eval echo configure:1756: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3410 - rm -rf conftest*
3411 - break
3412 -else
3413 - echo "configure: failed program was:" >&5
3414 - cat conftest.$ac_ext >&5
3416 -rm -f conftest*
3417 -done
3418 -if test -n "$ac_declaration"; then
3419 - echo '#ifdef __cplusplus' >>confdefs.h
3420 - echo $ac_declaration >>confdefs.h
3421 - echo '#endif' >>confdefs.h
3424 + case "$build:$target" in
3425 + powerpc-apple-darwin8*:i?86-apple-darwin*)
3426 + CFLAGS=$_SAVE_CFLAGS
3427 + CXXFLAGS=$_SAVE_CXXFLAGS
3428 + ;;
3429 + esac
3431 for ac_prog in $RANLIB "${target_alias}-ranlib" "${target}-ranlib"
3433 # Extract the first word of "$ac_prog", so it can be a program name with args.
3434 set dummy $ac_prog; ac_word=$2
3435 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3436 -echo "configure:1777: checking for $ac_word" >&5
3437 +echo "configure:1720: checking for $ac_word" >&5
3438 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
3439 echo $ac_n "(cached) $ac_c" 1>&6
3440 else
3441 @@ -1808,7 +1751,7 @@ do
3442 # Extract the first word of "$ac_prog", so it can be a program name with args.
3443 set dummy $ac_prog; ac_word=$2
3444 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3445 -echo "configure:1812: checking for $ac_word" >&5
3446 +echo "configure:1755: checking for $ac_word" >&5
3447 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
3448 echo $ac_n "(cached) $ac_c" 1>&6
3449 else
3450 @@ -1843,7 +1786,7 @@ do
3451 # Extract the first word of "$ac_prog", so it can be a program name with args.
3452 set dummy $ac_prog; ac_word=$2
3453 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3454 -echo "configure:1847: checking for $ac_word" >&5
3455 +echo "configure:1790: checking for $ac_word" >&5
3456 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
3457 echo $ac_n "(cached) $ac_c" 1>&6
3458 else
3459 @@ -1878,7 +1821,7 @@ do
3460 # Extract the first word of "$ac_prog", so it can be a program name with args.
3461 set dummy $ac_prog; ac_word=$2
3462 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3463 -echo "configure:1882: checking for $ac_word" >&5
3464 +echo "configure:1825: checking for $ac_word" >&5
3465 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
3466 echo $ac_n "(cached) $ac_c" 1>&6
3467 else
3468 @@ -1913,7 +1856,7 @@ do
3469 # Extract the first word of "$ac_prog", so it can be a program name with args.
3470 set dummy $ac_prog; ac_word=$2
3471 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3472 -echo "configure:1917: checking for $ac_word" >&5
3473 +echo "configure:1860: checking for $ac_word" >&5
3474 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
3475 echo $ac_n "(cached) $ac_c" 1>&6
3476 else
3477 @@ -1948,7 +1891,7 @@ do
3478 # Extract the first word of "$ac_prog", so it can be a program name with args.
3479 set dummy $ac_prog; ac_word=$2
3480 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3481 -echo "configure:1952: checking for $ac_word" >&5
3482 +echo "configure:1895: checking for $ac_word" >&5
3483 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
3484 echo $ac_n "(cached) $ac_c" 1>&6
3485 else
3486 @@ -1985,7 +1928,7 @@ do
3487 # Extract the first word of "$ac_prog", so it can be a program name with args.
3488 set dummy $ac_prog; ac_word=$2
3489 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3490 -echo "configure:1989: checking for $ac_word" >&5
3491 +echo "configure:1932: checking for $ac_word" >&5
3492 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
3493 echo $ac_n "(cached) $ac_c" 1>&6
3494 else
3495 @@ -2017,7 +1960,7 @@ test -n "$CXX" || CXX="gcc"
3498 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
3499 -echo "configure:2021: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
3500 +echo "configure:1964: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
3502 ac_ext=C
3503 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
3504 @@ -2028,12 +1971,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
3506 cat > conftest.$ac_ext << EOF
3508 -#line 2032 "configure"
3509 +#line 1975 "configure"
3510 #include "confdefs.h"
3512 int main(){return(0);}
3514 -if { (eval echo configure:2037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3515 +if { (eval echo configure:1980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3516 ac_cv_prog_cxx_works=yes
3517 # If we can't run a trivial program, we are probably using a cross compiler.
3518 if (./conftest; exit) 2>/dev/null; then
3519 @@ -2059,12 +2002,12 @@ if test $ac_cv_prog_cxx_works = no; then
3520 { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
3522 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
3523 -echo "configure:2063: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
3524 +echo "configure:2006: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
3525 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
3526 cross_compiling=$ac_cv_prog_cxx_cross
3528 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
3529 -echo "configure:2068: checking whether we are using GNU C++" >&5
3530 +echo "configure:2011: checking whether we are using GNU C++" >&5
3531 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
3532 echo $ac_n "(cached) $ac_c" 1>&6
3533 else
3534 @@ -2073,7 +2016,7 @@ else
3535 yes;
3536 #endif
3538 -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2077: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
3539 +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
3540 ac_cv_prog_gxx=yes
3541 else
3542 ac_cv_prog_gxx=no
3543 @@ -2092,7 +2035,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
3544 ac_save_CXXFLAGS="$CXXFLAGS"
3545 CXXFLAGS=
3546 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
3547 -echo "configure:2096: checking whether ${CXX-g++} accepts -g" >&5
3548 +echo "configure:2039: checking whether ${CXX-g++} accepts -g" >&5
3549 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
3550 echo $ac_n "(cached) $ac_c" 1>&6
3551 else
3552 @@ -2123,64 +2066,13 @@ else
3556 -for ac_declaration in \
3557 - ''\
3558 - '#include <stdlib.h>' \
3559 - 'extern "C" void std::exit (int) throw (); using std::exit;' \
3560 - 'extern "C" void std::exit (int); using std::exit;' \
3561 - 'extern "C" void exit (int) throw ();' \
3562 - 'extern "C" void exit (int);' \
3563 - 'void exit (int);'
3565 - cat > conftest.$ac_ext <<EOF
3566 -#line 2137 "configure"
3567 -#include "confdefs.h"
3568 -#include <stdlib.h>
3569 -$ac_declaration
3570 -int main() {
3571 -exit (42);
3572 -; return 0; }
3573 -EOF
3574 -if { (eval echo configure:2145: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3576 -else
3577 - echo "configure: failed program was:" >&5
3578 - cat conftest.$ac_ext >&5
3579 - rm -rf conftest*
3580 - continue
3582 -rm -f conftest*
3583 - cat > conftest.$ac_ext <<EOF
3584 -#line 2155 "configure"
3585 -#include "confdefs.h"
3586 -$ac_declaration
3587 -int main() {
3588 -exit (42);
3589 -; return 0; }
3590 -EOF
3591 -if { (eval echo configure:2162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3592 - rm -rf conftest*
3593 - break
3594 -else
3595 - echo "configure: failed program was:" >&5
3596 - cat conftest.$ac_ext >&5
3598 -rm -f conftest*
3599 -done
3600 -if test -n "$ac_declaration"; then
3601 - echo '#ifdef __cplusplus' >>confdefs.h
3602 - echo $ac_declaration >>confdefs.h
3603 - echo '#endif' >>confdefs.h
3607 if test "$CXX" = "cl" -a -z "$CC"; then
3608 CC=$CXX
3609 else
3610 # Extract the first word of "gcc", so it can be a program name with args.
3611 set dummy gcc; ac_word=$2
3612 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3613 -echo "configure:2184: checking for $ac_word" >&5
3614 +echo "configure:2076: checking for $ac_word" >&5
3615 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
3616 echo $ac_n "(cached) $ac_c" 1>&6
3617 else
3618 @@ -2210,7 +2102,7 @@ if test -z "$CC"; then
3619 # Extract the first word of "cc", so it can be a program name with args.
3620 set dummy cc; ac_word=$2
3621 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3622 -echo "configure:2214: checking for $ac_word" >&5
3623 +echo "configure:2106: checking for $ac_word" >&5
3624 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
3625 echo $ac_n "(cached) $ac_c" 1>&6
3626 else
3627 @@ -2261,7 +2153,7 @@ fi
3628 # Extract the first word of "cl", so it can be a program name with args.
3629 set dummy cl; ac_word=$2
3630 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3631 -echo "configure:2265: checking for $ac_word" >&5
3632 +echo "configure:2157: checking for $ac_word" >&5
3633 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
3634 echo $ac_n "(cached) $ac_c" 1>&6
3635 else
3636 @@ -2293,7 +2185,7 @@ fi
3639 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
3640 -echo "configure:2297: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
3641 +echo "configure:2189: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
3643 ac_ext=c
3644 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
3645 @@ -2304,12 +2196,12 @@ cross_compiling=$ac_cv_prog_cc_cross
3647 cat > conftest.$ac_ext << EOF
3649 -#line 2308 "configure"
3650 +#line 2200 "configure"
3651 #include "confdefs.h"
3653 main(){return(0);}
3655 -if { (eval echo configure:2313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3656 +if { (eval echo configure:2205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3657 ac_cv_prog_cc_works=yes
3658 # If we can't run a trivial program, we are probably using a cross compiler.
3659 if (./conftest; exit) 2>/dev/null; then
3660 @@ -2335,12 +2227,12 @@ if test $ac_cv_prog_cc_works = no; then
3661 { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
3663 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
3664 -echo "configure:2339: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
3665 +echo "configure:2231: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
3666 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
3667 cross_compiling=$ac_cv_prog_cc_cross
3669 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
3670 -echo "configure:2344: checking whether we are using GNU C" >&5
3671 +echo "configure:2236: checking whether we are using GNU C" >&5
3672 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
3673 echo $ac_n "(cached) $ac_c" 1>&6
3674 else
3675 @@ -2349,7 +2241,7 @@ else
3676 yes;
3677 #endif
3679 -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2353: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
3680 +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
3681 ac_cv_prog_gcc=yes
3682 else
3683 ac_cv_prog_gcc=no
3684 @@ -2368,7 +2260,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
3685 ac_save_CFLAGS="$CFLAGS"
3686 CFLAGS=
3687 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
3688 -echo "configure:2372: checking whether ${CC-cc} accepts -g" >&5
3689 +echo "configure:2264: checking whether ${CC-cc} accepts -g" >&5
3690 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
3691 echo $ac_n "(cached) $ac_c" 1>&6
3692 else
3693 @@ -2401,7 +2293,7 @@ fi
3696 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
3697 -echo "configure:2405: checking how to run the C preprocessor" >&5
3698 +echo "configure:2297: checking how to run the C preprocessor" >&5
3699 # On Suns, sometimes $CPP names a directory.
3700 if test -n "$CPP" && test -d "$CPP"; then
3701 CPP=
3702 @@ -2416,13 +2308,13 @@ else
3703 # On the NeXT, cc -E runs the code through the compiler's parser,
3704 # not just through cpp.
3705 cat > conftest.$ac_ext <<EOF
3706 -#line 2420 "configure"
3707 +#line 2312 "configure"
3708 #include "confdefs.h"
3709 #include <assert.h>
3710 Syntax Error
3712 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
3713 -{ (eval echo configure:2426: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
3714 +{ (eval echo configure:2318: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
3715 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
3716 if test -z "$ac_err"; then
3718 @@ -2433,13 +2325,13 @@ else
3719 rm -rf conftest*
3720 CPP="${CC-cc} -E -traditional-cpp"
3721 cat > conftest.$ac_ext <<EOF
3722 -#line 2437 "configure"
3723 +#line 2329 "configure"
3724 #include "confdefs.h"
3725 #include <assert.h>
3726 Syntax Error
3728 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
3729 -{ (eval echo configure:2443: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
3730 +{ (eval echo configure:2335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
3731 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
3732 if test -z "$ac_err"; then
3734 @@ -2450,13 +2342,13 @@ else
3735 rm -rf conftest*
3736 CPP="${CC-cc} -nologo -E"
3737 cat > conftest.$ac_ext <<EOF
3738 -#line 2454 "configure"
3739 +#line 2346 "configure"
3740 #include "confdefs.h"
3741 #include <assert.h>
3742 Syntax Error
3744 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
3745 -{ (eval echo configure:2460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
3746 +{ (eval echo configure:2352: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
3747 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
3748 if test -z "$ac_err"; then
3750 @@ -2483,7 +2375,7 @@ echo "$ac_t""$CPP" 1>&6
3751 # Extract the first word of "ranlib", so it can be a program name with args.
3752 set dummy ranlib; ac_word=$2
3753 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3754 -echo "configure:2487: checking for $ac_word" >&5
3755 +echo "configure:2379: checking for $ac_word" >&5
3756 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
3757 echo $ac_n "(cached) $ac_c" 1>&6
3758 else
3759 @@ -2515,7 +2407,7 @@ do
3760 # Extract the first word of "$ac_prog", so it can be a program name with args.
3761 set dummy $ac_prog; ac_word=$2
3762 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3763 -echo "configure:2519: checking for $ac_word" >&5
3764 +echo "configure:2411: checking for $ac_word" >&5
3765 if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then
3766 echo $ac_n "(cached) $ac_c" 1>&6
3767 else
3768 @@ -2556,7 +2448,7 @@ do
3769 # Extract the first word of "$ac_prog", so it can be a program name with args.
3770 set dummy $ac_prog; ac_word=$2
3771 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3772 -echo "configure:2560: checking for $ac_word" >&5
3773 +echo "configure:2452: checking for $ac_word" >&5
3774 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
3775 echo $ac_n "(cached) $ac_c" 1>&6
3776 else
3777 @@ -2597,7 +2489,7 @@ do
3778 # Extract the first word of "$ac_prog", so it can be a program name with args.
3779 set dummy $ac_prog; ac_word=$2
3780 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3781 -echo "configure:2601: checking for $ac_word" >&5
3782 +echo "configure:2493: checking for $ac_word" >&5
3783 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
3784 echo $ac_n "(cached) $ac_c" 1>&6
3785 else
3786 @@ -2638,7 +2530,7 @@ do
3787 # Extract the first word of "$ac_prog", so it can be a program name with args.
3788 set dummy $ac_prog; ac_word=$2
3789 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3790 -echo "configure:2642: checking for $ac_word" >&5
3791 +echo "configure:2534: checking for $ac_word" >&5
3792 if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then
3793 echo $ac_n "(cached) $ac_c" 1>&6
3794 else
3795 @@ -2679,7 +2571,7 @@ do
3796 # Extract the first word of "$ac_prog", so it can be a program name with args.
3797 set dummy $ac_prog; ac_word=$2
3798 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3799 -echo "configure:2683: checking for $ac_word" >&5
3800 +echo "configure:2575: checking for $ac_word" >&5
3801 if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then
3802 echo $ac_n "(cached) $ac_c" 1>&6
3803 else
3804 @@ -2734,6 +2626,12 @@ if test "`echo | $AS -v 2>&1 | grep -c G
3806 rm -f a.out
3808 +case "$build:$target" in
3809 + i?86-apple-darwin*:powerpc-apple-darwin*)
3810 + cross_compiling=yes
3811 + ;;
3812 +esac
3814 if test "$cross_compiling" = "yes"; then
3815 CROSS_COMPILE=1
3816 else
3817 @@ -2741,7 +2639,7 @@ else
3820 echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6
3821 -echo "configure:2745: checking for gcc -pipe support" >&5
3822 +echo "configure:2643: checking for gcc -pipe support" >&5
3823 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
3824 echo '#include <stdio.h>' > dummy-hello.c
3825 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
3826 @@ -2756,14 +2654,14 @@ if test -n "$GNU_CC" && test -n "$GNU_CX
3827 _SAVE_CFLAGS=$CFLAGS
3828 CFLAGS="$CFLAGS -pipe"
3829 cat > conftest.$ac_ext <<EOF
3830 -#line 2760 "configure"
3831 +#line 2658 "configure"
3832 #include "confdefs.h"
3833 #include <stdio.h>
3834 int main() {
3835 printf("Hello World\n");
3836 ; return 0; }
3838 -if { (eval echo configure:2767: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3839 +if { (eval echo configure:2665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3840 rm -rf conftest*
3841 _res_gcc_pipe="yes"
3842 else
3843 @@ -2796,7 +2694,7 @@ do
3844 # Extract the first word of "$ac_prog", so it can be a program name with args.
3845 set dummy $ac_prog; ac_word=$2
3846 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
3847 -echo "configure:2800: checking for $ac_word" >&5
3848 +echo "configure:2698: checking for $ac_word" >&5
3849 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
3850 echo $ac_n "(cached) $ac_c" 1>&6
3851 else
3852 @@ -2857,6 +2755,7 @@ if test -n "$CROSS_COMPILE"; then
3853 linux*) OS_ARCH=Linux ;;
3854 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
3855 mingw*) OS_ARCH=WINNT ;;
3856 + darwin*) OS_ARCH=Darwin ;;
3857 esac
3858 else
3859 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
3860 @@ -2998,6 +2897,13 @@ if test "$OS_TARGET" = "WIN16"; then
3862 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
3864 +# Check whether --with-macos-sdk or --without-macos-sdk was given.
3865 +if test "${with_macos_sdk+set}" = set; then
3866 + withval="$with_macos_sdk"
3867 + MACOS_SDK_DIR=$withval
3872 case "$host" in
3873 *-mingw*)
3874 @@ -3040,17 +2946,17 @@ EOF
3875 DSO_LDOPTS='-brtl -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib'
3876 ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'`
3877 echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6
3878 -echo "configure:3044: checking for sys/atomic_op.h" >&5
3879 +echo "configure:2950: checking for sys/atomic_op.h" >&5
3880 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
3881 echo $ac_n "(cached) $ac_c" 1>&6
3882 else
3883 cat > conftest.$ac_ext <<EOF
3884 -#line 3049 "configure"
3885 +#line 2955 "configure"
3886 #include "confdefs.h"
3887 #include <sys/atomic_op.h>
3889 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
3890 -{ (eval echo configure:3054: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
3891 +{ (eval echo configure:2960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
3892 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
3893 if test -z "$ac_err"; then
3894 rm -rf conftest*
3895 @@ -3208,7 +3114,7 @@ EOF
3896 _DEBUG_FLAGS='-gdwarf-2 -O0'
3897 MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
3898 echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6
3899 -echo "configure:3212: checking for gethostbyaddr in -lbind" >&5
3900 +echo "configure:3118: checking for gethostbyaddr in -lbind" >&5
3901 ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'`
3902 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
3903 echo $ac_n "(cached) $ac_c" 1>&6
3904 @@ -3216,7 +3122,7 @@ else
3905 ac_save_LIBS="$LIBS"
3906 LIBS="-lbind $LIBS"
3907 cat > conftest.$ac_ext <<EOF
3908 -#line 3220 "configure"
3909 +#line 3126 "configure"
3910 #include "confdefs.h"
3911 /* Override any gcc2 internal prototype to avoid an error. */
3912 /* We use char because int might match the return type of a gcc2
3913 @@ -3227,7 +3133,7 @@ int main() {
3914 gethostbyaddr()
3915 ; return 0; }
3917 -if { (eval echo configure:3231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3918 +if { (eval echo configure:3137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3919 rm -rf conftest*
3920 eval "ac_cv_lib_$ac_lib_var=yes"
3921 else
3922 @@ -3408,28 +3314,81 @@ EOF
3925 CFLAGS="$CFLAGS -Wmost -fno-common"
3926 - if echo $OS_TEST | grep -c 86 2>/dev/null; then
3927 - cat >> confdefs.h <<\EOF
3928 + case "${target_cpu}" in
3929 + i*86*)
3930 + cat >> confdefs.h <<\EOF
3931 #define i386 1
3934 - CPU_ARCH=i386
3935 - else
3936 - cat >> confdefs.h <<\EOF
3937 + CPU_ARCH=i386
3938 + ;;
3939 + *)
3940 + cat >> confdefs.h <<\EOF
3941 #define ppc 1
3944 - CPU_ARCH=ppc
3945 - fi
3946 + CPU_ARCH=ppc
3947 + ;;
3948 + esac
3949 DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@'
3950 # Use the standard preprocessor (cpp)
3951 CFLAGS="$CFLAGS -no-cpp-precomp"
3952 - MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@'
3953 + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
3954 STRIP="$STRIP -x -S"
3955 DLL_SUFFIX=dylib
3956 USE_PTHREADS=1
3957 MDCPUCFG_H=_darwin.cfg
3958 PR_MD_CSRCS=darwin.c
3961 + if test "$MACOS_SDK_DIR"; then
3962 + if test ! -d "$MACOS_SDK_DIR"; then
3963 + { echo "configure: error: SDK not found. When using --with-macos-sdk, you must
3964 +specify a valid SDK. SDKs are installed when the optional cross-development
3965 +tools are selected during the Xcode/Developer Tools installation." 1>&2; exit 1; }
3966 + fi
3969 + CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
3970 + GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
3971 + GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
3973 + GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
3974 + if test "$GCC_VERSION_MAJOR" -lt "4" ; then
3975 + SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks"
3976 + if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
3977 + SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks"
3978 + fi
3980 + SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}"
3982 + CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
3984 + CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
3986 + MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}"
3987 + LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
3988 + DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS"
3989 + export NEXT_ROOT=$MACOS_SDK_DIR
3991 + if test -n "$CROSS_COMPILE" ; then
3992 + HOST_CC="NEXT_ROOT= $HOST_CC"
3993 + HOST_CXX="NEXT_ROOT= $HOST_CXX"
3994 + fi
3995 + else
3996 + CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
3998 + CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
4000 + if test "$GCC_VERSION_FULL" != "4.0.0" ; then
4001 + LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
4002 + DSO_LDOPTS="$DSO_LDOPTS -isysroot ${MACOS_SDK_DIR}"
4003 + else
4004 + LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
4005 + DSO_LDOPTS="$DSO_LDOPTS -Wl,-syslibroot,${MACOS_SDK_DIR}"
4006 + fi
4007 + fi
4008 + fi
4011 *-dgux*)
4012 @@ -3976,8 +3935,8 @@ EOF
4015 if test -n "$MOZ_DEBUG"; then
4016 - DLLFLAGS="$DLLFLAGS -DEBUG -DEBUGTYPE:CV"
4017 - LDFLAGS="$LDFLAGS -DEBUG -DEBUGTYPE:CV"
4018 + DLLFLAGS="$DLLFLAGS -DEBUG"
4019 + LDFLAGS="$LDFLAGS -DEBUG"
4022 if test "$OS_TARGET" = "WINNT"; then
4023 @@ -4445,17 +4404,17 @@ EOF
4025 ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
4026 echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
4027 -echo "configure:4449: checking for machine/builtins.h" >&5
4028 +echo "configure:4408: checking for machine/builtins.h" >&5
4029 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
4030 echo $ac_n "(cached) $ac_c" 1>&6
4031 else
4032 cat > conftest.$ac_ext <<EOF
4033 -#line 4454 "configure"
4034 +#line 4413 "configure"
4035 #include "confdefs.h"
4036 #include <machine/builtins.h>
4038 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
4039 -{ (eval echo configure:4459: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
4040 +{ (eval echo configure:4418: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
4041 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
4042 if test -z "$ac_err"; then
4043 rm -rf conftest*
4044 @@ -4853,12 +4812,12 @@ esac
4045 if test -z "$SKIP_LIBRARY_CHECKS"; then
4047 echo $ac_n "checking for dlopen""... $ac_c" 1>&6
4048 -echo "configure:4857: checking for dlopen" >&5
4049 +echo "configure:4816: checking for dlopen" >&5
4050 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
4051 echo $ac_n "(cached) $ac_c" 1>&6
4052 else
4053 cat > conftest.$ac_ext <<EOF
4054 -#line 4862 "configure"
4055 +#line 4821 "configure"
4056 #include "confdefs.h"
4057 /* System header to define __stub macros and hopefully few prototypes,
4058 which can conflict with char dlopen(); below. */
4059 @@ -4881,7 +4840,7 @@ dlopen();
4061 ; return 0; }
4063 -if { (eval echo configure:4885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
4064 +if { (eval echo configure:4844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
4065 rm -rf conftest*
4066 eval "ac_cv_func_dlopen=yes"
4067 else
4068 @@ -4900,7 +4859,7 @@ else
4069 echo "$ac_t""no" 1>&6
4071 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
4072 -echo "configure:4904: checking for dlopen in -ldl" >&5
4073 +echo "configure:4863: checking for dlopen in -ldl" >&5
4074 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
4075 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
4076 echo $ac_n "(cached) $ac_c" 1>&6
4077 @@ -4908,7 +4867,7 @@ else
4078 ac_save_LIBS="$LIBS"
4079 LIBS="-ldl $LIBS"
4080 cat > conftest.$ac_ext <<EOF
4081 -#line 4912 "configure"
4082 +#line 4871 "configure"
4083 #include "confdefs.h"
4084 /* Override any gcc2 internal prototype to avoid an error. */
4085 /* We use char because int might match the return type of a gcc2
4086 @@ -4919,7 +4878,7 @@ int main() {
4087 dlopen()
4088 ; return 0; }
4090 -if { (eval echo configure:4923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
4091 +if { (eval echo configure:4882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
4092 rm -rf conftest*
4093 eval "ac_cv_lib_$ac_lib_var=yes"
4094 else
4095 @@ -4947,13 +4906,13 @@ fi
4097 if test $ac_cv_prog_gcc = yes; then
4098 echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
4099 -echo "configure:4951: checking whether ${CC-cc} needs -traditional" >&5
4100 +echo "configure:4910: checking whether ${CC-cc} needs -traditional" >&5
4101 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
4102 echo $ac_n "(cached) $ac_c" 1>&6
4103 else
4104 ac_pattern="Autoconf.*'x'"
4105 cat > conftest.$ac_ext <<EOF
4106 -#line 4957 "configure"
4107 +#line 4916 "configure"
4108 #include "confdefs.h"
4109 #include <sgtty.h>
4110 Autoconf TIOCGETP
4111 @@ -4971,7 +4930,7 @@ rm -f conftest*
4113 if test $ac_cv_prog_gcc_traditional = no; then
4114 cat > conftest.$ac_ext <<EOF
4115 -#line 4975 "configure"
4116 +#line 4934 "configure"
4117 #include "confdefs.h"
4118 #include <termio.h>
4119 Autoconf TCGETA
4120 @@ -4995,12 +4954,12 @@ fi
4121 for ac_func in lchown strerror
4123 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
4124 -echo "configure:4999: checking for $ac_func" >&5
4125 +echo "configure:4958: checking for $ac_func" >&5
4126 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
4127 echo $ac_n "(cached) $ac_c" 1>&6
4128 else
4129 cat > conftest.$ac_ext <<EOF
4130 -#line 5004 "configure"
4131 +#line 4963 "configure"
4132 #include "confdefs.h"
4133 /* System header to define __stub macros and hopefully few prototypes,
4134 which can conflict with char $ac_func(); below. */
4135 @@ -5023,7 +4982,7 @@ $ac_func();
4137 ; return 0; }
4139 -if { (eval echo configure:5027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
4140 +if { (eval echo configure:4986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
4141 rm -rf conftest*
4142 eval "ac_cv_func_$ac_func=yes"
4143 else
4144 @@ -5061,7 +5020,7 @@ fi
4147 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
4148 -echo "configure:5065: checking for pthread_create in -lpthreads" >&5
4149 +echo "configure:5024: checking for pthread_create in -lpthreads" >&5
4150 echo "
4151 #include <pthread.h>
4152 void *foo(void *v) { int a = 1; }
4153 @@ -5083,7 +5042,7 @@ echo "
4154 echo "$ac_t""no" 1>&6
4156 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
4157 -echo "configure:5087: checking for pthread_create in -lpthread" >&5
4158 +echo "configure:5046: checking for pthread_create in -lpthread" >&5
4159 echo "
4160 #include <pthread.h>
4161 void *foo(void *v) { int a = 1; }
4162 @@ -5105,7 +5064,7 @@ echo "
4163 echo "$ac_t""no" 1>&6
4165 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
4166 -echo "configure:5109: checking for pthread_create in -lc_r" >&5
4167 +echo "configure:5068: checking for pthread_create in -lc_r" >&5
4168 echo "
4169 #include <pthread.h>
4170 void *foo(void *v) { int a = 1; }
4171 @@ -5127,7 +5086,7 @@ echo "
4172 echo "$ac_t""no" 1>&6
4174 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
4175 -echo "configure:5131: checking for pthread_create in -lc" >&5
4176 +echo "configure:5090: checking for pthread_create in -lc" >&5
4177 echo "
4178 #include <pthread.h>
4179 void *foo(void *v) { int a = 1; }
4180 @@ -5277,7 +5236,7 @@ if test -n "$USE_PTHREADS"; then
4181 rm -f conftest*
4182 ac_cv_have_dash_pthread=no
4183 echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
4184 -echo "configure:5281: checking whether ${CC-cc} accepts -pthread" >&5
4185 +echo "configure:5240: checking whether ${CC-cc} accepts -pthread" >&5
4186 echo 'int main() { return 0; }' | cat > conftest.c
4187 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
4188 if test $? -eq 0; then
4189 @@ -5293,7 +5252,7 @@ echo "configure:5281: checking whether $
4190 ac_cv_have_dash_pthreads=no
4191 if test "$ac_cv_have_dash_pthread" = "no"; then
4192 echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
4193 -echo "configure:5297: checking whether ${CC-cc} accepts -pthreads" >&5
4194 +echo "configure:5256: checking whether ${CC-cc} accepts -pthreads" >&5
4195 echo 'int main() { return 0; }' | cat > conftest.c
4196 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
4197 if test $? -eq 0; then
4198 @@ -5658,6 +5617,7 @@ esac
4203 MAKEFILES="
4204 Makefile
4205 config/Makefile
4206 @@ -5744,34 +5704,15 @@ trap 'rm -f $CONFIG_STATUS conftest*; ex
4207 # Transform confdefs.h into DEFS.
4208 # Protect against shell expansion while executing Makefile rules.
4209 # Protect against Makefile macro expansion.
4211 -# If the first sed substitution is executed (which looks for macros that
4212 -# take arguments), then we branch to the quote section. Otherwise,
4213 -# look for a macro that doesn't take arguments.
4214 -cat >confdef2opt.sed <<\_ACEOF
4215 -t clear
4216 -: clear
4217 -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
4218 -t quote
4219 -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
4220 -t quote
4222 -: quote
4223 -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
4224 -s,\[,\\&,g
4225 -s,\],\\&,g
4226 -s,\$,$$,g
4228 -_ACEOF
4229 -# We use echo to avoid assuming a particular line-breaking character.
4230 -# The extra dot is to prevent the shell from consuming trailing
4231 -# line-breaks from the sub-command output. A line-break within
4232 -# single-quotes doesn't work because, if this script is created in a
4233 -# platform that uses two characters for line-breaks (e.g., DOS), tr
4234 -# would break.
4235 -ac_LF_and_DOT=`echo; echo .`
4236 -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
4237 -rm -f confdef2opt.sed
4238 +cat > conftest.defs <<\EOF
4239 +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
4240 +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
4241 +s%\[%\\&%g
4242 +s%\]%\\&%g
4243 +s%\$%$$%g
4244 +EOF
4245 +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
4246 +rm -f conftest.defs
4249 # Without the "./", some shells look in PATH for config.status.
4250 @@ -5935,6 +5876,7 @@ s%@EXEFLAGS@%$EXEFLAGS%g
4251 s%@OS_DLLFLAGS@%$OS_DLLFLAGS%g
4252 s%@CYGWIN_WRAPPER@%$CYGWIN_WRAPPER%g
4253 s%@WIN_TOP_SRC@%$WIN_TOP_SRC%g
4254 +s%@NEXT_ROOT@%$NEXT_ROOT%g
4256 CEOF
4258 diff -uprN --exclude=CVS mozilla/directory/c-sdk/configure.in mozilla.new/directory/c-sdk/configure.in
4259 --- mozilla/directory/c-sdk/configure.in 2005-06-14 23:27:33.000000000 +0200
4260 +++ mozilla.new/directory/c-sdk/configure.in 2006-02-24 11:15:31.000000000 +0100
4261 @@ -401,25 +401,41 @@ if test "$target" != "$host"; then
4262 HOST_LDFLAGS="$LDFLAGS"
4265 - CC="$HOST_CC"
4266 - CFLAGS="$HOST_CFLAGS"
4267 - LDFLAGS="$HOST_LDFLAGS"
4269 - AC_MSG_CHECKING([whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
4270 - AC_TRY_COMPILE([], [return(0);],
4271 - [ac_cv_prog_host_cc_works=1 AC_MSG_RESULT([yes])],
4272 - AC_MSG_ERROR([installation or configuration problem: $host compiler $HOST_CC cannot create executables.]) )
4274 CC=$_SAVE_CC
4275 CFLAGS=$_SAVE_CFLAGS
4276 LDFLAGS=$_SAVE_LDFLAGS
4278 + case "$build:$target" in
4279 + powerpc-apple-darwin8*:i?86-apple-darwin*)
4280 + dnl The Darwin cross compiler doesn't necessarily point itself at a
4281 + dnl root that has libraries for the proper architecture, it defaults
4282 + dnl to the system root. The libraries in the system root on current
4283 + dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
4284 + dnl checks will fail. Fake a working SDK in that case.
4285 + _SAVE_CFLAGS=$CFLAGS
4286 + _SAVE_CXXFLAGS=$CXXLAGS
4287 + CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
4288 + CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
4289 + ;;
4290 + esac
4292 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", echo)
4293 unset ac_cv_prog_CC
4294 AC_PROG_CC
4295 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", echo)
4296 unset ac_cv_prog_CXX
4297 AC_PROG_CXX
4299 + case "$build:$target" in
4300 + powerpc-apple-darwin8*:i?86-apple-darwin*)
4301 + dnl Revert the changes made above. From this point on, the target
4302 + dnl compiler will never be used without applying the SDK to CFLAGS
4303 + dnl (see --with-macos-sdk below).
4304 + CFLAGS=$_SAVE_CFLAGS
4305 + CXXFLAGS=$_SAVE_CXXFLAGS
4306 + ;;
4307 + esac
4309 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", echo)
4310 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", echo)
4311 AC_CHECK_PROGS(AS, $AS "${target_alias}-as" "${target}-as", echo)
4312 @@ -460,6 +476,15 @@ if test "`echo | $AS -v 2>&1 | grep -c G
4314 rm -f a.out
4316 +case "$build:$target" in
4317 + i?86-apple-darwin*:powerpc-apple-darwin*)
4318 + dnl cross_compiling will have erroneously been set to "no" in this
4319 + dnl case, because the x86 build host is able to run ppc code in a
4320 + dnl translated environment, making a cross compiler appear native.
4321 + cross_compiling=yes
4322 + ;;
4323 +esac
4325 if test "$cross_compiling" = "yes"; then
4326 CROSS_COMPILE=1
4327 else
4328 @@ -537,6 +562,7 @@ if test -n "$CROSS_COMPILE"; then
4329 linux*) OS_ARCH=Linux ;;
4330 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
4331 mingw*) OS_ARCH=WINNT ;;
4332 + darwin*) OS_ARCH=Darwin ;;
4333 esac
4334 else
4335 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
4336 @@ -679,6 +705,13 @@ fi
4337 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
4339 dnl ========================================================
4340 +dnl = Mac OS X SDK support
4341 +dnl ========================================================
4342 +AC_ARG_WITH(macos-sdk,
4343 + [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
4344 + MACOS_SDK_DIR=$withval)
4346 +dnl ========================================================
4348 dnl ========================================================
4349 dnl Override of system specific host options
4350 @@ -874,22 +907,107 @@ case "$target" in
4351 AC_DEFINE(DARWIN)
4352 AC_DEFINE(HAVE_BSD_FLOCK)
4353 CFLAGS="$CFLAGS -Wmost -fno-common"
4354 - if echo $OS_TEST | grep -c 86 2>/dev/null; then
4355 - AC_DEFINE(i386)
4356 - CPU_ARCH=i386
4357 - else
4358 - AC_DEFINE(ppc)
4359 - CPU_ARCH=ppc
4360 - fi
4361 + case "${target_cpu}" in
4362 + i*86*)
4363 + AC_DEFINE(i386)
4364 + CPU_ARCH=i386
4365 + ;;
4366 + *)
4367 + AC_DEFINE(ppc)
4368 + CPU_ARCH=ppc
4369 + ;;
4370 + esac
4371 DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@'
4372 # Use the standard preprocessor (cpp)
4373 CFLAGS="$CFLAGS -no-cpp-precomp"
4374 - MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@'
4375 + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
4376 STRIP="$STRIP -x -S"
4377 DLL_SUFFIX=dylib
4378 USE_PTHREADS=1
4379 MDCPUCFG_H=_darwin.cfg
4380 PR_MD_CSRCS=darwin.c
4382 + dnl MACOS_SDK_DIR will be set to the SDK location whenever one is
4383 + dnl in use. NEXT_ROOT will be set and exported if it's needed for
4384 + dnl ld.
4386 + if test "$MACOS_SDK_DIR"; then
4387 + dnl Sync this section with the one in Mozilla's top level.
4388 + if test ! -d "$MACOS_SDK_DIR"; then
4389 + AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
4390 +specify a valid SDK. SDKs are installed when the optional cross-development
4391 +tools are selected during the Xcode/Developer Tools installation.])
4392 + fi
4394 + changequote(,)
4395 + CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
4396 + GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
4397 + GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
4398 + changequote([,])
4399 + GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
4400 + if test "$GCC_VERSION_MAJOR" -lt "4" ; then
4401 + SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks"
4402 + if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
4403 + SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks"
4404 + fi
4406 + SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}"
4408 + CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
4410 + dnl CPP needs to be set for AC_CHECK_HEADER.
4411 + CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
4413 + dnl ld support for -syslibroot is compiler-agnostic, but only
4414 + dnl available on Tiger. Although it's possible to switch on
4415 + dnl the build host's OS release to use ld -syslibroot when
4416 + dnl available, ld -syslibroot cause warnings as long as
4417 + dnl NEXT_ROOT is set. NEXT_ROOT should be set because both
4418 + dnl both the compiler and linker use it.
4419 + dnl
4420 + dnl LDFLAGS is for the utilities built in config (now and
4421 + dnl nsinstall). DSO_LDOPTS is used when linking shared
4422 + dnl libraries.
4423 + MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}"
4424 + LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
4425 + DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS"
4426 + export NEXT_ROOT=$MACOS_SDK_DIR
4428 + if test -n "$CROSS_COMPILE" ; then
4429 + dnl NEXT_ROOT will be in the environment, but it
4430 + dnl shouldn't be set for the build host. HOST_CXX is
4431 + dnl presently unused.
4432 + HOST_CC="NEXT_ROOT= $HOST_CC"
4433 + HOST_CXX="NEXT_ROOT= $HOST_CXX"
4434 + fi
4435 + else
4436 + dnl gcc >= 4.0 uses different paths than above, but knows
4437 + dnl how to find them itself.
4438 + CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
4440 + dnl CPP needs to be set for AC_CHECK_HEADER.
4441 + CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
4443 + dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which
4444 + dnl has an ld that supports -syslibroot. Don't set
4445 + dnl NEXT_ROOT because it will be ignored and cause
4446 + dnl warnings when -syslibroot is specified.
4447 + dnl
4448 + dnl Both LDFLAGS and DSO_LDOPTS are set here, see the
4449 + dnl gcc < 4.0 case for the explanation.
4450 + if test "$GCC_VERSION_FULL" != "4.0.0" ; then
4451 + dnl gcc > 4.0.0 will pass -syslibroot to ld automatically
4452 + dnl based on the -isysroot it receives.
4453 + LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
4454 + DSO_LDOPTS="$DSO_LDOPTS -isysroot ${MACOS_SDK_DIR}"
4455 + else
4456 + dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs
4457 + dnl to be explicit.
4458 + LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
4459 + DSO_LDOPTS="$DSO_LDOPTS -Wl,-syslibroot,${MACOS_SDK_DIR}"
4460 + fi
4461 + fi
4462 + fi
4465 *-dgux*)
4466 @@ -2335,6 +2453,7 @@ AC_SUBST(EXEFLAGS)
4467 AC_SUBST(OS_DLLFLAGS)
4468 AC_SUBST(CYGWIN_WRAPPER)
4469 AC_SUBST(WIN_TOP_SRC)
4470 +AC_SUBST(NEXT_ROOT)
4472 dnl ========================================================
4473 dnl Generate output files.
4474 diff -uprN --exclude=CVS mozilla/directory/xpcom/base/src/nsLDAPProtocolHandler.cpp mozilla.new/directory/xpcom/base/src/nsLDAPProtocolHandler.cpp
4475 --- mozilla/directory/xpcom/base/src/nsLDAPProtocolHandler.cpp 2004-04-25 23:07:12.000000000 +0200
4476 +++ mozilla.new/directory/xpcom/base/src/nsLDAPProtocolHandler.cpp 2006-02-24 11:16:21.000000000 +0100
4477 @@ -118,6 +118,7 @@ NS_IMETHODIMP
4478 nsLDAPProtocolHandler::NewChannel(nsIURI* uri,
4479 nsIChannel* *result)
4481 + NS_ENSURE_ARG_POINTER(uri);
4482 nsresult rv;
4483 nsLDAPChannel *channel;
4485 diff -uprN --exclude=CVS mozilla/docshell/base/nsDocShell.cpp mozilla.new/docshell/base/nsDocShell.cpp
4486 --- mozilla/docshell/base/nsDocShell.cpp 2006-01-11 23:04:33.000000000 +0100
4487 +++ mozilla.new/docshell/base/nsDocShell.cpp 2006-02-24 11:16:27.000000000 +0100
4488 @@ -40,6 +40,11 @@
4490 * ***** END LICENSE BLOCK ***** */
4492 +#ifdef MOZ_LOGGING
4493 +// so we can get logging even in release builds (but only for some things)
4494 +#define FORCE_PR_LOG 1
4495 +#endif
4497 #include "nsIBrowserDOMWindow.h"
4498 #include "nsIComponentManager.h"
4499 #include "nsIContent.h"
4500 @@ -202,8 +207,11 @@ static PRBool gValidateOrigin = (PRBool)
4501 #define NS_ERROR_DOCUMENT_IS_PRINTMODE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GENERAL,2001)
4503 #ifdef PR_LOGGING
4504 +#ifdef DEBUG
4505 static PRLogModuleInfo* gDocShellLog;
4506 #endif
4507 +static PRLogModuleInfo* gDocShellLeakLog;
4508 +#endif
4510 //*****************************************************************************
4511 //*** nsDocShellFocusController
4512 @@ -274,9 +282,15 @@ nsDocShell::nsDocShell():
4515 #ifdef PR_LOGGING
4516 +#ifdef DEBUG
4517 if (! gDocShellLog)
4518 gDocShellLog = PR_NewLogModule("nsDocShell");
4519 #endif
4520 + if (nsnull == gDocShellLeakLog)
4521 + gDocShellLeakLog = PR_NewLogModule("nsDocShellLeak");
4522 + if (gDocShellLeakLog)
4523 + PR_LOG(gDocShellLeakLog, PR_LOG_DEBUG, ("DOCSHELL %p created\n", this));
4524 +#endif
4527 nsDocShell::~nsDocShell()
4528 @@ -290,6 +304,11 @@ nsDocShell::~nsDocShell()
4529 if (--gDocShellCount == 0) {
4530 NS_IF_RELEASE(sURIFixup);
4533 +#ifdef PR_LOGGING
4534 + if (gDocShellLeakLog)
4535 + PR_LOG(gDocShellLeakLog, PR_LOG_DEBUG, ("DOCSHELL %p destroyed\n", this));
4536 +#endif
4539 nsresult
4540 @@ -628,7 +647,7 @@ nsDocShell::LoadURI(nsIURI * aURI,
4541 aLoadInfo->GetSendReferrer(&sendReferrer);
4544 -#ifdef PR_LOGGING
4545 +#if defined(PR_LOGGING) && defined(DEBUG)
4546 if (PR_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) {
4547 nsCAutoString uristr;
4548 aURI->GetAsciiSpec(uristr);
4549 @@ -733,8 +752,10 @@ nsDocShell::LoadURI(nsIURI * aURI,
4550 } // !shEntry
4552 if (shEntry) {
4553 +#ifdef DEBUG
4554 PR_LOG(gDocShellLog, PR_LOG_DEBUG,
4555 ("nsDocShell[%p]: loading from session history", this));
4556 +#endif
4558 rv = LoadHistoryEntry(shEntry, loadType);
4560 @@ -1162,10 +1183,27 @@ nsresult nsDocShell::FindTarget(const PR
4561 name.LowerCaseEqualsLiteral("_new")) {
4562 name.Truncate();
4565 + // Push a null JSContext on the JSContext stack. We don't want
4566 + // this search by name to use random stuff from the stack as the
4567 + // "caller" -- we're the caller.
4568 + nsCOMPtr<nsIJSContextStack> stack =
4569 + do_GetService("@mozilla.org/js/xpc/ContextStack;1");
4570 + if (stack) {
4571 + rv = stack->Push(nsnull);
4572 + NS_ENSURE_SUCCESS(rv, rv);
4575 rv = parentWindow->Open(EmptyString(), // URL to load
4576 name, // Window name
4577 EmptyString(), // Window features
4578 getter_AddRefs(newWindow));
4580 + if (stack) {
4581 + JSContext* cx;
4582 + stack->Pop(&cx);
4583 + NS_ASSERTION(!cx, "Unexpected JSContext popped!");
4586 if (NS_FAILED(rv)) return rv;
4588 @@ -1348,6 +1386,15 @@ PRBool
4589 nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest,
4590 PRBool aFireOnLocationChange)
4592 +#ifdef PR_LOGGING
4593 + if (gDocShellLeakLog && PR_LOG_TEST(gDocShellLeakLog, PR_LOG_DEBUG)) {
4594 + nsCAutoString spec;
4595 + if (aURI)
4596 + aURI->GetSpec(spec);
4597 + PR_LogPrint("DOCSHELL %p SetCurrentURI %s\n", this, spec.get());
4599 +#endif
4601 // We don't want to send a location change when we're displaying an error
4602 // page, and we don't want to change our idea of "current URI" either
4603 if (mLoadType == LOAD_ERROR_PAGE) {
4604 @@ -3058,7 +3105,7 @@ nsDocShell::LoadErrorPage(nsIURI *aURI,
4605 const PRUnichar *aDescription,
4606 nsIChannel* aFailedChannel)
4608 -#ifdef PR_LOGGING
4609 +#if defined(PR_LOGGING) && defined(DEBUG)
4610 if (PR_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) {
4611 nsCAutoString spec;
4612 aURI->GetSpec(spec);
4613 @@ -6156,6 +6203,15 @@ nsDocShell::InternalLoad(nsIURI * aURI,
4614 nsIRequest** aRequest)
4616 nsresult rv = NS_OK;
4618 +#ifdef PR_LOGGING
4619 + if (gDocShellLeakLog && PR_LOG_TEST(gDocShellLeakLog, PR_LOG_DEBUG)) {
4620 + nsCAutoString spec;
4621 + if (aURI)
4622 + aURI->GetSpec(spec);
4623 + PR_LogPrint("DOCSHELL %p InternalLoad %s\n", this, spec.get());
4625 +#endif
4627 // Initialize aDocShell/aRequest
4628 if (aDocShell) {
4629 @@ -7192,7 +7248,7 @@ nsDocShell::OnNewURI(nsIURI * aURI, nsIC
4630 PRBool aAddToGlobalHistory)
4632 NS_ASSERTION(aURI, "uri is null");
4633 -#ifdef PR_LOGGING
4634 +#if defined(PR_LOGGING) && defined(DEBUG)
4635 if (PR_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) {
4636 nsCAutoString spec;
4637 aURI->GetSpec(spec);
4638 @@ -7253,9 +7309,11 @@ nsDocShell::OnNewURI(nsIURI * aURI, nsIC
4639 if (mCurrentURI)
4640 aURI->Equals(mCurrentURI, &equalUri);
4642 +#ifdef DEBUG
4643 PR_LOG(gDocShellLog, PR_LOG_DEBUG,
4644 (" shAvailable=%i updateHistory=%i equalURI=%i\n",
4645 shAvailable, updateHistory, equalUri));
4646 +#endif
4648 /* If the url to be loaded is the same as the one already there,
4649 * and the original loadType is LOAD_NORMAL, LOAD_LINK, or
4650 @@ -7414,7 +7472,7 @@ nsresult
4651 nsDocShell::AddToSessionHistory(nsIURI * aURI,
4652 nsIChannel * aChannel, nsISHEntry ** aNewEntry)
4654 -#ifdef PR_LOGGING
4655 +#if defined(PR_LOGGING) && defined(DEBUG)
4656 if (PR_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) {
4657 nsCAutoString spec;
4658 aURI->GetSpec(spec);
4659 diff -uprN --exclude=CVS mozilla/dom/public/idl/xul/nsIDOMXULDocument.idl mozilla.new/dom/public/idl/xul/nsIDOMXULDocument.idl
4660 --- mozilla/dom/public/idl/xul/nsIDOMXULDocument.idl 2005-08-31 22:47:05.000000000 +0200
4661 +++ mozilla.new/dom/public/idl/xul/nsIDOMXULDocument.idl 2006-02-24 11:16:40.000000000 +0100
4662 @@ -85,3 +85,16 @@ interface nsIDOMXULDocument : nsISupport
4664 void loadOverlay(in DOMString url, in nsIObserver aObserver);
4667 +/**
4668 + * This interface is a hack for bug 319434 since we have to preserve the
4669 + * nsIDOMXULDocument interface on the branch. It provides non-scriptable
4670 + * functions that don't do security checks to access the popup and tooltip
4671 + * nodes.
4672 + */
4673 +[uuid(87545e48-b966-4579-829a-ca01b0fca9b3)]
4674 +interface nsIDOMXULDocument2 : nsIDOMXULDocument
4676 + nsIDOMNode trustedGetPopupNode();
4677 + nsIDOMNode trustedGetTooltipNode();
4679 diff -uprN --exclude=CVS mozilla/dom/src/base/nsDOMClassInfo.cpp mozilla.new/dom/src/base/nsDOMClassInfo.cpp
4680 --- mozilla/dom/src/base/nsDOMClassInfo.cpp 2006-01-11 23:05:28.000000000 +0100
4681 +++ mozilla.new/dom/src/base/nsDOMClassInfo.cpp 2006-02-24 11:16:41.000000000 +0100
4682 @@ -5521,12 +5521,36 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
4683 my_cx = (JSContext *)my_context->GetNativeContext();
4686 + // Resolving a standard class won't do any evil, and it's possible
4687 + // for caps to get the answer wrong, so disable the security check
4688 + // for this case.
4690 JSBool did_resolve = JS_FALSE;
4691 + PRBool doSecurityCheckInAddProperty = sDoSecurityCheckInAddProperty;
4692 + sDoSecurityCheckInAddProperty = PR_FALSE;
4694 - if (!::JS_ResolveStandardClass(my_cx, obj, id, &did_resolve)) {
4695 - *_retval = JS_FALSE;
4696 + JSBool ok = ::JS_ResolveStandardClass(my_cx, obj, id, &did_resolve);
4698 - return NS_ERROR_UNEXPECTED;
4699 + sDoSecurityCheckInAddProperty = doSecurityCheckInAddProperty;
4701 + if (!ok) {
4702 + // Trust the JS engine (or the script security manager) to set
4703 + // the exception in the JS engine.
4705 + jsval exn;
4706 + if (!JS_GetPendingException(my_cx, &exn)) {
4707 + return NS_ERROR_UNEXPECTED;
4710 + // Return NS_OK to avoid stomping over the exception that was passed
4711 + // down from the ResolveStandardClass call.
4712 + // Note that the order of the JS_ClearPendingException and
4713 + // JS_SetPendingException is important in the case that my_cx == cx.
4715 + JS_ClearPendingException(my_cx);
4716 + JS_SetPendingException(cx, exn);
4717 + *_retval = JS_FALSE;
4718 + return NS_OK;
4721 if (did_resolve) {
4722 @@ -5839,10 +5863,6 @@ nsWindowSH::NewEnumerate(nsIXPConnectWra
4723 return NS_OK;
4726 -#ifdef DEBUG_mrbkap
4727 - printf(">>> Enumerating a window!\n");
4728 -#endif
4730 // The security check passed, let's see if we need to get the inner
4731 // window's JS object or if we can just start enumerating.
4732 nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
4733 @@ -5876,13 +5896,6 @@ nsWindowSH::NewEnumerate(nsIXPConnectWra
4736 if (*idp != JSVAL_VOID) {
4737 -#ifdef DEBUG_mrbkap
4739 - jsval v;
4740 - NS_ASSERTION(JS_IdToValue(cx, *idp, &v), "Give me my value");
4741 - printf("=== %s\n", JS_GetStringBytes(JS_ValueToString(cx, v)));
4743 -#endif
4744 break;
4747 diff -uprN --exclude=CVS mozilla/dom/src/base/nsGlobalWindow.cpp mozilla.new/dom/src/base/nsGlobalWindow.cpp
4748 --- mozilla/dom/src/base/nsGlobalWindow.cpp 2006-01-09 06:48:53.000000000 +0100
4749 +++ mozilla.new/dom/src/base/nsGlobalWindow.cpp 2006-02-24 11:16:41.000000000 +0100
4750 @@ -161,6 +161,16 @@
4751 // belonging to the back-end like nsIContentPolicy
4752 #include "nsIPopupWindowManager.h"
4754 +#ifdef MOZ_LOGGING
4755 +// so we can get logging even in release builds
4756 +#define FORCE_PR_LOG 1
4757 +#endif
4758 +#include "prlog.h"
4760 +#ifdef PR_LOGGING
4761 +static PRLogModuleInfo* gDOMLeakPRLog;
4762 +#endif
4764 nsIScriptSecurityManager *nsGlobalWindow::sSecMan = nsnull;
4765 nsIFactory *nsGlobalWindow::sComputedDOMStyleFactory = nsnull;
4767 @@ -178,8 +188,14 @@ PRInt32 gTimeoutCnt
4768 #define DEBUG_PAGE_CACHE
4769 #endif
4771 +// The shortest interval/timeout we permit
4772 #define DOM_MIN_TIMEOUT_VALUE 10 // 10ms
4774 +// The longest interval (as PRIntervalTime) we permit, or that our
4775 +// timer code can handle, really. See DELAY_INTERVAL_LIMIT in
4776 +// nsTimerImpl.h for details.
4777 +#define DOM_MAX_TIMEOUT_VALUE PR_BIT(8 * sizeof(PRIntervalTime) - 1)
4779 #define FORWARD_TO_OUTER(method, args, err_rval) \
4780 PR_BEGIN_MACRO \
4781 if (IsInnerWindow()) { \
4782 @@ -322,6 +338,15 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalW
4783 printf("++DOMWINDOW == %d\n", gRefCnt);
4784 #endif
4786 +#ifdef PR_LOGGING
4787 + if (!gDOMLeakPRLog)
4788 + gDOMLeakPRLog = PR_NewLogModule("DOMLeak");
4790 + if (gDOMLeakPRLog)
4791 + PR_LOG(gDOMLeakPRLog, PR_LOG_DEBUG,
4792 + ("DOMWINDOW %p created outer=%p", this, aOuterWindow));
4793 +#endif
4795 if (!sSecMan) {
4796 CallGetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &sSecMan);
4798 @@ -336,6 +361,12 @@ nsGlobalWindow::~nsGlobalWindow()
4799 printf("--DOMWINDOW == %d\n", gRefCnt);
4800 #endif
4802 +#ifdef PR_LOGGING
4803 + if (gDOMLeakPRLog)
4804 + PR_LOG(gDOMLeakPRLog, PR_LOG_DEBUG,
4805 + ("DOMWINDOW %p destroyed", this));
4806 +#endif
4808 if (IsOuterWindow()) {
4809 // An outer window is destroyed with inner windows still possibly
4810 // alive, iterate through the inner windows and null out their
4811 @@ -817,6 +848,19 @@ nsGlobalWindow::SetNewDocument(nsIDOMDoc
4813 NS_WARN_IF_FALSE(mDocumentPrincipal == nsnull,
4814 "mDocumentPrincipal prematurely set!");
4815 +#ifdef PR_LOGGING
4816 + if (IsInnerWindow() && aDocument && gDOMLeakPRLog &&
4817 + PR_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) {
4818 + nsCOMPtr<nsIDocument> newDoc(do_QueryInterface(aDocument));
4819 + nsIURI *uri = nsnull;
4820 + if (newDoc)
4821 + uri = newDoc->GetDocumentURI();
4822 + nsCAutoString spec;
4823 + if (uri)
4824 + uri->GetSpec(spec);
4825 + PR_LogPrint("DOMWINDOW %p SetNewDocument %s", this, spec.get());
4827 +#endif
4829 if (!aIsInternalCall && IsInnerWindow()) {
4830 if (!mOuterWindow) {
4831 @@ -6004,6 +6048,12 @@ nsGlobalWindow::SetTimeoutOrInterval(PRB
4832 interval = DOM_MIN_TIMEOUT_VALUE;
4835 + // Make sure we don't proceed with a interval larger than our timer
4836 + // code can handle.
4837 + if (interval > PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE)) {
4838 + interval = PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE);
4841 timeout = new nsTimeout();
4842 if (!timeout)
4843 return NS_ERROR_OUT_OF_MEMORY;
4844 @@ -6080,14 +6130,14 @@ nsGlobalWindow::SetTimeoutOrInterval(PRB
4845 return NS_ERROR_FAILURE;
4848 - PRIntervalTime delta = PR_MillisecondsToInterval((PRUint32)interval);
4849 + PRTime delta = (PRTime)interval * PR_USEC_PER_MSEC;
4851 if (!IsFrozen()) {
4852 // If we're not currently frozen, then we set timeout->mWhen to be the
4853 // actual firing time of the timer (i.e., now + delta). We also actually
4854 // create a timer and fire it off.
4856 - timeout->mWhen = PR_IntervalNow() + delta;
4857 + timeout->mWhen = PR_Now() + delta;
4859 timeout->mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
4860 if (NS_FAILED(rv)) {
4861 @@ -6192,8 +6242,8 @@ nsGlobalWindow::RunTimeout(nsTimeout *aT
4863 // A native timer has gone off. See which of our timeouts need
4864 // servicing
4865 - PRIntervalTime now = PR_IntervalNow();
4866 - PRIntervalTime deadline;
4867 + PRTime now = PR_Now();
4868 + PRTime deadline;
4870 if (aTimeout && aTimeout->mWhen > now) {
4871 // The OS timer fired early (yikes!), and possibly out of order
4872 @@ -6247,7 +6297,7 @@ nsGlobalWindow::RunTimeout(nsTimeout *aT
4873 mTimeoutInsertionPoint = &dummy_timeout.mNext;
4875 prev = nsnull;
4876 - for (timeout = mTimeouts; timeout != &dummy_timeout; timeout = next) {
4877 + for (timeout = mTimeouts; timeout != &dummy_timeout && !IsFrozen(); timeout = next) {
4878 next = timeout->mNext;
4880 if (timeout->mFiringDepth != firingDepth) {
4881 @@ -6297,9 +6347,10 @@ nsGlobalWindow::RunTimeout(nsTimeout *aT
4882 } else {
4883 // Add a "secret" final argument that indicates timeout lateness
4884 // in milliseconds
4885 - PRIntervalTime lateness =
4886 - PR_IntervalToMilliseconds(now - timeout->mWhen);
4887 - timeout->mArgv[timeout->mArgc] = INT_TO_JSVAL((jsint) lateness);
4888 + PRTime lateness = now - timeout->mWhen;
4890 + timeout->mArgv[timeout->mArgc] =
4891 + INT_TO_JSVAL((jsint)(lateness / PR_USEC_PER_MSEC));
4893 jsval dummy;
4894 scx->CallEventHandler(mJSObject, timeout->mFunObj, timeout->mArgc + 1,
4895 @@ -6338,55 +6389,60 @@ nsGlobalWindow::RunTimeout(nsTimeout *aT
4896 return;
4899 + PRBool isInterval = PR_FALSE;
4901 // If we have a regular interval timer, we re-schedule the
4902 // timeout, accounting for clock drift.
4903 if (timeout->mInterval) {
4904 // Compute time to next timeout for interval timer.
4905 - timeout->mWhen += PR_MillisecondsToInterval(timeout->mInterval);
4906 - PRInt32 delay = timeout->mWhen - PR_IntervalNow();
4907 + // XXX Units?
4908 + PRTime nextInterval = timeout->mWhen +
4909 + ((PRTime)timeout->mInterval * PR_USEC_PER_MSEC);
4910 + PRTime delay = nextInterval - PR_Now();
4912 // If the next interval timeout is already supposed to have
4913 - // happened then run the timeout immediately.
4914 - if (delay < 0) {
4915 - delay = 0;
4918 - delay = PR_IntervalToMilliseconds(delay);
4920 - if (delay < DOM_MIN_TIMEOUT_VALUE) {
4921 - // Don't let intervals starve the message pump, no matter
4922 - // what. Just like we do for non-interval timeouts.
4924 - delay = DOM_MIN_TIMEOUT_VALUE;
4927 - // Reschedule the OS timer. Don't bother returning any error
4928 - // codes if this fails since nobody who cares about them is
4929 - // listening anyways.
4930 - nsresult rv =
4931 - timeout->mTimer->InitWithFuncCallback(TimerCallback, timeout, delay,
4932 - nsITimer::TYPE_ONE_SHOT);
4934 - if (NS_FAILED(rv)) {
4935 - NS_ERROR("Error initializing timer for DOM timeout!");
4936 + // happened then run the timeout as soon as we can (meaning
4937 + // after DOM_MIN_TIMEOUT_VALUE time has passed).
4938 + if (delay < ((PRTime)DOM_MIN_TIMEOUT_VALUE * PR_USEC_PER_MSEC)) {
4939 + delay = (PRTime)DOM_MIN_TIMEOUT_VALUE * PR_USEC_PER_MSEC;
4942 + if (timeout->mTimer) {
4943 + timeout->mWhen = nextInterval;
4945 + // Reschedule the OS timer. Don't bother returning any error
4946 + // codes if this fails since the callers of this method
4947 + // doesn't care about them nobody who cares about them
4948 + // anyways.
4949 + nsresult rv = timeout->mTimer->
4950 + InitWithFuncCallback(TimerCallback, timeout,
4951 + (PRInt32)(delay / PR_USEC_PER_MSEC),
4952 + nsITimer::TYPE_ONE_SHOT);
4954 + if (NS_FAILED(rv)) {
4955 + NS_ERROR("Error initializing timer for DOM timeout!");
4957 + // We failed to initialize the new OS timer, this timer does
4958 + // us no good here so we just cancel it (just in case) and
4959 + // null out the pointer to the OS timer, this will release the
4960 + // OS timer. As we continue executing the code below we'll end
4961 + // up deleting the timeout since it's not an interval timeout
4962 + // any more (since timeout->mTimer == nsnull).
4963 + timeout->mTimer->Cancel();
4964 + timeout->mTimer = nsnull;
4966 - // We failed to initialize the new OS timer, this timer does
4967 - // us no good here so we just cancel it (just in case) and
4968 - // null out the pointer to the OS timer, this will release the
4969 - // OS timer. As we continue executing the code below we'll end
4970 - // up deleting the timeout since it's not an interval timeout
4971 - // any more (since timeout->mTimer == nsnull).
4972 - timeout->mTimer->Cancel();
4973 - timeout->mTimer = nsnull;
4974 + // Now that the OS timer no longer has a reference to the
4975 + // timeout we need to drop that reference.
4976 + timeout->Release(scx);
4978 + } else {
4979 + NS_ASSERTION(IsFrozen(), "How'd our timer end up null if we're not frozen?");
4981 - // Now that the OS timer no longer has a reference to the
4982 - // timeout we need to drop that reference.
4983 - timeout->Release(scx);
4984 + timeout->mWhen = delay;
4985 + isInterval = PR_TRUE;
4989 - PRBool isInterval = PR_FALSE;
4991 if (timeout->mTimer) {
4992 if (timeout->mInterval) {
4993 isInterval = PR_TRUE;
4994 @@ -6975,7 +7031,7 @@ nsGlobalWindow::SuspendTimeouts()
4996 FORWARD_TO_INNER_VOID(SuspendTimeouts, ());
4998 - PRIntervalTime now = PR_IntervalNow();
4999 + PRTime now = PR_Now();
5000 for (nsTimeout *t = mTimeouts; t; t = t->mNext) {
5001 // Change mWhen to be the time remaining for this timer.
5002 if (t->mWhen > now)
5003 @@ -7025,14 +7081,19 @@ nsGlobalWindow::ResumeTimeouts()
5005 FORWARD_TO_INNER(ResumeTimeouts, (), NS_ERROR_NOT_INITIALIZED);
5007 - // Restore all of the timeouts, using the stored time remaining.
5008 + // Restore all of the timeouts, using the stored time remaining
5009 + // (stored in timeout->mWhen).
5011 - PRIntervalTime now = PR_IntervalNow();
5012 + PRTime now = PR_Now();
5013 nsresult rv;
5015 for (nsTimeout *t = mTimeouts; t; t = t->mNext) {
5016 - PRUint32 delay = PR_MAX(PR_IntervalToMilliseconds(t->mWhen),
5017 - DOM_MIN_TIMEOUT_VALUE);
5018 + PRUint32 delay =
5019 + PR_MAX(((PRUint32)(t->mWhen / PR_USEC_PER_MSEC)),
5020 + DOM_MIN_TIMEOUT_VALUE);
5022 + // Set mWhen back to the time when the timer is supposed to
5023 + // fire.
5024 t->mWhen += now;
5026 t->mTimer = do_CreateInstance("@mozilla.org/timer;1");
5027 diff -uprN --exclude=CVS mozilla/dom/src/base/nsGlobalWindow.h mozilla.new/dom/src/base/nsGlobalWindow.h
5028 --- mozilla/dom/src/base/nsGlobalWindow.h 2005-10-16 18:31:38.000000000 +0200
5029 +++ mozilla.new/dom/src/base/nsGlobalWindow.h 2006-02-24 11:16:41.000000000 +0100
5030 @@ -560,11 +560,12 @@ struct nsTimeout
5031 // Returned as value of setTimeout()
5032 PRUint32 mPublicId;
5034 - // Non-zero if repetitive timeout
5035 + // Non-zero interval in milliseconds if repetitive timeout
5036 PRInt32 mInterval;
5038 - // Nominal time to run this timeout
5039 - PRIntervalTime mWhen;
5040 + // Nominal time (in microseconds since the epoch) to run this
5041 + // timeout
5042 + PRTime mWhen;
5044 // Principal with which to execute
5045 nsCOMPtr<nsIPrincipal> mPrincipal;
5046 diff -uprN --exclude=CVS mozilla/editor/libeditor/html/nsHTMLEditor.cpp mozilla.new/editor/libeditor/html/nsHTMLEditor.cpp
5047 --- mozilla/editor/libeditor/html/nsHTMLEditor.cpp 2005-07-13 18:45:58.000000000 +0200
5048 +++ mozilla.new/editor/libeditor/html/nsHTMLEditor.cpp 2006-02-24 11:16:49.000000000 +0100
5049 @@ -4047,139 +4047,6 @@ nsHTMLEditor::DebugUnitTests(PRInt32 *ou
5051 #ifdef XP_MAC
5052 #pragma mark -
5053 -#pragma mark nsIEditorIMESupport overrides
5054 -#pragma mark -
5055 -#endif
5057 -NS_IMETHODIMP
5058 -nsHTMLEditor::SetCompositionString(const nsAString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply)
5060 - NS_ASSERTION(aTextRangeList, "null ptr");
5061 - if (nsnull == aTextRangeList)
5062 - return NS_ERROR_NULL_POINTER;
5064 - nsCOMPtr<nsICaret> caretP;
5066 - // workaround for windows ime bug 23558: we get every ime event twice.
5067 - // for escape keypress, this causes an empty string to be passed
5068 - // twice, which freaks out the editor. This is to detect and aviod that
5069 - // situation:
5070 - if (aCompositionString.IsEmpty() && !mIMETextNode)
5072 - return NS_OK;
5075 - nsCOMPtr<nsISelection> selection;
5076 - nsresult result = GetSelection(getter_AddRefs(selection));
5077 - if (NS_FAILED(result)) return result;
5079 - mIMETextRangeList = aTextRangeList;
5081 - if (!mPresShellWeak)
5082 - return NS_ERROR_NOT_INITIALIZED;
5084 - nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
5085 - if (!ps)
5086 - return NS_ERROR_NOT_INITIALIZED;
5088 - // XXX_kin: BEGIN HACK! HACK! HACK!
5089 - // XXX_kin:
5090 - // XXX_kin: This is lame! The IME stuff needs caret coordinates
5091 - // XXX_kin: synchronously, but the editor could be using async
5092 - // XXX_kin: updates (reflows and paints) for performance reasons.
5093 - // XXX_kin: In order to give IME what it needs, we have to temporarily
5094 - // XXX_kin: switch to sync updating during this call so that the
5095 - // XXX_kin: nsAutoPlaceHolderBatch can force sync reflows, paints,
5096 - // XXX_kin: and selection scrolling, so that we get back accurate
5097 - // XXX_kin: caret coordinates.
5099 - PRUint32 flags = 0;
5100 - PRBool restoreFlags = PR_FALSE;
5102 - if (NS_SUCCEEDED(GetFlags(&flags)) &&
5103 - (flags & nsIPlaintextEditor::eEditorUseAsyncUpdatesMask))
5105 - if (NS_SUCCEEDED(SetFlags(flags & (~nsIPlaintextEditor::eEditorUseAsyncUpdatesMask))))
5106 - restoreFlags = PR_TRUE;
5109 - // XXX_kin: END HACK! HACK! HACK!
5111 - // we need the nsAutoPlaceHolderBatch destructor called before hitting
5112 - // GetCaretCoordinates so the states in Frame system sync with content
5113 - // therefore, we put the nsAutoPlaceHolderBatch into an inner block
5115 - nsAutoPlaceHolderBatch batch(this, gIMETxnName);
5117 - result = InsertText(aCompositionString);
5119 - mIMEBufferLength = aCompositionString.Length();
5121 - ps->GetCaret(getter_AddRefs(caretP));
5122 - if (caretP)
5123 - caretP->SetCaretDOMSelection(selection);
5125 - // second part of 23558 fix:
5126 - if (aCompositionString.IsEmpty())
5128 - mIMETextNode = nsnull;
5132 - // XXX_kin: BEGIN HACK! HACK! HACK!
5133 - // XXX_kin:
5134 - // XXX_kin: Restore the previous set of flags!
5136 - if (restoreFlags)
5137 - SetFlags(flags);
5139 - // XXX_kin: END HACK! HACK! HACK!
5141 - result = caretP->GetCaretCoordinates(nsICaret::eIMECoordinates, selection,
5142 - &(aReply->mCursorPosition), &(aReply->mCursorIsCollapsed), nsnull);
5143 - NS_ASSERTION(NS_SUCCEEDED(result), "cannot get caret position");
5146 - return result;
5149 -NS_IMETHODIMP
5150 -nsHTMLEditor::GetReconversionString(nsReconversionEventReply* aReply)
5152 - nsresult res;
5154 - nsCOMPtr<nsISelection> selection;
5155 - res = GetSelection(getter_AddRefs(selection));
5156 - if (NS_FAILED(res) || !selection)
5157 - return (res == NS_OK) ? NS_ERROR_FAILURE : res;
5159 - // get the first range in the selection. Since it is
5160 - // unclear what to do if reconversion happens with a
5161 - // multirange selection, we will ignore any additional ranges.
5163 - nsCOMPtr<nsIDOMRange> range;
5164 - res = selection->GetRangeAt(0, getter_AddRefs(range));
5165 - if (NS_FAILED(res) || !range)
5166 - return (res == NS_OK) ? NS_ERROR_FAILURE : res;
5168 - nsAutoString textValue;
5169 - res = range->ToString(textValue);
5170 - if (NS_FAILED(res))
5171 - return res;
5173 - aReply->mReconversionString = (PRUnichar*) nsMemory::Clone(textValue.get(),
5174 - (textValue.Length() + 1) * sizeof(PRUnichar));
5175 - if (!aReply->mReconversionString)
5176 - return NS_ERROR_OUT_OF_MEMORY;
5178 - // delete the selection
5179 - res = DeleteSelection(eNone);
5181 - return res;
5184 -#ifdef XP_MAC
5185 -#pragma mark -
5186 #pragma mark StyleSheet utils
5187 #pragma mark -
5188 #endif
5189 diff -uprN --exclude=CVS mozilla/editor/libeditor/html/nsHTMLEditor.h mozilla.new/editor/libeditor/html/nsHTMLEditor.h
5190 --- mozilla/editor/libeditor/html/nsHTMLEditor.h 2005-06-16 15:10:55.000000000 +0200
5191 +++ mozilla.new/editor/libeditor/html/nsHTMLEditor.h 2006-02-24 11:16:49.000000000 +0100
5192 @@ -180,11 +180,6 @@ public:
5194 NS_IMETHOD GetNextElementByTagName(nsIDOMElement *aCurrentElement, const nsAString *aTagName, nsIDOMElement **aReturn);
5196 - /* ------------ nsIEditorIMESupport overrides -------------- */
5198 - NS_IMETHOD SetCompositionString(const nsAString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply);
5199 - NS_IMETHOD GetReconversionString(nsReconversionEventReply* aReply);
5201 /* ------------ nsIEditorStyleSheets methods -------------- */
5203 NS_IMETHOD AddStyleSheet(const nsAString & aURL);
5204 diff -uprN --exclude=CVS mozilla/editor/libeditor/html/nsHTMLEditRules.cpp mozilla.new/editor/libeditor/html/nsHTMLEditRules.cpp
5205 --- mozilla/editor/libeditor/html/nsHTMLEditRules.cpp 2005-06-16 15:10:55.000000000 +0200
5206 +++ mozilla.new/editor/libeditor/html/nsHTMLEditRules.cpp 2006-02-24 11:16:49.000000000 +0100
5207 @@ -1879,6 +1879,9 @@ nsHTMLEditRules::WillDeleteSelection(nsI
5208 if (NS_FAILED(res)) return res;
5209 if (*aCancel) return NS_OK;
5211 + // We should delete nothing.
5212 + if (aAction == nsIEditor::eNone)
5213 + return NS_OK;
5215 // what's in the direction we are deleting?
5216 nsWSRunObject wsObj(mHTMLEditor, startNode, startOffset);
5217 diff -uprN --exclude=CVS mozilla/editor/libeditor/text/nsPlaintextEditor.cpp mozilla.new/editor/libeditor/text/nsPlaintextEditor.cpp
5218 --- mozilla/editor/libeditor/text/nsPlaintextEditor.cpp 2006-01-23 08:55:18.000000000 +0100
5219 +++ mozilla.new/editor/libeditor/text/nsPlaintextEditor.cpp 2006-02-24 11:16:49.000000000 +0100
5220 @@ -1670,6 +1670,9 @@ nsPlaintextEditor::GetReconversionString
5221 if (!aReply->mReconversionString)
5222 return NS_ERROR_OUT_OF_MEMORY;
5224 + if (textValue.IsEmpty())
5225 + return NS_OK;
5227 // delete the selection
5228 return DeleteSelection(eNone);
5230 diff -uprN --exclude=CVS mozilla/editor/txtsvc/src/nsTextServicesDocument.cpp mozilla.new/editor/txtsvc/src/nsTextServicesDocument.cpp
5231 --- mozilla/editor/txtsvc/src/nsTextServicesDocument.cpp 2005-02-01 22:12:52.000000000 +0100
5232 +++ mozilla.new/editor/txtsvc/src/nsTextServicesDocument.cpp 2006-03-03 07:15:30.000000000 +0100
5233 @@ -2501,6 +2501,8 @@ nsTextServicesDocument::InsertNode(nsIDO
5234 nsresult
5235 nsTextServicesDocument::DeleteNode(nsIDOMNode *aChild)
5237 + NS_ENSURE_TRUE(mIterator, NS_ERROR_FAILURE);
5239 //**** KDEBUG ****
5240 // printf("** DeleteNode: 0x%.8x\n", aChild);
5241 // fflush(stdout);
5242 diff -uprN --exclude=CVS mozilla/editor/ui/composer/content/ComposerCommands.js mozilla.new/editor/ui/composer/content/ComposerCommands.js
5243 --- mozilla/editor/ui/composer/content/ComposerCommands.js 2005-08-17 22:29:02.000000000 +0200
5244 +++ mozilla.new/editor/ui/composer/content/ComposerCommands.js 2006-02-14 10:01:37.000000000 +0100
5245 @@ -2420,7 +2420,7 @@ var nsSpellingCommand =
5247 window.cancelSendMessage = false;
5248 try {
5249 - var skipBlockQuotes = (window.document.firstChild.getAttribute("windowtype") == "msgcompose");
5250 + var skipBlockQuotes = (window.document.documentElement.getAttribute("windowtype") == "msgcompose");
5251 window.openDialog("chrome://editor/content/EdSpellCheck.xul", "_blank",
5252 "chrome,close,titlebar,modal", false, skipBlockQuotes, true);
5254 diff -uprN --exclude=CVS mozilla/editor/ui/composer/content/editorApplicationOverlay.js mozilla.new/editor/ui/composer/content/editorApplicationOverlay.js
5255 --- mozilla/editor/ui/composer/content/editorApplicationOverlay.js 2004-06-25 01:43:59.000000000 +0200
5256 +++ mozilla.new/editor/ui/composer/content/editorApplicationOverlay.js 2006-02-14 10:01:37.000000000 +0100
5257 @@ -103,7 +103,7 @@ function editPage(url, launchWindow, del
5258 // if the current window is a browser window, then extract the current charset menu setting from the current
5259 // document and use it to initialize the new composer window...
5261 - var wintype = document.firstChild.getAttribute('windowtype');
5262 + var wintype = document.documentElement.getAttribute('windowtype');
5263 var charsetArg;
5265 if (launchWindow && (wintype == "navigator:browser") && launchWindow.content.document)
5266 diff -uprN --exclude=CVS mozilla/embedding/base/nsEmbedCID.h mozilla.new/embedding/base/nsEmbedCID.h
5267 --- mozilla/embedding/base/nsEmbedCID.h 2005-03-17 06:06:27.000000000 +0100
5268 +++ mozilla.new/embedding/base/nsEmbedCID.h 2006-02-24 11:16:27.000000000 +0100
5269 @@ -75,4 +75,16 @@
5270 #define NS_PROMPTSERVICE_CONTRACTID \
5271 "@mozilla.org/embedcomp/prompt-service;1"
5273 +/**
5274 + * Non Blocking Alert Service ContractID
5275 + * This service is for posing non blocking alerts to the user.
5277 + * This contract implements the following interfaces:
5278 + * nsINonBlockingAlertService
5280 + * Embedders may override this ContractID with their own implementation.
5281 + */
5282 +#define NS_NONBLOCKINGALERTSERVICE_CONTRACTID \
5283 + "@mozilla.org/embedcomp/nbalert-service;1"
5285 #endif // NSEMBEDCID_H
5286 diff -uprN --exclude=CVS mozilla/embedding/components/build/nsEmbeddingModule.cpp mozilla.new/embedding/components/build/nsEmbeddingModule.cpp
5287 --- mozilla/embedding/components/build/nsEmbeddingModule.cpp 2005-04-29 15:33:46.000000000 +0200
5288 +++ mozilla.new/embedding/components/build/nsEmbeddingModule.cpp 2006-02-24 11:16:27.000000000 +0100
5289 @@ -134,6 +134,7 @@ static const nsModuleComponentInfo gComp
5290 #ifdef MOZ_XUL
5291 { "Dialog ParamBlock", NS_DIALOGPARAMBLOCK_CID, NS_DIALOGPARAMBLOCK_CONTRACTID, nsDialogParamBlockConstructor },
5292 { "Prompt Service", NS_PROMPTSERVICE_CID, NS_PROMPTSERVICE_CONTRACTID, nsPromptServiceConstructor },
5293 + { "Nonblocking Alert Service", NS_PROMPTSERVICE_CID, NS_NONBLOCKINGALERTSERVICE_CONTRACTID, nsPromptServiceConstructor },
5294 { "JS Console Service", NS_JSCONSOLESERVICE_CID, NS_JSCONSOLESERVICE_CONTRACTID, nsJSConsoleServiceConstructor },
5295 #ifndef WINCE
5296 { "Printing Prompt Service", NS_PRINTINGPROMPTSERVICE_CID, NS_PRINTINGPROMPTSERVICE_CONTRACTID, nsPrintingPromptServiceConstructor },
5297 diff -uprN --exclude=CVS mozilla/embedding/components/windowwatcher/public/Makefile.in mozilla.new/embedding/components/windowwatcher/public/Makefile.in
5298 --- mozilla/embedding/components/windowwatcher/public/Makefile.in 2004-11-16 21:36:26.000000000 +0100
5299 +++ mozilla.new/embedding/components/windowwatcher/public/Makefile.in 2006-02-24 11:16:27.000000000 +0100
5300 @@ -55,6 +55,7 @@ XPIDLSRCS = nsIDialogParamBlock.idl \
5301 nsPIPromptService.idl \
5302 nsPIWindowWatcher.idl \
5303 nsIAuthPromptWrapper.idl \
5304 + nsINonBlockingAlertService.idl \
5305 $(NULL)
5307 include $(topsrcdir)/config/rules.mk
5308 diff -uprN --exclude=CVS mozilla/embedding/components/windowwatcher/public/nsINonBlockingAlertService.idl mozilla.new/embedding/components/windowwatcher/public/nsINonBlockingAlertService.idl
5309 --- mozilla/embedding/components/windowwatcher/public/nsINonBlockingAlertService.idl 1970-01-01 01:00:00.000000000 +0100
5310 +++ mozilla.new/embedding/components/windowwatcher/public/nsINonBlockingAlertService.idl 2006-02-23 00:31:52.000000000 +0100
5311 @@ -0,0 +1,55 @@
5312 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
5313 +/* ***** BEGIN LICENSE BLOCK *****
5314 + * Version: MPL 1.1
5316 + * The contents of this file are subject to the Mozilla Public License Version
5317 + * 1.1 (the "License"); you may not use this file except in compliance with
5318 + * the License. You may obtain a copy of the License at
5319 + * http://www.mozilla.org/MPL/
5321 + * Software distributed under the License is distributed on an "AS IS" basis,
5322 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
5323 + * for the specific language governing rights and limitations under the
5324 + * License.
5326 + * The Original Code is mozilla.org code.
5328 + * The Initial Developer of the Original Code is
5329 + * YAMASHITA Makoto <makotoy@ms.u-tokyo.ac.jp>.
5330 + * Portions created by the Initial Developer are Copyright (C) 2006
5331 + * the Initial Developer. All Rights Reserved.
5333 + * Contributor(s):
5335 + * ***** END LICENSE BLOCK ***** */
5337 +#include "nsISupports.idl"
5338 +interface nsIDOMWindow;
5340 +/**
5341 + * This is the interface to the embeddable non-blocking alert
5342 + * service. A non-blocking alert is a less serious informative alert
5343 + * that does not need to block the program's execution to get the
5344 + * user's response.
5346 + * The way to present the alert is left to the implementations. It
5347 + * may be a dialog separate from the parent window, or a window-modal
5348 + * sheet (as the ones in Mac OS X) attached to the parent.
5349 + */
5350 +[scriptable, uuid(E800EF97-AE37-46B7-A46C-31FBE79657EA)]
5351 +interface nsINonBlockingAlertService : nsISupports {
5352 + /**
5353 + * This shows a non-blocking alert with the specified title and
5354 + * message text. This function requires a valid parent window with
5355 + * which the alert is associated.
5357 + * @param aParent
5358 + * The parent window. This must not be null.
5359 + * @param aDialogTitle
5360 + * Text to appear in the title of the alert.
5361 + * @param aText
5362 + * Text to appear in the body of the alert.
5363 + */
5364 + void showNonBlockingAlert(in nsIDOMWindow aParent,
5365 + in wstring aDialogTitle, in wstring aText);
5367 diff -uprN --exclude=CVS mozilla/embedding/components/windowwatcher/src/nsPromptService.cpp mozilla.new/embedding/components/windowwatcher/src/nsPromptService.cpp
5368 --- mozilla/embedding/components/windowwatcher/src/nsPromptService.cpp 2004-11-01 19:50:11.000000000 +0100
5369 +++ mozilla.new/embedding/components/windowwatcher/src/nsPromptService.cpp 2006-02-24 11:16:27.000000000 +0100
5370 @@ -85,7 +85,8 @@ private:
5371 ************************ nsPromptService ***********************
5372 ****************************************************************/
5374 -NS_IMPL_ISUPPORTS2(nsPromptService, nsIPromptService, nsPIPromptService)
5375 +NS_IMPL_ISUPPORTS3(nsPromptService, nsIPromptService,
5376 + nsPIPromptService, nsINonBlockingAlertService)
5378 nsPromptService::nsPromptService() {
5380 @@ -605,6 +606,32 @@ nsPromptService::Select(nsIDOMWindow *pa
5381 return rv;
5384 +/* void showNonBlockingAlert (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText); */
5385 +NS_IMETHODIMP
5386 +nsPromptService::ShowNonBlockingAlert(nsIDOMWindow *aParent,
5387 + const PRUnichar *aDialogTitle,
5388 + const PRUnichar *aText)
5390 + NS_ENSURE_ARG(aParent);
5391 + if (!mWatcher)
5392 + return NS_ERROR_FAILURE;
5394 + nsCOMPtr<nsIDialogParamBlock> paramBlock(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
5395 + if (!paramBlock)
5396 + return NS_ERROR_FAILURE;
5398 + paramBlock->SetInt(nsPIPromptService::eNumberButtons, 1);
5399 + paramBlock->SetString(nsPIPromptService::eIconClass, NS_LITERAL_STRING("alert-icon").get());
5400 + paramBlock->SetString(nsPIPromptService::eDialogTitle, aDialogTitle);
5401 + paramBlock->SetString(nsPIPromptService::eMsg, aText);
5403 + nsCOMPtr<nsIDOMWindow> dialog;
5404 + mWatcher->OpenWindow(aParent, "chrome://global/content/commonDialog.xul",
5405 + "_blank", "dependent,centerscreen,chrome,titlebar",
5406 + paramBlock, getter_AddRefs(dialog));
5407 + return NS_OK;
5410 nsresult
5411 nsPromptService::DoDialog(nsIDOMWindow *aParent,
5412 nsIDialogParamBlock *aParamBlock, const char *aChromeURL)
5413 diff -uprN --exclude=CVS mozilla/embedding/components/windowwatcher/src/nsPromptService.h mozilla.new/embedding/components/windowwatcher/src/nsPromptService.h
5414 --- mozilla/embedding/components/windowwatcher/src/nsPromptService.h 2005-03-07 18:55:25.000000000 +0100
5415 +++ mozilla.new/embedding/components/windowwatcher/src/nsPromptService.h 2006-02-24 11:16:27.000000000 +0100
5416 @@ -41,17 +41,22 @@
5417 // {A2112D6A-0E28-421f-B46A-25C0B308CBD0}
5418 #define NS_PROMPTSERVICE_CID \
5419 {0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}}
5420 +// {150E7415-72D7-11DA-A924-00039386357A}
5421 +#define NS_NONBLOCKINGALERTSERVICE_CID \
5422 + {0x150e7415, 0x72d7, 0x11da, {0xa9, 0x24, 0x00, 0x03, 0x93, 0x86, 0x35, 0x7a}}
5424 #include "nsCOMPtr.h"
5425 #include "nsIPromptService.h"
5426 #include "nsPIPromptService.h"
5427 +#include "nsINonBlockingAlertService.h"
5428 #include "nsIWindowWatcher.h"
5430 class nsIDOMWindow;
5431 class nsIDialogParamBlock;
5433 class nsPromptService: public nsIPromptService,
5434 - public nsPIPromptService {
5435 + public nsPIPromptService,
5436 + public nsINonBlockingAlertService {
5438 public:
5440 @@ -62,6 +67,7 @@ public:
5442 NS_DECL_NSIPROMPTSERVICE
5443 NS_DECL_NSPIPROMPTSERVICE
5444 + NS_DECL_NSINONBLOCKINGALERTSERVICE
5445 NS_DECL_ISUPPORTS
5447 private:
5448 diff -uprN --exclude=CVS mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp mozilla.new/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
5449 --- mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp 2005-10-18 03:47:31.000000000 +0200
5450 +++ mozilla.new/embedding/components/windowwatcher/src/nsWindowWatcher.cpp 2006-03-03 07:12:52.000000000 +0100
5451 @@ -1,4 +1,5 @@
5452 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
5453 +/* vim: set ts=2 sw=2 et tw=78: */
5454 /* ***** BEGIN LICENSE BLOCK *****
5455 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5457 @@ -465,9 +466,14 @@ nsWindowWatcher::OpenWindow(nsIDOMWindow
5458 jsval *argv = nsnull;
5459 JSContext *cx;
5460 void *mark;
5461 - nsresult rv;
5463 - rv = ConvertSupportsTojsvals(aParent, aArguments, &argc, &argv, &cx, &mark);
5464 + // This kungFuDeathGrip is filled when we are using aParent's context. It
5465 + // prevents the context from being destroyed before we're truly done with
5466 + // it.
5467 + nsCOMPtr<nsIScriptContext> kungFuDeathGrip;
5469 + nsresult rv = ConvertSupportsTojsvals(aParent, aArguments, &argc, &argv, &cx,
5470 + &mark, getter_AddRefs(kungFuDeathGrip));
5471 if (NS_SUCCEEDED(rv)) {
5472 PRBool dialog = argc == 0 ? PR_FALSE : PR_TRUE;
5473 rv = OpenWindowJS(aParent, aUrl, aName, aFeatures, dialog, argc, argv,
5474 @@ -1017,7 +1023,7 @@ nsWindowWatcher::FindWindowEntry(nsIDOMW
5475 found = PR_FALSE;
5476 while (info != listEnd && NS_SUCCEEDED(rv)) {
5477 nsCOMPtr<nsIDOMWindow> infoWindow(do_QueryReferent(info->mWindow));
5478 - if (!infoWindow) // clean up dangling reference, while we're here
5479 + if (!infoWindow) { // clean up dangling reference, while we're here
5480 rv = RemoveWindow(info);
5482 else if (infoWindow.get() == aWindow)
5483 @@ -1755,7 +1761,8 @@ nsWindowWatcher::ConvertSupportsTojsvals
5484 nsISupports *aArgs,
5485 PRUint32 *aArgc, jsval **aArgv,
5486 JSContext **aUsedContext,
5487 - void **aMarkp)
5488 + void **aMarkp,
5489 + nsIScriptContext **aScriptContext)
5491 nsresult rv = NS_OK;
5493 @@ -1782,6 +1789,15 @@ nsWindowWatcher::ConvertSupportsTojsvals
5494 JSContextAutoPopper contextGuard;
5496 cx = GetJSContextFromWindow(aWindow);
5497 + if (cx) {
5498 + // Our caller needs to hold a strong ref to keep this context alive.
5499 + *aScriptContext = GetScriptContextFromJSContext(cx);
5500 + NS_ASSERTION(*aScriptContext,
5501 + "The window's context doesn't have a script context?");
5502 + NS_ADDREF(*aScriptContext);
5503 + } else {
5504 + *aScriptContext = nsnull;
5506 if (!cx)
5507 cx = GetJSContextFromCallStack();
5508 if (!cx) {
5509 @@ -2103,7 +2119,7 @@ nsWindowWatcher::GetJSContextFromWindow(
5511 /* (off-topic note:) the nsIScriptContext can be retrieved by
5512 nsCOMPtr<nsIScriptContext> scx;
5513 - nsJSUtils::nsGetDynamicScriptContext(cx, getter_AddRefs(scx));
5514 + nsJSUtils::GetDynamicScriptContext(cx, getter_AddRefs(scx));
5518 diff -uprN --exclude=CVS mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.h mozilla.new/embedding/components/windowwatcher/src/nsWindowWatcher.h
5519 --- mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.h 2005-08-15 04:50:31.000000000 +0200
5520 +++ mozilla.new/embedding/components/windowwatcher/src/nsWindowWatcher.h 2006-03-03 07:12:52.000000000 +0100
5521 @@ -55,6 +55,7 @@ class nsIDocShellTreeOwner;
5522 class nsIWebBrowserChrome;
5523 class nsString;
5524 class nsWatcherWindowEnumerator;
5525 +class nsIScriptContext;
5526 struct JSContext;
5527 struct JSObject;
5528 struct nsWatcherWindowEntry;
5529 @@ -110,7 +111,8 @@ private:
5530 nsISupports *aArgs,
5531 PRUint32 *aArgc, jsval **aArgv,
5532 JSContext **aUsedContext,
5533 - void **aMarkp);
5534 + void **aMarkp,
5535 + nsIScriptContext **aScriptContext);
5536 static nsresult AddSupportsTojsvals(nsISupports *aArg,
5537 JSContext *cx, jsval *aArgv);
5538 static nsresult AddInterfaceTojsvals(nsISupports *aArg,
5539 diff -uprN --exclude=CVS mozilla/embedding/config/basebrowser-mac-macho mozilla.new/embedding/config/basebrowser-mac-macho
5540 --- mozilla/embedding/config/basebrowser-mac-macho 2005-12-01 23:25:09.000000000 +0100
5541 +++ mozilla.new/embedding/config/basebrowser-mac-macho 2006-02-24 11:16:27.000000000 +0100
5542 @@ -250,19 +250,19 @@ res/fonts/fontEncoding.properties
5544 ; Optional for MathML
5546 -;res/mathml.css
5547 -;res/dtd/mathml.dtd
5548 -;res/entityTables/mathml20.properties
5549 -;res/fonts/mathfont.properties
5550 -;res/fonts/mathfontCMEX10.properties
5551 -;res/fonts/mathfontCMSY10.properties
5552 -;res/fonts/mathfontMath1.properties
5553 -;res/fonts/mathfontMath2.properties
5554 -;res/fonts/mathfontMath4.properties
5555 -;res/fonts/mathfontMTExtra.properties
5556 -;res/fonts/mathfontPUA.properties
5557 -;res/fonts/mathfontSymbol.properties
5558 -;Components/ucvmath.dylib
5559 +res/mathml.css
5560 +res/dtd/mathml.dtd
5561 +res/entityTables/mathml20.properties
5562 +res/fonts/mathfont.properties
5563 +res/fonts/mathfontCMEX10.properties
5564 +res/fonts/mathfontCMSY10.properties
5565 +res/fonts/mathfontMath1.properties
5566 +res/fonts/mathfontMath2.properties
5567 +res/fonts/mathfontMath4.properties
5568 +res/fonts/mathfontMTExtra.properties
5569 +res/fonts/mathfontPUA.properties
5570 +res/fonts/mathfontSymbol.properties
5571 +components/libucvmath.dylib
5573 ; p3p
5574 components/libp3p.dylib
5575 diff -uprN --exclude=CVS mozilla/embedding/config/embed-jar.mn mozilla.new/embedding/config/embed-jar.mn
5576 --- mozilla/embedding/config/embed-jar.mn 2005-06-09 06:05:10.000000000 +0200
5577 +++ mozilla.new/embedding/config/embed-jar.mn 2006-02-24 11:16:27.000000000 +0100
5578 @@ -69,3 +69,5 @@ locale/XXXX/cookie/contents.rdf,
5579 # Marquee stuff
5580 content/xbl-marquee, comm/content/xbl-marquee
5582 +# SVG
5583 +content/global/svg, toolkit/content/global/svg
5584 diff -uprN --exclude=CVS mozilla/embedding/tests/wxEmbed/GeckoProtocolHandler.cpp mozilla.new/embedding/tests/wxEmbed/GeckoProtocolHandler.cpp
5585 --- mozilla/embedding/tests/wxEmbed/GeckoProtocolHandler.cpp 2005-08-13 21:33:51.000000000 +0200
5586 +++ mozilla.new/embedding/tests/wxEmbed/GeckoProtocolHandler.cpp 2006-02-24 11:16:27.000000000 +0100
5587 @@ -245,6 +245,7 @@ NS_IMETHODIMP GeckoProtocolHandlerImpl::
5588 /* nsIChannel newChannel (in nsIURI aURI); */
5589 NS_IMETHODIMP GeckoProtocolHandlerImpl::NewChannel(nsIURI *aURI, nsIChannel **_retval)
5591 + NS_ENSURE_ARG_POINTER(aURI);
5592 GeckoProtocolChannel *channel = new GeckoProtocolChannel;
5593 if (!channel)
5595 diff -uprN --exclude=CVS mozilla/extensions/auth/nsAuthSSPI.cpp mozilla.new/extensions/auth/nsAuthSSPI.cpp
5596 --- mozilla/extensions/auth/nsAuthSSPI.cpp 2005-08-24 16:04:42.000000000 +0200
5597 +++ mozilla.new/extensions/auth/nsAuthSSPI.cpp 2006-03-12 20:03:49.000000000 +0100
5598 @@ -34,7 +34,7 @@
5599 * the terms of any one of the MPL, the GPL or the LGPL.
5601 * ***** END LICENSE BLOCK ***** */
5605 // Negotiate Authentication Support Module
5607 @@ -356,6 +356,10 @@ nsAuthSSPI::GetNextToken(const void *inT
5608 &ctxAttr,
5609 NULL);
5610 if (rc == SEC_I_CONTINUE_NEEDED || rc == SEC_E_OK) {
5611 + if (!ob.cbBuffer) {
5612 + nsMemory::Free(ob.pvBuffer);
5613 + ob.pvBuffer = NULL;
5615 *outToken = ob.pvBuffer;
5616 *outTokenLen = ob.cbBuffer;
5618 @@ -389,6 +393,9 @@ nsAuthSSPI::Unwrap(const void *inToken,
5619 ib[0].BufferType = SECBUFFER_STREAM;
5620 ib[0].cbBuffer = inTokenLen;
5621 ib[0].pvBuffer = nsMemory::Alloc(ib[0].cbBuffer);
5622 + if (!ib[0].pvBuffer)
5623 + return NS_ERROR_OUT_OF_MEMORY;
5625 memcpy(ib[0].pvBuffer, inToken, inTokenLen);
5627 // app data
5628 @@ -412,7 +419,10 @@ nsAuthSSPI::Unwrap(const void *inToken,
5630 nsMemory::Free(ib[0].pvBuffer);
5632 - return rc;
5633 + if (!SEC_SUCCESS(rc))
5634 + return NS_ERROR_FAILURE;
5636 + return NS_OK;
5639 // utility class used to free memory on exit
5640 @@ -456,7 +466,7 @@ nsAuthSSPI::Wrap(const void *inToken,
5641 &sizes);
5643 if (!SEC_SUCCESS(rc))
5644 - return rc;
5645 + return NS_ERROR_FAILURE;
5647 ibd.cBuffers = 3;
5648 ibd.pBuffers = bufs.ib;
5649 @@ -494,20 +504,24 @@ nsAuthSSPI::Wrap(const void *inToken,
5651 if (SEC_SUCCESS(rc)) {
5652 int len = bufs.ib[0].cbBuffer + bufs.ib[1].cbBuffer + bufs.ib[2].cbBuffer;
5653 + char *p = (char *) nsMemory::Alloc(len);
5655 - *outToken = nsMemory::Alloc(len);
5657 - if (!*outToken)
5658 + if (!p)
5659 return NS_ERROR_OUT_OF_MEMORY;
5661 + *outToken = (void *) p;
5662 + *outTokenLen = len;
5664 - memcpy(outToken, bufs.ib[0].pvBuffer, bufs.ib[0].cbBuffer);
5665 + memcpy(p, bufs.ib[0].pvBuffer, bufs.ib[0].cbBuffer);
5666 + p += bufs.ib[0].cbBuffer;
5668 - memcpy(outToken + bufs.ib[0].cbBuffer,
5669 - bufs.ib[1].pvBuffer, bufs.ib[1].cbBuffer);
5670 + memcpy(p,bufs.ib[1].pvBuffer, bufs.ib[1].cbBuffer);
5671 + p += bufs.ib[1].cbBuffer;
5673 - memcpy(outToken + bufs.ib[0].cbBuffer + bufs.ib[1].cbBuffer,
5674 - bufs.ib[2].pvBuffer, bufs.ib[2].cbBuffer);
5675 + memcpy(p,bufs.ib[2].pvBuffer, bufs.ib[2].cbBuffer);
5677 + return NS_OK;
5680 - return rc;
5681 + return NS_ERROR_FAILURE;
5683 diff -uprN --exclude=CVS mozilla/extensions/datetime/nsDateTimeHandler.cpp mozilla.new/extensions/datetime/nsDateTimeHandler.cpp
5684 --- mozilla/extensions/datetime/nsDateTimeHandler.cpp 2004-11-01 19:50:12.000000000 +0100
5685 +++ mozilla.new/extensions/datetime/nsDateTimeHandler.cpp 2006-02-24 11:16:21.000000000 +0100
5686 @@ -125,6 +125,7 @@ NS_IMETHODIMP
5687 nsDateTimeHandler::NewProxiedChannel(nsIURI* url, nsIProxyInfo* proxyInfo,
5688 nsIChannel* *result)
5690 + NS_ENSURE_ARG_POINTER(url);
5691 nsresult rv;
5693 nsDateTimeChannel *chan = new nsDateTimeChannel();
5694 diff -uprN --exclude=CVS mozilla/extensions/finger/nsFingerHandler.cpp mozilla.new/extensions/finger/nsFingerHandler.cpp
5695 --- mozilla/extensions/finger/nsFingerHandler.cpp 2004-11-01 19:50:12.000000000 +0100
5696 +++ mozilla.new/extensions/finger/nsFingerHandler.cpp 2006-02-24 11:16:21.000000000 +0100
5697 @@ -127,6 +127,7 @@ NS_IMETHODIMP
5698 nsFingerHandler::NewProxiedChannel(nsIURI* url, nsIProxyInfo* proxyInfo,
5699 nsIChannel* *result)
5701 + NS_ENSURE_ARG_POINTER(url);
5702 nsresult rv;
5704 nsFingerChannel *chan = new nsFingerChannel();
5705 diff -uprN --exclude=CVS mozilla/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp mozilla.new/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
5706 --- mozilla/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp 2005-02-25 21:46:26.000000000 +0100
5707 +++ mozilla.new/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp 2006-02-24 11:16:22.000000000 +0100
5708 @@ -940,6 +940,7 @@ nsGnomeVFSProtocolHandler::NewURI(const
5709 NS_IMETHODIMP
5710 nsGnomeVFSProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult)
5712 + NS_ENSURE_ARG_POINTER(aURI);
5713 nsresult rv;
5715 nsCAutoString spec;
5716 diff -uprN --exclude=CVS mozilla/extensions/help/resources/content/helpMenuOverlay.xul mozilla.new/extensions/help/resources/content/helpMenuOverlay.xul
5717 --- mozilla/extensions/help/resources/content/helpMenuOverlay.xul 2005-07-01 16:12:45.000000000 +0200
5718 +++ mozilla.new/extensions/help/resources/content/helpMenuOverlay.xul 2006-03-03 07:12:12.000000000 +0100
5719 @@ -19,10 +19,24 @@
5720 position="1" id="help"
5721 key="key_openHelp"
5722 command="cmd_openHelp"/>
5723 +#ifdef XP_WIN
5724 +#define DISPLAY_IE_USERS_HELP_MENU_ITEM
5725 +#endif
5726 +#ifdef XP_MACOSX
5727 +#define DISPLAY_IE_USERS_HELP_MENU_ITEM
5728 +#endif
5729 +#ifdef HPUX
5730 +#define DISPLAY_IE_USERS_HELP_MENU_ITEM
5731 +#endif
5732 +#ifdef SOLARIS
5733 +#define DISPLAY_IE_USERS_HELP_MENU_ITEM
5734 +#endif
5735 +#ifdef DISPLAY_IE_USERS_HELP_MENU_ITEM
5736 <menuitem label="&helpForIEUsers.label;"
5737 accesskey="&helpForIEUsers.accesskey;"
5738 position="2"
5739 oncommand="openHelp('ieusers');" />
5740 +#endif
5741 </menupopup>
5743 <commandset id="tasksCommands">
5744 diff -uprN --exclude=CVS mozilla/extensions/help/resources/jar.mn mozilla.new/extensions/help/resources/jar.mn
5745 --- mozilla/extensions/help/resources/jar.mn 2005-04-05 01:35:22.000000000 +0200
5746 +++ mozilla.new/extensions/help/resources/jar.mn 2006-03-03 07:12:12.000000000 +0100
5747 @@ -3,7 +3,7 @@ help.jar:
5748 content/help/contextHelp.js (content/contextHelp.js)
5749 content/help/help.js (content/help.js)
5750 * content/help/contents.rdf (content/contents.rdf)
5751 - content/help/helpMenuOverlay.xul (content/helpMenuOverlay.xul)
5752 +* content/help/helpMenuOverlay.xul (content/helpMenuOverlay.xul)
5753 content/help/helpContextOverlay.xul (content/helpContextOverlay.xul)
5754 * content/help/platformClasses.css (content/platformClasses.css)
5756 diff -uprN --exclude=CVS mozilla/extensions/help/resources/locale/en-US/using_priv_help.xhtml mozilla.new/extensions/help/resources/locale/en-US/using_priv_help.xhtml
5757 --- mozilla/extensions/help/resources/locale/en-US/using_priv_help.xhtml 2006-01-23 08:54:36.000000000 +0100
5758 +++ mozilla.new/extensions/help/resources/locale/en-US/using_priv_help.xhtml 2006-02-14 10:01:12.000000000 +0100
5759 @@ -1182,15 +1182,15 @@
5760 <p>If you click Yes at least some of the time, Form Manager will soon have
5761 enough data to begin filling out forms automatically.</p>
5763 -<p>Form preferences allow you to</p>
5764 +<p>Form preferences allow you to:</p>
5766 <ul>
5767 <li><strong>Save form data from web pages when completing forms:</strong>
5768 - This checkbox determines whether are asked if you want to save form data
5769 - every time you submit a new form. This option is selected by default. If
5770 - you deselect it, Form Manager never asks if you want to save form data.
5771 + This checkbox determines whether you are asked if you want to save form
5772 + data every time you submit a new form. This option is selected by default.
5773 + If you deselect it, Form Manager never asks if you want to save form data.
5774 The only way to save form data is for you open the Edit Menu and choose
5775 - Fill in Form while viewing a form that you&apos;ve just filled in.
5776 + Save Form Info while viewing a form that you&apos;ve just filled in.
5778 <p>Note that deselecting this option turns off the notification feature,
5779 but not Form Manager. The form data it may have already collected is
5780 @@ -1422,8 +1422,8 @@
5782 <p>If you choose to encrypt your stored sensitive information, you&apos;ll need
5783 a master password. With encryption selected, you&apos;ll be asked for your
5784 - master password at least once during a browser session in which you access
5785 - any of your stored sensitive information.</p>
5786 + master password at least once during a &brandShortName; session in which you
5787 + access any of your stored sensitive information.</p>
5789 <p>If you choose encryption, but don&apos;t already have a master password,
5790 you&apos;ll be prompted to create one the first time you try to save or
5791 @@ -1433,12 +1433,13 @@
5792 time:</p>
5794 <ol>
5795 - <li>Open the Tools menu, choose Password Manager, and then choose Change
5796 - Master Password from the submenu (even though you are setting it for the
5797 - first time, not changing it).
5799 - <p>You see the Set Master Password dialog box.</p>
5800 - </li>
5801 + <li>Open the <span class="mac">&brandShortName;</span>
5802 + <span class="noMac">Edit</span> menu and choose Preferences.</li>
5803 + <li>Under the Privacy &amp; Security category, click Master Passwords. (If no
5804 + subcategories are visible, double-click Privacy &amp; Security to expand
5805 + the list.)</li>
5806 + <li>In the Change Master Password section, click Change Password... to open
5807 + the Change Master Password dialog box.</li>
5808 <li>Enter your desired master password, and retype it to confirm the
5809 spelling.</li>
5810 <li>Click OK.</li>
5811 @@ -1457,11 +1458,14 @@
5812 <p>To change your master password:</p>
5814 <ol>
5815 - <li>Open the Tools menu, choose Privacy &amp; Security, and then choose
5816 - Password Manager.</li>
5817 - <li>Select Change Master Password from the submenu. You see the Set Master
5818 - Password dialog box.</li>
5819 - <li>Enter your current master password (if you have previously set one).</li>
5820 + <li>Open the <span class="mac">&brandShortName;</span>
5821 + <span class="noMac">Edit</span> menu and choose Preferences.</li>
5822 + <li>Under the Privacy &amp; Security category, click Master Passwords. (If no
5823 + subcategories are visible, double-click Privacy &amp; Security to expand
5824 + the list.)</li>
5825 + <li>In the Change Master Password section, click Change Password... to open
5826 + the Change Master Password dialog box.</li>
5827 + <li>Enter your current master password.</li>
5828 <li>Enter your new master password, and retype it to confirm the
5829 spelling.</li>
5830 <li>Click OK.</li>
5831 @@ -1478,8 +1482,9 @@
5832 <h2 id="logging_out_of_your_master_password">Logging Out of Your Master
5833 Password</h2>
5835 -<p>Normally, you are asked for your master password once during each browser
5836 - session during which you access any of your stored sensitive information.</p>
5837 +<p>Normally, you are asked for your master password once during each
5838 + &brandShortName; session during which you access any of your stored sensitive
5839 + information.</p>
5841 <p>It&apos;s also possible to require that your master password be requested
5842 each time it is needed, or after a certain amount of time has passed. For
5843 @@ -1507,7 +1512,7 @@
5844 data (see <a href="#encrypting_stored_sensitive_information">Encrypting
5845 Stored Sensitive Information</a>), you won&apos;t be able to access any of
5846 the stored password and form data that it protects (assuming you have turned
5847 - on encryption. Your master password is your most important password. Make
5848 + on encryption). Your master password is your most important password. Make
5849 sure you remember it or record it in a safe place.</p>
5851 <p>As a last resort, it&apos;s possible to reset your master password if you
5852 @@ -1546,7 +1551,7 @@
5853 load.</p>
5855 <p>You can also control how frequently animated images repeat their animation,
5856 - or turn off animation completely</p>
5857 + or turn off animation completely.</p>
5859 <p>The next section describes how to control these image settings. The default
5860 settings allow all images to be accepted and allow them to repeat their
5861 diff -uprN --exclude=CVS mozilla/extensions/help/resources/locale/en-US/welcome_help.xhtml mozilla.new/extensions/help/resources/locale/en-US/welcome_help.xhtml
5862 --- mozilla/extensions/help/resources/locale/en-US/welcome_help.xhtml 2005-03-10 19:44:00.000000000 +0100
5863 +++ mozilla.new/extensions/help/resources/locale/en-US/welcome_help.xhtml 2006-02-14 10:01:12.000000000 +0100
5864 @@ -71,32 +71,16 @@
5865 </tr>
5867 <tr valign="top">
5868 - <td colspan="2"><h2>Support</h2></td>
5869 - </tr>
5870 - <tr>
5871 - <td><h3>Technical Support</h3></td>
5872 - <td><h3>Peer Support</h3></td>
5873 + <td colspan="2"><h2>Peer Support</h2></td>
5874 </tr>
5876 <tr valign="top">
5877 <td>
5878 - <p><strong><a href="http://support.decisionone.com/mozilla/mozilla_help_main.htm">DecisionOne</a></strong></p>
5880 - <p>Affordable service providing e-mail and phone-in support.</p>
5881 - </td>
5882 - <td>
5883 <p><strong><a href="http://forums.mozillazine.org/index.php">MozillaZine
5884 Forums</a></strong></p>
5886 <p>Web forums for Mozilla users like you.</p>
5887 </td>
5888 - </tr>
5890 - <tr valign="top">
5891 - <td>
5892 - <p><strong><a href="http://www.mozillapl.org/?newlang=eng">MozillaPL</a></strong></p>
5893 - <p>Free community service based on consultants availability.</p>
5894 - </td>
5895 <td>
5896 <p><strong><a href="http://www.mozilla.org/support/#community">User
5897 Newsgroups</a></strong></p>
5898 @@ -106,13 +90,14 @@
5899 </tr>
5901 <tr valign="top">
5902 - <td></td>
5903 <td>
5904 - <p><strong>Realtime Chat</strong></p>
5905 + <p><strong><a href="irc://moznet/mozillazine/">Realtime Chat</a></strong></p>
5906 <p>Chat with &brandShortName; users via IRC.</p>
5907 </td>
5908 + <td></td>
5909 </tr>
5911 + <!--
5912 <tr valign="top">
5913 <td colspan="2"><h2>User Feedback</h2></td>
5914 </tr>
5915 @@ -122,9 +107,10 @@
5916 Feedback Agent</a></strong></p>
5917 </td>
5918 </tr>
5919 + -->
5920 </table>
5922 -<p>Copyright &copy; 2003-2004 The Mozilla Foundation.</p>
5923 +<p>Copyright &copy; 2003-2006 The Mozilla Foundation.</p>
5925 </body>
5926 </html>
5927 diff -uprN --exclude=CVS mozilla/extensions/java/xpcom/interfaces/Makefile.in mozilla.new/extensions/java/xpcom/interfaces/Makefile.in
5928 --- mozilla/extensions/java/xpcom/interfaces/Makefile.in 2006-01-06 22:01:30.000000000 +0100
5929 +++ mozilla.new/extensions/java/xpcom/interfaces/Makefile.in 2006-02-24 11:16:22.000000000 +0100
5930 @@ -63,7 +63,7 @@ GEN_JAVA_SRCS = \
5931 # install jars into SDK
5932 SDK_LIBRARY = $(JARFILE) $(JARFILE_SRC)
5934 -GARBAGE += $(JARFILE) $(JARFILE_SRC) $(GEN_JAVA_SRCS)
5935 +GARBAGE += $(JARFILE) $(JARFILE_SRC) $(GEN_JAVA_SRCS) java.files
5936 GARBAGE_DIRS += _javagen org
5938 include $(topsrcdir)/config/rules.mk
5939 @@ -89,12 +89,12 @@ _javagen/org/mozilla/xpcom/.iface_done:
5940 $(RUN) $(DIST)/bin/GenerateJavaInterfaces$(BIN_SUFFIX) -d $(OUTPUT_DIR)
5941 @touch $@
5943 -# Use find and xargs for passing list of Java files to JAVAC. This avoids the
5944 -# "argument list too long" error on Windows when using *.java
5945 +# Using the temporary "java.files" avoids an "argument list too long"
5946 +# error on Windows when using *.java
5947 org/mozilla/xpcom/.class_done: _javagen/org/mozilla/xpcom/.iface_done
5948 @echo Compiling Java interface classes
5949 - find _javagen -name "*.java" | xargs $(JAVAC) $(JAVAC_FLAGS) -classpath . \
5950 - -d . -sourcepath _javagen
5951 + find _javagen -name "*.java" > java.files
5952 + $(JAVAC) $(JAVAC_FLAGS) -classpath . -d . -sourcepath _javagen @java.files
5953 @touch $@
5955 $(JARFILE): org/mozilla/xpcom/.class_done Makefile
5956 @@ -117,3 +117,7 @@ $(TEMP_SDK_DIR)::
5958 libs:: $(JARFILE) $(JARFILE_SRC) $(TEMP_SDK_DIR)
5959 $(INSTALL) $(IFLAGS2) $^
5961 +# Build the implementation Java classes, which depend on these interfaces
5962 +libs::
5963 + $(MAKE) -C ../src jarfile
5964 diff -uprN --exclude=CVS mozilla/extensions/java/xpcom/Makefile.in mozilla.new/extensions/java/xpcom/Makefile.in
5965 --- mozilla/extensions/java/xpcom/Makefile.in 2006-01-09 06:48:32.000000000 +0100
5966 +++ mozilla.new/extensions/java/xpcom/Makefile.in 2006-02-24 11:16:22.000000000 +0100
5967 @@ -46,11 +46,8 @@ DIRS = src
5969 TOOL_DIRS = \
5970 tools/genifaces \
5971 - interfaces \
5972 glue \
5973 $(NULL)
5975 include $(topsrcdir)/config/rules.mk
5977 -tools::
5978 - $(MAKE) -C src jarfile
5979 diff -uprN --exclude=CVS mozilla/extensions/java/xpcom/src/Makefile.in mozilla.new/extensions/java/xpcom/src/Makefile.in
5980 --- mozilla/extensions/java/xpcom/src/Makefile.in 2006-01-06 22:01:33.000000000 +0100
5981 +++ mozilla.new/extensions/java/xpcom/src/Makefile.in 2006-02-24 11:16:22.000000000 +0100
5982 @@ -92,7 +92,7 @@ EXTRA_DSO_LDOPTS = \
5983 $(MOZ_COMPONENT_LIBS) \
5984 $(NULL)
5986 -GARBAGE += $(JARFILE) $(JARFILE_SRC)
5987 +GARBAGE += $(JARFILE) $(JARFILE_SRC) java.files
5988 GARBAGE_DIRS += _javagen org
5990 include $(topsrcdir)/config/rules.mk
5991 @@ -115,13 +115,14 @@ _javagen/org/mozilla/xpcom/internal/.ifa
5992 _javagen/org/mozilla/xpcom/internal
5993 @touch $@
5995 -# Use find and xargs for passing list of Java files to JAVAC. This avoids the
5996 -# "argument list too long" error on Windows when using *.java
5997 +# Using the temporary "java.files" avoids an "argument list too long"
5998 +# error on Windows when using *.java
5999 org/mozilla/xpcom/internal/.class_done: _javagen/org/mozilla/xpcom/internal/.iface_done
6000 @echo Compiling Java implementation classes
6001 - find _javagen -name "*.java" | xargs $(JAVAC) $(JAVAC_FLAGS) \
6002 - -classpath ".$(SEP)../interfaces/MozillaInterfaces.jar" \
6003 - -d . -sourcepath _javagen
6004 + find _javagen -name "*.java" > java.files
6005 + $(JAVAC) $(JAVAC_FLAGS) \
6006 + -classpath ".$(SEP)../interfaces/MozillaInterfaces.jar" \
6007 + -d . -sourcepath _javagen @java.files
6008 @touch $@
6010 $(JARFILE): org/mozilla/xpcom/internal/.class_done Makefile
6011 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/fy-NL/chrome/about.dtd mozilla.new/extensions/reporter/locales/fy-NL/chrome/about.dtd
6012 --- mozilla/extensions/reporter/locales/fy-NL/chrome/about.dtd 1970-01-01 01:00:00.000000000 +0100
6013 +++ mozilla.new/extensions/reporter/locales/fy-NL/chrome/about.dtd 2006-01-24 15:27:12.000000000 +0100
6014 @@ -0,0 +1,4 @@
6015 +<!ENTITY projectLead.text "Projektlieder">
6016 +<!ENTITY copyright.text "Auteursrjocht (C) 2004-2005">
6017 +<!ENTITY thanks.text "Tige dank">
6019 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/fy-NL/chrome/reporter.dtd mozilla.new/extensions/reporter/locales/fy-NL/chrome/reporter.dtd
6020 --- mozilla/extensions/reporter/locales/fy-NL/chrome/reporter.dtd 1970-01-01 01:00:00.000000000 +0100
6021 +++ mozilla.new/extensions/reporter/locales/fy-NL/chrome/reporter.dtd 2006-01-24 15:27:12.000000000 +0100
6022 @@ -0,0 +1,3 @@
6023 +<!ENTITY productName.label "Rapportearder">
6024 +<!ENTITY productVersion.label "v0.2">
6026 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/fy-NL/chrome/reporterOverlay.dtd mozilla.new/extensions/reporter/locales/fy-NL/chrome/reporterOverlay.dtd
6027 --- mozilla/extensions/reporter/locales/fy-NL/chrome/reporterOverlay.dtd 1970-01-01 01:00:00.000000000 +0100
6028 +++ mozilla.new/extensions/reporter/locales/fy-NL/chrome/reporterOverlay.dtd 2006-01-24 15:27:12.000000000 +0100
6029 @@ -0,0 +1,5 @@
6030 +<!-- Entities for the Sample Extension Options Dialog go here -->
6031 +<!ENTITY reporterMenu.title "Stikkene webstee rapporteare">
6032 +<!ENTITY reporterMenu.tooltip "Stikkene webstee rapporteare">
6033 +<!ENTITY reporterMenu.accesskey "R">
6035 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/fy-NL/chrome/reporterOverlay.properties mozilla.new/extensions/reporter/locales/fy-NL/chrome/reporterOverlay.properties
6036 --- mozilla/extensions/reporter/locales/fy-NL/chrome/reporterOverlay.properties 1970-01-01 01:00:00.000000000 +0100
6037 +++ mozilla.new/extensions/reporter/locales/fy-NL/chrome/reporterOverlay.properties 2006-01-24 15:27:12.000000000 +0100
6038 @@ -0,0 +1 @@
6039 +# Script accessible strings for the browser integration overlay go here.
6040 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/fy-NL/chrome/reportResults.dtd mozilla.new/extensions/reporter/locales/fy-NL/chrome/reportResults.dtd
6041 --- mozilla/extensions/reporter/locales/fy-NL/chrome/reportResults.dtd 1970-01-01 01:00:00.000000000 +0100
6042 +++ mozilla.new/extensions/reporter/locales/fy-NL/chrome/reportResults.dtd 2006-01-24 15:27:12.000000000 +0100
6043 @@ -0,0 +1,14 @@
6044 +<!ENTITY reportSite "Webstee">
6045 +<!ENTITY reportProblemType "Probleemtype">
6046 +<!ENTITY reportDecsription "Beskriuwing">
6047 +<!ENTITY reportPlatform "Platform">
6048 +<!ENTITY reportProduct "Produkt">
6049 +<!ENTITY reportoscpu "OS">
6050 +<!ENTITY reportGecko "Gecko">
6051 +<!ENTITY reportBuildConfig "Bouwkonfiguraasje">
6052 +<!ENTITY reportUseragent "Useragent">
6053 +<!ENTITY reportLanguage "Spraak">
6054 +<!ENTITY reportEmail "E-mail">
6055 +<!ENTITY error "Foutdetails">
6056 +<!ENTITY faultCode "Kode">
6057 +<!ENTITY faultMessage "Berjocht">
6058 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/fy-NL/chrome/reportWizard.dtd mozilla.new/extensions/reporter/locales/fy-NL/chrome/reportWizard.dtd
6059 --- mozilla/extensions/reporter/locales/fy-NL/chrome/reportWizard.dtd 1970-01-01 01:00:00.000000000 +0100
6060 +++ mozilla.new/extensions/reporter/locales/fy-NL/chrome/reportWizard.dtd 2006-01-24 15:27:12.000000000 +0100
6061 @@ -0,0 +1,40 @@
6062 +<!-- Entities for the Sample Extension Options Dialog go here -->
6063 +<!ENTITY reportWizard.title "Stikkene webstee rapporteare">
6064 +<!ENTITY privacyNotice.label "Privacy-oerienkomst">
6065 +<!ENTITY reportWizardPrivacy.description "Dit helpprogramma stelt jo in steat om it evangelisaasjeteam yn te ljochten oer websteeën welke net goed yn Firefox wurkje of Firefox ûtslûte. Dit is jo manier om ûs te helpen de best mooglike erfaring foar Firefox-gebrûkers te verzekerjen. Nim de tiid om de folgende ynformaasje te lêzen oer hoe wy omgean mei de ynformaasje die wy sammelje as jo beslisse om mei te dwaan.">
6066 +<!ENTITY reportWizardMustAgree.description "Om fjrder te gean motte jo mei de boppensteande privacy-oerienkomst ynstemme.">
6067 +<!ENTITY dontShowPrivacyStatement.label "Ik ha de bopensteande privacy-oerienkomst lêzen en aksepteard.">
6068 +<!ENTITY dontShowPrivacyStatement.accesskey "I">
6069 +<!ENTITY reportForm.label "Rapport ynvulle">
6070 +<!ENTITY reportForm.description "Vertel ûs wat mear oer it probleem wer jo tsjin oan roun:">
6071 +<!ENTITY reportForm.url.title "Webstee-URL:">
6072 +<!ENTITY reportForm.behind_login.title "Webstee is mei in wachtwurd befeilige"><!-- No ":" at the end -->
6073 +<!ENTITY reportForm.behind_login.accesskey "W">
6074 +<!ENTITY reportForm.problem_type.title "Probleemtype:">
6075 +<!ENTITY reportForm.problem_type.accesskey "T">
6076 +<!ENTITY reportForm.problem_type.chooseOne.title "Kies der ien...">
6077 +<!-- DO *NOT* Add/change/modify (except localization) without consulting with r.m.o server admin first! -->
6078 +<!ENTITY reportForm.problem_type.item1.title "Browser wurd net ondersteund">
6079 +<!ENTITY reportForm.problem_type.item2.title "Kin net ynlogge">
6080 +<!ENTITY reportForm.problem_type.item3.title "Plugin wurd net sjen litten">
6081 +<!ENTITY reportForm.problem_type.item4.title "Oare ynhâld mist">
6082 +<!ENTITY reportForm.problem_type.item5.title "Reageert verkeerd">
6083 +<!ENTITY reportForm.problem_type.item6.title "Verskiint verkeerd">
6084 +<!ENTITY reportForm.problem_type.item7.title "Oar probleem">
6085 +<!ENTITY reportForm.describe.title "Probleembeskriuwing:">
6086 +<!ENTITY reportForm.describe.accesskey "P">
6087 +<!ENTITY reportForm.platform.title "Platform:">
6088 +<!ENTITY reportForm.product.title "Produkt:">
6089 +<!ENTITY reportForm.gecko.title "Gecko:">
6090 +<!ENTITY reportForm.useragent.title "Useragent:">
6091 +<!ENTITY reportForm.language.title "Spraak:">
6092 +<!-- Make sure this has "(Optional)" at the end. This is important for the user to know -->
6093 +<!ENTITY reportForm.email.title "E-mail (opsjoneel):">
6094 +<!ENTITY reportForm.email.accesskey "E">
6095 +<!ENTITY reportForm.privacyPolicy.title "Privacy-oerienkomst">
6096 +<!ENTITY reportForm.privacyPolicy.tooltip "Privacy-oerienkomst besjen">
6097 +<!ENTITY reportResults.showDetail.title "Details sjen litte">
6098 +<!ENTITY reportResults.showDetail.accesskey "S">
6099 +<!ENTITY sendReport.label "Rapport oan it ferstjoeren">
6100 +<!ENTITY sendReport.description "It rapport nei de server oan it ferstjoeren...">
6101 +<!ENTITY finish.label "Rapport ferstjoert">
6102 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/fy-NL/chrome/reportWizard.properties mozilla.new/extensions/reporter/locales/fy-NL/chrome/reportWizard.properties
6103 --- mozilla/extensions/reporter/locales/fy-NL/chrome/reportWizard.properties 1970-01-01 01:00:00.000000000 +0100
6104 +++ mozilla.new/extensions/reporter/locales/fy-NL/chrome/reportWizard.properties 2006-01-24 15:27:12.000000000 +0100
6105 @@ -0,0 +1,10 @@
6106 +submitReport=Rapport ferstjoere
6108 +sendingReport=Rapport oan it ferstjoeren...
6109 +reportSent=Rapport ferstjoert
6111 +finishError=Fout by it ferstjoeren fan it rapport
6113 +successfullyCreatedReport=Rapport suksesfol oerbrocht
6114 +failedCreatingReport=Der wie in fout by it meitsjen fan it rapport en der is dus gjin ynformaasje ferstjoert nei mozilla.org
6116 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/lt/chrome/about.dtd mozilla.new/extensions/reporter/locales/lt/chrome/about.dtd
6117 --- mozilla/extensions/reporter/locales/lt/chrome/about.dtd 1970-01-01 01:00:00.000000000 +0100
6118 +++ mozilla.new/extensions/reporter/locales/lt/chrome/about.dtd 2006-01-24 15:27:13.000000000 +0100
6119 @@ -0,0 +1,4 @@
6120 +<!ENTITY projectLead.text "Projekto vadovas">
6121 +<!ENTITY copyright.text "Copyright (C) 2004-2005">
6122 +<!ENTITY thanks.text "Padėkos">
6124 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/lt/chrome/reporter.dtd mozilla.new/extensions/reporter/locales/lt/chrome/reporter.dtd
6125 --- mozilla/extensions/reporter/locales/lt/chrome/reporter.dtd 1970-01-01 01:00:00.000000000 +0100
6126 +++ mozilla.new/extensions/reporter/locales/lt/chrome/reporter.dtd 2006-01-24 15:27:13.000000000 +0100
6127 @@ -0,0 +1,3 @@
6128 +<!ENTITY productName.label "Reporter">
6129 +<!ENTITY productVersion.label "v0.2">
6131 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/lt/chrome/reporterOverlay.dtd mozilla.new/extensions/reporter/locales/lt/chrome/reporterOverlay.dtd
6132 --- mozilla/extensions/reporter/locales/lt/chrome/reporterOverlay.dtd 1970-01-01 01:00:00.000000000 +0100
6133 +++ mozilla.new/extensions/reporter/locales/lt/chrome/reporterOverlay.dtd 2006-01-24 15:27:13.000000000 +0100
6134 @@ -0,0 +1,5 @@
6135 +<!-- Entities for the Sample Extension Options Dialog go here -->
6136 +<!ENTITY reporterMenu.title "Pranešti apie neveikiančią svetainę">
6137 +<!ENTITY reporterMenu.tooltip "Pranešti apie neveikiančią svetainę">
6138 +<!ENTITY reporterMenu.accesskey "P">
6140 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/lt/chrome/reporterOverlay.properties mozilla.new/extensions/reporter/locales/lt/chrome/reporterOverlay.properties
6141 --- mozilla/extensions/reporter/locales/lt/chrome/reporterOverlay.properties 1970-01-01 01:00:00.000000000 +0100
6142 +++ mozilla.new/extensions/reporter/locales/lt/chrome/reporterOverlay.properties 2006-01-24 15:27:13.000000000 +0100
6143 @@ -0,0 +1 @@
6144 +# Script accessible strings for the browser integration overlay go here.
6145 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/lt/chrome/reportResults.dtd mozilla.new/extensions/reporter/locales/lt/chrome/reportResults.dtd
6146 --- mozilla/extensions/reporter/locales/lt/chrome/reportResults.dtd 1970-01-01 01:00:00.000000000 +0100
6147 +++ mozilla.new/extensions/reporter/locales/lt/chrome/reportResults.dtd 2006-01-24 15:27:13.000000000 +0100
6148 @@ -0,0 +1,14 @@
6149 +<!ENTITY reportSite "Svetainė">
6150 +<!ENTITY reportProblemType "Nesklandumo tipas">
6151 +<!ENTITY reportDecsription "Aprašas">
6152 +<!ENTITY reportPlatform "Platforma">
6153 +<!ENTITY reportProduct "Programa">
6154 +<!ENTITY reportoscpu "Operacinė sistema">
6155 +<!ENTITY reportGecko "„Gecko“ versija">
6156 +<!ENTITY reportBuildConfig "Darinio sąranka">
6157 +<!ENTITY reportUseragent "Naudotojo programa">
6158 +<!ENTITY reportLanguage "Kalba">
6159 +<!ENTITY reportEmail "El. paštas">
6160 +<!ENTITY error "Išsamiau apie klaidą">
6161 +<!ENTITY faultCode "Kodas">
6162 +<!ENTITY faultMessage "Pranešimas">
6163 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/lt/chrome/reportWizard.dtd mozilla.new/extensions/reporter/locales/lt/chrome/reportWizard.dtd
6164 --- mozilla/extensions/reporter/locales/lt/chrome/reportWizard.dtd 1970-01-01 01:00:00.000000000 +0100
6165 +++ mozilla.new/extensions/reporter/locales/lt/chrome/reportWizard.dtd 2006-01-24 15:27:13.000000000 +0100
6166 @@ -0,0 +1,55 @@
6167 +<!-- Entities for the Sample Extension Options Dialog go here -->
6168 +<!ENTITY reportWizard.title "Pranešimas apie neveikiančią svetainę">
6170 +<!ENTITY privacyNotice.label "Privatumo politika">
6171 +<!ENTITY reportWizardPrivacy.description "Ši priemonė leidžia pranešti naršyklės kokybės priežiūros komandai apie svetainę, kuri naršyklėje „&brandShortName;“ veikia nekorektiškai arba paveikia „&brandShortName;“ veikimą. Tuo galite padėti pagerinti „&brandShortName;“ kokybę ir žiniatinklio naršymą su šia naršykle. Prašom perskaityti žemiau pateiktą tekstą, paaiškinantį, kaip mes panaudojame iš Jūsų gautą informaciją.">
6172 +<!ENTITY reportWizardMustAgree.description "Jei norite tęsti, turite sutikti su aukščiau pateikta privatumo politika.">
6174 +<!ENTITY dontShowPrivacyStatement.label "Privatumo politiką perskaičiau ir sutinku su ja.">
6175 +<!ENTITY dontShowPrivacyStatement.accesskey "P">
6177 +<!ENTITY reportForm.label "Pranešimo informacijos pildymas">
6179 +<!ENTITY reportForm.description "Prašom trumpai apibūdinti nesklandumą, su kuriuo susidurėte:">
6180 +<!ENTITY reportForm.url.title "Svetainės URL:">
6182 +<!ENTITY reportForm.behind_login.title "Svetainė apsaugota slaptažodžiu"><!-- No ":" at the end -->
6183 +<!ENTITY reportForm.behind_login.accesskey "S">
6185 +<!ENTITY reportForm.problem_type.title "Nesklandumo tipas:">
6186 +<!ENTITY reportForm.problem_type.accesskey "T">
6188 +<!ENTITY reportForm.problem_type.chooseOne.title "Prašom parinkti...">
6190 +<!-- DO *NOT* Add/change/modify (except localization) without consulting with r.m.o server admin first! -->
6191 +<!ENTITY reportForm.problem_type.item1.title "Nesuderinama su naršykle">
6192 +<!ENTITY reportForm.problem_type.item2.title "Nepavyksta prisijungti">
6193 +<!ENTITY reportForm.problem_type.item3.title "Nerodomi papildiniai">
6194 +<!ENTITY reportForm.problem_type.item4.title "Prarandama turinio dalis">
6195 +<!ENTITY reportForm.problem_type.item5.title "Neteisingas tinklalapio funkcionavimas">
6196 +<!ENTITY reportForm.problem_type.item6.title "Neteisingas tinklalapio vaizdavimas">
6197 +<!ENTITY reportForm.problem_type.item7.title "Kitas nesklandumas">
6199 +<!ENTITY reportForm.describe.title "Nesklandumo aprašas:">
6200 +<!ENTITY reportForm.describe.accesskey "N">
6202 +<!ENTITY reportForm.platform.title "Platforma:">
6203 +<!ENTITY reportForm.product.title "Programa:">
6204 +<!ENTITY reportForm.gecko.title "„Gecko“ versija:">
6205 +<!ENTITY reportForm.useragent.title "Naudotojo programa:">
6206 +<!ENTITY reportForm.language.title "Kalba:">
6208 +<!-- Make sure this has "(Optional)" at the end. This is important for the user to know -->
6209 +<!ENTITY reportForm.email.title "El. paštas (nebūtina):">
6210 +<!ENTITY reportForm.email.accesskey "E">
6212 +<!ENTITY reportForm.privacyPolicy.title "Privatumo politiką">
6213 +<!ENTITY reportForm.privacyPolicy.tooltip "Peržiūrėti privatumo politiką">
6215 +<!ENTITY reportResults.showDetail.title "Išsamiau">
6216 +<!ENTITY reportResults.showDetail.accesskey "š">
6218 +<!ENTITY sendReport.label "Siunčiamas pranešimas">
6219 +<!ENTITY sendReport.description "Pranešimas siunčiamas serveriui...">
6221 +<!ENTITY finish.label "Pranešimas išsiųstas">
6222 diff -uprN --exclude=CVS mozilla/extensions/reporter/locales/lt/chrome/reportWizard.properties mozilla.new/extensions/reporter/locales/lt/chrome/reportWizard.properties
6223 --- mozilla/extensions/reporter/locales/lt/chrome/reportWizard.properties 1970-01-01 01:00:00.000000000 +0100
6224 +++ mozilla.new/extensions/reporter/locales/lt/chrome/reportWizard.properties 2006-01-24 15:27:13.000000000 +0100
6225 @@ -0,0 +1,9 @@
6226 +submitReport=Pateikti prane\u0161im\u0105
6228 +sendingReport=Siun\u010diamas prane\u0161imas...
6229 +reportSent=Prane\u0161imas i\u0161si\u0173stas
6231 +finishError=Klaida siun\u010diant prane\u0161im\u0105
6233 +successfullyCreatedReport=Prane\u0161imas s\u0117kmingai perduotas
6234 +failedCreatingReport=Klaida kuriant prane\u0161im\u0105. Bendrijai \u201emozilla.org\u201c nei\u0161si\u0173sta jokios informacijos
6235 diff -uprN --exclude=CVS mozilla/extensions/reporter/Makefile.in mozilla.new/extensions/reporter/Makefile.in
6236 --- mozilla/extensions/reporter/Makefile.in 2005-11-01 14:55:47.000000000 +0100
6237 +++ mozilla.new/extensions/reporter/Makefile.in 2006-02-14 10:01:12.000000000 +0100
6238 @@ -64,6 +64,7 @@ ALL_LOCALES = \
6239 eu \
6240 fi \
6241 fr \
6242 + fy-NL \
6243 ga-IE \
6244 gu-IN \
6245 he \
6246 @@ -73,6 +74,7 @@ ALL_LOCALES = \
6247 ja \
6248 ja-JP-mac \
6249 ko \
6250 + lt \
6251 mk \
6252 mn \
6253 nb-NO \
6254 diff -uprN --exclude=CVS mozilla/extensions/schema-validation/src/Makefile.in mozilla.new/extensions/schema-validation/src/Makefile.in
6255 --- mozilla/extensions/schema-validation/src/Makefile.in 2005-06-24 17:38:12.000000000 +0200
6256 +++ mozilla.new/extensions/schema-validation/src/Makefile.in 2006-02-14 10:01:12.000000000 +0100
6257 @@ -45,10 +45,15 @@ include $(DEPTH)/config/autoconf.mk
6258 MODULE = schemavalidation
6259 LIBRARY_NAME = schemavalidation
6260 SHORT_LIBNAME = schemval
6261 +IS_COMPONENT = 1
6262 +ifndef MINIMO
6263 # Do not set EXPORT_LIBRARY as we do not want schema-validation in the static libs list
6264 #EXPORT_LIBRARY = 1
6265 FORCE_SHARED_LIB = 1
6266 -IS_COMPONENT = 1
6267 +else
6268 +EXPORT_LIBRARY = 1
6269 +MODULE_NAME = schemavalidation
6270 +endif
6271 GRE_MODULE = 1
6272 MOZILLA_INTERNAL_API = 1
6274 diff -uprN --exclude=CVS mozilla/extensions/schema-validation/src/nsSchemaValidator.cpp mozilla.new/extensions/schema-validation/src/nsSchemaValidator.cpp
6275 --- mozilla/extensions/schema-validation/src/nsSchemaValidator.cpp 2005-10-14 21:09:10.000000000 +0200
6276 +++ mozilla.new/extensions/schema-validation/src/nsSchemaValidator.cpp 2006-03-03 07:12:23.000000000 +0100
6277 @@ -71,6 +71,7 @@
6278 #include "prprf.h"
6279 #include "prtime.h"
6280 #include "plbase64.h"
6281 +#include <ctype.h>
6283 #define NS_SCHEMA_1999_NAMESPACE "http://www.w3.org/1999/XMLSchema"
6284 #define NS_SCHEMA_2001_NAMESPACE "http://www.w3.org/2001/XMLSchema"
6285 @@ -333,7 +334,8 @@ nsSchemaValidator::ValidateSimpletype(co
6287 case nsISchemaSimpleType::SIMPLE_TYPE_LIST: {
6288 // handle lists
6289 - rv = ValidateListSimpletype(aNodeValue, aSchemaSimpleType, &isValid);
6290 + rv = ValidateListSimpletype(aNodeValue, aSchemaSimpleType, nsnull,
6291 + &isValid);
6292 break;
6295 @@ -348,6 +350,50 @@ nsSchemaValidator::ValidateSimpletype(co
6296 return rv;
6299 +nsresult
6300 +nsSchemaValidator::ValidateDerivedSimpletype(const nsAString & aNodeValue,
6301 + nsSchemaDerivedSimpleType *aDerived,
6302 + PRBool *aResult)
6304 + // This method is called when validating a simpletype that derives from another
6305 + // simpletype.
6307 + PRBool isValid = PR_FALSE;
6309 + PRUint16 simpleTypeValue;
6310 + nsresult rv = aDerived->mBaseType->GetSimpleType(&simpleTypeValue);
6312 + switch (simpleTypeValue) {
6313 + case nsISchemaSimpleType::SIMPLE_TYPE_BUILTIN: {
6314 + rv = ValidateDerivedBuiltinType(aNodeValue, aDerived, &isValid);
6315 + break;
6318 + case nsISchemaSimpleType::SIMPLE_TYPE_RESTRICTION: {
6319 + // this happens when for example someone derives from a union which then
6320 + // derives from another type.
6321 + rv = nsSchemaValidatorUtils::GetDerivedSimpleType(aDerived->mBaseType,
6322 + aDerived);
6323 + ValidateDerivedSimpletype(aNodeValue, aDerived, &isValid);
6324 + break;
6327 + case nsISchemaSimpleType::SIMPLE_TYPE_LIST: {
6328 + rv = ValidateListSimpletype(aNodeValue, aDerived->mBaseType, aDerived,
6329 + &isValid);
6330 + break;
6333 + case nsISchemaSimpleType::SIMPLE_TYPE_UNION: {
6334 + rv = ValidateDerivedUnionSimpletype(aNodeValue, aDerived, &isValid);
6335 + break;
6339 + *aResult = isValid;
6340 + return rv;
6344 * Simpletype restrictions allow restricting a built-in type with several
6345 * facets, such as totalDigits or maxLength.
6346 @@ -357,6 +403,8 @@ nsSchemaValidator::ValidateRestrictionSi
6347 nsISchemaSimpleType *aType,
6348 PRBool *aResult)
6350 + PRBool isValid = PR_FALSE;
6352 nsCOMPtr<nsISchemaRestrictionType> restrictionType = do_QueryInterface(aType);
6353 NS_ENSURE_STATE(restrictionType);
6355 @@ -366,151 +414,88 @@ nsSchemaValidator::ValidateRestrictionSi
6356 nsresult rv = restrictionType->GetBaseType(getter_AddRefs(simpleBaseType));
6357 NS_ENSURE_SUCCESS(rv, rv);
6359 - // get the amount of restriction facet defined.
6360 - PRUint32 facetCount;
6361 - rv = restrictionType->GetFacetCount(&facetCount);
6362 - NS_ENSURE_SUCCESS(rv, rv);
6363 - LOG((" %d facet(s) defined.", facetCount));
6365 - // we create variables for all possible restriction facets and populate them
6366 - // if we run into them. This is faster than having the same code repeated
6367 - // for each built-in type and only handling the relevant facets.
6368 - PRBool isLengthDefined = PR_FALSE;
6369 - PRUint32 length = 0;
6370 - PRBool isMinLengthDefined = PR_FALSE;
6371 - PRUint32 minLength = 0;
6372 - PRBool isMaxLengthDefined = PR_FALSE;
6373 - PRUint32 maxLength = 0;
6374 - nsAutoString pattern;
6375 - unsigned short whitespace = 0;
6376 - nsAutoString maxInclusive;
6377 - nsAutoString minInclusive;
6378 - nsAutoString maxExclusive;
6379 - nsAutoString minExclusive;
6380 - PRUint32 totalDigits = 0;
6381 - // since fractionDigits is 0..n, need a bool to remember if it was set or not.
6382 - PRBool fractionDigitsSet = PR_FALSE;
6383 - PRUint32 fractionDigits = 0;
6384 - nsAutoString enumeration;
6385 - nsStringArray enumerationList;
6387 - nsCOMPtr<nsISchemaFacet> facet;
6388 - PRUint32 facetCounter;
6389 - PRUint16 facetType;
6391 - // handle all defined facets
6392 - for (facetCounter = 0; facetCounter < facetCount; ++facetCounter) {
6393 - rv = restrictionType->GetFacet(facetCounter, getter_AddRefs(facet));
6394 - NS_ENSURE_SUCCESS(rv, rv);
6396 - facet->GetFacetType(&facetType);
6398 - switch (facetType) {
6399 - case nsISchemaFacet::FACET_TYPE_LENGTH: {
6400 - isLengthDefined = PR_TRUE;
6401 - facet->GetLengthValue(&length);
6402 - LOG((" - Length Facet found (value is %d)", length));
6403 - break;
6406 - case nsISchemaFacet::FACET_TYPE_MINLENGTH: {
6407 - isMinLengthDefined = PR_TRUE;
6408 - facet->GetLengthValue(&minLength);
6409 - LOG((" - Min Length Facet found (value is %d)", minLength));
6410 - break;
6413 - case nsISchemaFacet::FACET_TYPE_MAXLENGTH: {
6414 - isMaxLengthDefined = PR_TRUE;
6415 - facet->GetLengthValue(&maxLength);
6416 - LOG((" - Max Length Facet found (value is %d)", maxLength));
6417 - break;
6420 - case nsISchemaFacet::FACET_TYPE_PATTERN: {
6421 - facet->GetValue(pattern);
6422 - LOG((" - Pattern Facet found (value is %s)",
6423 - NS_ConvertUTF16toUTF8(pattern).get()));
6424 - break;
6427 - case nsISchemaFacet::FACET_TYPE_ENUMERATION: {
6428 - facet->GetValue(enumeration);
6429 - enumerationList.AppendString(enumeration);
6430 - LOG((" - Enumeration found (%s)",
6431 - NS_ConvertUTF16toUTF8(enumeration).get()));
6432 - break;
6435 - case nsISchemaFacet::FACET_TYPE_WHITESPACE: {
6436 - // XXX whitespace not supported yet
6437 - facet->GetWhitespaceValue(&whitespace);
6438 - break;
6441 - case nsISchemaFacet::FACET_TYPE_MAXINCLUSIVE: {
6442 - facet->GetValue(maxInclusive);
6443 - LOG((" - Max Inclusive Facet found (value is %s)",
6444 - NS_ConvertUTF16toUTF8(maxInclusive).get()));
6445 - break;
6448 - case nsISchemaFacet::FACET_TYPE_MININCLUSIVE: {
6449 - facet->GetValue(minInclusive);
6450 - LOG((" - Min Inclusive Facet found (value is %s)",
6451 - NS_ConvertUTF16toUTF8(minInclusive).get()));
6452 - break;
6455 - case nsISchemaFacet::FACET_TYPE_MAXEXCLUSIVE: {
6456 - facet->GetValue(maxExclusive);
6457 - LOG((" - Max Exclusive Facet found (value is %s)",
6458 - NS_ConvertUTF16toUTF8(maxExclusive).get()));
6459 - break;
6462 - case nsISchemaFacet::FACET_TYPE_MINEXCLUSIVE: {
6463 - facet->GetValue(minExclusive);
6464 - LOG((" - Min Exclusive Facet found (value is %s)",
6465 - NS_ConvertUTF16toUTF8(minExclusive).get()));
6466 - break;
6469 - case nsISchemaFacet::FACET_TYPE_TOTALDIGITS: {
6470 - facet->GetDigitsValue(&totalDigits);
6471 - LOG((" - Totaldigits Facet found (value is %d)", totalDigits));
6472 - break;
6475 - case nsISchemaFacet::FACET_TYPE_FRACTIONDIGITS: {
6476 - fractionDigitsSet = PR_TRUE;
6477 - facet->GetDigitsValue(&fractionDigits);
6478 - LOG((" - Fractiondigits Facet found (value is %d)", fractionDigits));
6479 - break;
6483 + nsSchemaDerivedSimpleType derivedType;
6484 + rv = nsSchemaValidatorUtils::GetDerivedSimpleType(aType, &derivedType);
6485 + rv = ValidateDerivedSimpletype(aNodeValue, &derivedType, &isValid);
6486 + *aResult = isValid;
6487 + return rv;
6490 +nsresult
6491 +nsSchemaValidator::ValidateDerivedBuiltinType(const nsAString & aNodeValue,
6492 + nsSchemaDerivedSimpleType *aDerived,
6493 + PRBool *aResult)
6495 + PRBool isValid = PR_FALSE;
6496 // now that we have loaded all the restriction facets,
6497 // check the base type and validate
6498 - PRUint16 builtinTypeValue;
6499 nsCOMPtr<nsISchemaBuiltinType> schemaBuiltinType =
6500 - do_QueryInterface(simpleBaseType);
6501 + do_QueryInterface(aDerived->mBaseType);
6502 NS_ENSURE_STATE(schemaBuiltinType);
6504 - schemaBuiltinType->GetBuiltinType(&builtinTypeValue);
6505 + PRUint16 builtinTypeValue;
6506 + nsresult rv = schemaBuiltinType->GetBuiltinType(&builtinTypeValue);
6508 #ifdef PR_LOGGING
6509 DumpBaseType(schemaBuiltinType);
6510 #endif
6512 - PRBool isValid = PR_FALSE;
6513 - switch(builtinTypeValue) {
6514 + switch (builtinTypeValue) {
6515 case nsISchemaBuiltinType::BUILTIN_TYPE_STRING: {
6516 - rv = ValidateBuiltinTypeString(aNodeValue, length, isLengthDefined,
6517 - minLength, isMinLengthDefined,
6518 - maxLength, isMaxLengthDefined,
6519 - &enumerationList, &isValid);
6520 + rv = ValidateBuiltinTypeString(aNodeValue,
6521 + aDerived->length.value,
6522 + aDerived->length.isDefined,
6523 + aDerived->minLength.value,
6524 + aDerived->minLength.isDefined,
6525 + aDerived->maxLength.value,
6526 + aDerived->maxLength.isDefined,
6527 + &aDerived->enumerationList,
6528 + &isValid);
6529 + break;
6532 + case nsISchemaBuiltinType::BUILTIN_TYPE_NORMALIZED_STRING: {
6533 + if (nsSchemaValidatorUtils::IsValidSchemaNormalizedString(aNodeValue)) {
6534 + rv = ValidateBuiltinTypeString(aNodeValue,
6535 + aDerived->length.value,
6536 + aDerived->length.isDefined,
6537 + aDerived->minLength.value,
6538 + aDerived->minLength.isDefined,
6539 + aDerived->maxLength.value,
6540 + aDerived->maxLength.isDefined,
6541 + &aDerived->enumerationList,
6542 + &isValid);
6544 + break;
6547 + case nsISchemaBuiltinType::BUILTIN_TYPE_TOKEN: {
6548 + if (nsSchemaValidatorUtils::IsValidSchemaToken(aNodeValue)) {
6549 + rv = ValidateBuiltinTypeString(aNodeValue,
6550 + aDerived->length.value,
6551 + aDerived->length.isDefined,
6552 + aDerived->minLength.value,
6553 + aDerived->minLength.isDefined,
6554 + aDerived->maxLength.value,
6555 + aDerived->maxLength.isDefined,
6556 + &aDerived->enumerationList,
6557 + &isValid);
6559 + break;
6562 + case nsISchemaBuiltinType::BUILTIN_TYPE_LANGUAGE: {
6563 + if (nsSchemaValidatorUtils::IsValidSchemaLanguage(aNodeValue)) {
6564 + rv = ValidateBuiltinTypeString(aNodeValue,
6565 + aDerived->length.value,
6566 + aDerived->length.isDefined,
6567 + aDerived->minLength.value,
6568 + aDerived->minLength.isDefined,
6569 + aDerived->maxLength.value,
6570 + aDerived->maxLength.isDefined,
6571 + &aDerived->enumerationList,
6572 + &isValid);
6574 break;
6577 @@ -520,139 +505,395 @@ nsSchemaValidator::ValidateRestrictionSi
6580 case nsISchemaBuiltinType::BUILTIN_TYPE_GDAY: {
6581 - rv = ValidateBuiltinTypeGDay(aNodeValue, maxExclusive, minExclusive,
6582 - maxInclusive, minInclusive, &isValid);
6583 + rv = ValidateBuiltinTypeGDay(aNodeValue,
6584 + aDerived->maxExclusive.value,
6585 + aDerived->minExclusive.value,
6586 + aDerived->maxInclusive.value,
6587 + aDerived->minInclusive.value,
6588 + &isValid);
6589 break;
6592 case nsISchemaBuiltinType::BUILTIN_TYPE_GMONTH: {
6593 - rv = ValidateBuiltinTypeGMonth(aNodeValue, maxExclusive, minExclusive,
6594 - maxInclusive, minInclusive, &isValid);
6595 + rv = ValidateBuiltinTypeGMonth(aNodeValue,
6596 + aDerived->maxExclusive.value,
6597 + aDerived->minExclusive.value,
6598 + aDerived->maxInclusive.value,
6599 + aDerived->minInclusive.value,
6600 + &isValid);
6601 break;
6604 case nsISchemaBuiltinType::BUILTIN_TYPE_GYEAR: {
6605 - rv = ValidateBuiltinTypeGYear(aNodeValue, maxExclusive, minExclusive,
6606 - maxInclusive, minInclusive, &isValid);
6607 + rv = ValidateBuiltinTypeGYear(aNodeValue,
6608 + aDerived->maxExclusive.value,
6609 + aDerived->minExclusive.value,
6610 + aDerived->maxInclusive.value,
6611 + aDerived->minInclusive.value,
6612 + &isValid);
6613 break;
6616 case nsISchemaBuiltinType::BUILTIN_TYPE_GYEARMONTH: {
6617 - rv = ValidateBuiltinTypeGYearMonth(aNodeValue, maxExclusive, minExclusive,
6618 - maxInclusive, minInclusive, &isValid);
6619 + rv = ValidateBuiltinTypeGYearMonth(aNodeValue,
6620 + aDerived->maxExclusive.value,
6621 + aDerived->minExclusive.value,
6622 + aDerived->maxInclusive.value,
6623 + aDerived->minInclusive.value,
6624 + &isValid);
6625 break;
6628 case nsISchemaBuiltinType::BUILTIN_TYPE_GMONTHDAY: {
6629 - rv = ValidateBuiltinTypeGMonthDay(aNodeValue, maxExclusive, minExclusive,
6630 - maxInclusive, minInclusive, &isValid);
6631 + rv = ValidateBuiltinTypeGMonthDay(aNodeValue,
6632 + aDerived->maxExclusive.value,
6633 + aDerived->minExclusive.value,
6634 + aDerived->maxInclusive.value,
6635 + aDerived->minInclusive.value,
6636 + &isValid);
6637 break;
6640 case nsISchemaBuiltinType::BUILTIN_TYPE_DATE: {
6641 - rv = ValidateBuiltinTypeDate(aNodeValue, maxExclusive, minExclusive,
6642 - maxInclusive, minInclusive, &isValid);
6643 + rv = ValidateBuiltinTypeDate(aNodeValue,
6644 + aDerived->maxExclusive.value,
6645 + aDerived->minExclusive.value,
6646 + aDerived->maxInclusive.value,
6647 + aDerived->minInclusive.value,
6648 + &isValid);
6649 break;
6652 case nsISchemaBuiltinType::BUILTIN_TYPE_TIME: {
6653 - rv = ValidateBuiltinTypeTime(aNodeValue, maxExclusive, minExclusive,
6654 - maxInclusive, minInclusive, &isValid);
6655 + rv = ValidateBuiltinTypeTime(aNodeValue,
6656 + aDerived->maxExclusive.value,
6657 + aDerived->minExclusive.value,
6658 + aDerived->maxInclusive.value,
6659 + aDerived->minInclusive.value,
6660 + &isValid);
6661 break;
6664 case nsISchemaBuiltinType::BUILTIN_TYPE_DATETIME: {
6665 - rv = ValidateBuiltinTypeDateTime(aNodeValue, maxExclusive, minExclusive,
6666 - maxInclusive, minInclusive, &isValid);
6667 + rv = ValidateBuiltinTypeDateTime(aNodeValue,
6668 + aDerived->maxExclusive.value,
6669 + aDerived->minExclusive.value,
6670 + aDerived->maxInclusive.value,
6671 + aDerived->minInclusive.value,
6672 + &isValid);
6673 break;
6676 case nsISchemaBuiltinType::BUILTIN_TYPE_DURATION: {
6677 - rv = ValidateBuiltinTypeDuration(aNodeValue, maxExclusive, minExclusive,
6678 - maxInclusive, minInclusive, &isValid);
6679 + rv = ValidateBuiltinTypeDuration(aNodeValue,
6680 + aDerived->maxExclusive.value,
6681 + aDerived->minExclusive.value,
6682 + aDerived->maxInclusive.value,
6683 + aDerived->minInclusive.value,
6684 + &isValid);
6685 break;
6688 case nsISchemaBuiltinType::BUILTIN_TYPE_INTEGER: {
6689 - rv = ValidateBuiltinTypeInteger(aNodeValue, totalDigits, maxExclusive,
6690 - minExclusive, maxInclusive, minInclusive,
6691 - &enumerationList, &isValid);
6692 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6693 + aDerived->totalDigits.value,
6694 + aDerived->maxExclusive.value,
6695 + aDerived->minExclusive.value,
6696 + aDerived->maxInclusive.value,
6697 + aDerived->minInclusive.value,
6698 + &aDerived->enumerationList,
6699 + &isValid);
6700 break;
6703 /* http://w3.org/TR/xmlschema-2/#nonPositiveInteger */
6704 case nsISchemaBuiltinType::BUILTIN_TYPE_NONPOSITIVEINTEGER: {
6705 - if (maxExclusive.IsEmpty()) {
6706 - maxExclusive.AssignLiteral("1");
6707 + if (aDerived->maxExclusive.value.IsEmpty()) {
6708 + aDerived->maxExclusive.value.AssignLiteral("1");
6709 + } else if (aDerived->maxInclusive.value.IsEmpty()) {
6710 + aDerived->maxInclusive.value.AssignLiteral("0");
6713 - if (minInclusive.IsEmpty()) {
6714 - minInclusive.AssignLiteral("0");
6717 - rv = ValidateBuiltinTypeInteger(aNodeValue, totalDigits, maxExclusive,
6718 - minExclusive, maxInclusive, minInclusive,
6719 - &enumerationList, &isValid);
6720 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6721 + aDerived->totalDigits.value,
6722 + aDerived->maxExclusive.value,
6723 + aDerived->minExclusive.value,
6724 + aDerived->maxInclusive.value,
6725 + aDerived->minInclusive.value,
6726 + &aDerived->enumerationList,
6727 + &isValid);
6728 break;
6731 /* http://www.w3.org/TR/xmlschema-2/#negativeInteger */
6732 case nsISchemaBuiltinType::BUILTIN_TYPE_NEGATIVEINTEGER: {
6733 - if (maxExclusive.IsEmpty()) {
6734 - maxExclusive.AssignLiteral("0");
6735 + if (aDerived->maxExclusive.value.IsEmpty()) {
6736 + aDerived->maxExclusive.value.AssignLiteral("0");
6737 + } else if (aDerived->maxInclusive.value.IsEmpty()) {
6738 + aDerived->maxInclusive.value.AssignLiteral("-1");
6741 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6742 + aDerived->totalDigits.value,
6743 + aDerived->maxExclusive.value,
6744 + aDerived->minExclusive.value,
6745 + aDerived->maxInclusive.value,
6746 + aDerived->minInclusive.value,
6747 + &aDerived->enumerationList,
6748 + &isValid);
6749 + break;
6752 + /* http://w3.org/TR/xmlschema-2/#positiveInteger */
6753 + case nsISchemaBuiltinType::BUILTIN_TYPE_POSITIVEINTEGER: {
6754 + if (aDerived->minInclusive.value.IsEmpty()) {
6755 + aDerived->minInclusive.value.AssignLiteral("1");
6756 + } else if (aDerived->minExclusive.value.IsEmpty()) {
6757 + aDerived->minExclusive.value.AssignLiteral("0");
6760 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6761 + aDerived->totalDigits.value,
6762 + aDerived->maxExclusive.value,
6763 + aDerived->minExclusive.value,
6764 + aDerived->maxInclusive.value,
6765 + aDerived->minInclusive.value,
6766 + &aDerived->enumerationList,
6767 + &isValid);
6768 + break;
6771 + /* http://www.w3.org/TR/xmlschema-2/#long */
6772 + case nsISchemaBuiltinType::BUILTIN_TYPE_LONG: {
6773 + if (aDerived->maxInclusive.value.IsEmpty()) {
6774 + aDerived->maxInclusive.value.AssignLiteral("9223372036854775807");
6777 + if (aDerived->minInclusive.value.IsEmpty()) {
6778 + aDerived->minInclusive.value.AssignLiteral("-9223372036854775808");
6781 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6782 + aDerived->totalDigits.value,
6783 + aDerived->maxExclusive.value,
6784 + aDerived->minExclusive.value,
6785 + aDerived->maxInclusive.value,
6786 + aDerived->minInclusive.value,
6787 + &aDerived->enumerationList,
6788 + &isValid);
6789 + break;
6792 + /* http://www.w3.org/TR/xmlschema-2/#int */
6793 + case nsISchemaBuiltinType::BUILTIN_TYPE_INT: {
6794 + if (aDerived->maxInclusive.value.IsEmpty()) {
6795 + aDerived->maxInclusive.value.AssignLiteral("2147483647");
6798 + if (aDerived->minInclusive.value.IsEmpty()) {
6799 + aDerived->minInclusive.value.AssignLiteral("-2147483648");
6802 - if (minInclusive.IsEmpty()) {
6803 - minInclusive.AssignLiteral("-1");
6804 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6805 + aDerived->totalDigits.value,
6806 + aDerived->maxExclusive.value,
6807 + aDerived->minExclusive.value,
6808 + aDerived->maxInclusive.value,
6809 + aDerived->minInclusive.value,
6810 + &aDerived->enumerationList,
6811 + &isValid);
6812 + break;
6815 + /* http://www.w3.org/TR/xmlschema-2/#short */
6816 + case nsISchemaBuiltinType::BUILTIN_TYPE_SHORT: {
6817 + if (aDerived->maxInclusive.value.IsEmpty()) {
6818 + aDerived->maxInclusive.value.AssignLiteral("32767");
6821 + if (aDerived->minInclusive.value.IsEmpty()) {
6822 + aDerived->minInclusive.value.AssignLiteral("-32768");
6825 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6826 + aDerived->totalDigits.value,
6827 + aDerived->maxExclusive.value,
6828 + aDerived->minExclusive.value,
6829 + aDerived->maxInclusive.value,
6830 + aDerived->minInclusive.value,
6831 + &aDerived->enumerationList,
6832 + &isValid);
6833 + break;
6836 + /* http://www.w3.org/TR/xmlschema-2/#unsignedLong */
6837 + case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDLONG: {
6838 + if (aDerived->maxInclusive.value.IsEmpty()) {
6839 + aDerived->maxInclusive.value.AssignLiteral("18446744073709551615");
6842 + if (aDerived->minInclusive.value.IsEmpty()) {
6843 + aDerived->minInclusive.value.AssignLiteral("0");
6846 - rv = ValidateBuiltinTypeInteger(aNodeValue, totalDigits,maxExclusive,
6847 - minExclusive, maxInclusive, minInclusive,
6848 - &enumerationList, &isValid);
6849 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6850 + aDerived->totalDigits.value,
6851 + aDerived->maxExclusive.value,
6852 + aDerived->minExclusive.value,
6853 + aDerived->maxInclusive.value,
6854 + aDerived->minInclusive.value,
6855 + &aDerived->enumerationList,
6856 + &isValid);
6857 + break;
6860 + /* http://www.w3.org/TR/xmlschema-2/#unsignedInt */
6861 + case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDINT: {
6862 + if (aDerived->maxInclusive.value.IsEmpty()) {
6863 + aDerived->maxInclusive.value.AssignLiteral("4294967295");
6866 + if (aDerived->minInclusive.value.IsEmpty()) {
6867 + aDerived->minInclusive.value.AssignLiteral("0");
6870 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6871 + aDerived->totalDigits.value,
6872 + aDerived->maxExclusive.value,
6873 + aDerived->minExclusive.value,
6874 + aDerived->maxInclusive.value,
6875 + aDerived->minInclusive.value,
6876 + &aDerived->enumerationList,
6877 + &isValid);
6878 + break;
6881 + /* http://www.w3.org/TR/xmlschema-2/#unsignedShort */
6882 + case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDSHORT: {
6883 + if (aDerived->maxInclusive.value.IsEmpty()) {
6884 + aDerived->maxInclusive.value.AssignLiteral("65535");
6887 + if (aDerived->minInclusive.value.IsEmpty()) {
6888 + aDerived->minInclusive.value.AssignLiteral("0");
6891 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6892 + aDerived->totalDigits.value,
6893 + aDerived->maxExclusive.value,
6894 + aDerived->minExclusive.value,
6895 + aDerived->maxInclusive.value,
6896 + aDerived->minInclusive.value,
6897 + &aDerived->enumerationList,
6898 + &isValid);
6899 + break;
6902 + /* http://www.w3.org/TR/xmlschema-2/#unsignedByte */
6903 + case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDBYTE: {
6904 + if (aDerived->maxInclusive.value.IsEmpty()) {
6905 + aDerived->maxInclusive.value.AssignLiteral("255");
6908 + if (aDerived->minInclusive.value.IsEmpty()) {
6909 + aDerived->minInclusive.value.AssignLiteral("0");
6912 + rv = ValidateBuiltinTypeInteger(aNodeValue,
6913 + aDerived->totalDigits.value,
6914 + aDerived->maxExclusive.value,
6915 + aDerived->minExclusive.value,
6916 + aDerived->maxInclusive.value,
6917 + aDerived->minInclusive.value,
6918 + &aDerived->enumerationList,
6919 + &isValid);
6920 break;
6923 case nsISchemaBuiltinType::BUILTIN_TYPE_BYTE: {
6924 - rv = ValidateBuiltinTypeByte(aNodeValue, totalDigits, maxExclusive,
6925 - minExclusive, maxInclusive, minInclusive,
6926 - &enumerationList, &isValid);
6927 + rv = ValidateBuiltinTypeByte(aNodeValue,
6928 + aDerived->totalDigits.value,
6929 + aDerived->maxExclusive.value,
6930 + aDerived->minExclusive.value,
6931 + aDerived->maxInclusive.value,
6932 + aDerived->minInclusive.value,
6933 + &aDerived->enumerationList,
6934 + &isValid);
6935 break;
6938 case nsISchemaBuiltinType::BUILTIN_TYPE_FLOAT: {
6939 - rv = ValidateBuiltinTypeFloat(aNodeValue, totalDigits, maxExclusive,
6940 - minExclusive, maxInclusive, minInclusive,
6941 - &enumerationList, &isValid);
6942 + rv = ValidateBuiltinTypeFloat(aNodeValue,
6943 + aDerived->totalDigits.value,
6944 + aDerived->maxExclusive.value,
6945 + aDerived->minExclusive.value,
6946 + aDerived->maxInclusive.value,
6947 + aDerived->minInclusive.value,
6948 + &aDerived->enumerationList,
6949 + &isValid);
6950 break;
6953 case nsISchemaBuiltinType::BUILTIN_TYPE_DECIMAL: {
6954 - rv = ValidateBuiltinTypeDecimal(aNodeValue, totalDigits, fractionDigits,
6955 - fractionDigitsSet, maxExclusive,
6956 - minExclusive, maxInclusive, minInclusive,
6957 - &enumerationList, &isValid);
6958 + rv = ValidateBuiltinTypeDecimal(aNodeValue,
6959 + aDerived->totalDigits.value,
6960 + aDerived->fractionDigits.value,
6961 + aDerived->fractionDigits.isDefined,
6962 + aDerived->maxExclusive.value,
6963 + aDerived->minExclusive.value,
6964 + aDerived->maxInclusive.value,
6965 + aDerived->minInclusive.value,
6966 + &aDerived->enumerationList,
6967 + &isValid);
6968 break;
6971 case nsISchemaBuiltinType::BUILTIN_TYPE_ANYURI: {
6972 - rv = ValidateBuiltinTypeAnyURI(aNodeValue, length, minLength, maxLength,
6973 - &enumerationList, &isValid);
6974 + rv = ValidateBuiltinTypeAnyURI(aNodeValue,
6975 + aDerived->length.value,
6976 + aDerived->minLength.value,
6977 + aDerived->maxLength.value,
6978 + &aDerived->enumerationList,
6979 + &isValid);
6980 break;
6983 case nsISchemaBuiltinType::BUILTIN_TYPE_BASE64BINARY: {
6984 - rv = ValidateBuiltinTypeBase64Binary(aNodeValue, length, isLengthDefined,
6985 - minLength, isMinLengthDefined,
6986 - maxLength, isMaxLengthDefined,
6987 - &enumerationList, &isValid);
6988 + rv = ValidateBuiltinTypeBase64Binary(aNodeValue,
6989 + aDerived->length.value,
6990 + aDerived->length.isDefined,
6991 + aDerived->minLength.value,
6992 + aDerived->minLength.isDefined,
6993 + aDerived->maxLength.value,
6994 + aDerived->maxLength.isDefined,
6995 + &aDerived->enumerationList,
6996 + &isValid);
6997 + break;
7000 + case nsISchemaBuiltinType::BUILTIN_TYPE_HEXBINARY: {
7001 + rv = ValidateBuiltinTypeHexBinary(aNodeValue,
7002 + aDerived->length.value,
7003 + aDerived->length.isDefined,
7004 + aDerived->minLength.value,
7005 + aDerived->minLength.isDefined,
7006 + aDerived->maxLength.value,
7007 + aDerived->maxLength.isDefined,
7008 + &aDerived->enumerationList,
7009 + &isValid);
7010 break;
7013 case nsISchemaBuiltinType::BUILTIN_TYPE_QNAME: {
7014 - rv = ValidateBuiltinTypeQName(aNodeValue, length, isLengthDefined,
7015 - minLength, isMinLengthDefined,
7016 - maxLength, isMaxLengthDefined,
7017 - &enumerationList, &isValid);
7018 + rv = ValidateBuiltinTypeQName(aNodeValue,
7019 + aDerived->length.value,
7020 + aDerived->length.isDefined,
7021 + aDerived->minLength.value,
7022 + aDerived->minLength.isDefined,
7023 + aDerived->maxLength.value,
7024 + aDerived->maxLength.isDefined,
7025 + &aDerived->enumerationList,
7026 + &isValid);
7027 break;
7030 @@ -663,10 +904,11 @@ nsSchemaValidator::ValidateRestrictionSi
7032 // finally check if a pattern is defined, as all types can be constrained by
7033 // regexp patterns.
7034 - if (isValid && !pattern.IsEmpty()) {
7035 + if (isValid && aDerived->pattern.isDefined) {
7036 // check if the pattern matches
7037 nsCOMPtr<nsISchemaValidatorRegexp> regexp = do_GetService(kREGEXP_CID);
7038 - rv = regexp->RunRegexp(aNodeValue, pattern, "g", &isValid);
7039 + rv = regexp->RunRegexp(aNodeValue, aDerived->pattern.value, "g", &isValid);
7040 + NS_ENSURE_SUCCESS(rv, rv);
7042 #ifdef PR_LOGGING
7043 LOG((" Checking Regular Expression"));
7044 @@ -703,12 +945,37 @@ nsSchemaValidator::ValidateBuiltinType(c
7045 #endif
7047 PRBool isValid = PR_FALSE;
7049 switch(builtinTypeValue) {
7050 case nsISchemaBuiltinType::BUILTIN_TYPE_STRING: {
7051 isValid = PR_TRUE;
7052 break;
7055 + case nsISchemaBuiltinType::BUILTIN_TYPE_NORMALIZED_STRING: {
7056 + if (nsSchemaValidatorUtils::IsValidSchemaNormalizedString(aNodeValue)) {
7057 + rv = ValidateBuiltinTypeString(aNodeValue, 0, PR_FALSE, 0, PR_FALSE, 0,
7058 + PR_FALSE, nsnull, &isValid);
7060 + break;
7063 + case nsISchemaBuiltinType::BUILTIN_TYPE_TOKEN: {
7064 + if (nsSchemaValidatorUtils::IsValidSchemaToken(aNodeValue)) {
7065 + rv = ValidateBuiltinTypeString(aNodeValue, 0, PR_FALSE, 0, PR_FALSE, 0,
7066 + PR_FALSE, nsnull, &isValid);
7068 + break;
7071 + case nsISchemaBuiltinType::BUILTIN_TYPE_LANGUAGE: {
7072 + if (nsSchemaValidatorUtils::IsValidSchemaLanguage(aNodeValue)) {
7073 + rv = ValidateBuiltinTypeString(aNodeValue, 0, PR_FALSE, 0, PR_FALSE, 0,
7074 + PR_FALSE, nsnull, &isValid);
7076 + break;
7079 case nsISchemaBuiltinType::BUILTIN_TYPE_BOOLEAN: {
7080 rv = ValidateBuiltinTypeBoolean(aNodeValue, &isValid);
7081 break;
7082 @@ -767,24 +1034,105 @@ nsSchemaValidator::ValidateBuiltinType(c
7084 /* http://w3.org/TR/xmlschema-2/#nonPositiveInteger */
7085 case nsISchemaBuiltinType::BUILTIN_TYPE_NONPOSITIVEINTEGER: {
7086 - // nonPositiveInteger inherits from integer, with maxExclusive
7087 - // being 1
7088 - ValidateBuiltinTypeInteger(aNodeValue, nsnull, NS_LITERAL_STRING("1"),
7089 - EmptyString(), EmptyString(), EmptyString(),
7090 - nsnull, &isValid);
7091 + // nonPositiveInteger inherits from integer, with maxInclusive
7092 + // being 0
7093 + ValidateBuiltinTypeInteger(aNodeValue, nsnull, EmptyString(),
7094 + EmptyString(), NS_LITERAL_STRING("0"),
7095 + EmptyString(), nsnull, &isValid);
7096 break;
7099 /* http://www.w3.org/TR/xmlschema-2/#negativeInteger */
7100 case nsISchemaBuiltinType::BUILTIN_TYPE_NEGATIVEINTEGER: {
7101 - // negativeInteger inherits from integer, with maxExclusive
7102 - // being 0 (only negative numbers)
7103 - ValidateBuiltinTypeInteger(aNodeValue, nsnull, NS_LITERAL_STRING("0"),
7104 - EmptyString(), EmptyString(), EmptyString(),
7105 - nsnull, &isValid);
7106 + // negativeInteger inherits from integer, with maxInclusive
7107 + // being -1 (only negative integers)
7108 + ValidateBuiltinTypeInteger(aNodeValue, nsnull, EmptyString(),
7109 + EmptyString(), NS_LITERAL_STRING("-1"),
7110 + EmptyString(), nsnull, &isValid);
7111 break;
7114 + /* http://w3.org/TR/xmlschema-2/#positiveInteger */
7115 + case nsISchemaBuiltinType::BUILTIN_TYPE_POSITIVEINTEGER: {
7116 + // positiveInteger inherits from integer, with minInclusive
7117 + // being 1
7118 + ValidateBuiltinTypeInteger(aNodeValue, nsnull, EmptyString(),
7119 + EmptyString(), EmptyString(),
7120 + NS_LITERAL_STRING("1"), nsnull, &isValid);
7121 + break;
7124 + /* http://www.w3.org/TR/xmlschema-2/#long */
7125 + case nsISchemaBuiltinType::BUILTIN_TYPE_LONG: {
7126 + // maxInclusive is 9223372036854775807 and minInclusive is
7127 + // -9223372036854775808
7128 + ValidateBuiltinTypeInteger(aNodeValue, nsnull,
7129 + EmptyString(), EmptyString(),
7130 + NS_LITERAL_STRING("9223372036854775807"),
7131 + NS_LITERAL_STRING("-9223372036854775808"),
7132 + nsnull, &isValid);
7135 + /* http://www.w3.org/TR/xmlschema-2/#int */
7136 + case nsISchemaBuiltinType::BUILTIN_TYPE_INT: {
7137 + // maxInclusive is 2147483647 and minInclusive is -2147483648
7138 + ValidateBuiltinTypeInteger(aNodeValue, nsnull,
7139 + EmptyString(), EmptyString(),
7140 + NS_LITERAL_STRING("2147483647"),
7141 + NS_LITERAL_STRING("-2147483648"),
7142 + nsnull, &isValid);
7145 + /* http://www.w3.org/TR/xmlschema-2/#short */
7146 + case nsISchemaBuiltinType::BUILTIN_TYPE_SHORT: {
7147 + // maxInclusive is 32767 and minInclusive is -32768
7148 + ValidateBuiltinTypeInteger(aNodeValue, nsnull,
7149 + EmptyString(), EmptyString(),
7150 + NS_LITERAL_STRING("32767"),
7151 + NS_LITERAL_STRING("-32768"),
7152 + nsnull, &isValid);
7155 + /* http://www.w3.org/TR/xmlschema-2/#unsignedLong */
7156 + case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDLONG: {
7157 + // maxInclusive is 18446744073709551615. and minInclusive is 0
7158 + ValidateBuiltinTypeInteger(aNodeValue, nsnull,
7159 + EmptyString(), EmptyString(),
7160 + NS_LITERAL_STRING("18446744073709551615"),
7161 + NS_LITERAL_STRING("0"),
7162 + nsnull, &isValid);
7165 + /* http://www.w3.org/TR/xmlschema-2/#unsignedInt */
7166 + case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDINT: {
7167 + // maxInclusive is 4294967295. and minInclusive is 0
7168 + ValidateBuiltinTypeInteger(aNodeValue, nsnull,
7169 + EmptyString(), EmptyString(),
7170 + NS_LITERAL_STRING("4294967295"),
7171 + NS_LITERAL_STRING("0"),
7172 + nsnull, &isValid);
7175 + /* http://www.w3.org/TR/xmlschema-2/#unsignedShort */
7176 + case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDSHORT: {
7177 + // maxInclusive is 65535. and minInclusive is 0
7178 + ValidateBuiltinTypeInteger(aNodeValue, nsnull,
7179 + EmptyString(), EmptyString(),
7180 + NS_LITERAL_STRING("65535"),
7181 + NS_LITERAL_STRING("0"),
7182 + nsnull, &isValid);
7185 + /* http://www.w3.org/TR/xmlschema-2/#unsignedByte */
7186 + case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDBYTE: {
7187 + // maxInclusive is 255. and minInclusive is 0
7188 + ValidateBuiltinTypeInteger(aNodeValue, nsnull,
7189 + EmptyString(), EmptyString(),
7190 + NS_LITERAL_STRING("255"),
7191 + NS_LITERAL_STRING("0"),
7192 + nsnull, &isValid);
7195 case nsISchemaBuiltinType::BUILTIN_TYPE_BYTE: {
7196 isValid = IsValidSchemaByte(aNodeValue, nsnull);
7197 break;
7198 @@ -813,6 +1161,11 @@ nsSchemaValidator::ValidateBuiltinType(c
7199 break;
7202 + case nsISchemaBuiltinType::BUILTIN_TYPE_HEXBINARY: {
7203 + isValid = IsValidSchemaHexBinary(aNodeValue);
7204 + break;
7207 case nsISchemaBuiltinType::BUILTIN_TYPE_QNAME: {
7208 isValid = IsValidSchemaQName(aNodeValue);
7209 break;
7210 @@ -831,8 +1184,16 @@ nsSchemaValidator::ValidateBuiltinType(c
7211 nsresult
7212 nsSchemaValidator::ValidateListSimpletype(const nsAString & aNodeValue,
7213 nsISchemaSimpleType *aSchemaSimpleType,
7214 + nsSchemaDerivedSimpleType *aFacets,
7215 PRBool *aResult)
7217 + /* When a datatype is derived from an list datatype, the following facets apply:
7218 + * length, maxLength, minLength, enumeration, pattern, whitespace
7220 + * The length facets apply to the whole list, ie the number of items in the list.
7221 + * Patterns are applied to the whole list as well.
7222 + */
7224 PRBool isValid = PR_FALSE;
7226 nsresult rv;
7227 @@ -847,16 +1208,68 @@ nsSchemaValidator::ValidateListSimpletyp
7228 nsCStringArray stringArray;
7229 stringArray.ParseString(NS_ConvertUTF16toUTF8(aNodeValue).get(), " \t\r\n");
7231 - PRInt32 count = stringArray.Count();
7232 - nsAutoString tmp;
7233 + PRUint32 count = stringArray.Count();
7235 - for (PRInt32 i=0; i < count; ++i) {
7236 - CopyUTF8toUTF16(stringArray[i]->get(), tmp);
7237 - LOG((" Validating List Item (%d): %s", i, NS_ConvertUTF16toUTF8(tmp).get()));
7238 - rv = ValidateSimpletype(tmp, listSimpleType, &isValid);
7239 + // if facets have been provided, check them first
7240 + PRBool facetsValid = PR_TRUE;
7241 + if (aFacets) {
7242 + if (aFacets->length.isDefined) {
7243 + if (aFacets->length.value != count) {
7244 + facetsValid = PR_FALSE;
7245 + LOG((" Not valid: List is not the right length (%d)",
7246 + aFacets->length.value));
7250 + if (facetsValid && aFacets->maxLength.isDefined) {
7251 + if (aFacets->maxLength.value < count) {
7252 + facetsValid = PR_FALSE;
7253 + LOG((" Not valid: Length (%d) of the list is too large",
7254 + aFacets->maxLength.value));
7258 - if (!isValid)
7259 - break;
7260 + if (facetsValid && aFacets->minLength.isDefined) {
7261 + if (aFacets->minLength.value > count) {
7262 + facetsValid = PR_FALSE;
7263 + LOG((" Not valid: Length (%d) of the list is too small",
7264 + aFacets->minLength.value));
7268 + if (facetsValid && aFacets->pattern.isDefined) {
7269 + // check if the pattern matches
7270 + nsCOMPtr<nsISchemaValidatorRegexp> regexp = do_GetService(kREGEXP_CID);
7271 + rv = regexp->RunRegexp(aNodeValue, aFacets->pattern.value, "g",
7272 + &facetsValid);
7273 +#ifdef PR_LOGGING
7274 + LOG((" Checking Regular Expression"));
7275 + if (facetsValid) {
7276 + LOG((" -- pattern validates!"));
7277 + } else {
7278 + LOG((" -- pattern does not validate!"));
7280 +#endif
7283 + if (facetsValid && aFacets->enumerationList.Count() > 0) {
7284 + facetsValid =
7285 + nsSchemaValidatorUtils::HandleEnumeration(aNodeValue,
7286 + aFacets->enumerationList);
7290 + // either no facets passed in or facets validated fine
7291 + if (facetsValid) {
7292 + nsAutoString tmp;
7293 + for (PRUint32 i=0; i < count; ++i) {
7294 + CopyUTF8toUTF16(stringArray[i]->get(), tmp);
7295 + LOG((" Validating List Item (%d): %s", i, NS_ConvertUTF16toUTF8(tmp).get()));
7296 + rv = ValidateSimpletype(tmp, listSimpleType, &isValid);
7298 + if (!isValid)
7299 + break;
7304 @@ -873,7 +1286,8 @@ nsSchemaValidator::ValidateUnionSimplety
7305 PRBool isValid = PR_FALSE;
7307 nsresult rv;
7308 - nsCOMPtr<nsISchemaUnionType> unionType = do_QueryInterface(aSchemaSimpleType, &rv);
7309 + nsCOMPtr<nsISchemaUnionType> unionType = do_QueryInterface(aSchemaSimpleType,
7310 + &rv);
7311 NS_ENSURE_SUCCESS(rv, rv);
7313 nsCOMPtr<nsISchemaSimpleType> unionSimpleType;
7314 @@ -896,6 +1310,50 @@ nsSchemaValidator::ValidateUnionSimplety
7315 return rv;
7318 +nsresult
7319 +nsSchemaValidator::ValidateDerivedUnionSimpletype(const nsAString & aNodeValue,
7320 + nsSchemaDerivedSimpleType *aDerived,
7321 + PRBool *aResult)
7323 + // This method is called when a simple type is derived from a union type
7324 + // via restrictions. So we walk all the possible types, and pass in the
7325 + // loaded restriction facets so that they will override the ones defined
7326 + // my the union type. We actually have to create a custom
7327 + // nsSchemaDerivedSimpleType for each type, since we need to change the basetype
7328 + // and to avoid any new restrictions being added to aDerived.
7330 + PRBool isValid = PR_FALSE;
7332 + nsresult rv;
7333 + nsCOMPtr<nsISchemaUnionType> unionType = do_QueryInterface(aDerived->mBaseType,
7334 + &rv);
7335 + NS_ENSURE_SUCCESS(rv, rv);
7337 + nsCOMPtr<nsISchemaSimpleType> unionSimpleType;
7338 + PRUint32 count;
7339 + unionType->GetUnionTypeCount(&count);
7341 + // compare against the union simpletypes in order until a match is found
7342 + for (PRUint32 i=0; i < count; ++i) {
7343 + rv = unionType->GetUnionType(i, getter_AddRefs(unionSimpleType));
7344 + NS_ENSURE_SUCCESS(rv, rv);
7346 + nsSchemaDerivedSimpleType derivedType;
7347 + nsSchemaValidatorUtils::CopyDerivedSimpleType(&derivedType, aDerived);
7349 + derivedType.mBaseType = unionSimpleType;
7351 + LOG((" Validating Union Type #%d", i));
7352 + rv = ValidateDerivedSimpletype(aNodeValue, &derivedType, &isValid);
7354 + if (isValid)
7355 + break;
7358 + *aResult = isValid;
7359 + return rv;
7362 /* http://www.w3.org/TR/xmlschema-2/#string */
7363 nsresult
7364 nsSchemaValidator::ValidateBuiltinTypeString(const nsAString & aNodeValue,
7365 @@ -929,7 +1387,8 @@ nsSchemaValidator::ValidateBuiltinTypeSt
7368 if (isValid && aEnumerationList && (aEnumerationList->Count() > 0)) {
7369 - isValid = nsSchemaValidatorUtils::HandleEnumeration(aNodeValue, *aEnumerationList);
7370 + isValid = nsSchemaValidatorUtils::HandleEnumeration(aNodeValue,
7371 + *aEnumerationList);
7374 #ifdef PR_LOGGING
7375 @@ -2638,10 +3097,9 @@ PRBool
7376 nsSchemaValidator::IsValidSchemaAnyURI(const nsAString & aString)
7378 PRBool isValid = PR_FALSE;
7379 - nsresult rv;
7381 nsCOMPtr<nsIURI> uri;
7382 - rv = NS_NewURI(getter_AddRefs(uri), aString);
7383 + nsresult rv = NS_NewURI(getter_AddRefs(uri), aString);
7385 if (rv == NS_OK)
7386 isValid = PR_TRUE;
7387 @@ -2777,6 +3235,83 @@ nsSchemaValidator::IsValidSchemaQName(co
7388 return isValid;
7391 +// http://www.w3.org/TR/xmlschema-2/#hexBinary
7392 +nsresult
7393 +nsSchemaValidator::ValidateBuiltinTypeHexBinary(const nsAString & aNodeValue,
7394 + PRUint32 aLength,
7395 + PRBool aLengthDefined,
7396 + PRUint32 aMinLength,
7397 + PRBool aMinLengthDefined,
7398 + PRUint32 aMaxLength,
7399 + PRBool aMaxLengthDefined,
7400 + nsStringArray *aEnumerationList,
7401 + PRBool *aResult)
7403 + PRBool isValid = PR_FALSE;
7405 + isValid = IsValidSchemaHexBinary(aNodeValue);
7407 + if (isValid) {
7408 + // For hexBinary, length is measured in octets (8 bits) of binary data. So
7409 + // one byte of binary data is represented by two hex digits, so we
7410 + // divide by 2 to get the binary data length.
7412 + PRUint32 binaryDataLength = aNodeValue.Length() / 2;
7414 + if (aLengthDefined && (binaryDataLength != aLength)) {
7415 + isValid = PR_FALSE;
7416 + LOG((" Not valid: Not the right length (%d)", binaryDataLength));
7419 + if (isValid && aMinLengthDefined && (binaryDataLength < aMinLength)) {
7420 + isValid = PR_FALSE;
7421 + LOG((" Not valid: Length (%d) is too small", binaryDataLength));
7424 + if (isValid && aMaxLengthDefined && (binaryDataLength > aMaxLength)) {
7425 + isValid = PR_FALSE;
7426 + LOG((" Not valid: Length (%d) is too large", binaryDataLength));
7429 + if (isValid && aEnumerationList && (aEnumerationList->Count() > 0)) {
7430 + isValid = nsSchemaValidatorUtils::HandleEnumeration(aNodeValue, *aEnumerationList);
7434 + LOG((isValid ? (" Value is valid!") : (" Value is not valid!")));
7436 + *aResult = isValid;
7437 + return NS_OK;
7440 +PRBool
7441 +nsSchemaValidator::IsValidSchemaHexBinary(const nsAString & aString)
7443 + // hex binary length has to be even
7444 + PRUint32 length = aString.Length();
7446 + if (length % 2 != 0)
7447 + return PR_FALSE;
7449 + nsAString::const_iterator start, end;
7450 + aString.BeginReading(start);
7451 + aString.EndReading(end);
7453 + PRBool isValid = PR_TRUE;
7455 + // each character has to be in [0-9a-fA-F]
7456 + while (start != end) {
7457 + PRUnichar temp = *start++;
7459 + if (!isxdigit(temp)) {
7460 + isValid = PR_FALSE;
7461 + break;
7465 + return isValid;
7468 #ifdef DEBUG
7469 void
7470 nsSchemaValidator::DumpBaseType(nsISchemaBuiltinType *aBuiltInType)
7471 diff -uprN --exclude=CVS mozilla/extensions/schema-validation/src/nsSchemaValidator.h mozilla.new/extensions/schema-validation/src/nsSchemaValidator.h
7472 --- mozilla/extensions/schema-validation/src/nsSchemaValidator.h 2005-06-24 17:38:12.000000000 +0200
7473 +++ mozilla.new/extensions/schema-validation/src/nsSchemaValidator.h 2006-03-03 07:12:23.000000000 +0100
7474 @@ -48,7 +48,7 @@
7475 /* eced2af3-fde9-4575-b5a4-e1c830b24611 */
7476 #define NS_SCHEMAVALIDATOR_CID \
7477 { 0xeced2af3, 0xfde9, 0x4575, \
7478 - {0xb5, 0xa4, 0xe1, 0xc8, 0x30, 0xb2, 0x46, 0x11}}
7479 + {0xb5, 0xa4, 0xe1, 0xc8, 0x30, 0xb2, 0x46, 0x11}}
7481 #define NS_SCHEMAVALIDATOR_CONTRACTID "@mozilla.org/schemavalidator;1"
7483 @@ -72,10 +72,16 @@ private:
7484 nsresult ValidateSimpletype(const nsAString & aNodeValue,
7485 nsISchemaSimpleType *aSchemaSimpleType,
7486 PRBool *aResult);
7487 + nsresult ValidateDerivedSimpletype(const nsAString & aNodeValue,
7488 + nsSchemaDerivedSimpleType *aDerived,
7489 + PRBool *aResult);
7491 nsresult ValidateRestrictionSimpletype(const nsAString & aNodeValue,
7492 nsISchemaSimpleType *aSchemaSimpleType,
7493 PRBool *aResult);
7494 + nsresult ValidateDerivedBuiltinType(const nsAString & aNodeValue,
7495 + nsSchemaDerivedSimpleType *aDerived,
7496 + PRBool *aResult);
7498 nsresult ValidateBuiltinType(const nsAString & aNodeValue,
7499 nsISchemaSimpleType *aSchemaSimpleType,
7500 @@ -83,11 +89,15 @@ private:
7502 nsresult ValidateListSimpletype(const nsAString & aNodeValue,
7503 nsISchemaSimpleType *aSchemaSimpleType,
7504 + nsSchemaDerivedSimpleType *aDerived,
7505 PRBool *aResult);
7507 nsresult ValidateUnionSimpletype(const nsAString & aNodeValue,
7508 nsISchemaSimpleType *aSchemaSimpleType,
7509 PRBool *aResult);
7510 + nsresult ValidateDerivedUnionSimpletype(const nsAString & aNodeValue,
7511 + nsSchemaDerivedSimpleType *aDerived,
7512 + PRBool *aResult);
7514 // methods dealing with validation of built-in types
7515 nsresult ValidateBuiltinTypeString(const nsAString & aNodeValue,
7516 @@ -238,6 +248,19 @@ private:
7517 PRBool *aResult);
7518 PRBool IsValidSchemaBase64Binary(const nsAString & aString, char** aDecodedString);
7521 + nsresult ValidateBuiltinTypeHexBinary(const nsAString & aNodeValue,
7522 + PRUint32 aLength,
7523 + PRBool aLengthDefined,
7524 + PRUint32 aMinLength,
7525 + PRBool aMinLengthDefined,
7526 + PRUint32 aMaxLength,
7527 + PRBool aMaxLengthDefined,
7528 + nsStringArray *aEnumerationList,
7529 + PRBool *aResult);
7530 + PRBool IsValidSchemaHexBinary(const nsAString & aString);
7533 nsresult ValidateBuiltinTypeQName(const nsAString & aNodeValue,
7534 PRUint32 aLength,
7535 PRBool aLengthDefined,
7536 @@ -249,7 +272,6 @@ private:
7537 PRBool *aResult);
7538 PRBool IsValidSchemaQName(const nsAString & aString);
7541 // helper methods
7542 void DumpBaseType(nsISchemaBuiltinType *aBuiltInType);
7544 diff -uprN --exclude=CVS mozilla/extensions/schema-validation/src/nsSchemaValidatorUtils.cpp mozilla.new/extensions/schema-validation/src/nsSchemaValidatorUtils.cpp
7545 --- mozilla/extensions/schema-validation/src/nsSchemaValidatorUtils.cpp 2005-10-14 21:47:41.000000000 +0200
7546 +++ mozilla.new/extensions/schema-validation/src/nsSchemaValidatorUtils.cpp 2006-03-03 07:12:24.000000000 +0100
7547 @@ -87,8 +87,7 @@ nsSchemaValidatorUtils::IsValidSchemaInt
7548 if (aResult)
7549 *aResult = intValue;
7551 - return (!((intValue == LONG_MAX || intValue == LONG_MIN) && errno == ERANGE))
7552 - && *pEnd == '\0';
7553 + return (*pEnd == '\0');
7556 PRBool
7557 @@ -307,7 +306,7 @@ nsSchemaValidatorUtils::ParseSchemaDate(
7558 fullDate.AppendLiteral("-");
7559 fullDate.Append(year);
7561 - LOG(("\n Parsed date is %s", NS_ConvertUTF16toUTF8(fullDate).get()));
7562 + LOG((" Parsed date is %s", NS_ConvertUTF16toUTF8(fullDate).get()));
7564 PRStatus status = PR_ParseTimeString(NS_ConvertUTF16toUTF8(fullDate).get(),
7565 PR_TRUE, &dateTime);
7566 @@ -334,7 +333,7 @@ nsSchemaValidatorUtils::ParseSchemaDate(
7570 - LOG(("\n Date is %s \n", ((isValid) ? "Valid" : "Not Valid")));
7571 + LOG((" Date is %s", ((isValid) ? "Valid" : "Not Valid")));
7573 return isValid;
7575 @@ -1177,6 +1176,7 @@ nsSchemaValidatorUtils::CompareDurations
7576 PRTime foo;
7577 PRExplodedTime explodedTime, newTime1, newTime2;
7579 + // XXX: nspr doesn't handle pre-1900 dates and will return an error!
7580 char* datetimeArray[] = { "1696-09-01T00:00:00Z", "1697-02-01T00:00:00Z",
7581 "1903-03-01T00:00:00Z", "1903-07-01T00:00:00Z" };
7582 PRBool indeterminate = PR_FALSE;
7583 @@ -1294,6 +1294,56 @@ nsSchemaValidatorUtils::AddDurationToDat
7584 return resultDatetime;
7587 +// http://www.w3.org/TR/xmlschema-2/#normalizedString
7588 +PRBool
7589 +nsSchemaValidatorUtils::IsValidSchemaNormalizedString(const nsAString &aStrValue)
7591 + PRBool isValid = PR_FALSE;
7592 + nsAutoString string(aStrValue);
7594 + // may not contain carriage return, line feed nor tab characters
7595 + if (string.FindCharInSet("\t\r\n") == kNotFound)
7596 + isValid = PR_TRUE;
7598 + return isValid;
7601 +// http://www.w3.org/TR/xmlschema-2/#token
7602 +PRBool
7603 +nsSchemaValidatorUtils::IsValidSchemaToken(const nsAString &aStrValue)
7605 + PRBool isValid = PR_FALSE;
7606 + nsAutoString string(aStrValue);
7608 + // may not contain carriage return, line feed, tab characters. Also can
7609 + // not contain leading/trailing whitespace and no internal sequences of
7610 + // two or more spaces.
7611 + if ((string.FindCharInSet("\t\r\n") == kNotFound) &&
7612 + (string.Find(NS_LITERAL_STRING(" ")) == kNotFound) &&
7613 + (string.First() != ' ') &&
7614 + (string.Last() != ' '))
7615 + isValid = PR_TRUE;
7617 + return isValid;
7620 +// http://www.w3.org/TR/xmlschema-2/#language
7621 +PRBool
7622 +nsSchemaValidatorUtils::IsValidSchemaLanguage(const nsAString &aStrValue)
7624 + PRBool isValid = PR_FALSE;
7626 + // pattern is defined in spec
7627 + nsAutoString pattern;
7628 + pattern.AssignLiteral("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*");
7630 + nsCOMPtr<nsISchemaValidatorRegexp> regexp = do_GetService(kREGEXP_CID);
7631 + nsresult rv = regexp->RunRegexp(aStrValue, pattern, "g", &isValid);
7632 + NS_ENSURE_SUCCESS(rv, rv);
7634 + return isValid;
7637 PRBool
7638 nsSchemaValidatorUtils::HandleEnumeration(const nsAString &aStrValue,
7639 const nsStringArray &aEnumerationList)
7640 @@ -1305,6 +1355,7 @@ nsSchemaValidatorUtils::HandleEnumeratio
7641 for (PRInt32 i = 0; i < count; ++i) {
7642 if (aEnumerationList[i]->Equals(aStrValue)) {
7643 isValid = PR_TRUE;
7644 + LOG((" Valid: Value matched enumeration #%d", i));
7645 break;
7648 @@ -1378,3 +1429,249 @@ nsSchemaValidatorUtils::RemoveTrailingZe
7649 aString.Cut(length - count, count);
7652 +// Walks the inheritance tree until it finds a type that isn't a restriction
7653 +// type. While it finds restriction types, it collects restriction facets and
7654 +// places them into the nsSchemaDerivedSimpleType. Once a facet has been found,
7655 +// it makes sure that it won't be overwritten by the same facet defined in one
7656 +// of the inherited types.
7657 +nsresult
7658 +nsSchemaValidatorUtils::GetDerivedSimpleType(nsISchemaSimpleType *aSimpleType,
7659 + nsSchemaDerivedSimpleType *aDerived)
7661 + PRBool done = PR_FALSE, hasEnumerations = PR_FALSE;
7662 + nsCOMPtr<nsISchemaSimpleType> simpleType(aSimpleType);
7663 + PRUint16 simpleTypeValue;
7664 + PRUint32 facetCount;
7666 + nsAutoString enumeration;
7667 + nsresult rv = NS_OK;
7669 + while(simpleType && !done) {
7670 + // get the type of the simpletype
7671 + rv = simpleType->GetSimpleType(&simpleTypeValue);
7672 + NS_ENSURE_SUCCESS(rv, rv);
7674 + switch (simpleTypeValue) {
7675 + case nsISchemaSimpleType::SIMPLE_TYPE_RESTRICTION: {
7676 + // handle the facets
7678 + nsCOMPtr<nsISchemaRestrictionType> restrictionType =
7679 + do_QueryInterface(simpleType);
7681 + nsCOMPtr<nsISchemaFacet> facet;
7682 + PRUint32 facetCounter;
7683 + PRUint16 facetType;
7685 + // get the amount of restriction facet defined.
7686 + rv = restrictionType->GetFacetCount(&facetCount);
7687 + NS_ENSURE_SUCCESS(rv, rv);
7688 + LOG((" %d facet(s) defined.", facetCount));
7690 + // if we had enumerations, we may not add new ones, since we are
7691 + // being restricted. So if x restricts y, x defines the possible
7692 + // enumerations and any enumerations on y are skipped
7693 + hasEnumerations = (aDerived->enumerationList.Count() > 0);
7695 + for (facetCounter = 0; facetCounter < facetCount; ++facetCounter) {
7696 + rv = restrictionType->GetFacet(facetCounter, getter_AddRefs(facet));
7697 + NS_ENSURE_SUCCESS(rv, rv);
7698 + facet->GetFacetType(&facetType);
7700 + switch (facetType) {
7701 + case nsISchemaFacet::FACET_TYPE_LENGTH: {
7702 + nsSchemaIntFacet *length = &aDerived->length;
7703 + if (!length->isDefined) {
7704 + length->isDefined = PR_TRUE;
7705 + facet->GetLengthValue(&length->value);
7706 + LOG((" - Length Facet found (value is %d)",
7707 + length->value));
7709 + break;
7712 + case nsISchemaFacet::FACET_TYPE_MINLENGTH: {
7713 + nsSchemaIntFacet *minLength = &aDerived->minLength;
7714 + if (!minLength->isDefined) {
7715 + minLength->isDefined = PR_TRUE;
7716 + facet->GetLengthValue(&minLength->value);
7717 + LOG((" - Min Length Facet found (value is %d)",
7718 + minLength->value));
7720 + break;
7723 + case nsISchemaFacet::FACET_TYPE_MAXLENGTH: {
7724 + nsSchemaIntFacet *maxLength = &aDerived->maxLength;
7725 + if (!maxLength->isDefined) {
7726 + maxLength->isDefined = PR_TRUE;
7727 + facet->GetLengthValue(&maxLength->value);
7728 + LOG((" - Max Length Facet found (value is %d)",
7729 + maxLength->value));
7731 + break;
7734 + case nsISchemaFacet::FACET_TYPE_PATTERN: {
7735 + nsSchemaStringFacet *pattern = &aDerived->pattern;
7736 + if (!pattern->isDefined) {
7737 + pattern->isDefined = PR_TRUE;
7738 + facet->GetValue(pattern->value);
7739 + LOG((" - Pattern Facet found (value is %s)",
7740 + NS_ConvertUTF16toUTF8(pattern->value).get()));
7742 + break;
7745 + case nsISchemaFacet::FACET_TYPE_ENUMERATION: {
7746 + if (!hasEnumerations) {
7747 + facet->GetValue(enumeration);
7748 + aDerived->enumerationList.AppendString(enumeration);
7749 + LOG((" - Enumeration found (%s)",
7750 + NS_ConvertUTF16toUTF8(enumeration).get()));
7752 + break;
7755 + case nsISchemaFacet::FACET_TYPE_WHITESPACE: {
7756 + if (!aDerived->isWhitespaceDefined)
7757 + facet->GetWhitespaceValue(&aDerived->whitespace);
7758 + break;
7761 + case nsISchemaFacet::FACET_TYPE_MAXINCLUSIVE: {
7762 + nsSchemaStringFacet *maxInclusive = &aDerived->maxInclusive;
7763 + if (!maxInclusive->isDefined) {
7764 + maxInclusive->isDefined = PR_TRUE;
7765 + facet->GetValue(maxInclusive->value);
7766 + LOG((" - Max Inclusive Facet found (value is %s)",
7767 + NS_ConvertUTF16toUTF8(maxInclusive->value).get()));
7769 + break;
7772 + case nsISchemaFacet::FACET_TYPE_MININCLUSIVE: {
7773 + nsSchemaStringFacet *minInclusive = &aDerived->minInclusive;
7774 + if (!minInclusive->isDefined) {
7775 + minInclusive->isDefined = PR_TRUE;
7776 + facet->GetValue(minInclusive->value);
7777 + LOG((" - Min Inclusive Facet found (value is %s)",
7778 + NS_ConvertUTF16toUTF8(minInclusive->value).get()));
7780 + break;
7783 + case nsISchemaFacet::FACET_TYPE_MAXEXCLUSIVE: {
7784 + nsSchemaStringFacet *maxExclusive = &aDerived->maxExclusive;
7785 + if (!maxExclusive->isDefined) {
7786 + maxExclusive->isDefined = PR_TRUE;
7787 + facet->GetValue(aDerived->maxExclusive.value);
7788 + LOG((" - Max Exclusive Facet found (value is %s)",
7789 + NS_ConvertUTF16toUTF8(maxExclusive->value).get()));
7791 + break;
7794 + case nsISchemaFacet::FACET_TYPE_MINEXCLUSIVE: {
7795 + nsSchemaStringFacet *minExclusive = &aDerived->minExclusive;
7796 + if (!minExclusive->isDefined) {
7797 + minExclusive->isDefined = PR_TRUE;
7798 + facet->GetValue(minExclusive->value);
7799 + LOG((" - Min Exclusive Facet found (value is %s)",
7800 + NS_ConvertUTF16toUTF8(minExclusive->value).get()));
7802 + break;
7805 + case nsISchemaFacet::FACET_TYPE_TOTALDIGITS: {
7806 + nsSchemaIntFacet *totalDigits = &aDerived->totalDigits;
7807 + if (!totalDigits->isDefined) {
7808 + totalDigits->isDefined = PR_TRUE;
7809 + facet->GetDigitsValue(&totalDigits->value);
7810 + LOG((" - Totaldigits Facet found (value is %d)",
7811 + totalDigits->value));
7813 + break;
7816 + case nsISchemaFacet::FACET_TYPE_FRACTIONDIGITS: {
7817 + nsSchemaIntFacet *fractionDigits = &aDerived->fractionDigits;
7818 + if (!fractionDigits->isDefined) {
7819 + fractionDigits->isDefined = PR_TRUE;
7820 + facet->GetDigitsValue(&fractionDigits->value);
7821 + LOG((" - FractionDigits Facet found (value is %d)",
7822 + fractionDigits->value));
7824 + break;
7829 + // get base type
7830 + nsresult rv = restrictionType->GetBaseType(getter_AddRefs(simpleType));
7831 + NS_ENSURE_SUCCESS(rv, rv);
7832 + break;
7835 + case nsISchemaSimpleType::SIMPLE_TYPE_BUILTIN: {
7836 + // we are done
7837 + aDerived->mBaseType = simpleType;
7838 + done = PR_TRUE;
7839 + break;
7842 + case nsISchemaSimpleType::SIMPLE_TYPE_LIST: {
7843 + // set as base type
7844 + aDerived->mBaseType = simpleType;
7845 + done = PR_TRUE;
7846 + break;
7849 + case nsISchemaSimpleType::SIMPLE_TYPE_UNION: {
7850 + // set as base type
7851 + aDerived->mBaseType = simpleType;
7852 + done = PR_TRUE;
7853 + break;
7858 + return rv;
7861 +// copies the data from aDerivedSrc to aDerivedDest
7862 +void
7863 +nsSchemaValidatorUtils::CopyDerivedSimpleType(nsSchemaDerivedSimpleType *aDerivedDest,
7864 + nsSchemaDerivedSimpleType *aDerivedSrc)
7866 + aDerivedDest->mBaseType = aDerivedSrc->mBaseType;
7868 + aDerivedDest->length.value = aDerivedSrc->length.value;
7869 + aDerivedDest->length.isDefined = aDerivedSrc->length.isDefined;
7870 + aDerivedDest->minLength.value = aDerivedSrc->minLength.value;
7871 + aDerivedDest->minLength.isDefined = aDerivedSrc->minLength.isDefined;
7872 + aDerivedDest->maxLength.value = aDerivedSrc->maxLength.value;
7873 + aDerivedDest->maxLength.isDefined = aDerivedSrc->maxLength.isDefined;
7875 + aDerivedDest->pattern.value = aDerivedSrc->pattern.value;
7876 + aDerivedDest->pattern.isDefined = aDerivedSrc->pattern.isDefined;
7878 + aDerivedDest->isWhitespaceDefined = aDerivedSrc->isWhitespaceDefined;
7879 + aDerivedDest->whitespace = aDerivedSrc->whitespace;
7881 + aDerivedDest->maxInclusive.value = aDerivedSrc->maxInclusive.value;
7882 + aDerivedDest->maxInclusive.isDefined = aDerivedSrc->maxInclusive.isDefined;
7883 + aDerivedDest->minInclusive.value = aDerivedSrc->minInclusive.value;
7884 + aDerivedDest->minInclusive.isDefined = aDerivedSrc->minInclusive.isDefined;
7885 + aDerivedDest->maxExclusive.value = aDerivedSrc->maxExclusive.value;
7886 + aDerivedDest->maxExclusive.isDefined = aDerivedSrc->maxExclusive.isDefined;
7887 + aDerivedDest->minExclusive.value = aDerivedSrc->minExclusive.value;
7888 + aDerivedDest->minExclusive.isDefined = aDerivedSrc->minExclusive.isDefined;
7890 + aDerivedDest->totalDigits.value = aDerivedSrc->totalDigits.value;
7891 + aDerivedDest->totalDigits.isDefined = aDerivedSrc->totalDigits.isDefined;
7892 + aDerivedDest->fractionDigits.value = aDerivedSrc->fractionDigits.value;
7893 + aDerivedDest->fractionDigits.isDefined = aDerivedSrc->fractionDigits.isDefined;
7895 + aDerivedDest->enumerationList = aDerivedSrc->enumerationList;
7898 diff -uprN --exclude=CVS mozilla/extensions/schema-validation/src/nsSchemaValidatorUtils.h mozilla.new/extensions/schema-validation/src/nsSchemaValidatorUtils.h
7899 --- mozilla/extensions/schema-validation/src/nsSchemaValidatorUtils.h 2005-07-26 21:57:17.000000000 +0200
7900 +++ mozilla.new/extensions/schema-validation/src/nsSchemaValidatorUtils.h 2006-03-03 07:12:24.000000000 +0100
7901 @@ -40,8 +40,13 @@
7902 #define __nsSchemaValidatorUtils_h__
7904 #include "nsCOMPtr.h"
7905 -#include "nsISchemaDuration.h"
7906 +#include "nsString.h"
7907 +#include "nsISchema.h"
7908 #include "nsCOMArray.h"
7909 +#include "nsIServiceManager.h"
7910 +#include "nsIComponentManager.h"
7911 +#include "nsISchemaDuration.h"
7912 +#include "nsISchemaValidatorRegexp.h"
7914 struct nsSchemaGDay {
7915 PRUint32 day; // day represented (1-31)
7916 @@ -94,12 +99,61 @@ const nsMonthShortHand monthShortHand[]
7917 { "12", "Dec" }
7920 +#define kREGEXP_CID "@mozilla.org/xmlextras/schemas/schemavalidatorregexp;1"
7922 +class nsSchemaStringFacet
7924 +public:
7925 + PRBool isDefined;
7926 + nsString value;
7927 + nsSchemaStringFacet() {
7928 + isDefined = PR_FALSE;
7932 +class nsSchemaIntFacet
7934 +public:
7935 + PRBool isDefined;
7936 + PRUint32 value;
7937 + nsSchemaIntFacet() {
7938 + isDefined = PR_FALSE;
7939 + value = 0;
7943 +struct nsSchemaDerivedSimpleType {
7944 + nsISchemaSimpleType* mBaseType;
7946 + nsSchemaIntFacet length;
7947 + nsSchemaIntFacet minLength;
7948 + nsSchemaIntFacet maxLength;
7950 + nsSchemaStringFacet pattern;
7952 + PRBool isWhitespaceDefined;
7953 + unsigned short whitespace;
7955 + nsSchemaStringFacet maxInclusive;
7956 + nsSchemaStringFacet minInclusive;
7957 + nsSchemaStringFacet maxExclusive;
7958 + nsSchemaStringFacet minExclusive;
7960 + nsSchemaIntFacet totalDigits;
7961 + nsSchemaIntFacet fractionDigits;
7963 + nsStringArray enumerationList;
7966 class nsSchemaValidatorUtils
7968 public:
7969 static PRBool IsValidSchemaInteger(const nsAString & aNodeValue, long *aResult);
7970 static PRBool IsValidSchemaInteger(const char* aString, long *aResult);
7972 + static PRBool IsValidSchemaDouble(const nsAString & aNodeValue, double *aResult);
7973 + static PRBool IsValidSchemaDouble(const char* aString, double *aResult);
7975 static PRBool ParseSchemaDate(const nsAString & aStrValue, char *rv_year,
7976 char *rv_month, char *rv_day);
7977 static PRBool ParseSchemaTime(const nsAString & aStrValue, char *rv_hour,
7978 @@ -136,19 +190,24 @@ public:
7979 static PRExplodedTime AddDurationToDatetime(PRExplodedTime aDatetime,
7980 nsISchemaDuration *aDuration);
7982 + static PRBool IsValidSchemaNormalizedString(const nsAString & aStrValue);
7983 + static PRBool IsValidSchemaToken(const nsAString & aStrValue);
7984 + static PRBool IsValidSchemaLanguage(const nsAString & aStrValue);
7986 static PRBool HandleEnumeration(const nsAString &aStrValue,
7987 const nsStringArray &aEnumerationList);
7989 static void RemoveLeadingZeros(nsAString & aString);
7990 static void RemoveTrailingZeros(nsAString & aString);
7992 + static nsresult GetDerivedSimpleType(nsISchemaSimpleType *aSimpleType,
7993 + nsSchemaDerivedSimpleType *aDerived);
7994 + static void CopyDerivedSimpleType(nsSchemaDerivedSimpleType *aDerivedDest,
7995 + nsSchemaDerivedSimpleType *aDerivedSrc);
7996 private:
7997 nsSchemaValidatorUtils();
7998 ~nsSchemaValidatorUtils();
8000 - static PRBool IsValidSchemaDouble(const nsAString & aNodeValue, double *aResult);
8001 - static PRBool IsValidSchemaDouble(const char* aString, double *aResult);
8003 protected:
8006 diff -uprN --exclude=CVS mozilla/extensions/schema-validation/tests/schema.html mozilla.new/extensions/schema-validation/tests/schema.html
8007 --- mozilla/extensions/schema-validation/tests/schema.html 2005-06-24 17:38:12.000000000 +0200
8008 +++ mozilla.new/extensions/schema-validation/tests/schema.html 2006-03-03 07:12:24.000000000 +0100
8009 @@ -125,7 +125,7 @@
8010 .getService(Components.interfaces.nsISchemaLoader);
8011 try {
8012 schema = schemaLoader.load("file:///home/doron/mozbuilds/trunk/mozilla/extensions/schema-validation/tests/schema.xsd");
8013 - myValidator.loadSchema(schema);
8014 + myValidator.loadSchema(schema);
8015 } catch(e){alert(e)}
8017 //schema collection
8018 @@ -138,17 +138,6 @@
8020 start = new Date();
8023 - validate("true false 0 1", "list-test-1", true);
8024 - validate("true false e 1", "list-test-1", false);
8026 - validate("100 33 4", "list-test-2", true);
8027 - validate("100 333 4", "list-test-2", false);
8029 - validate("50", "union-test-1", true);
8030 - validate("N/A", "union-test-1", true);
8031 - validate("#REF!", "union-test-1", false);*/
8033 if (1) {
8034 validate("220", "integer-test-1", false);
8035 validate("2", "integer-test-1", false);
8036 @@ -207,6 +196,7 @@
8037 validate("220.343434", "decimal-test-1", true);
8038 validate("220.3434a34", "decimal-test-1", false);
8039 validate("220.343.34", "decimal-test-1", false);
8040 + validate("0.2", "decimal-test-1", true);
8042 validate("220.343435", "decimal-test-2", false);
8043 validate("220.3434342", "decimal-test-2", true);
8044 @@ -230,6 +220,47 @@
8045 validate("1002.32", "decimal-test-4", false);
8046 validate("100.322", "decimal-test-4", false);
8048 + validate("220", "long-test-1", true);
8049 + validate("-220", "long-test-1", true);
8050 + validate("9223372036854775807", "long-test-1", true);
8051 + validate("-9223372036854775808", "long-test-1", true);
8052 + validate("-9223372036854775809", "long-test-1", false);
8053 + validate("9223372036854775808", "long-test-1", false);
8055 + validate("220", "int-test-1", true);
8056 + validate("-220", "int-test-1", true);
8057 + validate("2147483647", "int-test-1", true);
8058 + validate("-2147483648", "int-test-1", true);
8059 + validate("2147483648", "int-test-1", false);
8060 + validate("-2147483649", "int-test-1", false);
8062 + validate("220", "short-test-1", true);
8063 + validate("-220", "short-test-1", true);
8064 + validate("32767", "short-test-1", true);
8065 + validate("-32768", "short-test-1", true);
8066 + validate("32768", "short-test-1", false);
8067 + validate("-32769", "short-test-1", false);
8069 + validate("220", "unsignedLong-test-1", true);
8070 + validate("-220", "unsignedLong-test-1", false);
8071 + validate("18446744073709551615", "unsignedLong-test-1", true);
8072 + validate("18446744073709551616", "unsignedLong-test-1", false);
8074 + validate("220", "unsignedInt-test-1", true);
8075 + validate("-220", "unsignedInt-test-1", false);
8076 + validate("4294967295", "unsignedInt-test-1", true);
8077 + validate("4294967296", "unsignedInt-test-1", false);
8079 + validate("220", "unsignedShort-test-1", true);
8080 + validate("-220", "unsignedShort-test-1", false);
8081 + validate("65535", "unsignedShort-test-1", true);
8082 + validate("65536", "unsignedShort-test-1", false);
8084 + validate("220", "unsignedByte-test-1", true);
8085 + validate("-220", "unsignedByte-test-1", false);
8086 + validate("255", "unsignedByte-test-1", true);
8087 + validate("256", "unsignedByte-test-1", false);
8089 validate("bla", "string-test-1", false);
8090 validate("blaadadad", "string-test-1", false);
8091 validate("bla22", "string-test-1", true);
8092 @@ -256,7 +287,7 @@
8093 validate("---30", "gday-test-1", true);
8094 validate("---30Z", "gday-test-1", true);
8095 validate("---3", "gday-test-1", false);
8096 - validate("----3", "gday-test-1", false);
8097 + validate("----3", "gday-test-1", false);
8099 validate("---03", "gday-test-2", false);
8100 validate("---14", "gday-test-2", true);
8101 @@ -272,28 +303,28 @@
8102 validate("---05", "gday-test-3", true);
8103 validate("---21", "gday-test-3", true);
8105 - validate("--01--", "gmonth-test-1", true);
8106 - validate("--05--Z", "gmonth-test-1", true);
8107 - validate("--05---03:43", "gmonth-test-1", true);
8108 - validate("--05--a03:43", "gmonth-test-1", false);
8109 - validate("--12--", "gmonth-test-1", true);
8110 - validate("--32--", "gmonth-test-1", false);
8111 - validate("---2--", "gmonth-test-1", false);
8112 - validate("--543--", "gmonth-test-1", false);
8114 - validate("--01--", "gmonth-test-2", false);
8115 - validate("--05--", "gmonth-test-2", false);
8116 - validate("--06--", "gmonth-test-2", true);
8117 - validate("--10--", "gmonth-test-2", true);
8118 - validate("--11--", "gmonth-test-2", false);
8119 - validate("--12--", "gmonth-test-2", false);
8121 - validate("--01--", "gmonth-test-3", false);
8122 - validate("--05--", "gmonth-test-3", true);
8123 - validate("--06--", "gmonth-test-3", true);
8124 - validate("--10--", "gmonth-test-3", true);
8125 - validate("--11--", "gmonth-test-3", true);
8126 - validate("--12--", "gmonth-test-3", false);
8127 + validate("--01", "gmonth-test-1", true);
8128 + validate("--05Z", "gmonth-test-1", true);
8129 + validate("--05-03:43", "gmonth-test-1", true);
8130 + validate("--05a03:43", "gmonth-test-1", false);
8131 + validate("--12", "gmonth-test-1", true);
8132 + validate("--32", "gmonth-test-1", false);
8133 + validate("---2", "gmonth-test-1", false);
8134 + validate("--543", "gmonth-test-1", false);
8136 + validate("--01", "gmonth-test-2", false);
8137 + validate("--05", "gmonth-test-2", false);
8138 + validate("--06", "gmonth-test-2", true);
8139 + validate("--10", "gmonth-test-2", true);
8140 + validate("--11", "gmonth-test-2", false);
8141 + validate("--12", "gmonth-test-2", false);
8143 + validate("--01", "gmonth-test-3", false);
8144 + validate("--05", "gmonth-test-3", true);
8145 + validate("--06", "gmonth-test-3", true);
8146 + validate("--10", "gmonth-test-3", true);
8147 + validate("--11", "gmonth-test-3", true);
8148 + validate("--12", "gmonth-test-3", false);
8150 validate("1989", "gyear-test-1", true);
8151 validate("1234-13:43", "gyear-test-1", true);
8152 @@ -440,16 +471,21 @@
8154 validate("VGhpcyBpcyBhIHRlc3Q=", "base64-test-1", true);
8155 validate(" VGhpcyBpcyBhIHRlQ= ", "base64-test-1", false);
8158 validate("VGhpcyBpcyBhIHRlc3Q=", "base64-test-2", true);
8159 validate("VGhpcyBpcyBhIHRlc3Qh", "base64-test-2", false);
8162 validate("VGhpcyBpcyBhIHRlc3Q=", "base64-test-3", true);
8163 validate("VGhpcyBpcyBhIHRlc3Qh", "base64-test-3", false);
8164 validate("aGk=", "base64-test-3", false);
8165 validate("aGkh", "base64-test-3", true);
8166 validate("aGkgdGhlcmUh", "base64-test-3", true);
8168 + validate("0FB7", "hexbinary-test-1", true);
8169 + validate("0FB72", "hexbinary-test-1", false);
8170 + validate("023-", "hexbinary-test-1", false);
8171 + validate("0HB7", "hexbinary-test-1", false);
8173 validate("58758", "better-us-zipcode", true);
8174 validate("a758", "better-us-zipcode", false);
8176 @@ -482,11 +518,83 @@
8177 validate("P32D", "duration-test-3", true);
8178 validate("P27D", "duration-test-3", false);
8181 validate("test:foo", "qname-test-1", true);
8182 validate(":fooasdad", "qname-test-1", false);
8183 validate("n:s", "qname-test-1", true);
8184 validate("test:123456789", "qname-test-1", false);
8186 + validate("2004-02-28T24:21:03Z", "datetime-test-1", true);
8187 + validate("2004-02-28T25:21:03Z", "datetime-test-1", false);
8188 + validate("2004-02-28T22:61:03Z", "datetime-test-1", false);
8189 + validate("-2004-02-28T12:21:03.434Z", "datetime-test-1", true);
8190 + validate("-2004-02-28T12:21:03-04:00", "datetime-test-1", true);
8191 + validate("-2004-02-30T12:21:03Z", "datetime-test-1", false);
8193 + validate("2004-02-11T12:21:03Z", "datetime-test-2", true);
8194 + validate("2004-02-18T00:00:00Z", "datetime-test-2", true);
8195 + validate("2004-02-18T12:21:03Z", "datetime-test-2", false);
8196 + validate("2004-02-30T12:21:03Z", "datetime-test-2", false);
8197 + validate("2002-06-29T12:21:03Z", "datetime-test-2", true);
8198 + validate("2001-02-18T12:21:03Z", "datetime-test-2", false);
8199 + validate("2001-01-18T12:21:03Z", "datetime-test-2", false);
8200 + validate("2002-02-30T12:21:03Z", "datetime-test-2", false);
8202 + validate("2004-02-18T12:21:03Z", "datetime-test-3", true);
8203 + validate("2004-02-18T00:00:00Z", "datetime-test-3", true);
8204 + validate("2004-02-18T12:22:03Z", "datetime-test-3", false);
8205 + validate("2004-02-21T12:22:03Z", "datetime-test-3", false);
8206 + validate("2001-02-18T12:21:03Z", "datetime-test-3", true);
8207 + validate("2002-02-18T12:21:03Z", "datetime-test-3", true);
8208 + validate("2001-02-18T12:20:03Z", "datetime-test-3", false);
8209 + validate("2001-01-18T22:20:03Z", "datetime-test-3", false);
8210 + validate("2004-02-18T12:21:03-02:00", "datetime-test-3", false);
8211 + validate("2004-02-18T12:21:03+02:00", "datetime-test-3", true);
8213 + validate("true false 0 1", "list-test-1", true);
8214 + validate("true false e 1", "list-test-1", false);
8216 + validate("100 33 4", "list-test-2", true);
8217 + validate("100 333 4", "list-test-2", false);
8219 + validate("50", "union-test-1", true);
8220 + validate("N/A", "union-test-1", true);
8221 + validate("#REF!", "union-test-1", false);
8223 + validateSimpleTypeString("bla", "normalizedString", true);
8224 + validateSimpleTypeString("bla ", "normalizedString", false);
8226 + validateSimpleTypeString("bla", "token", true);
8227 + validateSimpleTypeString("bla ", "token", false);
8228 + validateSimpleTypeString("bla ", "token", false);
8229 + validateSimpleTypeString(" bla ", "token", false);
8230 + validateSimpleTypeString("bla afaf", "token", true);
8231 + validateSimpleTypeString("bla afaf", "token", false);
8233 + validateSimpleTypeString("en-US", "language", true);
8234 + validateSimpleTypeString("fr", "language", true);
8235 + validateSimpleTypeString("2", "language", false);
8237 + validate("Applicant", "IndividualRole", true);
8238 + validate("Applicanter", "IndividualRole", true);
8239 + validate("Applicant1", "IndividualRole", false);
8241 + validate("Applicant Trustee", "IndividualRoleList", true);
8242 + validate("Applicant Trustee Foo", "IndividualRoleList", false);
8244 + validate("Applicant Trustee", "IndividualRoleListType", true);
8245 + validate("Applicant Trustee Foo", "IndividualRoleListType", false);
8246 + validate("Applicant Trustee Trustee Applicant", "IndividualRoleListType", true);
8247 + validate("Applicant Trustee Trustee Applicant Trustee", "IndividualRoleListType", false);
8249 + validate("Applicant Trustee Trustee Applicant", "IndividualRoleListType2", true);
8250 + validate("Applicant Trustee Trustee", "IndividualRoleListType2", false);
8251 + validate("Applicant Trustee", "IndividualRoleListType2", false);
8253 + validate("Applicant Trustee Trustee Applicant", "IndividualRoleListType3", true);
8254 + validate("Applicant Trustee Trustee", "IndividualRoleListType3", false);
8256 + validate("Applicant Trustee Supplier", "IndividualRoleListType5", false);
8257 + validate("Applicant Trustee", "IndividualRoleListType5", true);
8260 end = new Date();
8261 diff -uprN --exclude=CVS mozilla/extensions/schema-validation/tests/schema.xsd mozilla.new/extensions/schema-validation/tests/schema.xsd
8262 --- mozilla/extensions/schema-validation/tests/schema.xsd 2005-06-24 17:38:12.000000000 +0200
8263 +++ mozilla.new/extensions/schema-validation/tests/schema.xsd 2006-03-03 07:12:24.000000000 +0100
8264 @@ -21,12 +21,59 @@
8265 </restriction>
8266 </simpleType>
8268 - <simpleType name="test-nonPositiveInteger">
8269 + <simpleType name="nonPositiveInteger-test-1">
8270 <restriction base='nonPositiveInteger'>
8271 <totalDigits value="3"/>
8272 </restriction>
8273 </simpleType>
8275 + <simpleType name="positiveInteger-test-1">
8276 + <restriction base='positiveInteger'>
8277 + <totalDigits value="3"/>
8278 + </restriction>
8279 + </simpleType>
8281 + <simpleType name="negativeInteger-test-1">
8282 + <restriction base='negativeInteger'>
8283 + <totalDigits value="3"/>
8284 + </restriction>
8285 + </simpleType>
8287 + <simpleType name='long-test-1'>
8288 + <restriction base='long'>
8289 + </restriction>
8290 + </simpleType>
8292 + <simpleType name='int-test-1'>
8293 + <restriction base='int'>
8294 + </restriction>
8295 + </simpleType>
8297 + <simpleType name='short-test-1'>
8298 + <restriction base='short'>
8299 + </restriction>
8300 + </simpleType>
8302 + <simpleType name='unsignedLong-test-1'>
8303 + <restriction base='unsignedLong'>
8304 + </restriction>
8305 + </simpleType>
8307 + <simpleType name='unsignedInt-test-1'>
8308 + <restriction base='unsignedInt'>
8309 + </restriction>
8310 + </simpleType>
8312 + <simpleType name='unsignedShort-test-1'>
8313 + <restriction base='unsignedShort'>
8314 + </restriction>
8315 + </simpleType>
8317 + <simpleType name='unsignedByte-test-1'>
8318 + <restriction base='unsignedByte'>
8319 + </restriction>
8320 + </simpleType>
8322 <simpleType name="byte-test-1">
8323 <restriction base='byte'>
8324 </restriction>
8325 @@ -139,15 +186,15 @@
8327 <simpleType name="gmonth-test-2">
8328 <restriction base='gMonth'>
8329 - <maxExclusive value="--11--Z"/>
8330 - <minExclusive value="--05--"/>
8331 + <maxExclusive value="--11Z"/>
8332 + <minExclusive value="--05"/>
8333 </restriction>
8334 </simpleType>
8336 <simpleType name="gmonth-test-3">
8337 <restriction base='gMonth'>
8338 - <maxInclusive value="--11--"/>
8339 - <minInclusive value="--05--"/>
8340 + <maxInclusive value="--11"/>
8341 + <minInclusive value="--05"/>
8342 </restriction>
8343 </simpleType>
8345 @@ -284,7 +331,6 @@
8346 </restriction>
8347 </simpleType>
8350 <simpleType name="anyuri-test-1">
8351 <restriction base='anyURI'>
8352 </restriction>
8353 @@ -321,6 +367,11 @@
8354 </restriction>
8355 </simpleType>
8357 + <simpleType name="hexbinary-test-1">
8358 + <restriction base='hexBinary'>
8359 + </restriction>
8360 + </simpleType>
8362 <simpleType name="qname-test-1">
8363 <restriction base='QName'>
8364 <maxLength value="13"/>
8365 @@ -334,7 +385,6 @@
8366 </restriction>
8367 </simpleType>
8370 <simpleType name="list-test-1">
8371 <list itemType="boolean"/>
8372 </simpleType>
8373 @@ -362,7 +412,76 @@
8374 </restriction>
8375 </simpleType>
8376 </union>
8377 - </simpleType>
8378 + </simpleType>
8380 + <simpleType name="TypeCode">
8381 + <restriction base="test:UrType">
8382 + <enumeration value="Applicanter"/>
8383 + <enumeration value="Applicant"/>
8384 + <enumeration value="Third_Party"/>
8385 + <enumeration value="Trustee"/>
8386 + <maxLength value="50"/>
8387 + </restriction>
8388 + </simpleType>
8390 + <simpleType name="UrType">
8391 + <restriction base="string">
8392 + </restriction>
8393 + </simpleType>
8395 + <simpleType name="IndividualRole">
8396 + <restriction base="test:TypeCode">
8397 + <enumeration value="Applicant"/>
8398 + <enumeration value="Third_Party"/>
8399 + <enumeration value="Trustee"/>
8400 + </restriction>
8401 + </simpleType>
8403 + <simpleType name='IndividualRoleList'>
8404 + <list itemType='test:IndividualRole'/>
8405 + </simpleType>
8407 + <simpleType name='IndividualRoleListType'>
8408 + <restriction base='test:IndividualRoleList'>
8409 + <maxLength value='4'/>
8410 + </restriction>
8411 + </simpleType>
8413 + <simpleType name='IndividualRoleListType2'>
8414 + <restriction base='test:IndividualRoleList'>
8415 + <length value='4'/>
8416 + </restriction>
8417 + </simpleType>
8419 + <simpleType name='IndividualRoleListType3'>
8420 + <restriction base='test:IndividualRoleList'>
8421 + <minLength value='4'/>
8422 + </restriction>
8423 + </simpleType>
8425 + <simpleType name="RoleUnion">
8426 + <union>
8427 + <simpleType>
8428 + <restriction base="test:IndividualRoleListType"/>
8429 + </simpleType>
8430 + <simpleType>
8431 + <restriction base="string">
8432 + <enumeration value="N/A"/>
8433 + </restriction>
8434 + </simpleType>
8435 + <simpleType>
8436 + <restriction base="string">
8437 + <maxLength value="4"/>
8438 + </restriction>
8439 + </simpleType>
8440 + </union>
8441 + </simpleType>
8443 + <simpleType name='IndividualRoleListType5'>
8444 + <restriction base='test:IndividualRoleList'>
8445 + <enumeration value='Applicant Trustee'/>
8446 + </restriction>
8447 + </simpleType>
8449 <!-- complex types -->
8451 diff -uprN --exclude=CVS mozilla/extensions/transformiix/source/base/txURIUtils.cpp mozilla.new/extensions/transformiix/source/base/txURIUtils.cpp
8452 --- mozilla/extensions/transformiix/source/base/txURIUtils.cpp 2004-06-25 14:26:01.000000000 +0200
8453 +++ mozilla.new/extensions/transformiix/source/base/txURIUtils.cpp 2006-02-24 11:16:22.000000000 +0100
8454 @@ -326,6 +326,7 @@ void
8455 URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
8457 if (!aSourceNode) {
8458 + // XXXbz passing nsnull as the first arg to Reset is illegal
8459 aNewDoc->Reset(nsnull, nsnull);
8460 return;
8462 @@ -338,21 +339,31 @@ URIUtils::ResetWithSource(nsIDocument *a
8464 if (!sourceDoc) {
8465 NS_ASSERTION(0, "no source document found");
8466 + // XXXbz passing nsnull as the first arg to Reset is illegal
8467 aNewDoc->Reset(nsnull, nsnull);
8468 return;
8471 - nsCOMPtr<nsIChannel> channel;
8472 + nsIPrincipal* sourcePrincipal = sourceDoc->GetPrincipal();
8473 + if (!sourcePrincipal) {
8474 + return;
8477 + // Copy the channel and loadgroup from the source document.
8478 nsCOMPtr<nsILoadGroup> loadGroup = sourceDoc->GetDocumentLoadGroup();
8479 - nsCOMPtr<nsIIOService> serv = do_GetService(NS_IOSERVICE_CONTRACTID);
8480 - if (serv) {
8481 - // Create a temporary channel to get nsIDocument->Reset to
8482 - // do the right thing. We want the output document to get
8483 - // much of the input document's characteristics.
8484 - serv->NewChannelFromURI(sourceDoc->GetDocumentURI(),
8485 - getter_AddRefs(channel));
8486 + nsCOMPtr<nsIChannel> channel = sourceDoc->GetChannel();
8487 + if (!channel) {
8488 + // Need to synthesize one
8489 + if (NS_FAILED(NS_NewChannel(getter_AddRefs(channel),
8490 + sourceDoc->GetDocumentURI(),
8491 + nsnull,
8492 + loadGroup))) {
8493 + return;
8495 + channel->SetOwner(sourcePrincipal);
8497 aNewDoc->Reset(channel, loadGroup);
8498 + aNewDoc->SetPrincipal(sourcePrincipal);
8499 aNewDoc->SetBaseURI(sourceDoc->GetBaseURI());
8501 // Copy charset
8502 diff -uprN --exclude=CVS mozilla/extensions/transformiix/source/xpath/nsXPathResult.cpp mozilla.new/extensions/transformiix/source/xpath/nsXPathResult.cpp
8503 --- mozilla/extensions/transformiix/source/xpath/nsXPathResult.cpp 2005-08-25 14:45:04.000000000 +0200
8504 +++ mozilla.new/extensions/transformiix/source/xpath/nsXPathResult.cpp 2006-02-24 11:16:22.000000000 +0100
8505 @@ -249,12 +249,18 @@ nsXPathResult::ContentRemoved(nsIDocumen
8506 nsresult
8507 nsXPathResult::SetExprResult(txAExprResult* aExprResult, PRUint16 aResultType)
8509 + mResultType = aResultType;
8511 + if ((isSnapshot() || isIterator() || isNode()) &&
8512 + aExprResult->getResultType() != txAExprResult::NODESET) {
8513 + return NS_ERROR_DOM_TYPE_ERR;
8516 if (mDocument) {
8517 mDocument->RemoveObserver(this);
8518 mDocument = nsnull;
8521 - mResultType = aResultType;
8522 mResult.set(aExprResult);
8524 if (!isIterator()) {
8525 diff -uprN --exclude=CVS mozilla/extensions/transformiix/source/xslt/txMozillaTextOutput.cpp mozilla.new/extensions/transformiix/source/xslt/txMozillaTextOutput.cpp
8526 --- mozilla/extensions/transformiix/source/xslt/txMozillaTextOutput.cpp 2005-04-15 03:30:11.000000000 +0200
8527 +++ mozilla.new/extensions/transformiix/source/xslt/txMozillaTextOutput.cpp 2006-02-24 11:16:22.000000000 +0100
8528 @@ -50,6 +50,7 @@
8529 #include "nsIDOMNSDocument.h"
8530 #include "nsIParser.h"
8531 #include "nsICharsetAlias.h"
8532 +#include "nsIPrincipal.h"
8534 static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
8536 @@ -172,18 +173,27 @@ void txMozillaTextOutput::createResultDo
8539 // Reset and set up document
8540 - nsCOMPtr<nsIChannel> channel;
8541 nsCOMPtr<nsIDocument> sourceDoc = do_QueryInterface(aSourceDocument);
8542 + nsIPrincipal* sourcePrincipal = sourceDoc->GetPrincipal();
8543 + if (!sourcePrincipal) {
8544 + return;
8547 nsCOMPtr<nsILoadGroup> loadGroup = sourceDoc->GetDocumentLoadGroup();
8548 - nsCOMPtr<nsIIOService> serv = do_GetService(NS_IOSERVICE_CONTRACTID);
8549 - if (serv) {
8550 - // Create a temporary channel to get nsIDocument->Reset to
8551 - // do the right thing. We want the output document to get
8552 - // much of the input document's characteristics.
8553 - serv->NewChannelFromURI(sourceDoc->GetDocumentURI(),
8554 - getter_AddRefs(channel));
8555 + nsCOMPtr<nsIChannel> channel = sourceDoc->GetChannel();
8556 + if (!channel) {
8557 + // Need to synthesize one
8558 + if (NS_FAILED(NS_NewChannel(getter_AddRefs(channel),
8559 + sourceDoc->GetDocumentURI(),
8560 + nsnull,
8561 + loadGroup))) {
8562 + return;
8564 + channel->SetOwner(sourcePrincipal);
8566 + // Copy the channel and loadgroup from the source document.
8567 doc->Reset(channel, loadGroup);
8568 + doc->SetPrincipal(sourcePrincipal);
8569 doc->SetBaseURI(sourceDoc->GetBaseURI());
8571 // Set the charset
8572 diff -uprN --exclude=CVS mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp mozilla.new/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp
8573 --- mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp 2005-09-04 20:15:59.000000000 +0200
8574 +++ mozilla.new/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp 2006-02-24 11:16:22.000000000 +0100
8575 @@ -64,6 +64,7 @@
8576 #include "txXSLTProcessor.h"
8577 #include "nsIPrincipal.h"
8578 #include "jsapi.h"
8579 +#include "nsIEventQueueService.h"
8581 static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
8583 @@ -322,6 +323,31 @@ txMozillaXSLTProcessor::SetSourceContent
8584 return NS_OK;
8587 +PR_BEGIN_EXTERN_C
8588 +void* PR_CALLBACK
8589 +HandleTransformBlockerEvent(PLEvent *aEvent)
8591 + txMozillaXSLTProcessor *processor =
8592 + NS_STATIC_CAST(txMozillaXSLTProcessor*, aEvent->owner);
8593 + processor->TransformToDoc(nsnull, nsnull);
8595 + return nsnull;
8598 +void PR_CALLBACK
8599 +DestroyTransformBlockerEvent(PLEvent *aEvent)
8601 + txMozillaXSLTProcessor *processor =
8602 + NS_STATIC_CAST(txMozillaXSLTProcessor*, aEvent->owner);
8603 + nsCOMPtr<nsIDocument> document =
8604 + do_QueryInterface(processor->GetSourceContentModel());
8605 + document->UnblockOnload();
8607 + NS_RELEASE(processor);
8608 + delete aEvent;
8610 +PR_END_EXTERN_C
8612 nsresult
8613 txMozillaXSLTProcessor::DoTransform()
8615 @@ -329,7 +355,41 @@ txMozillaXSLTProcessor::DoTransform()
8616 NS_ENSURE_TRUE(mStylesheet, NS_ERROR_UNEXPECTED);
8617 NS_ASSERTION(mObserver, "no observer");
8619 - return TransformToDoc(nsnull, nsnull);
8620 + nsresult rv;
8621 + nsCOMPtr<nsIDocument> document = do_QueryInterface(mSource, &rv);
8622 + NS_ENSURE_SUCCESS(rv, rv);
8624 + nsCOMPtr<nsIEventQueueService> service =
8625 + do_GetService(NS_EVENTQUEUESERVICE_CONTRACTID, &rv);
8626 + NS_ENSURE_SUCCESS(rv, rv);
8627 + nsCOMPtr<nsIEventQueue> eventQ;
8628 + rv = service->GetSpecialEventQueue(nsIEventQueueService::UI_THREAD_EVENT_QUEUE,
8629 + getter_AddRefs(eventQ));
8630 + NS_ENSURE_SUCCESS(rv, rv);
8632 + PLEvent* event = new PLEvent();
8633 + if (!event) {
8634 + return NS_ERROR_OUT_OF_MEMORY;
8637 + PL_InitEvent(event, this, HandleTransformBlockerEvent,
8638 + DestroyTransformBlockerEvent);
8640 + document->BlockOnload();
8642 + // After this point, event destruction will release |this| (in
8643 + // DestroyTransformBlockerEvent)
8644 + NS_ADDREF_THIS();
8646 + rv = eventQ->PostEvent(event);
8647 + if (NS_FAILED(rv)) {
8648 + // XXX Maybe we should just display the source document in this case?
8649 + // Also, set up context information, see bug 204655.
8650 + reportError(rv, nsnull, nsnull);
8651 + PL_DestroyEvent(event);
8654 + return rv;
8657 NS_IMETHODIMP
8658 diff -uprN --exclude=CVS mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.h mozilla.new/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.h
8659 --- mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.h 2005-01-28 16:08:58.000000000 +0100
8660 +++ mozilla.new/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.h 2006-02-24 11:16:22.000000000 +0100
8661 @@ -155,12 +155,13 @@ public:
8662 return mSource;
8665 + nsresult TransformToDoc(nsIDOMDocument *aOutputDoc,
8666 + nsIDOMDocument **aResult);
8668 private:
8669 nsresult DoTransform();
8670 void notifyError();
8671 nsresult ensureStylesheet();
8672 - nsresult TransformToDoc(nsIDOMDocument *aOutputDoc,
8673 - nsIDOMDocument **aResult);
8675 nsRefPtr<txStylesheet> mStylesheet;
8676 nsIDocument* mStylesheetDocument; // weak
8677 diff -uprN --exclude=CVS mozilla/extensions/xforms/jar.mn mozilla.new/extensions/xforms/jar.mn
8678 --- mozilla/extensions/xforms/jar.mn 2005-09-02 19:23:35.000000000 +0200
8679 +++ mozilla.new/extensions/xforms/jar.mn 2006-02-14 10:01:13.000000000 +0100
8680 @@ -9,9 +9,11 @@ xforms.jar:
8681 * content/xforms/xforms-prefs.js (resources/content/xforms-prefs.js)
8682 content/xforms/xforms.xml (resources/content/xforms.xml)
8683 content/xforms/select1.xml (resources/content/select1.xml)
8684 + content/xforms/range.xml (resources/content/range.xml)
8685 content/xforms/select.xml (resources/content/select.xml)
8686 content/xforms/bindingex.css (resources/content/bindingex.css)
8687 content/xforms/bindingex.xul (resources/content/bindingex.xul)
8688 + content/xforms/calendar.png (resources/content/calendar.png)
8689 * locale/en-US/xforms/contents.rdf (resources/locale/en-US/contents.rdf)
8690 locale/en-US/xforms/xforms.properties (resources/locale/en-US/xforms.properties)
8691 locale/en-US/xforms/xforms.dtd (resources/locale/en-US/xforms.dtd)
8692 diff -uprN --exclude=CVS mozilla/extensions/xforms/Makefile.in mozilla.new/extensions/xforms/Makefile.in
8693 --- mozilla/extensions/xforms/Makefile.in 2006-01-09 06:48:33.000000000 +0100
8694 +++ mozilla.new/extensions/xforms/Makefile.in 2006-02-24 11:16:23.000000000 +0100
8695 @@ -49,14 +49,22 @@ include $(DEPTH)/config/autoconf.mk
8696 MODULE = xforms
8697 LIBRARY_NAME = xforms
8698 IS_COMPONENT = 1
8699 +ifndef MINIMO
8700 # Do not set EXPORT_LIBRARY as we do not want xforms in the static libs list
8701 #EXPORT_LIBRARY = 1
8702 FORCE_SHARED_LIB = 1
8703 +else
8704 +MODULE_NAME = xforms
8705 +EXPORT_LIBRARY = 1
8706 +endif
8707 MOZILLA_INTERNAL_API = 1
8709 # Also build schema-validation
8710 DIRS = ../schema-validation \
8711 $(NULL)
8713 +ifndef MINIMO
8714 +ifdef MOZ_XUL_APP
8715 # XPI settings
8716 # XPI_NAME is exported to include schema-validation in xforms package
8717 export XPI_NAME = xforms
8718 @@ -64,7 +72,10 @@ XPI_PKGNAME = xforms
8719 USE_EXTENSION_MANIFEST = 1
8720 NO_JAR_AUTO_REG = 1
8721 INSTALL_EXTENSION_ID = {cf2812dc-6a7c-4402-b639-4d277dac4c36}
8722 -PACKAGE_VERSION = 0.3
8723 +PACKAGE_VERSION = 0.4
8725 +# We want to strip the XPI
8726 +STRIP_XPI = 1
8728 XULAPP_DEFINES = \
8729 -DFIREFOX_VERSION=$(FIREFOX_VERSION) \
8730 @@ -75,6 +86,8 @@ XULAPP_DEFINES = \
8732 # Include these in the XPI
8733 DIST_FILES = install.rdf install.js
8734 +endif
8735 +endif
8737 # XForms depends
8738 REQUIRES = \
8739 @@ -103,6 +116,7 @@ REQUIRES = \
8740 # XForms IDLs
8741 XPIDLSRCS = \
8742 nsIXFormsModelElement.idl \
8743 + nsIXFormsNSModelElement.idl \
8744 nsIInstanceElementPrivate.idl \
8745 nsIModelElementPrivate.idl \
8746 nsIXFormsControl.idl \
8747 @@ -120,12 +134,16 @@ XPIDLSRCS = \
8748 nsIXFormsSubmissionElement.idl \
8749 nsIXFormsControlBase.idl \
8750 nsIXFormsDelegate.idl \
8751 + nsIDelegateInternal.idl \
8752 nsIXFormsUIWidget.idl \
8753 nsIXFormsItemElement.idl \
8754 nsIXFormsLabelElement.idl \
8755 nsIXFormsItemSetUIElement.idl \
8756 + nsIXFormsAccessors.idl \
8757 + nsIXFormsRangeAccessors.idl \
8758 nsIXFormsUploadElement.idl \
8759 nsIXFormsUploadUIElement.idl \
8760 + nsIXFormsCopyElement.idl \
8761 $(NULL)
8763 # XForms source files
8764 @@ -181,6 +199,10 @@ CPPSRCS = \
8765 nsXFormsControlStub.cpp \
8766 nsXFormsUtilityService.cpp \
8767 nsXFormsDelegateStub.cpp \
8768 + nsXFormsRangeElement.cpp \
8769 + nsXFormsAccessors.cpp \
8770 + nsXFormsRangeAccessors.cpp \
8771 + nsXFormsCopyElement.cpp \
8772 $(NULL)
8774 # Standard Mozilla make rules
8775 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIDelegateInternal.idl mozilla.new/extensions/xforms/nsIDelegateInternal.idl
8776 --- mozilla/extensions/xforms/nsIDelegateInternal.idl 1970-01-01 01:00:00.000000000 +0100
8777 +++ mozilla.new/extensions/xforms/nsIDelegateInternal.idl 2006-02-07 16:30:11.000000000 +0100
8778 @@ -0,0 +1,57 @@
8779 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
8780 +/* ***** BEGIN LICENSE BLOCK *****
8781 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
8783 + * The contents of this file are subject to the Mozilla Public License Version
8784 + * 1.1 (the "License"); you may not use this file except in compliance with
8785 + * the License. You may obtain a copy of the License at
8786 + * http://www.mozilla.org/MPL/
8788 + * Software distributed under the License is distributed on an "AS IS" basis,
8789 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8790 + * for the specific language governing rights and limitations under the
8791 + * License.
8793 + * The Original Code is Mozilla XForms support.
8795 + * The Initial Developer of the Original Code is
8796 + * Novell, Inc.
8797 + * Portions created by the Initial Developer are Copyright (C) 2005
8798 + * the Initial Developer. All Rights Reserved.
8800 + * Contributor(s):
8801 + * Allan Beaufour <abeaufour@novell.com>
8803 + * Alternatively, the contents of this file may be used under the terms of
8804 + * either the GNU General Public License Version 2 or later (the "GPL"), or
8805 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
8806 + * in which case the provisions of the GPL or the LGPL are applicable instead
8807 + * of those above. If you wish to allow use of your version of this file only
8808 + * under the terms of either the GPL or the LGPL, and not to allow others to
8809 + * use your version of this file under the terms of the MPL, indicate your
8810 + * decision by deleting the provisions above and replace them with the notice
8811 + * and other provisions required by the GPL or the LGPL. If you do not delete
8812 + * the provisions above, a recipient may use your version of this file under
8813 + * the terms of any one of the MPL, the GPL or the LGPL.
8815 + * ***** END LICENSE BLOCK ***** */
8817 +#include "nsIXFormsDelegate.idl"
8819 +/**
8820 + * Internal interface implemented by XForms controls that delegates the UI to
8821 + * an external entity.
8822 + */
8823 +[uuid(aec21659-67e6-4808-b877-670ff756636a)]
8824 +interface nsIDelegateInternal : nsIXFormsDelegate
8826 + /**
8827 + * The value bound to the XForms control.
8828 + */
8829 + attribute DOMString value;
8831 + /**
8832 + * Is the delegate bound to a node?
8833 + */
8834 + readonly attribute boolean hasBoundNode;
8836 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIInstanceElementPrivate.idl mozilla.new/extensions/xforms/nsIInstanceElementPrivate.idl
8837 --- mozilla/extensions/xforms/nsIInstanceElementPrivate.idl 2005-10-22 16:39:09.000000000 +0200
8838 +++ mozilla.new/extensions/xforms/nsIInstanceElementPrivate.idl 2006-02-14 10:01:13.000000000 +0100
8839 @@ -44,7 +44,7 @@ interface nsIDOMElement;
8841 * Private interface implemented by the instance element.
8843 -[uuid(446dc7b6-91fc-4de5-b6de-5ac22538ee5e)]
8844 +[uuid(debb24ef-7ba1-4e01-9f62-18106b25c993)]
8845 interface nsIInstanceElementPrivate : nsISupports
8848 @@ -54,5 +54,5 @@ interface nsIInstanceElementPrivate : ns
8849 readonly attribute nsIDOMElement element;
8850 void backupOriginalDocument();
8851 void restoreOriginalDocument();
8852 - void initializeLazyInstance();
8853 + void initialize();
8855 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIModelElementPrivate.idl mozilla.new/extensions/xforms/nsIModelElementPrivate.idl
8856 --- mozilla/extensions/xforms/nsIModelElementPrivate.idl 2005-06-29 20:14:43.000000000 +0200
8857 +++ mozilla.new/extensions/xforms/nsIModelElementPrivate.idl 2006-02-24 11:16:23.000000000 +0100
8858 @@ -42,17 +42,12 @@ interface nsIXFormsControl;
8859 interface nsISchemaType;
8860 interface nsIInstanceElementPrivate;
8861 interface nsIDOMNode;
8862 -%{C++
8863 - #include "nsCOMArray.h"
8866 -[ptr] native nsCOMArrayPtr(nsCOMArray<nsIInstanceElementPrivate>);
8869 * Private interface implemented by the model element for other
8870 * elements to use.
8872 -[uuid(b21b65d3-3305-4ce0-a604-3648cff61aca)]
8873 +[uuid(a6522c1a-a343-4b36-a130-75eb279a667a)]
8874 interface nsIModelElementPrivate : nsIXFormsModelElement
8877 @@ -105,6 +100,18 @@ interface nsIModelElementPrivate : nsIXF
8878 out AString nodeValue);
8881 + * Insert a set of nodes underneath an instance node.
8882 + * @param aContextNode The instance node
8883 + * @param aNodeContent Node that holds the contents to insert under
8884 + * the instance node
8885 + * @param aNodeChanged Indicates whether the contents of the instance
8886 + * node really did change due to this action
8887 + */
8888 + void setNodeContent(in nsIDOMNode aContextNode,
8889 + in nsIDOMNode aNodeContent,
8890 + out boolean aNodeChanged);
8892 + /**
8893 * Validates the instance node against the schemas loaded by the model.
8895 PRBool validateNode(in nsIDOMNode aInstanceNode);
8896 @@ -126,12 +133,6 @@ interface nsIModelElementPrivate : nsIXF
8897 void setStates(in nsIXFormsControl aControl, in nsIDOMNode aBoundNode);
8900 - * The list of instance elements held by this model. Includes lazy-authored
8901 - * instance elements
8902 - */
8903 - readonly attribute nsCOMArrayPtr instanceList;
8905 - /**
8906 * Add an instance element to the model's instance list
8907 * @param aInstanceElement The instance element to add to the list
8909 @@ -141,4 +142,14 @@ interface nsIModelElementPrivate : nsIXF
8910 * This attribute is set when the model's instance was lazy authored
8912 readonly attribute boolean lazyAuthored;
8914 + /**
8915 + * Retrieves the type for an instance data node
8917 + * @param aInstanceData The instance data node
8918 + * @param aType The type of the node
8919 + * @param aNSURI The namespace of the type
8920 + */
8921 + void GetTypeFromNode(in nsIDOMNode aInstanceData, out AString aType,
8922 + out AString aNSUri);
8924 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIXFormsAccessors.idl mozilla.new/extensions/xforms/nsIXFormsAccessors.idl
8925 --- mozilla/extensions/xforms/nsIXFormsAccessors.idl 1970-01-01 01:00:00.000000000 +0100
8926 +++ mozilla.new/extensions/xforms/nsIXFormsAccessors.idl 2006-02-24 11:16:23.000000000 +0100
8927 @@ -0,0 +1,105 @@
8928 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
8929 +/* ***** BEGIN LICENSE BLOCK *****
8930 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
8932 + * The contents of this file are subject to the Mozilla Public License Version
8933 + * 1.1 (the "License"); you may not use this file except in compliance with
8934 + * the License. You may obtain a copy of the License at
8935 + * http://www.mozilla.org/MPL/
8937 + * Software distributed under the License is distributed on an "AS IS" basis,
8938 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8939 + * for the specific language governing rights and limitations under the
8940 + * License.
8942 + * The Original Code is Mozilla XForms support.
8944 + * The Initial Developer of the Original Code is
8945 + * Novell, Inc.
8946 + * Portions created by the Initial Developer are Copyright (C) 2005
8947 + * the Initial Developer. All Rights Reserved.
8949 + * Contributor(s):
8950 + * Allan Beaufour <abeaufour@novell.com>
8952 + * Alternatively, the contents of this file may be used under the terms of
8953 + * either the GNU General Public License Version 2 or later (the "GPL"), or
8954 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
8955 + * in which case the provisions of the GPL or the LGPL are applicable instead
8956 + * of those above. If you wish to allow use of your version of this file only
8957 + * under the terms of either the GPL or the LGPL, and not to allow others to
8958 + * use your version of this file under the terms of the MPL, indicate your
8959 + * decision by deleting the provisions above and replace them with the notice
8960 + * and other provisions required by the GPL or the LGPL. If you do not delete
8961 + * the provisions above, a recipient may use your version of this file under
8962 + * the terms of any one of the MPL, the GPL or the LGPL.
8964 + * ***** END LICENSE BLOCK ***** */
8966 +#include "nsISupports.idl"
8967 +#include "nsIDOMNode.idl"
8969 +/**
8970 + * Interface exposing the states of an XForms control.
8972 + * For more information on this interface please see
8973 + * http://developer.mozilla.org/en/docs/XForms:Custom_Controls
8974 + */
8975 +[scriptable, uuid(74992960-42a9-4479-a1ff-f7f1b37e187a)]
8976 +interface nsIXFormsAccessors : nsISupports
8978 + /**
8979 + * Get the value bound to the XForms control.
8980 + */
8981 + DOMString getValue();
8983 + /**
8984 + * Set the value bound to the XForms control.
8985 + */
8986 + void setValue(in DOMString value);
8988 + /**
8989 + * @see http://www.w3.org/TR/xforms/slice6.html#model-prop-readOnly
8990 + */
8991 + boolean isReadonly();
8993 + /**
8994 + * @see http://www.w3.org/TR/xforms/slice6.html#model-prop-relevant
8995 + */
8996 + boolean isRelevant();
8998 + /**
8999 + * @see http://www.w3.org/TR/xforms/slice6.html#model-prop-required
9000 + */
9001 + boolean isRequired();
9003 + /**
9004 + * @see http://www.w3.org/TR/xforms/slice6.html#model-prop-validate
9005 + */
9006 + boolean isValid();
9008 + /**
9009 + * true, if XForms control is bound to a node in a data model.
9010 + */
9011 + boolean hasBoundNode();
9013 + /**
9014 + * Node that the control is bound to in its data model.
9015 + */
9016 + nsIDOMNode getBoundNode();
9018 + /**
9019 + * Used to set the complete contents of the bound node. This function is
9020 + * meant to be used like setValue() except that it can be used to set more
9021 + * than just the first textnode contained under the bound node. If there
9022 + * is nothing contained under aNode, then all children of the bound node
9023 + * will be eliminated.
9025 + * @param aNode setContent will take the contents of aNode and copy
9026 + * them under the control's bound node.
9027 + * @param aForceUpdate Indicates whether setContent should rebuild,
9028 + * recalculate, revalidate and refresh the model that
9029 + * this control is bound to prior to returning
9030 + */
9031 + void setContent(in nsIDOMNode aNode, in boolean aForceUpdate);
9033 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIXFormsCopyElement.idl mozilla.new/extensions/xforms/nsIXFormsCopyElement.idl
9034 --- mozilla/extensions/xforms/nsIXFormsCopyElement.idl 1970-01-01 01:00:00.000000000 +0100
9035 +++ mozilla.new/extensions/xforms/nsIXFormsCopyElement.idl 2006-02-07 16:30:11.000000000 +0100
9036 @@ -0,0 +1,54 @@
9037 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
9038 +/* ***** BEGIN LICENSE BLOCK *****
9039 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9041 + * The contents of this file are subject to the Mozilla Public License Version
9042 + * 1.1 (the "License"); you may not use this file except in compliance with
9043 + * the License. You may obtain a copy of the License at
9044 + * http://www.mozilla.org/MPL/
9046 + * Software distributed under the License is distributed on an "AS IS" basis,
9047 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
9048 + * for the specific language governing rights and limitations under the
9049 + * License.
9051 + * The Original Code is Mozilla XForms support.
9053 + * The Initial Developer of the Original Code is
9054 + * IBM Corporation.
9055 + * Portions created by the Initial Developer are Copyright (C) 2005
9056 + * the Initial Developer. All Rights Reserved.
9058 + * Contributor(s):
9059 + * Aaron Reed <aaronr@us.ibm.com>
9061 + * Alternatively, the contents of this file may be used under the terms of
9062 + * either of the GNU General Public License Version 2 or later (the "GPL"),
9063 + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
9064 + * in which case the provisions of the GPL or the LGPL are applicable instead
9065 + * of those above. If you wish to allow use of your version of this file only
9066 + * under the terms of either the GPL or the LGPL, and not to allow others to
9067 + * use your version of this file under the terms of the MPL, indicate your
9068 + * decision by deleting the provisions above and replace them with the notice
9069 + * and other provisions required by the GPL or the LGPL. If you do not delete
9070 + * the provisions above, a recipient may use your version of this file under
9071 + * the terms of any one of the MPL, the GPL or the LGPL.
9073 + * ***** END LICENSE BLOCK ***** */
9075 +/**
9076 + * This interface is implemented by XForms \<copy\> elements.
9077 + */
9079 +#include "nsISupports.idl"
9080 +#include "nsIDOMNode.idl"
9082 +[uuid(4af9ad8e-5266-44ac-b9f7-ef2cb9fe2637)]
9083 +interface nsIXFormsCopyElement : nsISupports
9085 + /**
9086 + * Returns the node that will be deep copied into the instance data if the
9087 + * item element which contains this copy element is selected.
9088 + */
9089 + readonly attribute nsIDOMNode copyNode;
9091 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIXFormsDelegate.idl mozilla.new/extensions/xforms/nsIXFormsDelegate.idl
9092 --- mozilla/extensions/xforms/nsIXFormsDelegate.idl 2005-06-26 20:30:17.000000000 +0200
9093 +++ mozilla.new/extensions/xforms/nsIXFormsDelegate.idl 2006-02-14 10:01:13.000000000 +0100
9094 @@ -39,45 +39,36 @@
9096 #include "nsISupports.idl"
9098 +interface nsIXFormsAccessors;
9101 * Interface implemented by XForms controls that delegates the UI to an
9102 * external entity.
9104 + * For more information on this interface please see
9105 + * http://developer.mozilla.org/en/docs/XForms:Custom_Controls
9108 -[scriptable, uuid(3b2300dc-9311-4eb7-a5c9-ca2ee4064de6)]
9109 +[scriptable, uuid(902898eb-490e-4c36-a00b-9e74adcfbc43)]
9110 interface nsIXFormsDelegate : nsISupports
9113 - * The value bound to the XForms control.
9114 + * Get the IXFormsAccessors object for this control.
9116 - attribute DOMString value;
9117 + nsIXFormsAccessors getXFormsAccessors();
9120 - * @see http://www.w3.org/TR/xforms/slice6.html#model-prop-readOnly
9121 - */
9122 - readonly attribute boolean isReadonly;
9124 - /**
9125 - * @see http://www.w3.org/TR/xforms/slice6.html#model-prop-relevant
9126 - */
9127 - readonly attribute boolean isEnabled;
9129 - /**
9130 - * @see http://www.w3.org/TR/xforms/slice6.html#model-prop-required
9131 - */
9132 - readonly attribute boolean isRequired;
9134 - /**
9135 - * Tells whether the XForms control is valid.
9136 - */
9137 - readonly attribute boolean isValid;
9139 - /**
9140 - * true, if XForms control is bound to a node in a data model.
9141 + * This should be called by XBL widgets, when they are created.
9143 - readonly attribute boolean hasBoundNode;
9144 + void widgetAttached();
9147 - * This should be called by XBL widgets, when they are created.
9148 + * Report an error
9150 + * @param errorMsg The error message id
9152 + * @todo XXX this should be extended to allow for "raw strings", not
9153 + * necessarily kept in bundles.
9155 - void widgetAttached();
9156 + void reportError(in DOMString errorMsg);
9158 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIXFormsItemElement.idl mozilla.new/extensions/xforms/nsIXFormsItemElement.idl
9159 --- mozilla/extensions/xforms/nsIXFormsItemElement.idl 2005-08-03 20:43:43.000000000 +0200
9160 +++ mozilla.new/extensions/xforms/nsIXFormsItemElement.idl 2006-02-14 10:01:13.000000000 +0100
9161 @@ -37,11 +37,13 @@
9162 * ***** END LICENSE BLOCK ***** */
9164 #include "nsISupports.idl"
9165 +#include "nsIDOMNode.idl"
9166 +#include "nsIXFormsDelegate.idl"
9169 * Interface implemented by the item element.
9171 -[scriptable, uuid(796a2e26-a40b-4ebf-be2c-42faf5fea6c4)]
9172 +[scriptable, uuid(ec8d3556-8ed2-4143-88d1-6b7b2c8b0b3b)]
9173 interface nsIXFormsItemElement : nsISupports
9176 @@ -67,4 +69,18 @@ interface nsIXFormsItemElement : nsISupp
9177 * \<select1\> element, which can then refresh its UI.
9179 void labelRefreshed();
9181 + /**
9182 + * Indicates whether the item element contains a value child or a copy
9183 + * child. We'll assume that if the item is NOT a copy item, then it must
9184 + * be a value item. Which means that it must contain a XForms value element
9185 + * child.
9186 + */
9187 + attribute boolean isCopyItem;
9189 + /*
9190 + * returns the node that the contained copy element is bound to
9191 + */
9192 + readonly attribute nsIDOMNode copyNode;
9195 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIXFormsNSModelElement.idl mozilla.new/extensions/xforms/nsIXFormsNSModelElement.idl
9196 --- mozilla/extensions/xforms/nsIXFormsNSModelElement.idl 1970-01-01 01:00:00.000000000 +0100
9197 +++ mozilla.new/extensions/xforms/nsIXFormsNSModelElement.idl 2006-02-07 16:30:11.000000000 +0100
9198 @@ -0,0 +1,50 @@
9199 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
9200 +/* ***** BEGIN LICENSE BLOCK *****
9201 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9203 + * The contents of this file are subject to the Mozilla Public License Version
9204 + * 1.1 (the "License"); you may not use this file except in compliance with
9205 + * the License. You may obtain a copy of the License at
9206 + * http://www.mozilla.org/MPL/
9208 + * Software distributed under the License is distributed on an "AS IS" basis,
9209 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
9210 + * for the specific language governing rights and limitations under the
9211 + * License.
9213 + * The Original Code is Mozilla XForms support.
9215 + * The Initial Developer of the Original Code is
9216 + * IBM Corporation.
9217 + * Portions created by the Initial Developer are Copyright (C) 2005
9218 + * the Initial Developer. All Rights Reserved.
9220 + * Contributor(s):
9221 + * Allan Beaufour <allan@beaufour.dk>
9223 + * Alternatively, the contents of this file may be used under the terms of
9224 + * either of the GNU General Public License Version 2 or later (the "GPL"),
9225 + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
9226 + * in which case the provisions of the GPL or the LGPL are applicable instead
9227 + * of those above. If you wish to allow use of your version of this file only
9228 + * under the terms of either the GPL or the LGPL, and not to allow others to
9229 + * use your version of this file under the terms of the MPL, indicate your
9230 + * decision by deleting the provisions above and replace them with the notice
9231 + * and other provisions required by the GPL or the LGPL. If you do not delete
9232 + * the provisions above, a recipient may use your version of this file under
9233 + * the terms of any one of the MPL, the GPL or the LGPL.
9235 + * ***** END LICENSE BLOCK ***** */
9237 +#include "domstubs.idl"
9239 +interface nsIDOMNodeList;
9241 +/**
9242 + * Defines additional post-spec. functions for the \<model\> element.
9243 + */
9244 +[scriptable, uuid(85fd60c7-1db7-40c0-ae8d-f723fdd1eea8)]
9245 +interface nsIXFormsNSModelElement : nsISupports
9247 + nsIDOMNodeList getInstanceDocuments();
9249 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIXFormsRangeAccessors.idl mozilla.new/extensions/xforms/nsIXFormsRangeAccessors.idl
9250 --- mozilla/extensions/xforms/nsIXFormsRangeAccessors.idl 1970-01-01 01:00:00.000000000 +0100
9251 +++ mozilla.new/extensions/xforms/nsIXFormsRangeAccessors.idl 2006-02-07 16:30:11.000000000 +0100
9252 @@ -0,0 +1,57 @@
9253 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
9254 +/* ***** BEGIN LICENSE BLOCK *****
9255 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9257 + * The contents of this file are subject to the Mozilla Public License Version
9258 + * 1.1 (the "License"); you may not use this file except in compliance with
9259 + * the License. You may obtain a copy of the License at
9260 + * http://www.mozilla.org/MPL/
9262 + * Software distributed under the License is distributed on an "AS IS" basis,
9263 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
9264 + * for the specific language governing rights and limitations under the
9265 + * License.
9267 + * The Original Code is Mozilla XForms support.
9269 + * The Initial Developer of the Original Code is
9270 + * Novell, Inc.
9271 + * Portions created by the Initial Developer are Copyright (C) 2005
9272 + * the Initial Developer. All Rights Reserved.
9274 + * Contributor(s):
9275 + * Allan Beaufour <abeaufour@novell.com>
9277 + * Alternatively, the contents of this file may be used under the terms of
9278 + * either the GNU General Public License Version 2 or later (the "GPL"), or
9279 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
9280 + * in which case the provisions of the GPL or the LGPL are applicable instead
9281 + * of those above. If you wish to allow use of your version of this file only
9282 + * under the terms of either the GPL or the LGPL, and not to allow others to
9283 + * use your version of this file under the terms of the MPL, indicate your
9284 + * decision by deleting the provisions above and replace them with the notice
9285 + * and other provisions required by the GPL or the LGPL. If you do not delete
9286 + * the provisions above, a recipient may use your version of this file under
9287 + * the terms of any one of the MPL, the GPL or the LGPL.
9289 + * ***** END LICENSE BLOCK ***** */
9291 +#include "nsIXFormsAccessors.idl"
9293 +/**
9294 + * Accessors provided by XForms \<range\> controls.
9296 + * @see http://www.w3.org/TR/xforms/slice8.html#ui-range
9297 + */
9298 +[scriptable, uuid(8a6c4540-4c2b-4591-af0e-ef147543eee7)]
9299 +interface nsIXFormsRangeAccessors : nsIXFormsAccessors
9301 + /** The start of the range interval */
9302 + DOMString getRangeStart();
9304 + /** The end of the range interval */
9305 + DOMString getRangeEnd();
9307 + /** The step size */
9308 + DOMString getRangeStep();
9310 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIXFormsSelectChild.idl mozilla.new/extensions/xforms/nsIXFormsSelectChild.idl
9311 --- mozilla/extensions/xforms/nsIXFormsSelectChild.idl 2005-09-02 19:23:35.000000000 +0200
9312 +++ mozilla.new/extensions/xforms/nsIXFormsSelectChild.idl 2006-02-14 10:01:13.000000000 +0100
9313 @@ -52,7 +52,7 @@ class nsStringArray;
9314 * of an XForms select element (choices, item, itemset).
9317 -[scriptable, uuid(a29ac2bd-f36a-451e-99e1-0f3bd94ffbef)]
9318 +[scriptable, uuid(9fac2f59-4ec8-456f-ad06-4e28cd7d5b2c)]
9319 interface nsIXFormsSelectChild : nsISupports
9322 @@ -61,4 +61,11 @@ interface nsIXFormsSelectChild : nsISupp
9323 * this method returns that \<item\>.
9325 nsIDOMNode selectItemByValue(in AString value);
9327 + /*
9328 + * selectItemByNode is used in \<select1\> and \<select\>. If the
9329 + * XFormsSelectChild is or contains an \<item\>, which has a node 'equal' the
9330 + * parameter |aNode|, this method returns the first \<item\> that matches.
9331 + */
9332 + nsIDOMNode selectItemByNode(in nsIDOMNode aNode);
9334 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsIXFormsUIWidget.idl mozilla.new/extensions/xforms/nsIXFormsUIWidget.idl
9335 --- mozilla/extensions/xforms/nsIXFormsUIWidget.idl 2005-06-26 20:30:17.000000000 +0200
9336 +++ mozilla.new/extensions/xforms/nsIXFormsUIWidget.idl 2006-02-14 10:01:13.000000000 +0100
9337 @@ -41,6 +41,10 @@
9340 * Interface implemented by XForms UI widgets.
9342 + * For more information on this interface please see
9343 + * http://developer.mozilla.org/en/docs/XForms:Custom_Controls
9346 [scriptable, uuid(b88a1c27-47a2-4c25-be7c-170501a93643)]
9347 interface nsIXFormsUIWidget : nsIDOMElement
9348 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsAccessors.cpp mozilla.new/extensions/xforms/nsXFormsAccessors.cpp
9349 --- mozilla/extensions/xforms/nsXFormsAccessors.cpp 1970-01-01 01:00:00.000000000 +0100
9350 +++ mozilla.new/extensions/xforms/nsXFormsAccessors.cpp 2006-02-24 11:16:23.000000000 +0100
9351 @@ -0,0 +1,223 @@
9352 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
9353 +/* ***** BEGIN LICENSE BLOCK *****
9354 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9356 + * The contents of this file are subject to the Mozilla Public License Version
9357 + * 1.1 (the "License"); you may not use this file except in compliance with
9358 + * the License. You may obtain a copy of the License at
9359 + * http://www.mozilla.org/MPL/
9361 + * Software distributed under the License is distributed on an "AS IS" basis,
9362 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
9363 + * for the specific language governing rights and limitations under the
9364 + * License.
9366 + * The Original Code is Mozilla XForms support.
9368 + * The Initial Developer of the Original Code is
9369 + * Novell, Inc.
9370 + * Portions created by the Initial Developer are Copyright (C) 2005
9371 + * the Initial Developer. All Rights Reserved.
9373 + * Contributor(s):
9374 + * Allan Beaufour <abeaufour@novell.com>
9375 + * Olli Pettay <Olli.Pettay@helsinki.fi>
9377 + * Alternatively, the contents of this file may be used under the terms of
9378 + * either the GNU General Public License Version 2 or later (the "GPL"), or
9379 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
9380 + * in which case the provisions of the GPL or the LGPL are applicable instead
9381 + * of those above. If you wish to allow use of your version of this file only
9382 + * under the terms of either the GPL or the LGPL, and not to allow others to
9383 + * use your version of this file under the terms of the MPL, indicate your
9384 + * decision by deleting the provisions above and replace them with the notice
9385 + * and other provisions required by the GPL or the LGPL. If you do not delete
9386 + * the provisions above, a recipient may use your version of this file under
9387 + * the terms of any one of the MPL, the GPL or the LGPL.
9389 + * ***** END LICENSE BLOCK ***** */
9391 +#include "nsString.h"
9392 +#include "nsIDOMElement.h"
9393 +#include "nsXFormsUtils.h"
9394 +#include "nsXFormsAccessors.h"
9395 +#include "nsDOMString.h"
9396 +#include "nsIEventStateManager.h"
9397 +#include "nsIContent.h"
9398 +#include "nsIXFormsControl.h"
9400 +NS_IMPL_ISUPPORTS2(nsXFormsAccessors, nsIXFormsAccessors, nsIClassInfo)
9402 +void
9403 +nsXFormsAccessors::Destroy()
9405 + mElement = nsnull;
9406 + mDelegate = nsnull;
9409 +nsresult
9410 +nsXFormsAccessors::GetState(PRInt32 aState, PRBool *aStateVal)
9412 + NS_ENSURE_ARG_POINTER(aStateVal);
9413 + nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
9414 + *aStateVal = (content && (content->IntrinsicState() & aState));
9416 + return NS_OK;
9419 +NS_IMETHODIMP
9420 +nsXFormsAccessors::GetValue(nsAString &aValue)
9422 + if (mDelegate) {
9423 + mDelegate->GetValue(aValue);
9424 + } else {
9425 + SetDOMStringToNull(aValue);
9427 + return NS_OK;
9430 +NS_IMETHODIMP
9431 +nsXFormsAccessors::SetValue(const nsAString & aValue)
9433 + return mDelegate ? mDelegate->SetValue(aValue) : NS_OK;
9436 +NS_IMETHODIMP
9437 +nsXFormsAccessors::HasBoundNode(PRBool *aHasBoundNode)
9439 + NS_ENSURE_ARG_POINTER(aHasBoundNode);
9440 + *aHasBoundNode = PR_FALSE;
9441 + return mDelegate ? mDelegate->GetHasBoundNode(aHasBoundNode) : NS_OK;
9444 +NS_IMETHODIMP
9445 +nsXFormsAccessors::IsReadonly(PRBool *aStateVal)
9447 + return GetState(NS_EVENT_STATE_MOZ_READONLY, aStateVal);
9450 +NS_IMETHODIMP
9451 +nsXFormsAccessors::IsRelevant(PRBool *aStateVal)
9453 + return GetState(NS_EVENT_STATE_ENABLED, aStateVal);
9456 +NS_IMETHODIMP
9457 +nsXFormsAccessors::IsRequired(PRBool *aStateVal)
9459 + return GetState(NS_EVENT_STATE_REQUIRED, aStateVal);
9462 +NS_IMETHODIMP
9463 +nsXFormsAccessors::IsValid(PRBool *aStateVal)
9465 + return GetState(NS_EVENT_STATE_VALID, aStateVal);
9468 +NS_IMETHODIMP
9469 +nsXFormsAccessors::SetContent(nsIDOMNode *aNode, PRBool aForceUpdate)
9471 + NS_ENSURE_STATE(mElement);
9472 + NS_ENSURE_ARG(aNode);
9474 + nsCOMPtr<nsIDOMNode> boundNode;
9475 + nsresult rv = GetBoundNode(getter_AddRefs(boundNode));
9476 + NS_ENSURE_STATE(boundNode);
9478 + nsCOMPtr<nsIModelElementPrivate> modelPriv = nsXFormsUtils::GetModel(mElement);
9479 + NS_ENSURE_STATE(modelPriv);
9481 + PRBool changed;
9482 + rv = modelPriv->SetNodeContent(boundNode, aNode, &changed);
9483 + NS_ENSURE_SUCCESS(rv, rv);
9484 + if (aForceUpdate) {
9485 + nsCOMPtr<nsIDOMNode> model = do_QueryInterface(modelPriv);
9487 + if (model) {
9488 + rv = nsXFormsUtils::DispatchEvent(model, eEvent_Rebuild);
9489 + NS_ENSURE_SUCCESS(rv, rv);
9490 + rv = nsXFormsUtils::DispatchEvent(model, eEvent_Recalculate);
9491 + NS_ENSURE_SUCCESS(rv, rv);
9492 + rv = nsXFormsUtils::DispatchEvent(model, eEvent_Revalidate);
9493 + NS_ENSURE_SUCCESS(rv, rv);
9494 + rv = nsXFormsUtils::DispatchEvent(model, eEvent_Refresh);
9495 + NS_ENSURE_SUCCESS(rv, rv);
9499 + return NS_OK;
9502 +NS_IMETHODIMP
9503 +nsXFormsAccessors::GetBoundNode(nsIDOMNode **aBoundNode)
9505 + NS_ENSURE_ARG_POINTER(aBoundNode);
9506 + if (mDelegate) {
9507 + nsCOMPtr<nsIXFormsControl> control = do_QueryInterface(mDelegate);
9508 + return control->GetBoundNode(aBoundNode);
9510 + return NS_OK;
9513 +// nsIClassInfo implementation
9515 +static const nsIID sScriptingIIDs[] = {
9516 + NS_IXFORMSACCESSORS_IID
9519 +NS_IMETHODIMP
9520 +nsXFormsAccessors::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
9522 + return nsXFormsUtils::CloneScriptingInterfaces(sScriptingIIDs,
9523 + NS_ARRAY_LENGTH(sScriptingIIDs),
9524 + aCount, aArray);
9527 +NS_IMETHODIMP
9528 +nsXFormsAccessors::GetHelperForLanguage(PRUint32 language,
9529 + nsISupports **_retval)
9531 + *_retval = nsnull;
9532 + return NS_OK;
9535 +NS_IMETHODIMP
9536 +nsXFormsAccessors::GetContractID(char * *aContractID)
9538 + *aContractID = nsnull;
9539 + return NS_OK;
9542 +NS_IMETHODIMP
9543 +nsXFormsAccessors::GetClassDescription(char * *aClassDescription)
9545 + *aClassDescription = nsnull;
9546 + return NS_OK;
9549 +NS_IMETHODIMP
9550 +nsXFormsAccessors::GetClassID(nsCID * *aClassID)
9552 + *aClassID = nsnull;
9553 + return NS_OK;
9556 +NS_IMETHODIMP
9557 +nsXFormsAccessors::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
9559 + *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
9560 + return NS_OK;
9563 +NS_IMETHODIMP
9564 +nsXFormsAccessors::GetFlags(PRUint32 *aFlags)
9566 + *aFlags = nsIClassInfo::DOM_OBJECT;
9567 + return NS_OK;
9570 +NS_IMETHODIMP
9571 +nsXFormsAccessors::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
9573 + return NS_ERROR_NOT_AVAILABLE;
9575 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsAccessors.h mozilla.new/extensions/xforms/nsXFormsAccessors.h
9576 --- mozilla/extensions/xforms/nsXFormsAccessors.h 1970-01-01 01:00:00.000000000 +0100
9577 +++ mozilla.new/extensions/xforms/nsXFormsAccessors.h 2006-02-07 16:30:11.000000000 +0100
9578 @@ -0,0 +1,85 @@
9579 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
9580 +/* ***** BEGIN LICENSE BLOCK *****
9581 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9583 + * The contents of this file are subject to the Mozilla Public License Version
9584 + * 1.1 (the "License"); you may not use this file except in compliance with
9585 + * the License. You may obtain a copy of the License at
9586 + * http://www.mozilla.org/MPL/
9588 + * Software distributed under the License is distributed on an "AS IS" basis,
9589 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
9590 + * for the specific language governing rights and limitations under the
9591 + * License.
9593 + * The Original Code is Mozilla XForms support.
9595 + * The Initial Developer of the Original Code is
9596 + * Novell, Inc.
9597 + * Portions created by the Initial Developer are Copyright (C) 2005
9598 + * the Initial Developer. All Rights Reserved.
9600 + * Contributor(s):
9601 + * Allan Beaufour <abeaufour@novell.com>
9603 + * Alternatively, the contents of this file may be used under the terms of
9604 + * either the GNU General Public License Version 2 or later (the "GPL"), or
9605 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
9606 + * in which case the provisions of the GPL or the LGPL are applicable instead
9607 + * of those above. If you wish to allow use of your version of this file only
9608 + * under the terms of either the GPL or the LGPL, and not to allow others to
9609 + * use your version of this file under the terms of the MPL, indicate your
9610 + * decision by deleting the provisions above and replace them with the notice
9611 + * and other provisions required by the GPL or the LGPL. If you do not delete
9612 + * the provisions above, a recipient may use your version of this file under
9613 + * the terms of any one of the MPL, the GPL or the LGPL.
9615 + * ***** END LICENSE BLOCK ***** */
9617 +#ifndef __NSXFORMSACCESSORS_H__
9618 +#define __NSXFORMSACCESSORS_H__
9620 +#include "nsIClassInfo.h"
9621 +#include "nsIXFormsAccessors.h"
9622 +#include "nsIDelegateInternal.h"
9624 +class nsIDOMElement;
9626 +/**
9627 + * Implementation of the nsIXFormsAccessors object. It is always owned by a
9628 + * nsIXFormsDelegate.
9629 + */
9630 +class nsXFormsAccessors : public nsIXFormsAccessors,
9631 + public nsIClassInfo
9633 +public:
9634 + NS_DECL_ISUPPORTS
9635 + NS_DECL_NSICLASSINFO
9636 + NS_DECL_NSIXFORMSACCESSORS
9638 + /** Constructor */
9639 + nsXFormsAccessors(nsIDelegateInternal* aDelegate, nsIDOMElement* aElement)
9640 + : mDelegate(aDelegate), mElement(aElement)
9644 + /** Called by the owning delegate when it itself is destroyed */
9645 + void Destroy();
9647 +protected:
9648 + /**
9649 + * Checks the status of the model item properties
9651 + * @param aState The state to check
9652 + * @para aStateVal The returned state
9653 + */
9654 + nsresult GetState(PRInt32 aState, PRBool *aStateVal);
9656 + /** The delegate owning us */
9657 + nsIDelegateInternal* mDelegate;
9659 + /** The control DOM element */
9660 + nsIDOMElement* mElement;
9663 +#endif
9664 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsAtoms.cpp mozilla.new/extensions/xforms/nsXFormsAtoms.cpp
9665 --- mozilla/extensions/xforms/nsXFormsAtoms.cpp 2005-10-22 16:39:09.000000000 +0200
9666 +++ mozilla.new/extensions/xforms/nsXFormsAtoms.cpp 2006-02-14 10:01:13.000000000 +0100
9667 @@ -61,7 +61,6 @@ nsIAtom *nsXFormsAtoms::incremental;
9668 nsIAtom *nsXFormsAtoms::clazz;
9669 nsIAtom *nsXFormsAtoms::deferredBindListProperty;
9670 nsIAtom *nsXFormsAtoms::readyForBindProperty;
9671 -nsIAtom *nsXFormsAtoms::accesskey;
9672 nsIAtom *nsXFormsAtoms::fatalError;
9673 nsIAtom *nsXFormsAtoms::isInstanceDocument;
9674 nsIAtom *nsXFormsAtoms::instanceDocumentOwner;
9675 @@ -89,7 +88,6 @@ const nsStaticAtom nsXFormsAtoms::Atoms_
9676 { "class", &nsXFormsAtoms::clazz },
9677 { "DeferredBindListProperty", &nsXFormsAtoms::deferredBindListProperty },
9678 { "ReadyForBindProperty", &nsXFormsAtoms::readyForBindProperty },
9679 - { "accesskey", &nsXFormsAtoms::accesskey },
9680 { "fatalError", &nsXFormsAtoms::fatalError },
9681 { "isInstanceDocument", &nsXFormsAtoms::isInstanceDocument },
9682 { "instanceDocumentOwner", &nsXFormsAtoms::instanceDocumentOwner }
9683 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsAtoms.h mozilla.new/extensions/xforms/nsXFormsAtoms.h
9684 --- mozilla/extensions/xforms/nsXFormsAtoms.h 2005-10-22 16:39:09.000000000 +0200
9685 +++ mozilla.new/extensions/xforms/nsXFormsAtoms.h 2006-02-14 10:01:13.000000000 +0100
9686 @@ -69,7 +69,6 @@ class nsXFormsAtoms
9687 static NS_HIDDEN_(nsIAtom *) clazz;
9688 static NS_HIDDEN_(nsIAtom *) deferredBindListProperty;
9689 static NS_HIDDEN_(nsIAtom *) readyForBindProperty;
9690 - static NS_HIDDEN_(nsIAtom *) accesskey;
9691 static NS_HIDDEN_(nsIAtom *) fatalError;
9692 static NS_HIDDEN_(nsIAtom *) isInstanceDocument;
9693 static NS_HIDDEN_(nsIAtom *) instanceDocumentOwner;
9694 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsChoicesElement.cpp mozilla.new/extensions/xforms/nsXFormsChoicesElement.cpp
9695 --- mozilla/extensions/xforms/nsXFormsChoicesElement.cpp 2005-09-02 19:23:35.000000000 +0200
9696 +++ mozilla.new/extensions/xforms/nsXFormsChoicesElement.cpp 2006-02-14 10:01:13.000000000 +0100
9697 @@ -219,6 +219,36 @@ nsXFormsChoicesElement::SelectItemByValu
9698 return NS_OK;
9701 +NS_IMETHODIMP
9702 +nsXFormsChoicesElement::SelectItemByNode(nsIDOMNode *aNode,
9703 + nsIDOMNode **aSelected)
9705 + NS_ENSURE_ARG_POINTER(aSelected);
9706 + NS_ENSURE_STATE(mElement);
9707 + *aSelected = nsnull;
9708 + nsCOMPtr<nsIDOMNodeList> children;
9709 + nsresult rv = mElement->GetChildNodes(getter_AddRefs(children));
9710 + NS_ENSURE_SUCCESS(rv, rv);
9712 + PRUint32 childCount = 0;
9713 + children->GetLength(&childCount);
9715 + nsCOMPtr<nsIDOMNode> childNode;
9716 + nsCOMPtr<nsIXFormsSelectChild> childItem;
9718 + for (PRUint32 i = 0; i < childCount; ++i) {
9719 + children->Item(i, getter_AddRefs(childNode));
9720 + childItem = do_QueryInterface(childNode);
9721 + if (childItem) {
9722 + childItem->SelectItemByNode(aNode, aSelected);
9723 + if (*aSelected)
9724 + return NS_OK;
9728 + return NS_OK;
9731 // internal methods
9733 void
9734 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsContextContainer.cpp mozilla.new/extensions/xforms/nsXFormsContextContainer.cpp
9735 --- mozilla/extensions/xforms/nsXFormsContextContainer.cpp 2005-08-03 20:43:43.000000000 +0200
9736 +++ mozilla.new/extensions/xforms/nsXFormsContextContainer.cpp 2006-02-14 10:01:13.000000000 +0100
9737 @@ -82,9 +82,12 @@ protected:
9738 /** The context size for the element */
9739 PRInt32 mContextSize;
9741 + /** Does this element have the repeat-index? */
9742 + PRBool mHasIndex;
9744 public:
9745 nsXFormsContextContainer()
9746 - : mContextPosition(1), mContextSize(1) {}
9747 + : mContextPosition(1), mContextSize(1), mHasIndex(PR_FALSE) {}
9749 NS_DECL_ISUPPORTS_INHERITED
9751 @@ -260,12 +263,13 @@ NS_IMETHODIMP
9752 nsXFormsContextContainer::SetIndexState(PRBool aHasIndex)
9754 if (mElement) {
9755 - NS_NAMED_LITERAL_STRING(repIndex, "repeat-index");
9756 + mHasIndex = aHasIndex;
9757 + NS_NAMED_LITERAL_STRING(classStr, "class");
9758 if (aHasIndex) {
9759 - mElement->SetAttribute(repIndex,
9760 - NS_LITERAL_STRING("1"));
9761 + mElement->SetAttribute(classStr,
9762 + NS_LITERAL_STRING("xf-repeat-item xf-repeat-index"));
9763 } else {
9764 - mElement->RemoveAttribute(repIndex);
9765 + mElement->SetAttribute(classStr, NS_LITERAL_STRING("xf-repeat-item"));
9768 return NS_OK;
9769 @@ -273,8 +277,10 @@ nsXFormsContextContainer::SetIndexState(
9771 NS_IMETHODIMP
9772 nsXFormsContextContainer::GetIndexState(PRBool *aHasIndex)
9774 - return mElement->HasAttribute(NS_LITERAL_STRING("repeat-index"), aHasIndex);
9776 + NS_ENSURE_ARG(aHasIndex);
9777 + *aHasIndex = mHasIndex;
9778 + return NS_OK;
9781 // Factory
9782 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsControlStub.cpp mozilla.new/extensions/xforms/nsXFormsControlStub.cpp
9783 --- mozilla/extensions/xforms/nsXFormsControlStub.cpp 2005-10-23 18:30:13.000000000 +0200
9784 +++ mozilla.new/extensions/xforms/nsXFormsControlStub.cpp 2006-02-14 10:01:13.000000000 +0100
9785 @@ -46,8 +46,6 @@
9786 #include "nsIDOMKeyEvent.h"
9787 #include "nsIDOMEventTarget.h"
9788 #include "nsIDOMXPathResult.h"
9789 -#include "nsIDOMDocumentView.h"
9790 -#include "nsIDOMAbstractView.h"
9791 #include "nsIXTFXMLVisualWrapper.h"
9792 #include "nsIDocument.h"
9793 #include "nsXFormsModelElement.h"
9794 @@ -55,8 +53,6 @@
9795 #include "nsIFocusController.h"
9796 #include "nsIScriptGlobalObject.h"
9797 #include "nsIServiceManager.h"
9798 -#include "nsIPrefBranch.h"
9799 -#include "nsIPrefService.h"
9800 #include "nsIEventStateManager.h"
9801 #include "nsIContent.h"
9803 @@ -417,68 +413,13 @@ nsXFormsControlStubBase::HandleDefault(n
9804 focusController->MoveFocus(PR_FALSE, nsnull);
9806 } else if (type.EqualsASCII(sXFormsEventsEntries[eEvent_BindingException].name)) {
9807 - *aHandled = HandleBindingException();
9808 + *aHandled = nsXFormsUtils::HandleBindingException(mElement);
9812 return NS_OK;
9815 -PRBool
9816 -nsXFormsControlStubBase::HandleBindingException()
9818 - if (!mElement) {
9819 - return PR_FALSE;
9821 - nsCOMPtr<nsIDOMDocument> doc;
9822 - mElement->GetOwnerDocument(getter_AddRefs(doc));
9824 - nsCOMPtr<nsIDocument> iDoc(do_QueryInterface(doc));
9825 - if (!iDoc) {
9826 - return PR_FALSE;
9829 - // check for fatalError property, enforcing that only one fatal error will
9830 - // be shown to the user
9831 - if (iDoc->GetProperty(nsXFormsAtoms::fatalError)) {
9832 - return PR_FALSE;
9834 - iDoc->SetProperty(nsXFormsAtoms::fatalError, iDoc);
9836 - // Check for preference, disabling this popup
9837 - PRBool disablePopup = PR_FALSE;
9838 - nsresult rv;
9839 - nsCOMPtr<nsIPrefBranch> pref = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
9840 - if (NS_SUCCEEDED(rv) && pref) {
9841 - PRBool val;
9842 - if (NS_SUCCEEDED(pref->GetBoolPref("xforms.disablePopup", &val)))
9843 - disablePopup = val;
9845 - if (disablePopup)
9846 - return PR_FALSE;
9848 - // Get nsIDOMWindowInternal
9849 - nsCOMPtr<nsIDOMDocumentView> dview(do_QueryInterface(doc));
9850 - if (!dview)
9851 - return PR_FALSE;
9853 - nsCOMPtr<nsIDOMAbstractView> aview;
9854 - dview->GetDefaultView(getter_AddRefs(aview));
9856 - nsCOMPtr<nsIDOMWindowInternal> internal(do_QueryInterface(aview));
9857 - if (!internal)
9858 - return PR_FALSE;
9860 - // Show popup
9861 - nsCOMPtr<nsIDOMWindow> messageWindow;
9862 - rv = internal->OpenDialog(NS_LITERAL_STRING("chrome://xforms/content/bindingex.xul"),
9863 - NS_LITERAL_STRING("XFormsBindingException"),
9864 - NS_LITERAL_STRING("modal,dialog,chrome,dependent"),
9865 - nsnull, getter_AddRefs(messageWindow));
9866 - return NS_SUCCEEDED(rv);
9870 #ifdef DEBUG_smaug
9871 static nsVoidArray* sControlList = nsnull;
9872 class ControlDebug
9873 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsControlStub.h mozilla.new/extensions/xforms/nsXFormsControlStub.h
9874 --- mozilla/extensions/xforms/nsXFormsControlStub.h 2005-10-23 18:30:13.000000000 +0200
9875 +++ mozilla.new/extensions/xforms/nsXFormsControlStub.h 2006-02-14 10:01:13.000000000 +0100
9876 @@ -222,16 +222,6 @@ protected:
9878 /** Removes the index change event listeners */
9879 void RemoveIndexListeners();
9881 - /**
9882 - * Shows an error dialog for the user the first time an
9883 - * xforms-binding-exception event is received by the control.
9885 - * The dialog can be disabled via the |xforms.disablePopup| preference.
9887 - * @return Whether handling was successful
9888 - */
9889 - PRBool HandleBindingException();
9893 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsCopyElement.cpp mozilla.new/extensions/xforms/nsXFormsCopyElement.cpp
9894 --- mozilla/extensions/xforms/nsXFormsCopyElement.cpp 1970-01-01 01:00:00.000000000 +0100
9895 +++ mozilla.new/extensions/xforms/nsXFormsCopyElement.cpp 2006-02-07 16:30:11.000000000 +0100
9896 @@ -0,0 +1,191 @@
9897 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
9898 +/* ***** BEGIN LICENSE BLOCK *****
9899 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9901 + * The contents of this file are subject to the Mozilla Public License Version
9902 + * 1.1 (the "License"); you may not use this file except in compliance with
9903 + * the License. You may obtain a copy of the License at
9904 + * http://www.mozilla.org/MPL/
9906 + * Software distributed under the License is distributed on an "AS IS" basis,
9907 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
9908 + * for the specific language governing rights and limitations under the
9909 + * License.
9911 + * The Original Code is Mozilla XForms support.
9913 + * The Initial Developer of the Original Code is
9914 + * IBM Corporation.
9915 + * Portions created by the Initial Developer are Copyright (C) 2005
9916 + * the Initial Developer. All Rights Reserved.
9918 + * Contributor(s):
9919 + * Aaron Reed <aaronr@us.ibm.com>
9921 + * Alternatively, the contents of this file may be used under the terms of
9922 + * either the GNU General Public License Version 2 or later (the "GPL"), or
9923 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
9924 + * in which case the provisions of the GPL or the LGPL are applicable instead
9925 + * of those above. If you wish to allow use of your version of this file only
9926 + * under the terms of either the GPL or the LGPL, and not to allow others to
9927 + * use your version of this file under the terms of the MPL, indicate your
9928 + * decision by deleting the provisions above and replace them with the notice
9929 + * and other provisions required by the GPL or the LGPL. If you do not delete
9930 + * the provisions above, a recipient may use your version of this file under
9931 + * the terms of any one of the MPL, the GPL or the LGPL.
9933 + * ***** END LICENSE BLOCK ***** */
9935 +#include "nsIXFormsCopyElement.h"
9936 +#include "nsXFormsStubElement.h"
9937 +#include "nsIXTFGenericElementWrapper.h"
9938 +#include "nsXFormsUtils.h"
9939 +#include "nsIDOMElement.h"
9940 +#include "nsString.h"
9941 +#include "nsIXFormsItemElement.h"
9943 +/**
9944 + * Implementation of the XForms \<copy\> element.
9946 + * @note The copy element does not display any content, it simply provides
9947 + * a node to be copied to instance data when the containing XForms item
9948 + * element is selected.
9949 + */
9951 +class nsXFormsCopyElement : public nsXFormsStubElement,
9952 + public nsIXFormsCopyElement
9954 +public:
9955 + nsXFormsCopyElement() : mElement(nsnull) {}
9957 + NS_DECL_ISUPPORTS_INHERITED
9959 + // nsIXTFGenericElement overrides
9960 + NS_IMETHOD OnCreated(nsIXTFGenericElementWrapper *aWrapper);
9962 + // nsIXTFElement overrides
9963 + NS_IMETHOD ParentChanged(nsIDOMElement *aNewParent);
9964 + NS_IMETHOD DocumentChanged(nsIDOMDocument *aNewParent);
9966 + // nsIXFormsCopyElement
9967 + NS_DECL_NSIXFORMSCOPYELEMENT
9969 +private:
9970 + nsIDOMElement *mElement;
9973 +NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsCopyElement,
9974 + nsXFormsStubElement,
9975 + nsIXFormsCopyElement)
9977 +NS_IMETHODIMP
9978 +nsXFormsCopyElement::OnCreated(nsIXTFGenericElementWrapper *aWrapper)
9980 + aWrapper->SetNotificationMask(nsIXTFElement::NOTIFY_PARENT_CHANGED |
9981 + nsIXTFElement::NOTIFY_DOCUMENT_CHANGED);
9983 + nsCOMPtr<nsIDOMElement> node;
9984 + aWrapper->GetElementNode(getter_AddRefs(node));
9986 + // It's ok to keep pointer to mElement. mElement will have an
9987 + // owning reference to this object, so as long as we null out mElement in
9988 + // OnDestroyed, it will always be valid.
9990 + mElement = node;
9991 + NS_ASSERTION(mElement, "Wrapper is not an nsIDOMElement, we'll crash soon");
9993 + return NS_OK;
9996 +// nsIXTFElement
9998 +NS_IMETHODIMP
9999 +nsXFormsCopyElement::ParentChanged(nsIDOMElement *aNewParent)
10001 + if (aNewParent) {
10002 + if (!nsXFormsUtils::IsXFormsElement(aNewParent,
10003 + NS_LITERAL_STRING("itemset")) &&
10004 + !nsXFormsUtils::IsXFormsElement(aNewParent,
10005 + NS_LITERAL_STRING("contextcontainer"))) {
10007 + // parent of a copy element must always be an itemset. We really can't
10008 + // enforce this all that well until we have full schema support but for
10009 + // now we'll at least warn the author. We are also checking for
10010 + // contextcontainer because under Mozilla, the children of an itemset
10011 + // element are cloned underneath a contextcontainer which is in turn
10012 + // contained in a nsXFormsItemElement. Each such item element is then
10013 + // appended as anonymous content of the itemset.
10014 + nsXFormsUtils::ReportError(NS_LITERAL_STRING("copyError"), mElement);
10017 + return NS_OK;
10020 +NS_IMETHODIMP
10021 +nsXFormsCopyElement::DocumentChanged(nsIDOMDocument* aNewDocument)
10023 + if (!aNewDocument)
10024 + return NS_OK;
10026 + // tell grandparent (xf:item) that it contains a xf:copy element and
10027 + // not a xf:value element.
10028 + nsCOMPtr<nsIDOMNode> contextContainer;
10029 + nsresult rv = mElement->GetParentNode(getter_AddRefs(contextContainer));
10030 + NS_ENSURE_TRUE(contextContainer, rv);
10032 + nsCOMPtr<nsIDOMNode> itemNode;
10033 + rv = contextContainer->GetParentNode(getter_AddRefs(itemNode));
10034 + NS_ENSURE_TRUE(itemNode, rv);
10036 + nsCOMPtr<nsIXFormsItemElement> item = do_QueryInterface(itemNode);
10038 + // It is possible that the grandparent ISN'T an xf:item, if this is the
10039 + // original template copy element whose parent is the xf:itemset and
10040 + // grandparent is the xf:select. We'll ignore a copy element in that case
10041 + // since it really isn't in play.
10042 + if (item) {
10043 + item->SetIsCopyItem(PR_TRUE);
10045 + return NS_OK;
10048 +// nsIXFormsCopyElement
10050 +NS_IMETHODIMP
10051 +nsXFormsCopyElement::GetCopyNode(nsIDOMNode **aNode)
10053 + NS_ENSURE_ARG_POINTER(aNode);
10054 + *aNode = nsnull;
10056 + nsCOMPtr<nsIModelElementPrivate> model;
10057 + nsCOMPtr<nsIDOMXPathResult> result;
10058 + nsresult rv =
10059 + nsXFormsUtils::EvaluateNodeBinding(mElement,
10060 + nsXFormsUtils::ELEMENT_WITH_MODEL_ATTR,
10061 + NS_LITERAL_STRING("ref"), EmptyString(),
10062 + nsIDOMXPathResult::FIRST_ORDERED_NODE_TYPE,
10063 + getter_AddRefs(model),
10064 + getter_AddRefs(result));
10066 + NS_ENSURE_SUCCESS(rv, rv);
10068 + if (result) {
10069 + nsCOMPtr<nsIDOMNode> singleNode;
10070 + result->GetSingleNodeValue(getter_AddRefs(singleNode));
10072 + NS_IF_ADDREF(*aNode = singleNode);
10075 + return NS_OK;
10078 +NS_HIDDEN_(nsresult)
10079 +NS_NewXFormsCopyElement(nsIXTFElement **aResult)
10081 + *aResult = new nsXFormsCopyElement();
10082 + if (!*aResult)
10083 + return NS_ERROR_OUT_OF_MEMORY;
10085 + NS_ADDREF(*aResult);
10086 + return NS_OK;
10088 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsDelegateStub.cpp mozilla.new/extensions/xforms/nsXFormsDelegateStub.cpp
10089 --- mozilla/extensions/xforms/nsXFormsDelegateStub.cpp 2005-10-22 17:24:19.000000000 +0200
10090 +++ mozilla.new/extensions/xforms/nsXFormsDelegateStub.cpp 2006-02-14 10:01:13.000000000 +0100
10091 @@ -54,11 +54,10 @@
10092 #include "nsXFormsUtils.h"
10093 #include "nsIServiceManager.h"
10094 #include "nsXFormsModelElement.h"
10095 -#include "nsIContent.h"
10096 -#include "nsIEventStateManager.h"
10098 -NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsDelegateStub,
10099 +NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsDelegateStub,
10100 nsXFormsBindableControlStub,
10101 + nsIDelegateInternal,
10102 nsIXFormsDelegate)
10105 @@ -91,6 +90,9 @@ NS_IMETHODIMP
10106 nsXFormsDelegateStub::OnDestroyed()
10108 nsXFormsModelElement::CancelPostRefresh(this);
10109 + if (mAccessor) {
10110 + mAccessor->Destroy();
10112 return nsXFormsBindableControlStub::OnDestroyed();
10115 @@ -169,48 +171,19 @@ nsXFormsDelegateStub::SetValue(const nsA
10116 return NS_OK;
10119 -nsresult
10120 -nsXFormsDelegateStub::GetState(PRInt32 aState, PRBool *aStateVal)
10122 - NS_ENSURE_ARG_POINTER(aStateVal);
10123 - *aStateVal = PR_FALSE;
10124 - nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
10125 - if (content && (content->IntrinsicState() & aState)) {
10126 - *aStateVal = PR_TRUE;
10127 - }
10128 - return NS_OK;
10131 -// XXXbeaufour search for "enabled", "disabled", HasAttribute() and SetAttribute()
10133 -NS_IMETHODIMP
10134 -nsXFormsDelegateStub::GetIsReadonly(PRBool *aStateVal)
10136 - return GetState(NS_EVENT_STATE_MOZ_READONLY, aStateVal);
10139 -NS_IMETHODIMP
10140 -nsXFormsDelegateStub::GetIsEnabled(PRBool *aStateVal)
10142 - return GetState(NS_EVENT_STATE_ENABLED, aStateVal);
10145 NS_IMETHODIMP
10146 -nsXFormsDelegateStub::GetIsRequired(PRBool *aStateVal)
10148 - return GetState(NS_EVENT_STATE_REQUIRED, aStateVal);
10151 -NS_IMETHODIMP
10152 -nsXFormsDelegateStub::GetIsValid(PRBool *aStateVal)
10153 +nsXFormsDelegateStub::GetHasBoundNode(PRBool *aHasBoundNode)
10155 - return GetState(NS_EVENT_STATE_VALID, aStateVal);
10156 + NS_ENSURE_ARG_POINTER(aHasBoundNode);
10157 + *aHasBoundNode = mBoundNode ? PR_TRUE : PR_FALSE;
10158 + return NS_OK;
10161 NS_IMETHODIMP
10162 -nsXFormsDelegateStub::GetHasBoundNode(PRBool *aHasBoundNode)
10163 +nsXFormsDelegateStub::ReportError(const nsAString& aErrorMsg)
10165 - *aHasBoundNode = mBoundNode ? PR_TRUE : PR_FALSE;
10166 + const nsPromiseFlatString& flat = PromiseFlatString(aErrorMsg);
10167 + nsXFormsUtils::ReportError(flat, mElement);
10168 return NS_OK;
10171 @@ -223,6 +196,8 @@ nsXFormsDelegateStub::WidgetAttached()
10172 return NS_OK;
10175 +// nsXFormsDelegateStub
10177 nsRepeatState
10178 nsXFormsDelegateStub::UpdateRepeatState()
10180 @@ -265,3 +240,16 @@ nsXFormsDelegateStub::SetMozTypeAttribut
10181 mElement->RemoveAttributeNS(mozTypeNs, mozType);
10185 +NS_IMETHODIMP
10186 +nsXFormsDelegateStub::GetXFormsAccessors(nsIXFormsAccessors **aAccessor)
10188 + if (!mAccessor) {
10189 + mAccessor = new nsXFormsAccessors(this, mElement);
10190 + if (!mAccessor) {
10191 + return NS_ERROR_OUT_OF_MEMORY;
10194 + NS_ADDREF(*aAccessor = mAccessor);
10195 + return NS_OK;
10197 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsDelegateStub.h mozilla.new/extensions/xforms/nsXFormsDelegateStub.h
10198 --- mozilla/extensions/xforms/nsXFormsDelegateStub.h 2005-10-22 17:24:19.000000000 +0200
10199 +++ mozilla.new/extensions/xforms/nsXFormsDelegateStub.h 2006-02-14 10:01:13.000000000 +0100
10200 @@ -40,12 +40,14 @@
10201 #ifndef __NSXFORMSDELEGATESTUB_H__
10202 #define __NSXFORMSDELEGATESTUB_H__
10204 +#include "nsAutoPtr.h"
10205 #include "nsCOMPtr.h"
10206 #include "nsString.h"
10207 #include "nsIDOMElement.h"
10208 -#include "nsIXFormsDelegate.h"
10209 +#include "nsIDelegateInternal.h"
10210 #include "nsXFormsControlStub.h"
10211 #include "nsIXFormsUIWidget.h"
10212 +#include "nsXFormsAccessors.h"
10214 class nsIAtom;
10216 @@ -65,11 +67,12 @@ enum nsRepeatState {
10217 * Stub implementation of the nsIXFormsDelegate interface.
10219 class nsXFormsDelegateStub : public nsXFormsBindableControlStub,
10220 - public nsIXFormsDelegate
10221 + public nsIDelegateInternal
10223 public:
10224 NS_DECL_ISUPPORTS_INHERITED
10225 NS_DECL_NSIXFORMSDELEGATE
10226 + NS_DECL_NSIDELEGATEINTERNAL
10228 NS_IMETHOD OnCreated(nsIXTFBindableElementWrapper *aWrapper);
10229 NS_IMETHOD OnDestroyed();
10230 @@ -96,9 +99,6 @@ public:
10231 : mControlType(aType), mRepeatState(eType_Unknown) {}
10233 protected:
10234 - // Checks the status of the model item properties.
10235 - nsresult GetState(PRInt32 aState, PRBool *aStateVal);
10237 // This is called when XBL widget is attached to the XForms control.
10238 // It checks the ancestors of the element and returns an nsRepeatState
10239 // depending on the elements place in the document.
10240 @@ -110,6 +110,9 @@ protected:
10242 nsString mControlType;
10243 nsRepeatState mRepeatState;
10245 + /** The accessors object for this delegate */
10246 + nsRefPtr<nsXFormsAccessors> mAccessor;
10249 #endif
10250 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsElementFactory.cpp mozilla.new/extensions/xforms/nsXFormsElementFactory.cpp
10251 --- mozilla/extensions/xforms/nsXFormsElementFactory.cpp 2005-10-22 16:39:09.000000000 +0200
10252 +++ mozilla.new/extensions/xforms/nsXFormsElementFactory.cpp 2006-02-14 10:01:13.000000000 +0100
10253 @@ -72,6 +72,8 @@ NS_HIDDEN_(nsresult) NS_NewXFormsItemEle
10254 NS_HIDDEN_(nsresult) NS_NewXFormsValueElement(nsIXTFElement **aElement);
10255 NS_HIDDEN_(nsresult) NS_NewXFormsChoicesElement(nsIXTFElement **aElement);
10256 NS_HIDDEN_(nsresult) NS_NewXFormsItemSetElement(nsIXTFElement **aElement);
10257 +NS_HIDDEN_(nsresult) NS_NewXFormsRangeElement(nsIXTFElement **aElement);
10258 +NS_HIDDEN_(nsresult) NS_NewXFormsCopyElement(nsIXTFElement **aElement);
10260 //Action Module Elements
10261 NS_HIDDEN_(nsresult) NS_NewXFormsDispatchElement(nsIXTFElement **aResult);
10262 @@ -188,6 +190,10 @@ nsXFormsElementFactory::CreateElement(co
10263 return NS_NewXFormsSwitchElement(aElement);
10264 if (aTagName.EqualsLiteral("upload"))
10265 return NS_NewXFormsUploadElement(aElement);
10266 + if (aTagName.EqualsLiteral("range"))
10267 + return NS_NewXFormsRangeElement(aElement);
10268 + if (aTagName.EqualsLiteral("copy"))
10269 + return NS_NewXFormsCopyElement(aElement);
10271 *aElement = nsnull;
10272 return NS_ERROR_FAILURE;
10273 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsInsertDeleteElement.cpp mozilla.new/extensions/xforms/nsXFormsInsertDeleteElement.cpp
10274 --- mozilla/extensions/xforms/nsXFormsInsertDeleteElement.cpp 2005-10-22 16:39:09.000000000 +0200
10275 +++ mozilla.new/extensions/xforms/nsXFormsInsertDeleteElement.cpp 2006-02-14 10:01:13.000000000 +0100
10276 @@ -12,6 +12,8 @@
10277 * for the specific language governing rights and limitations under the
10278 * License.
10280 + * The Original Code is XForms code.
10282 * The Initial Developer of the Original Code is
10283 * Novell, Inc.
10284 * Portions created by the Initial Developer are Copyright (C) 2005
10285 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsInstanceElement.cpp mozilla.new/extensions/xforms/nsXFormsInstanceElement.cpp
10286 --- mozilla/extensions/xforms/nsXFormsInstanceElement.cpp 2005-10-22 16:39:09.000000000 +0200
10287 +++ mozilla.new/extensions/xforms/nsXFormsInstanceElement.cpp 2006-02-14 10:01:13.000000000 +0100
10288 @@ -63,7 +63,7 @@ NS_IMPL_ISUPPORTS_INHERITED5(nsXFormsIns
10290 nsXFormsInstanceElement::nsXFormsInstanceElement()
10291 : mElement(nsnull)
10292 - , mAddingChildren(PR_FALSE)
10293 + , mInitialized(PR_FALSE)
10294 , mLazy(PR_FALSE)
10297 @@ -87,7 +87,7 @@ NS_IMETHODIMP
10298 nsXFormsInstanceElement::AttributeSet(nsIAtom *aName,
10299 const nsAString &aNewValue)
10301 - if (mAddingChildren || mLazy)
10302 + if (!mInitialized || mLazy)
10303 return NS_OK;
10305 if (aName == nsXFormsAtoms::src) {
10306 @@ -100,7 +100,7 @@ nsXFormsInstanceElement::AttributeSet(ns
10307 NS_IMETHODIMP
10308 nsXFormsInstanceElement::AttributeRemoved(nsIAtom *aName)
10310 - if (mAddingChildren || mLazy)
10311 + if (!mInitialized || mLazy)
10312 return NS_OK;
10314 if (aName == nsXFormsAtoms::src) {
10315 @@ -136,50 +136,10 @@ nsXFormsInstanceElement::AttributeRemove
10318 NS_IMETHODIMP
10319 -nsXFormsInstanceElement::BeginAddingChildren()
10321 - mAddingChildren = PR_TRUE;
10322 - return NS_OK;
10325 -NS_IMETHODIMP
10326 -nsXFormsInstanceElement::DoneAddingChildren()
10329 - mElement->HasAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_MOZ_XFORMS_LAZY),
10330 - NS_LITERAL_STRING("lazy"), &mLazy);
10331 - if (!mLazy) {
10332 - nsCOMPtr<nsIModelElementPrivate> model = GetModel();
10333 - NS_ENSURE_TRUE(model, NS_ERROR_FAILURE);
10334 - model->AddInstanceElement(this);
10336 - // By the time this is called, we should be inserted in the document and
10337 - // have all of our child elements, so this is our first opportunity to
10338 - // create the instance document.
10340 - nsAutoString src;
10341 - mElement->GetAttribute(NS_LITERAL_STRING("src"), src);
10343 - if (src.IsEmpty()) {
10344 - // If we don't have a linked external instance, use our inline data.
10345 - CloneInlineInstance();
10346 - } else {
10347 - LoadExternalInstance(src);
10351 - mAddingChildren = PR_FALSE;
10352 - return NS_OK;
10355 -NS_IMETHODIMP
10356 nsXFormsInstanceElement::OnCreated(nsIXTFGenericElementWrapper *aWrapper)
10358 aWrapper->SetNotificationMask(nsIXTFElement::NOTIFY_ATTRIBUTE_SET |
10359 - nsIXTFElement::NOTIFY_ATTRIBUTE_REMOVED |
10360 - nsIXTFElement::NOTIFY_PARENT_CHANGED |
10361 - nsIXTFElement::NOTIFY_BEGIN_ADDING_CHILDREN |
10362 - nsIXTFElement::NOTIFY_DONE_ADDING_CHILDREN);
10363 + nsIXTFElement::NOTIFY_ATTRIBUTE_REMOVED);
10365 nsCOMPtr<nsIDOMElement> node;
10366 aWrapper->GetElementNode(getter_AddRefs(node));
10367 @@ -194,22 +154,6 @@ nsXFormsInstanceElement::OnCreated(nsIXT
10368 return NS_OK;
10371 -NS_IMETHODIMP
10372 -nsXFormsInstanceElement::ParentChanged(nsIDOMElement *aNewParent)
10374 - if (!aNewParent || mAddingChildren || mLazy)
10375 - return NS_OK;
10377 - // Once we are set up in the DOM, can find the model and make sure that this
10378 - // instance is on the list of instance elements that model keeps
10379 - nsCOMPtr<nsIModelElementPrivate> model = GetModel();
10380 - if (model) {
10381 - model->AddInstanceElement(this);
10384 - return NS_OK;
10387 // nsIInterfaceRequestor
10389 NS_IMETHODIMP
10390 @@ -239,7 +183,7 @@ nsXFormsInstanceElement::OnChannelRedire
10391 nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
10392 NS_ENSURE_STATE(doc);
10394 - if (!nsXFormsUtils::CheckSameOrigin(doc->GetDocumentURI(), newURI)) {
10395 + if (!nsXFormsUtils::CheckSameOrigin(doc, newURI)) {
10396 nsXFormsUtils::ReportError(NS_LITERAL_STRING("instanceLoadOrigin"), domDoc);
10397 return NS_ERROR_ABORT;
10399 @@ -445,48 +389,73 @@ nsXFormsInstanceElement::GetElement(nsID
10402 NS_IMETHODIMP
10403 -nsXFormsInstanceElement::InitializeLazyInstance()
10404 +nsXFormsInstanceElement::Initialize()
10406 - NS_ENSURE_STATE(mElement);
10407 - if (!mLazy) {
10408 - mElement->HasAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_MOZ_XFORMS_LAZY),
10409 - NS_LITERAL_STRING("lazy"), &mLazy);
10410 + if (mInitialized || !mElement) {
10411 + return NS_OK;
10414 - NS_ENSURE_STATE(mLazy);
10416 - nsCOMPtr<nsIDOMDocument> domDoc;
10417 - mElement->GetOwnerDocument(getter_AddRefs(domDoc));
10418 - NS_ENSURE_STATE(domDoc);
10419 + mInitialized = PR_TRUE;
10421 - nsCOMPtr<nsIDOMDOMImplementation> domImpl;
10422 - nsresult rv = domDoc->GetImplementation(getter_AddRefs(domImpl));
10423 - NS_ENSURE_SUCCESS(rv, rv);
10425 - nsCOMPtr<nsIDOMDocument> newDoc;
10426 - rv = domImpl->CreateDocument(EmptyString(), EmptyString(), nsnull,
10427 - getter_AddRefs(newDoc));
10428 - NS_ENSURE_SUCCESS(rv, rv);
10429 + nsCOMPtr<nsIModelElementPrivate> model = GetModel();
10430 + NS_ENSURE_TRUE(model, NS_ERROR_FAILURE);
10431 + model->AddInstanceElement(this);
10433 - rv = SetDocument(newDoc);
10434 - NS_ENSURE_SUCCESS(rv, rv);
10435 + mElement->HasAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_MOZ_XFORMS_LAZY),
10436 + NS_LITERAL_STRING("lazy"), &mLazy);
10438 - // Lazy authored instance documents have a root named "instanceData"
10439 - nsCOMPtr<nsIDOMElement> instanceDataElement;
10440 - nsCOMPtr<nsIDOMNode> childReturn;
10441 - rv = mDocument->CreateElementNS(EmptyString(),
10442 - NS_LITERAL_STRING("instanceData"),
10443 - getter_AddRefs(instanceDataElement));
10444 - NS_ENSURE_SUCCESS(rv, rv);
10445 - rv = mDocument->AppendChild(instanceDataElement, getter_AddRefs(childReturn));
10446 - NS_ENSURE_SUCCESS(rv, rv);
10447 + // Lazy instance
10448 + if (mLazy) {
10449 + nsCOMPtr<nsIDOMDocument> domDoc;
10450 + mElement->GetOwnerDocument(getter_AddRefs(domDoc));
10451 + NS_ENSURE_STATE(domDoc);
10453 + nsCOMPtr<nsIDOMDOMImplementation> domImpl;
10454 + nsresult rv = domDoc->GetImplementation(getter_AddRefs(domImpl));
10455 + NS_ENSURE_SUCCESS(rv, rv);
10457 + nsCOMPtr<nsIDOMDocument> newDoc;
10458 + rv = domImpl->CreateDocument(EmptyString(), EmptyString(), nsnull,
10459 + getter_AddRefs(newDoc));
10460 + NS_ENSURE_SUCCESS(rv, rv);
10462 + rv = SetDocument(newDoc);
10463 + NS_ENSURE_SUCCESS(rv, rv);
10465 + // Lazy authored instance documents have a root named "instanceData"
10466 + nsCOMPtr<nsIDOMElement> instanceDataElement;
10467 + nsCOMPtr<nsIDOMNode> childReturn;
10468 + rv = mDocument->CreateElementNS(EmptyString(),
10469 + NS_LITERAL_STRING("instanceData"),
10470 + getter_AddRefs(instanceDataElement));
10471 + NS_ENSURE_SUCCESS(rv, rv);
10472 + rv = mDocument->AppendChild(instanceDataElement, getter_AddRefs(childReturn));
10473 + NS_ENSURE_SUCCESS(rv, rv);
10475 + // I don't know if not being able to create a backup document is worth
10476 + // failing this function. Since it probably won't be used often, we'll
10477 + // let it slide. But it probably does mean that things are going south
10478 + // with the browser.
10479 + domImpl->CreateDocument(EmptyString(), EmptyString(), nsnull,
10480 + getter_AddRefs(mOriginalDocument));
10481 + NS_WARN_IF_FALSE(mOriginalDocument, "Couldn't create mOriginalDocument!!");
10482 + } else {
10483 + // Normal instance
10485 - // I don't know if not being able to create a backup document is worth
10486 - // failing this function. Since it probably won't be used often, we'll
10487 - // let it slide. But it probably does mean that things are going south
10488 - // with the browser.
10489 - domImpl->CreateDocument(EmptyString(), EmptyString(), nsnull,
10490 - getter_AddRefs(mOriginalDocument));
10491 + // By the time this is called, we should be inserted in the document and
10492 + // have all of our child elements, so this is our first opportunity to
10493 + // create the instance document.
10495 + nsAutoString src;
10496 + mElement->GetAttribute(NS_LITERAL_STRING("src"), src);
10498 + if (src.IsEmpty()) {
10499 + // If we don't have a linked external instance, use our inline data.
10500 + CloneInlineInstance();
10501 + } else {
10502 + LoadExternalInstance(src);
10506 return NS_OK;
10508 @@ -568,7 +537,7 @@ nsXFormsInstanceElement::LoadExternalIns
10509 NS_NewURI(getter_AddRefs(uri), aSrc,
10510 doc->GetDocumentCharacterSet().get(), doc->GetDocumentURI());
10511 if (uri) {
10512 - if (nsXFormsUtils::CheckSameOrigin(doc->GetDocumentURI(), uri)) {
10513 + if (nsXFormsUtils::CheckSameOrigin(doc, uri)) {
10514 nsCOMPtr<nsILoadGroup> loadGroup;
10515 loadGroup = doc->GetDocumentLoadGroup();
10516 NS_WARN_IF_FALSE(loadGroup, "No load group!");
10517 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsInstanceElement.h mozilla.new/extensions/xforms/nsXFormsInstanceElement.h
10518 --- mozilla/extensions/xforms/nsXFormsInstanceElement.h 2005-10-22 16:39:09.000000000 +0200
10519 +++ mozilla.new/extensions/xforms/nsXFormsInstanceElement.h 2006-02-14 10:01:13.000000000 +0100
10520 @@ -75,10 +75,7 @@ public:
10521 NS_IMETHOD OnDestroyed();
10522 NS_IMETHOD AttributeSet(nsIAtom *aName, const nsAString &aNewValue);
10523 NS_IMETHOD AttributeRemoved(nsIAtom *aName);
10524 - NS_IMETHOD BeginAddingChildren();
10525 - NS_IMETHOD DoneAddingChildren();
10526 NS_IMETHOD OnCreated(nsIXTFGenericElementWrapper *aWrapper);
10527 - NS_IMETHOD ParentChanged(nsIDOMElement *aNewParent);
10529 nsXFormsInstanceElement() NS_HIDDEN;
10531 @@ -92,7 +89,7 @@ private:
10532 nsCOMPtr<nsIDOMDocument> mOriginalDocument;
10533 nsIDOMElement *mElement;
10534 nsCOMPtr<nsIStreamListener> mListener;
10535 - PRBool mAddingChildren;
10536 + PRBool mInitialized;
10537 PRBool mLazy;
10538 nsCOMPtr<nsIChannel> mChannel;
10540 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsItemElement.cpp mozilla.new/extensions/xforms/nsXFormsItemElement.cpp
10541 --- mozilla/extensions/xforms/nsXFormsItemElement.cpp 2005-10-24 22:55:46.000000000 +0200
10542 +++ mozilla.new/extensions/xforms/nsXFormsItemElement.cpp 2006-02-14 10:01:13.000000000 +0100
10543 @@ -56,6 +56,8 @@
10544 #include "nsIXFormsLabelElement.h"
10545 #include "nsIDocument.h"
10546 #include "nsXFormsModelElement.h"
10547 +#include "nsIXFormsCopyElement.h"
10548 +#include "nsIDOMEventTarget.h"
10551 * nsXFormsItemElement implements the XForms \<item\> element.
10552 @@ -69,7 +71,8 @@ class nsXFormsItemElement : public nsXFo
10553 public nsIXFormsItemElement
10555 public:
10556 - nsXFormsItemElement() : mElement(nsnull), mDoneAddingChildren(PR_FALSE)
10557 + nsXFormsItemElement() : mElement(nsnull), mDoneAddingChildren(PR_FALSE),
10558 + mIsCopyItem(PR_FALSE)
10562 @@ -95,6 +98,10 @@ private:
10563 nsIDOMElement* mElement;
10564 PRBool mDoneAddingChildren;
10566 + // If true, indicates that this item contains a xf:copy element (via
10567 + // xf:itemset) rather than a xf:value element
10568 + PRBool mIsCopyItem;
10570 // context node (used by itemset in select)
10571 nsCOMPtr<nsIDOMElement> mContextNode;
10573 @@ -222,12 +229,50 @@ nsXFormsItemElement::SelectItemByValue(c
10575 NS_ENSURE_ARG_POINTER(aSelected);
10576 NS_ENSURE_STATE(mElement);
10578 + *aSelected = nsnull;
10579 + if (mIsCopyItem) {
10580 + // copy items are selected by node, not by value
10581 + return NS_OK;
10584 nsAutoString value;
10585 - GetValue(value);
10586 - if (aValue.Equals(value)) {
10587 + nsresult rv = GetValue(value);
10589 + if (NS_SUCCEEDED(rv) && aValue.Equals(value)) {
10590 + NS_ADDREF(*aSelected = mElement);
10593 + return rv;
10596 +NS_IMETHODIMP
10597 +nsXFormsItemElement::SelectItemByNode(nsIDOMNode *aNode, nsIDOMNode **aSelected)
10599 + NS_ENSURE_ARG_POINTER(aSelected);
10600 + NS_ENSURE_STATE(mElement);
10601 + PRBool isCopyItem;
10602 + *aSelected = nsnull;
10604 + // If this item doesn't contain a copy element but instead has a value
10605 + // element, then there is no sense testing further.
10606 + GetIsCopyItem(&isCopyItem);
10607 + if (!isCopyItem) {
10608 + return NS_ERROR_FAILURE;
10611 + nsCOMPtr<nsIDOMNode> copyNode;
10612 + GetCopyNode(getter_AddRefs(copyNode));
10613 + NS_ENSURE_STATE(copyNode);
10615 + PRUint16 nodeType;
10616 + copyNode->GetNodeType(&nodeType);
10618 + // copy elements are only allowed to bind to ELEMENT_NODEs per spec. But
10619 + // test first before doing all of this work.
10620 + if ((nodeType == nsIDOMNode::ELEMENT_NODE) &&
10621 + (nsXFormsUtils::AreNodesEqual(copyNode, aNode))) {
10622 NS_ADDREF(*aSelected = mElement);
10623 - } else {
10624 - *aSelected = nsnull;
10627 return NS_OK;
10628 @@ -236,7 +281,16 @@ nsXFormsItemElement::SelectItemByValue(c
10629 NS_IMETHODIMP
10630 nsXFormsItemElement::GetValue(nsAString &aValue)
10633 + PRBool isCopyItem;
10634 + GetIsCopyItem(&isCopyItem);
10635 + if (isCopyItem) {
10636 + // if this item was built by an itemset and the itemset's template used
10637 + // a copy element, then there is no value element to be had. No sense
10638 + // continuing.
10639 + aValue.Truncate(0);
10640 + return NS_ERROR_FAILURE;
10643 nsCOMPtr<nsIDOMNode> firstChild, container;
10644 mElement->GetFirstChild(getter_AddRefs(firstChild));
10646 @@ -274,6 +328,52 @@ nsXFormsItemElement::GetValue(nsAString
10647 return NS_OK;
10650 +NS_IMETHODIMP
10651 +nsXFormsItemElement::GetCopyNode(nsIDOMNode **aNode)
10653 + NS_ENSURE_ARG_POINTER(aNode);
10655 + PRBool isCopyItem;
10656 + GetIsCopyItem(&isCopyItem);
10657 + if (!isCopyItem) {
10658 + // If this item doesn't contain a copy element but instead has a value
10659 + // element, then there is no sense continuing.
10660 + *aNode = nsnull;
10661 + return NS_ERROR_FAILURE;
10664 + // Since this item really contains a copy element, then firstChild MUST be
10665 + // a contextcontainer since copy elements can only exist as a child of an
10666 + // itemset.
10667 + nsCOMPtr<nsIDOMNode> container;
10668 + mElement->GetFirstChild(getter_AddRefs(container));
10670 + // Find the copy element contained by this item and get the copyNode from it.
10671 + nsCOMPtr<nsIDOMNodeList> children;
10672 + nsresult rv = container->GetChildNodes(getter_AddRefs(children));
10673 + NS_ENSURE_SUCCESS(rv, rv);
10675 + PRUint32 childCount;
10676 + children->GetLength(&childCount);
10678 + nsCOMPtr<nsIDOMNode> child;
10679 + nsAutoString value;
10681 + for (PRUint32 i = 0; i < childCount; ++i) {
10682 + children->Item(i, getter_AddRefs(child));
10683 + nsCOMPtr<nsIXFormsCopyElement> copyElement = do_QueryInterface(child);
10684 + if (copyElement) {
10685 + return copyElement->GetCopyNode(aNode);
10687 + }
10689 + // No copy element as a child. Set return node to null and set the copyitem
10690 + // boolean to false so we don't go through this unnecessary pain again.
10691 + aNode = nsnull;
10692 + SetIsCopyItem(PR_FALSE);
10693 + return NS_OK;
10696 void
10697 nsXFormsItemElement::Refresh()
10699 @@ -353,15 +453,6 @@ nsXFormsItemElement::GetLabelText(nsAStr
10700 NS_IMETHODIMP
10701 nsXFormsItemElement::LabelRefreshed()
10703 - nsCOMPtr<nsIDOMDocument> domDoc;
10704 - mElement->GetOwnerDocument(getter_AddRefs(domDoc));
10705 - nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
10706 - // This is an optimization. It prevents us doing some of the unnecessary
10707 - // refreshes.
10708 - if (doc && doc->GetProperty(nsXFormsAtoms::deferredBindListProperty)) {
10709 - return NS_OK;
10712 NS_ENSURE_STATE(mElement);
10713 nsCOMPtr<nsIDOMNode> parent, current;
10714 current = mElement;
10715 @@ -380,6 +471,21 @@ nsXFormsItemElement::LabelRefreshed()
10716 return NS_OK;
10719 +NS_IMETHODIMP
10720 +nsXFormsItemElement::GetIsCopyItem(PRBool *aIsCopyItem)
10722 + NS_ENSURE_ARG(aIsCopyItem);
10723 + *aIsCopyItem = mIsCopyItem;
10724 + return NS_OK;
10727 +NS_IMETHODIMP
10728 +nsXFormsItemElement::SetIsCopyItem(PRBool aIsCopyItem)
10730 + mIsCopyItem = aIsCopyItem;
10731 + return NS_OK;
10734 NS_HIDDEN_(nsresult)
10735 NS_NewXFormsItemElement(nsIXTFElement **aResult)
10737 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsItemSetElement.cpp mozilla.new/extensions/xforms/nsXFormsItemSetElement.cpp
10738 --- mozilla/extensions/xforms/nsXFormsItemSetElement.cpp 2005-10-04 20:28:21.000000000 +0200
10739 +++ mozilla.new/extensions/xforms/nsXFormsItemSetElement.cpp 2006-02-14 10:01:13.000000000 +0100
10740 @@ -191,8 +191,45 @@ nsXFormsItemSetElement::SelectItemByValu
10743 NS_IMETHODIMP
10744 +nsXFormsItemSetElement::SelectItemByNode(nsIDOMNode *aNode,
10745 + nsIDOMNode **aSelected)
10747 + NS_ENSURE_ARG_POINTER(aSelected);
10748 + NS_ENSURE_STATE(mElement);
10749 + *aSelected = nsnull;
10750 + // nsIXFormsItemSetUIElement is implemented by the XBL binding.
10751 + nsCOMPtr<nsIXFormsItemSetUIElement> uiItemSet(do_QueryInterface(mElement));
10752 + NS_ENSURE_STATE(uiItemSet);
10754 + nsCOMPtr<nsIDOMElement> anonContent;
10755 + uiItemSet->GetAnonymousItemSetContent(getter_AddRefs(anonContent));
10756 + NS_ENSURE_STATE(anonContent);
10758 + nsCOMPtr<nsIDOMNode> child, tmp;
10759 + anonContent->GetFirstChild(getter_AddRefs(child));
10760 + // Trying to select the first possible (generated) \<item\> element.
10761 + while (child) {
10762 + nsCOMPtr<nsIXFormsSelectChild> selectChild(do_QueryInterface(child));
10763 + if (selectChild) {
10764 + selectChild->SelectItemByNode(aNode, aSelected);
10765 + if (*aSelected) {
10766 + return NS_OK;
10769 + tmp.swap(child);
10770 + tmp->GetNextSibling(getter_AddRefs(child));
10772 + return NS_OK;
10775 +NS_IMETHODIMP
10776 nsXFormsItemSetElement::Bind()
10778 + mModel = nsXFormsUtils::GetModel(mElement);
10779 + if (mModel) {
10780 + mModel->AddFormControl(this);
10783 return NS_OK;
10786 @@ -287,8 +324,7 @@ nsXFormsItemSetElement::Refresh()
10788 nsCOMPtr<nsIXFormsContextControl> ctx(do_QueryInterface(contextContainer));
10789 if (ctx) {
10790 - ctx->SetContext(nsCOMPtr<nsIDOMElement>(do_QueryInterface(node)),
10791 - i + 1, nodeCount);
10792 + ctx->SetContext(node, i + 1, nodeCount);
10794 // Clone the template content under the item
10795 for (PRUint32 j = 0; j < templateNodeCount; ++j) {
10796 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsLabelElement.cpp mozilla.new/extensions/xforms/nsXFormsLabelElement.cpp
10797 --- mozilla/extensions/xforms/nsXFormsLabelElement.cpp 2005-09-02 19:23:35.000000000 +0200
10798 +++ mozilla.new/extensions/xforms/nsXFormsLabelElement.cpp 2006-02-14 10:01:13.000000000 +0100
10799 @@ -216,7 +216,7 @@ nsXFormsLabelElement::LoadExternalLabel(
10800 NS_NewURI(getter_AddRefs(uri), aSrc, doc->GetDocumentCharacterSet().get(),
10801 doc->GetDocumentURI());
10802 if (uri) {
10803 - if (nsXFormsUtils::CheckSameOrigin(doc->GetDocumentURI(), uri)) {
10804 + if (nsXFormsUtils::CheckSameOrigin(doc, uri)) {
10805 nsCOMPtr<nsILoadGroup> loadGroup;
10806 loadGroup = doc->GetDocumentLoadGroup();
10807 NS_WARN_IF_FALSE(loadGroup, "No load group!");
10808 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsLoadElement.cpp mozilla.new/extensions/xforms/nsXFormsLoadElement.cpp
10809 --- mozilla/extensions/xforms/nsXFormsLoadElement.cpp 2004-11-05 03:15:00.000000000 +0100
10810 +++ mozilla.new/extensions/xforms/nsXFormsLoadElement.cpp 2006-02-14 10:01:13.000000000 +0100
10811 @@ -80,19 +80,13 @@ nsXFormsLoadElement::HandleAction(nsIDOM
10812 return NS_OK;
10814 nsCOMPtr<nsIDOMDocument> doc;
10815 + nsCOMPtr<nsIDOMWindowInternal> internal;
10816 mElement->GetOwnerDocument(getter_AddRefs(doc));
10818 - nsCOMPtr<nsIDOMDocumentView> dview(do_QueryInterface(doc));
10819 - if (!dview)
10820 - return NS_OK;
10822 - nsCOMPtr<nsIDOMAbstractView> aview;
10823 - dview->GetDefaultView(getter_AddRefs(aview));
10825 - nsCOMPtr<nsIDOMWindowInternal> internal(do_QueryInterface(aview));
10826 - NS_ASSERTION(internal, "No AbstractView or it isn't an nsIDOMWindowInternal");
10827 - if (!internal)
10828 + nsXFormsUtils::GetWindowFromDocument(doc, getter_AddRefs(internal));
10829 + if (!internal) {
10830 + NS_ASSERTION(internal, "No AbstractView or it isn't an nsIDOMWindowInternal");
10831 return NS_OK;
10834 PRBool openNew = PR_FALSE;
10835 nsAutoString show;
10836 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsMDGEngine.cpp mozilla.new/extensions/xforms/nsXFormsMDGEngine.cpp
10837 --- mozilla/extensions/xforms/nsXFormsMDGEngine.cpp 2005-07-25 16:29:47.000000000 +0200
10838 +++ mozilla.new/extensions/xforms/nsXFormsMDGEngine.cpp 2006-02-24 11:16:23.000000000 +0100
10839 @@ -47,6 +47,7 @@
10840 #include "nsDeque.h"
10841 #include "nsIModelElementPrivate.h"
10842 #include "nsXFormsUtils.h"
10843 +#include "nsDOMError.h"
10845 #ifdef DEBUG
10846 //# define DEBUG_XF_MDG
10847 @@ -743,6 +744,147 @@ nsXFormsMDGEngine::SetNodeValueInternal(
10848 return NS_OK;
10851 +nsresult
10852 +nsXFormsMDGEngine::SetNodeContent(nsIDOMNode *aContextNode,
10853 + nsIDOMNode *aContentEnvelope,
10854 + PRBool *aNodeChanged)
10856 + NS_ENSURE_ARG(aContextNode);
10857 + NS_ENSURE_ARG(aContentEnvelope);
10859 + // ok, this is tricky. This function will REPLACE the contents of
10860 + // aContextNode with the a clone of the contents of aContentEnvelope. If
10861 + // aContentEnvelope has no contents, then any contents that aContextNode
10862 + // has will still be removed.
10864 + if (aNodeChanged) {
10865 + *aNodeChanged = PR_FALSE;
10868 + const nsXFormsNodeState* ns = GetNodeState(aContextNode);
10869 + NS_ENSURE_TRUE(ns, NS_ERROR_FAILURE);
10871 + // If the node is read-only and not set by a @calculate MIP,
10872 + // ignore the call
10873 + if (ns->IsReadonly()) {
10874 + ///
10875 + /// @todo Better feedback for readonly nodes? (XXX)
10876 + return NS_OK;
10879 + PRUint16 nodeType;
10880 + nsresult rv = aContextNode->GetNodeType(&nodeType);
10881 + NS_ENSURE_SUCCESS(rv, rv);
10883 + if (nodeType != nsIDOMNode::ELEMENT_NODE) {
10884 + // got to return something pretty unique that we can check down the road in
10885 + // order to dispatch any error events
10886 + return NS_ERROR_DOM_WRONG_TYPE_ERR;
10889 + // Need to determine if the contents of the context node and content envelope
10890 + // are already the same. If so, we can avoid some unnecessary work.
10892 + PRBool hasChildren1, hasChildren2, contentsEqual = PR_FALSE;
10893 + nsresult rv1 = aContextNode->HasChildNodes(&hasChildren1);
10894 + nsresult rv2 = aContentEnvelope->HasChildNodes(&hasChildren2);
10895 + if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2) && hasChildren1 == hasChildren2) {
10896 + // First test passed. Both have the same number of children nodes.
10897 + if (hasChildren1) {
10898 + nsCOMPtr<nsIDOMNodeList> children1, children2;
10899 + PRUint32 childrenLength1, childrenLength2;
10901 + rv1 = aContextNode->GetChildNodes(getter_AddRefs(children1));
10902 + rv2 = aContentEnvelope->GetChildNodes(getter_AddRefs(children2));
10904 + if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2) && children1 && children2) {
10906 + // Both have child nodes.
10907 + rv1 = children1->GetLength(&childrenLength1);
10908 + rv2 = children2->GetLength(&childrenLength2);
10909 + if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2) &&
10910 + (childrenLength1 == childrenLength2)) {
10912 + // both have the same number of child nodes. Now checking to see if
10913 + // each of the children are equal.
10914 + for (PRUint32 i = 0; i < childrenLength1; ++i) {
10915 + nsCOMPtr<nsIDOMNode> child1, child2;
10917 + rv1 = children1->Item(i, getter_AddRefs(child1));
10918 + rv2 = children2->Item(i, getter_AddRefs(child2));
10919 + if (NS_FAILED(rv1) || NS_FAILED(rv2)) {
10920 + // Unexpected error. Not as many children in the list as we
10921 + // were told.
10922 + return NS_ERROR_UNEXPECTED;
10925 + contentsEqual = nsXFormsUtils::AreNodesEqual(child1, child2, PR_TRUE);
10926 + if (!contentsEqual) {
10927 + break;
10932 + } else {
10933 + // neither have children
10934 + contentsEqual = PR_TRUE;
10938 + if (contentsEqual) {
10939 + return NS_OK;
10942 + // remove any child nodes that aContextNode already contains
10943 + nsCOMPtr<nsIDOMNode> resultNode;
10944 + nsCOMPtr<nsIDOMNodeList> childList;
10945 + rv = aContextNode->GetChildNodes(getter_AddRefs(childList));
10946 + NS_ENSURE_SUCCESS(rv, rv);
10947 + if (childList) {
10948 + PRUint32 length;
10949 + rv = childList->GetLength(&length);
10950 + NS_ENSURE_SUCCESS(rv, rv);
10952 + for (PRInt32 i = length-1; i >= 0; i--) {
10953 + nsCOMPtr<nsIDOMNode> childNode;
10954 + rv = childList->Item(i, getter_AddRefs(childNode));
10955 + NS_ENSURE_SUCCESS(rv, rv);
10957 + rv = aContextNode->RemoveChild(childNode, getter_AddRefs(resultNode));
10958 + NS_ENSURE_SUCCESS(rv, rv);
10962 + // add contents of the envelope under aContextNode
10963 + nsCOMPtr<nsIDOMNode> childNode;
10964 + rv = aContentEnvelope->GetFirstChild(getter_AddRefs(childNode));
10965 + NS_ENSURE_SUCCESS(rv, rv);
10967 + nsCOMPtr<nsIDOMDocument> document;
10968 + rv = aContextNode->GetOwnerDocument(getter_AddRefs(document));
10969 + NS_ENSURE_STATE(document);
10971 + while (childNode) {
10972 + nsCOMPtr<nsIDOMNode> importedNode;
10973 + rv = document->ImportNode(childNode, PR_TRUE, getter_AddRefs(importedNode));
10974 + NS_ENSURE_STATE(importedNode);
10975 + rv = aContextNode->AppendChild(importedNode, getter_AddRefs(resultNode));
10976 + NS_ENSURE_SUCCESS(rv, rv);
10978 + rv = childNode->GetNextSibling(getter_AddRefs(resultNode));
10979 + NS_ENSURE_SUCCESS(rv, rv);
10981 + resultNode.swap(childNode);
10984 + // NB: Never reached for Readonly nodes.
10985 + if (aNodeChanged) {
10986 + *aNodeChanged = PR_TRUE;
10989 + return NS_OK;
10992 const nsXFormsNodeState*
10993 nsXFormsMDGEngine::GetNodeState(nsIDOMNode *aContextNode)
10995 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsMDGEngine.h mozilla.new/extensions/xforms/nsXFormsMDGEngine.h
10996 --- mozilla/extensions/xforms/nsXFormsMDGEngine.h 2005-06-02 09:00:11.000000000 +0200
10997 +++ mozilla.new/extensions/xforms/nsXFormsMDGEngine.h 2006-02-14 10:01:13.000000000 +0100
10998 @@ -326,6 +326,7 @@ protected:
10999 PRBool aMarkNode = PR_TRUE,
11000 PRBool aIsCalculate = PR_FALSE,
11001 PRBool *aNodeChanged = nsnull);
11003 public:
11005 * Constructor
11006 @@ -420,6 +421,18 @@ public:
11007 nsAString &aNodeValue);
11010 + * Set the contents of a node
11012 + * @param aContextNode The node to set the contents of
11013 + * @param aContentEnvelope The container of the contents that need to be
11014 + * moved under aContextNode
11015 + * @param aNodeChanged Was node changed?
11016 + */
11017 + nsresult SetNodeContent(nsIDOMNode *aContextNode,
11018 + nsIDOMNode *aContentEnvelope,
11019 + PRBool *aNodeChanged = nsnull);
11021 + /**
11022 * External interface of GetNCNodeState(), returns const pointer to the node
11023 * state.
11025 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsMessageElement.cpp mozilla.new/extensions/xforms/nsXFormsMessageElement.cpp
11026 --- mozilla/extensions/xforms/nsXFormsMessageElement.cpp 2005-08-10 09:58:29.000000000 +0200
11027 +++ mozilla.new/extensions/xforms/nsXFormsMessageElement.cpp 2006-02-14 10:01:13.000000000 +0100
11028 @@ -77,7 +77,7 @@
11029 #include "nsIStringBundle.h"
11030 #include "nsIDOMSerializer.h"
11031 #include "nsIServiceManager.h"
11032 -#include "nsIXFormsDelegate.h"
11033 +#include "nsIDelegateInternal.h"
11035 #define EPHEMERAL_STYLE \
11036 "position:absolute;z-index:2147483647; \
11037 @@ -98,6 +98,7 @@
11038 <?xml-stylesheet href='chrome://global/skin/' type='text/css'?> \
11039 <window title='[XForms]'\
11040 xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' \
11041 + onkeypress='if (event.keyCode == event.DOM_VK_ESCAPE) window.close();' \
11042 onload='document.documentElement.lastChild.previousSibling \
11043 .firstChild.nextSibling.focus();'>"
11045 @@ -293,7 +294,7 @@ nsXFormsMessageElement::CloneNode(nsIDOM
11046 // to support <output> here.
11047 if (ns.EqualsLiteral(NS_NAMESPACE_XFORMS) &&
11048 localName.EqualsLiteral("output")) {
11049 - nsCOMPtr<nsIXFormsDelegate> outEl(do_QueryInterface(aSrc));
11050 + nsCOMPtr<nsIDelegateInternal> outEl(do_QueryInterface(aSrc));
11051 if (outEl) {
11052 nsCOMPtr<nsIDOMDocument> doc;
11053 aSrc->GetOwnerDocument(getter_AddRefs(doc));
11054 @@ -456,20 +457,12 @@ PRBool
11055 nsXFormsMessageElement::HandleInlineAlert(nsIDOMEvent* aEvent)
11057 nsCOMPtr<nsIDOMDocument> doc;
11058 + nsCOMPtr<nsIDOMWindowInternal> internal;
11059 mElement->GetOwnerDocument(getter_AddRefs(doc));
11061 - nsCOMPtr<nsIDOMDocumentView> dview(do_QueryInterface(doc));
11062 - if (!dview)
11063 - return PR_FALSE;
11065 - nsCOMPtr<nsIDOMAbstractView> aview;
11066 - dview->GetDefaultView(getter_AddRefs(aview));
11067 - if (!aview)
11068 - return PR_FALSE;
11070 - nsCOMPtr<nsIDOMWindowInternal> internal(do_QueryInterface(aview));
11071 - if (!internal)
11072 + nsXFormsUtils::GetWindowFromDocument(doc, getter_AddRefs(internal));
11073 + if (!internal) {
11074 return PR_FALSE;
11077 nsCOMPtr<nsIDOMViewCSS> cssView(do_QueryInterface(internal));
11078 if (!cssView)
11079 @@ -600,16 +593,11 @@ nsresult
11080 nsXFormsMessageElement::HandleModalAndModelessMessage(nsIDOMDocument* aDoc,
11081 nsAString& aLevel)
11083 - nsCOMPtr<nsIDOMDocumentView> dview(do_QueryInterface(aDoc));
11084 - if (!dview)
11085 - return NS_OK;
11087 - nsCOMPtr<nsIDOMAbstractView> aview;
11088 - dview->GetDefaultView(getter_AddRefs(aview));
11090 - nsCOMPtr<nsIDOMWindowInternal> internal(do_QueryInterface(aview));
11091 - if (!internal)
11092 + nsCOMPtr<nsIDOMWindowInternal> internal;
11093 + nsXFormsUtils::GetWindowFromDocument(aDoc, getter_AddRefs(internal));
11094 + if (!internal) {
11095 return NS_OK;
11098 nsAutoString instanceData;
11099 PRBool hasBinding = nsXFormsUtils::GetSingleNodeBindingValue(mElement,
11100 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsModelElement.cpp mozilla.new/extensions/xforms/nsXFormsModelElement.cpp
11101 --- mozilla/extensions/xforms/nsXFormsModelElement.cpp 2005-10-22 16:39:09.000000000 +0200
11102 +++ mozilla.new/extensions/xforms/nsXFormsModelElement.cpp 2006-02-24 11:16:23.000000000 +0100
11103 @@ -176,7 +176,8 @@ static const nsIID sScriptingIIDs[] = {
11104 NS_IDOMELEMENT_IID,
11105 NS_IDOMEVENTTARGET_IID,
11106 NS_IDOM3NODE_IID,
11107 - NS_IXFORMSMODELELEMENT_IID
11108 + NS_IXFORMSMODELELEMENT_IID,
11109 + NS_IXFORMSNSMODELELEMENT_IID
11112 static nsIAtom* sModelPropsList[eModel__count];
11113 @@ -259,19 +260,24 @@ nsXFormsModelElement::nsXFormsModelEleme
11114 mPendingInstanceCount(0),
11115 mDocumentLoaded(PR_FALSE),
11116 mNeedsRefresh(PR_FALSE),
11117 - mInstanceList(16),
11118 + mInstancesInitialized(PR_FALSE),
11119 + mInstanceDocuments(nsnull),
11120 mLazyModel(PR_FALSE)
11124 -NS_IMPL_ISUPPORTS_INHERITED6(nsXFormsModelElement,
11125 - nsXFormsStubElement,
11126 - nsIXFormsModelElement,
11127 - nsIModelElementPrivate,
11128 - nsISchemaLoadListener,
11129 - nsIWebServiceErrorHandler,
11130 - nsIDOMEventListener,
11131 - nsIXFormsContextControl)
11132 +NS_INTERFACE_MAP_BEGIN(nsXFormsModelElement)
11133 + NS_INTERFACE_MAP_ENTRY(nsIXFormsModelElement)
11134 + NS_INTERFACE_MAP_ENTRY(nsIXFormsNSModelElement)
11135 + NS_INTERFACE_MAP_ENTRY(nsIModelElementPrivate)
11136 + NS_INTERFACE_MAP_ENTRY(nsISchemaLoadListener)
11137 + NS_INTERFACE_MAP_ENTRY(nsIWebServiceErrorHandler)
11138 + NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
11139 + NS_INTERFACE_MAP_ENTRY(nsIXFormsContextControl)
11140 +NS_INTERFACE_MAP_END_INHERITING(nsXFormsStubElement)
11142 +NS_IMPL_ADDREF_INHERITED(nsXFormsModelElement, nsXFormsStubElement)
11143 +NS_IMPL_RELEASE_INHERITED(nsXFormsModelElement, nsXFormsStubElement)
11145 NS_IMETHODIMP
11146 nsXFormsModelElement::OnDestroyed()
11147 @@ -281,7 +287,9 @@ nsXFormsModelElement::OnDestroyed()
11148 mElement = nsnull;
11149 mSchemas = nsnull;
11151 - mInstanceList.Clear();
11152 + if (mInstanceDocuments)
11153 + mInstanceDocuments->DropReferences();
11155 return NS_OK;
11158 @@ -298,8 +306,16 @@ nsXFormsModelElement::RemoveModelFromDoc
11159 RemoveFromModelList(domDoc, this);
11161 nsCOMPtr<nsIDOMEventTarget> targ = do_QueryInterface(domDoc);
11162 - if (targ)
11163 + if (targ) {
11164 targ->RemoveEventListener(NS_LITERAL_STRING("DOMContentLoaded"), this, PR_TRUE);
11166 + nsCOMPtr<nsIDOMWindowInternal> window;
11167 + nsXFormsUtils::GetWindowFromDocument(domDoc, getter_AddRefs(window));
11168 + targ = do_QueryInterface(window);
11169 + if (targ) {
11170 + targ->RemoveEventListener(NS_LITERAL_STRING("unload"), this, PR_TRUE);
11175 NS_IMETHODIMP
11176 @@ -314,10 +330,6 @@ NS_IMETHODIMP
11177 nsXFormsModelElement::WillChangeDocument(nsIDOMDocument* aNewDocument)
11179 RemoveModelFromDocument();
11180 - if(!aNewDocument) {
11181 - // can't send this much later or the model won't still be in the document!
11182 - nsXFormsUtils::DispatchEvent(mElement, eEvent_ModelDestruct);
11184 return NS_OK;
11187 @@ -330,8 +342,16 @@ nsXFormsModelElement::DocumentChanged(ns
11188 AddToModelList(aNewDocument, this);
11190 nsCOMPtr<nsIDOMEventTarget> targ = do_QueryInterface(aNewDocument);
11191 - if (targ)
11192 + if (targ) {
11193 targ->AddEventListener(NS_LITERAL_STRING("DOMContentLoaded"), this, PR_TRUE);
11195 + nsCOMPtr<nsIDOMWindowInternal> window;
11196 + nsXFormsUtils::GetWindowFromDocument(aNewDocument, getter_AddRefs(window));
11197 + targ = do_QueryInterface(window);
11198 + if (targ) {
11199 + targ->AddEventListener(NS_LITERAL_STRING("unload"), this, PR_TRUE);
11203 return NS_OK;
11205 @@ -339,6 +359,36 @@ nsXFormsModelElement::DocumentChanged(ns
11206 NS_IMETHODIMP
11207 nsXFormsModelElement::DoneAddingChildren()
11209 + return InitializeInstances();
11212 +nsresult
11213 +nsXFormsModelElement::InitializeInstances()
11215 + if (mInstancesInitialized || !mElement) {
11216 + return NS_OK;
11219 + mInstancesInitialized = PR_TRUE;
11221 + nsCOMPtr<nsIDOMNodeList> children;
11222 + mElement->GetChildNodes(getter_AddRefs(children));
11224 + PRUint32 childCount = 0;
11225 + if (children) {
11226 + children->GetLength(&childCount);
11229 + for (PRUint32 i = 0; i < childCount; ++i) {
11230 + nsCOMPtr<nsIDOMNode> child;
11231 + children->Item(i, getter_AddRefs(child));
11232 + if (nsXFormsUtils::IsXFormsElement(child, NS_LITERAL_STRING("instance"))) {
11233 + nsCOMPtr<nsIInstanceElementPrivate> instance(do_QueryInterface(child));
11234 + if (instance) {
11235 + instance->Initialize();
11240 // (XForms 4.2.1)
11241 // 1. load xml schemas
11242 @@ -415,8 +465,13 @@ nsXFormsModelElement::DoneAddingChildren
11243 // If all of the children are added and there aren't any instance elements,
11244 // yet, then we need to make sure that one is ready in case the form author
11245 // is using lazy authoring.
11246 - PRUint32 instCount = mInstanceList.Count();
11247 + NS_ENSURE_STATE(mInstanceDocuments);
11248 + PRUint32 instCount;
11249 + mInstanceDocuments->GetLength(&instCount);
11250 if (!instCount) {
11251 +#ifdef DEBUG
11252 + printf("Creating lazy instance\n");
11253 +#endif
11254 nsCOMPtr<nsIDOMDocument> domDoc;
11255 mElement->GetOwnerDocument(getter_AddRefs(domDoc));
11256 nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(domDoc));
11257 @@ -426,8 +481,7 @@ nsXFormsModelElement::DoneAddingChildren
11258 NS_LITERAL_STRING(XFORMS_LAZY_INSTANCE_BINDING));
11259 NS_ENSURE_SUCCESS(rv, rv);
11261 - NS_WARN_IF_FALSE(mInstanceList.Count() == 1,
11262 - "Installing lazy instance didn't succeed!");
11263 + mInstanceDocuments->GetLength(&instCount);
11265 nsCOMPtr<nsIDOMNodeList> list;
11266 xblDoc->GetAnonymousNodes(mElement, getter_AddRefs(list));
11267 @@ -443,7 +497,7 @@ nsXFormsModelElement::DoneAddingChildren
11268 nsCOMPtr<nsIInstanceElementPrivate> instance =
11269 do_QueryInterface(item);
11270 if (instance) {
11271 - rv = instance->InitializeLazyInstance();
11272 + rv = instance->Initialize();
11273 NS_ENSURE_SUCCESS(rv, rv);
11275 mLazyModel = PR_TRUE;
11276 @@ -452,6 +506,7 @@ nsXFormsModelElement::DoneAddingChildren
11280 + NS_WARN_IF_FALSE(mLazyModel, "Installing lazy instance didn't succeed!");
11283 // (XForms 4.2.1 - cont)
11284 @@ -498,6 +553,8 @@ nsXFormsModelElement::HandleDefault(nsID
11285 Ready();
11286 } else if (type.EqualsASCII(sXFormsEventsEntries[eEvent_Reset].name)) {
11287 Reset();
11288 + } else if (type.EqualsASCII(sXFormsEventsEntries[eEvent_BindingException].name)) {
11289 + *aHandled = nsXFormsUtils::HandleBindingException(mElement);
11290 } else {
11291 *aHandled = PR_FALSE;
11293 @@ -542,12 +599,28 @@ nsXFormsModelElement::OnCreated(nsIXTFGe
11295 mSchemas = do_GetService(NS_SCHEMALOADER_CONTRACTID);
11297 + mInstanceDocuments = new nsXFormsModelInstanceDocuments();
11298 + NS_ASSERTION(mInstanceDocuments, "could not create mInstanceDocuments?!");
11300 + // Initialize hash tables
11301 + NS_ENSURE_TRUE(mNodeToType.Init(), NS_ERROR_OUT_OF_MEMORY);
11302 + NS_ENSURE_TRUE(mNodeToP3PType.Init(), NS_ERROR_OUT_OF_MEMORY);
11304 return NS_OK;
11307 // nsIXFormsModelElement
11309 NS_IMETHODIMP
11310 +nsXFormsModelElement::GetInstanceDocuments(nsIDOMNodeList **aDocuments)
11312 + NS_ENSURE_STATE(mInstanceDocuments);
11313 + NS_ENSURE_ARG_POINTER(aDocuments);
11314 + NS_ADDREF(*aDocuments = mInstanceDocuments);
11315 + return NS_OK;
11318 +NS_IMETHODIMP
11319 nsXFormsModelElement::GetInstanceDocument(const nsAString& aInstanceID,
11320 nsIDOMDocument **aDocument)
11322 @@ -569,6 +642,12 @@ nsXFormsModelElement::Rebuild()
11323 rv = mMDG.Clear();
11324 NS_ENSURE_SUCCESS(rv, rv);
11326 + // Clear any type information
11327 + NS_ENSURE_TRUE(mNodeToType.IsInitialized() && mNodeToP3PType.IsInitialized(),
11328 + NS_ERROR_FAILURE);
11329 + mNodeToType.Clear();
11330 + mNodeToP3PType.Clear();
11332 // 2. Re-attach all elements
11333 if (mDocumentLoaded) { // if it's not during initializing phase
11334 // Copy the form control list as it stands right now.
11335 @@ -867,57 +946,13 @@ nsXFormsModelElement::HandleEvent(nsIDOM
11337 nsAutoString type;
11338 aEvent->GetType(type);
11339 - if (!type.EqualsLiteral("DOMContentLoaded"))
11340 - return NS_OK;
11342 - mDocumentLoaded = PR_TRUE;
11344 - // dispatch xforms-model-construct, xforms-rebuild, xforms-recalculate,
11345 - // xforms-revalidate
11347 - // We wait until DOMContentLoaded to dispatch xforms-model-construct,
11348 - // since the model may have an action handler for this event and Mozilla
11349 - // doesn't register XML Event listeners until the document is loaded.
11351 - // xforms-model-construct is not cancellable, so always proceed.
11353 - nsXFormsUtils::DispatchEvent(mElement, eEvent_ModelConstruct);
11355 - if (mPendingInlineSchemas.Count() > 0) {
11356 - nsCOMPtr<nsIDOMElement> el;
11357 - nsresult rv;
11358 - for (PRInt32 i=0; i<mPendingInlineSchemas.Count(); ++i) {
11359 - GetSchemaElementById(mElement, *mPendingInlineSchemas[i],
11360 - getter_AddRefs(el));
11361 - if (!el) {
11362 - rv = NS_ERROR_UNEXPECTED;
11363 - } else {
11364 - nsCOMPtr<nsISchema> schema;
11365 - // no need to observe errors via the callback. instead, rely on
11366 - // this method returning a failure code when it encounters errors.
11367 - rv = mSchemas->ProcessSchemaElement(el, nsnull,
11368 - getter_AddRefs(schema));
11369 - if (NS_SUCCEEDED(rv))
11370 - mSchemaCount++;
11372 - if (NS_FAILED(rv)) {
11373 - // this is a fatal error (XXX)
11374 - nsXFormsUtils::ReportError(NS_LITERAL_STRING("schemaLoadError"), mElement);
11375 - nsXFormsUtils::DispatchEvent(mElement, eEvent_LinkException);
11376 - return NS_OK;
11379 - if (IsComplete()) {
11380 - rv = FinishConstruction();
11381 - NS_ENSURE_SUCCESS(rv, rv);
11382 - nsXFormsUtils::DispatchEvent(mElement, eEvent_Refresh);
11384 - mPendingInlineSchemas.Clear();
11385 + if (type.EqualsLiteral("DOMContentLoaded")) {
11386 + return HandleLoad(aEvent);
11387 + }else if (type.EqualsLiteral("unload")) {
11388 + return HandleUnload(aEvent);
11391 - // We may still be waiting on external documents to load.
11392 - MaybeNotifyCompletion();
11394 return NS_OK;
11397 @@ -977,26 +1012,15 @@ nsXFormsModelElement::GetTypeForControl(
11398 nsXFormsModelElement::GetTypeAndNSFromNode(nsIDOMNode *aInstanceData,
11399 nsAString &aType, nsAString &aNSUri)
11401 - nsAutoString schemaTypePrefix;
11402 - nsresult rv = nsXFormsUtils::ParseTypeFromNode(aInstanceData, aType,
11403 - schemaTypePrefix);
11404 + nsresult rv = GetTypeFromNode(aInstanceData, aType, aNSUri);
11406 - if(rv == NS_ERROR_NOT_AVAILABLE) {
11407 + if (rv == NS_ERROR_NOT_AVAILABLE) {
11408 // if there is no type assigned, then assume that the type is 'string'
11409 aNSUri.Assign(NS_LITERAL_STRING(NS_NAMESPACE_XML_SCHEMA));
11410 aType.Assign(NS_LITERAL_STRING("string"));
11411 rv = NS_OK;
11412 - } else {
11413 - if (schemaTypePrefix.IsEmpty()) {
11414 - aNSUri.AssignLiteral("");
11415 - } else {
11416 - // get the namespace url from the prefix
11417 - nsCOMPtr<nsIDOM3Node> domNode3 = do_QueryInterface(mElement, &rv);
11418 - NS_ENSURE_SUCCESS(rv, rv);
11420 - rv = domNode3->LookupNamespaceURI(schemaTypePrefix, aNSUri);
11424 return rv;
11427 @@ -1029,14 +1053,16 @@ NS_IMETHODIMP
11428 nsXFormsModelElement::FindInstanceElement(const nsAString &aID,
11429 nsIInstanceElementPrivate **aElement)
11431 + NS_ENSURE_STATE(mInstanceDocuments);
11432 *aElement = nsnull;
11434 - PRUint32 instCount = mInstanceList.Count();
11435 + PRUint32 instCount;
11436 + mInstanceDocuments->GetLength(&instCount);
11437 if (instCount) {
11438 nsCOMPtr<nsIDOMElement> element;
11439 nsAutoString id;
11440 for (PRUint32 i = 0; i < instCount; ++i) {
11441 - nsIInstanceElementPrivate* instEle = mInstanceList.ObjectAt(i);
11442 + nsIInstanceElementPrivate* instEle = mInstanceDocuments->GetInstanceAt(i);
11443 instEle->GetElement(getter_AddRefs(element));
11445 if (aID.IsEmpty()) {
11446 @@ -1084,6 +1110,16 @@ nsXFormsModelElement::GetNodeValue(nsIDO
11449 NS_IMETHODIMP
11450 +nsXFormsModelElement::SetNodeContent(nsIDOMNode *aContextNode,
11451 + nsIDOMNode *aNodeContent,
11452 + PRBool *aNodeChanged)
11454 + return mMDG.SetNodeContent(aContextNode,
11455 + aNodeContent,
11456 + aNodeChanged);
11459 +NS_IMETHODIMP
11460 nsXFormsModelElement::ValidateNode(nsIDOMNode *aInstanceNode, PRBool *aResult)
11462 NS_ENSURE_ARG_POINTER(aResult);
11463 @@ -1143,6 +1179,80 @@ nsXFormsModelElement::HandleInstanceData
11464 return NS_OK;
11467 +NS_IMETHODIMP
11468 +nsXFormsModelElement::GetTypeFromNode(nsIDOMNode *aInstanceData,
11469 + nsAString &aType,
11470 + nsAString &aNSUri)
11472 + // aInstanceData could be an instance data node or it could be an attribute
11473 + // on an instance data node (basically the node that a control is bound to).
11475 + nsString *typeVal = nsnull;
11477 + // Get type stored directly on instance node
11478 + nsAutoString typeAttribute;
11479 + nsCOMPtr<nsIDOMElement> nodeElem(do_QueryInterface(aInstanceData));
11480 + if (nodeElem) {
11481 + nodeElem->GetAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_XML_SCHEMA_INSTANCE),
11482 + NS_LITERAL_STRING("type"), typeAttribute);
11483 + if (!typeAttribute.IsEmpty()) {
11484 + typeVal = &typeAttribute;
11488 + // If there was no type information on the node itself, check for a type
11489 + // bound to the node via \<xforms:bind\>
11490 + if (!typeVal && !mNodeToType.Get(aInstanceData, &typeVal)) {
11491 + // No type information found
11492 + return NS_ERROR_NOT_AVAILABLE;
11495 + // split type (ns:type) into namespace and type.
11496 + nsAutoString prefix;
11497 + PRInt32 separator = typeVal->FindChar(':');
11498 + if ((PRUint32) separator == (typeVal->Length() - 1)) {
11499 + const PRUnichar *strings[] = { typeVal->get() };
11500 + nsXFormsUtils::ReportError(NS_LITERAL_STRING("missingTypeName"), strings, 1,
11501 + mElement, nsnull);
11502 + return NS_ERROR_UNEXPECTED;
11505 + if (separator == kNotFound) {
11506 + // no namespace prefix, which is valid;
11507 + prefix = EmptyString();
11508 + aType.Assign(*typeVal);
11509 + } else {
11510 + prefix.Assign(Substring(*typeVal, 0, separator));
11511 + aType.Assign(Substring(*typeVal, ++separator, typeVal->Length()));
11514 + if (prefix.IsEmpty()) {
11515 + aNSUri = EmptyString();
11516 + return NS_OK;
11519 + // get the namespace url from the prefix using instance data node
11520 + nsresult rv;
11521 + nsCOMPtr<nsIDOM3Node> domNode3 = do_QueryInterface(aInstanceData, &rv);
11522 + NS_ENSURE_SUCCESS(rv, rv);
11523 + rv = domNode3->LookupNamespaceURI(prefix, aNSUri);
11525 + if (DOMStringIsNull(aNSUri)) {
11526 + // if not found using instance data node, use <xf:instance> node
11527 + nsCOMPtr<nsIDOMNode> instanceNode;
11528 + rv = nsXFormsUtils::GetInstanceNodeForData(aInstanceData,
11529 + getter_AddRefs(instanceNode));
11530 + NS_ENSURE_SUCCESS(rv, rv);
11532 + domNode3 = do_QueryInterface(instanceNode, &rv);
11533 + NS_ENSURE_SUCCESS(rv, rv);
11534 + rv = domNode3->LookupNamespaceURI(prefix, aNSUri);
11537 + return rv;
11541 // nsIXFormsContextControl
11543 NS_IMETHODIMP
11544 @@ -1293,11 +1403,15 @@ nsXFormsModelElement::Ready()
11545 void
11546 nsXFormsModelElement::BackupOrRestoreInstanceData(PRBool restore)
11548 + if (!mInstanceDocuments)
11549 + return;
11551 - PRUint32 instCount = mInstanceList.Count();
11552 + PRUint32 instCount;
11553 + mInstanceDocuments->GetLength(&instCount);
11554 if (instCount) {
11555 for (PRUint32 i = 0; i < instCount; ++i) {
11556 - nsIInstanceElementPrivate *instance = mInstanceList.ObjectAt(i);
11557 + nsIInstanceElementPrivate *instance =
11558 + mInstanceDocuments->GetInstanceAt(i);
11560 // Don't know what to do with error if we get one.
11561 // Restore/BackupOriginalDocument will already output warnings.
11562 @@ -1448,15 +1562,6 @@ nsXFormsModelElement::MaybeNotifyComplet
11566 -static void
11567 -DeleteAutoString(void *aObject,
11568 - nsIAtom *aPropertyName,
11569 - void *aPropertyValue,
11570 - void *aData)
11572 - delete NS_STATIC_CAST(nsAutoString*, aPropertyValue);
11575 nsresult
11576 nsXFormsModelElement::ProcessBind(nsIXFormsXPathEvaluator *aEvaluator,
11577 nsIDOMNode *aContextNode,
11578 @@ -1543,33 +1648,24 @@ nsXFormsModelElement::ProcessBind(nsIXFo
11580 // type and p3ptype are stored as properties on the instance node
11581 if (j == eModel_type || j == eModel_p3ptype) {
11582 - nsAutoPtr<nsAutoString> prop (new nsAutoString(propStrings[j]));
11583 - nsCOMPtr<nsIContent> content = do_QueryInterface(node);
11584 - if (content) {
11585 - rv = content->SetProperty(sModelPropsList[j],
11586 - prop,
11587 - DeleteAutoString);
11588 - } else {
11589 - nsCOMPtr<nsIAttribute> attribute = do_QueryInterface(node);
11590 - if (attribute) {
11591 - rv = attribute->SetProperty(sModelPropsList[j],
11592 - prop,
11593 - DeleteAutoString);
11594 - } else {
11595 - NS_WARNING("node is neither nsIContent or nsIAttribute");
11596 - continue;
11599 - if (NS_SUCCEEDED(rv)) {
11600 - prop.forget();
11601 - } else {
11602 - return rv;
11604 - if (rv == NS_PROPTABLE_PROP_OVERWRITTEN) {
11605 + nsClassHashtable<nsISupportsHashKey, nsString> *table;
11606 + table = j == eModel_type ? &mNodeToType : &mNodeToP3PType;
11607 + NS_ENSURE_TRUE(table->IsInitialized(), NS_ERROR_FAILURE);
11609 + // Check for existing value
11610 + if (table->Get(node, nsnull)) {
11611 multiMIP = PR_TRUE;
11612 break;
11615 + // Insert value
11616 + nsAutoPtr<nsString> newString(new nsString(propStrings[j]));
11617 + NS_ENSURE_TRUE(newString, NS_ERROR_OUT_OF_MEMORY);
11618 + NS_ENSURE_TRUE(table->Put(node, newString), NS_ERROR_OUT_OF_MEMORY);
11620 + // string is succesfully stored in the table, we should not dealloc it
11621 + newString.forget();
11623 if (j == eModel_type) {
11624 // Inform MDG that it needs to check type. The only arguments
11625 // actually used are |eModel_constraint| and |node|.
11626 @@ -1661,22 +1757,11 @@ nsXFormsModelElement::SetStates(nsIXForm
11627 return SetStatesInternal(aControl, aBoundNode, PR_TRUE);
11630 -NS_IMETHODIMP
11631 -nsXFormsModelElement::GetInstanceList(nsCOMArray<nsIInstanceElementPrivate> **aInstanceList)
11633 - if (aInstanceList) {
11634 - *aInstanceList = &mInstanceList;
11636 - return NS_OK;
11639 nsresult
11640 nsXFormsModelElement::AddInstanceElement(nsIInstanceElementPrivate *aInstEle)
11642 - // always append to the end of the list. We need to keep the elements in
11643 - // document order since the first instance element is the default instance
11644 - // document for the model.
11645 - mInstanceList.AppendObject(aInstEle);
11646 + NS_ENSURE_STATE(mInstanceDocuments);
11647 + mInstanceDocuments->AddInstance(aInstEle);
11649 return NS_OK;
11651 @@ -1764,6 +1849,74 @@ nsXFormsModelElement::ProcessDeferredBin
11654 nsresult
11655 +nsXFormsModelElement::HandleLoad(nsIDOMEvent* aEvent)
11657 + if (!mInstancesInitialized) {
11658 + // XXX This is for Bug 308106. In Gecko 1.8 DoneAddingChildren is not
11659 + // called in XUL if the element doesn't have any child nodes.
11660 + InitializeInstances();
11663 + mDocumentLoaded = PR_TRUE;
11665 + // dispatch xforms-model-construct, xforms-rebuild, xforms-recalculate,
11666 + // xforms-revalidate
11668 + // We wait until DOMContentLoaded to dispatch xforms-model-construct,
11669 + // since the model may have an action handler for this event and Mozilla
11670 + // doesn't register XML Event listeners until the document is loaded.
11672 + // xforms-model-construct is not cancellable, so always proceed.
11674 + nsXFormsUtils::DispatchEvent(mElement, eEvent_ModelConstruct);
11676 + if (mPendingInlineSchemas.Count() > 0) {
11677 + nsCOMPtr<nsIDOMElement> el;
11678 + nsresult rv;
11679 + for (PRInt32 i=0; i<mPendingInlineSchemas.Count(); ++i) {
11680 + GetSchemaElementById(mElement, *mPendingInlineSchemas[i],
11681 + getter_AddRefs(el));
11682 + if (!el) {
11683 + rv = NS_ERROR_UNEXPECTED;
11684 + } else {
11685 + nsCOMPtr<nsISchema> schema;
11686 + // no need to observe errors via the callback. instead, rely on
11687 + // this method returning a failure code when it encounters errors.
11688 + rv = mSchemas->ProcessSchemaElement(el, nsnull,
11689 + getter_AddRefs(schema));
11690 + if (NS_SUCCEEDED(rv))
11691 + mSchemaCount++;
11693 + if (NS_FAILED(rv)) {
11694 + // this is a fatal error (XXX)
11695 + nsXFormsUtils::ReportError(NS_LITERAL_STRING("schemaLoadError"), mElement);
11696 + nsXFormsUtils::DispatchEvent(mElement, eEvent_LinkException);
11697 + return NS_OK;
11700 + if (IsComplete()) {
11701 + rv = FinishConstruction();
11702 + NS_ENSURE_SUCCESS(rv, rv);
11703 + nsXFormsUtils::DispatchEvent(mElement, eEvent_Refresh);
11705 + mPendingInlineSchemas.Clear();
11708 + // We may still be waiting on external documents to load.
11709 + MaybeNotifyCompletion();
11711 + return NS_OK;
11714 +nsresult
11715 +nsXFormsModelElement::HandleUnload(nsIDOMEvent* aEvent)
11717 + // due to fastback changes, had to move this notification out from under
11718 + // model's WillChangeDocument override.
11719 + return nsXFormsUtils::DispatchEvent(mElement, eEvent_ModelDestruct);
11722 +nsresult
11723 NS_NewXFormsModelElement(nsIXTFElement **aResult)
11725 *aResult = new nsXFormsModelElement();
11726 @@ -1773,3 +1926,124 @@ NS_NewXFormsModelElement(nsIXTFElement *
11727 NS_ADDREF(*aResult);
11728 return NS_OK;
11732 +// ---------------------------- //
11734 +// nsXFormsModelInstanceDocuments
11736 +NS_IMPL_ISUPPORTS2(nsXFormsModelInstanceDocuments, nsIDOMNodeList, nsIClassInfo)
11738 +nsXFormsModelInstanceDocuments::nsXFormsModelInstanceDocuments()
11739 + : mInstanceList(16)
11743 +NS_IMETHODIMP
11744 +nsXFormsModelInstanceDocuments::GetLength(PRUint32* aLength)
11746 + *aLength = mInstanceList.Count();
11748 + return NS_OK;
11751 +NS_IMETHODIMP
11752 +nsXFormsModelInstanceDocuments::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
11754 + *aReturn = nsnull;
11755 + nsIInstanceElementPrivate* instance = mInstanceList.SafeObjectAt(aIndex);
11756 + if (instance) {
11757 + nsCOMPtr<nsIDOMDocument> doc;
11758 + if (NS_SUCCEEDED(instance->GetDocument(getter_AddRefs(doc))) && doc) {
11759 + NS_ADDREF(*aReturn = doc);
11763 + return NS_OK;
11766 +nsIInstanceElementPrivate*
11767 +nsXFormsModelInstanceDocuments::GetInstanceAt(PRUint32 aIndex)
11769 + return mInstanceList.ObjectAt(aIndex);
11772 +void
11773 +nsXFormsModelInstanceDocuments::AddInstance(nsIInstanceElementPrivate *aInst)
11775 + // always append to the end of the list. We need to keep the elements in
11776 + // document order since the first instance element is the default instance
11777 + // document for the model.
11778 + mInstanceList.AppendObject(aInst);
11781 +void
11782 +nsXFormsModelInstanceDocuments::DropReferences()
11784 + mInstanceList.Clear();
11787 +// nsIClassInfo implementation
11789 +static const nsIID sInstScriptingIIDs[] = {
11790 + NS_IDOMNODELIST_IID
11793 +NS_IMETHODIMP
11794 +nsXFormsModelInstanceDocuments::GetInterfaces(PRUint32 *aCount,
11795 + nsIID * **aArray)
11797 + return
11798 + nsXFormsUtils::CloneScriptingInterfaces(sInstScriptingIIDs,
11799 + NS_ARRAY_LENGTH(sInstScriptingIIDs),
11800 + aCount, aArray);
11803 +NS_IMETHODIMP
11804 +nsXFormsModelInstanceDocuments::GetHelperForLanguage(PRUint32 language,
11805 + nsISupports **_retval)
11807 + *_retval = nsnull;
11808 + return NS_OK;
11811 +NS_IMETHODIMP
11812 +nsXFormsModelInstanceDocuments::GetContractID(char * *aContractID)
11814 + *aContractID = nsnull;
11815 + return NS_OK;
11818 +NS_IMETHODIMP
11819 +nsXFormsModelInstanceDocuments::GetClassDescription(char * *aClassDescription)
11821 + *aClassDescription = nsnull;
11822 + return NS_OK;
11825 +NS_IMETHODIMP
11826 +nsXFormsModelInstanceDocuments::GetClassID(nsCID * *aClassID)
11828 + *aClassID = nsnull;
11829 + return NS_OK;
11832 +NS_IMETHODIMP
11833 +nsXFormsModelInstanceDocuments::GetImplementationLanguage(PRUint32 *aLang)
11835 + *aLang = nsIProgrammingLanguage::CPLUSPLUS;
11836 + return NS_OK;
11839 +NS_IMETHODIMP
11840 +nsXFormsModelInstanceDocuments::GetFlags(PRUint32 *aFlags)
11842 + *aFlags = nsIClassInfo::DOM_OBJECT;
11843 + return NS_OK;
11846 +NS_IMETHODIMP
11847 +nsXFormsModelInstanceDocuments::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
11849 + return NS_ERROR_NOT_AVAILABLE;
11851 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsModelElement.h mozilla.new/extensions/xforms/nsXFormsModelElement.h
11852 --- mozilla/extensions/xforms/nsXFormsModelElement.h 2005-10-20 11:32:33.000000000 +0200
11853 +++ mozilla.new/extensions/xforms/nsXFormsModelElement.h 2006-02-24 11:16:23.000000000 +0100
11854 @@ -42,14 +42,17 @@
11856 #include "nsXFormsStubElement.h"
11857 #include "nsIModelElementPrivate.h"
11858 +#include "nsIXFormsNSModelElement.h"
11859 #include "nsIDOMEventListener.h"
11860 #include "nsISchema.h"
11861 #include "nsCOMArray.h"
11862 #include "nsVoidArray.h"
11863 #include "nsCOMPtr.h"
11864 #include "nsIDOMDocument.h"
11865 +#include "nsIDOMNodeList.h"
11866 #include "nsXFormsMDGEngine.h"
11867 #include "nsXFormsUtils.h"
11868 +#include "nsIClassInfo.h"
11870 #include "nsISchemaLoader.h"
11871 #include "nsISchema.h"
11872 @@ -60,6 +63,51 @@ class nsIDOMNode;
11873 class nsIXFormsXPathEvaluator;
11874 class nsIDOMXPathResult;
11875 class nsXFormsControl;
11876 +class nsXFormsModelInstanceDocuments;
11878 +/**
11879 + * Implementation of the instance node list returned by
11880 + * nsIXFormsModel::getInstanceDocuments.
11882 + * Manages the list of all instance elements that belong to a given
11883 + * nsXFormsModelElement.
11884 + */
11885 +class nsXFormsModelInstanceDocuments : public nsIDOMNodeList,
11886 + public nsIClassInfo
11888 +public:
11889 + nsXFormsModelInstanceDocuments();
11891 + NS_DECL_ISUPPORTS
11892 + NS_DECL_NSICLASSINFO
11893 + NS_DECL_NSIDOMNODELIST
11895 + /**
11896 + * Add an instance element
11898 + * @param aInstance The new instance element
11899 + */
11900 + void AddInstance(nsIInstanceElementPrivate *aInstance);
11902 + /**
11903 + * Get the instance document at a given index
11905 + * @note Does NOT addref the returned element!
11907 + * @param aIndex The index
11908 + * @return The instance element (or nsnull if not found)
11909 + */
11910 + nsIInstanceElementPrivate* GetInstanceAt(PRUint32 aIndex);
11912 + /**
11913 + * Instructs the class to drop references to all instance elements
11914 + */
11915 + void DropReferences();
11917 +protected:
11918 + /** The array holding the instance elements */
11919 + nsCOMArray<nsIInstanceElementPrivate> mInstanceList;
11923 * Implementation of the XForms \<model\> element.
11924 @@ -71,6 +119,7 @@ class nsXFormsControl;
11926 class nsXFormsModelElement : public nsXFormsStubElement,
11927 public nsIModelElementPrivate,
11928 + public nsIXFormsNSModelElement,
11929 public nsISchemaLoadListener,
11930 public nsIDOMEventListener,
11931 public nsIXFormsContextControl
11932 @@ -81,6 +130,7 @@ public:
11933 NS_DECL_ISUPPORTS_INHERITED
11934 NS_DECL_NSIXFORMSMODELELEMENT
11935 NS_DECL_NSIMODELELEMENTPRIVATE
11936 + NS_DECL_NSIXFORMSNSMODELELEMENT
11937 NS_DECL_NSISCHEMALOADLISTENER
11938 NS_DECL_NSIWEBSERVICEERRORHANDLER
11939 NS_DECL_NSIDOMEVENTLISTENER
11940 @@ -128,6 +178,8 @@ private:
11941 /** Initializes the MIPs on all form controls */
11942 NS_HIDDEN_(nsresult) InitializeControls();
11944 + NS_HIDDEN_(nsresult) InitializeInstances();
11946 NS_HIDDEN_(nsresult) ProcessBindElements();
11947 NS_HIDDEN_(nsresult) FinishConstruction();
11948 NS_HIDDEN_(nsresult) ConstructDone();
11949 @@ -178,6 +230,16 @@ private:
11950 PRBool IsComplete() const { return (mSchemaTotal == mSchemaCount
11951 && mPendingInstanceCount == 0); }
11953 + /**
11954 + * Called by HandleEvent. Event handler for the 'DOMContentLoaded' event.
11955 + */
11956 + NS_HIDDEN_(nsresult) HandleLoad(nsIDOMEvent *aEvent);
11958 + /**
11959 + * Called by HandleEvent. Event handler for the 'unload' event.
11960 + */
11961 + NS_HIDDEN_(nsresult) HandleUnload(nsIDOMEvent *aEvent);
11963 nsIDOMElement *mElement;
11964 nsCOMPtr<nsISchemaLoader> mSchemas;
11965 nsStringArray mPendingInlineSchemas;
11966 @@ -203,14 +265,32 @@ private:
11967 // xforms-revalidate yet
11968 PRBool mNeedsRefresh;
11970 + // This flag indicates whether instance elements have been initialized
11971 + PRBool mInstancesInitialized;
11974 - * List of instance elements contained by this model, including lazy-authored
11975 - * instance elements.
11976 + * All instance documents contained by this model, including lazy-authored
11977 + * instance documents.
11979 - nsCOMArray<nsIInstanceElementPrivate> mInstanceList;
11980 + nsRefPtr<nsXFormsModelInstanceDocuments> mInstanceDocuments;
11982 /** Indicates whether the model's instance was built by lazy authoring */
11983 PRBool mLazyModel;
11985 + /**
11986 + * Type information for nodes, with their type set through \<xforms:bind\>.
11988 + * @see http://www.w3.org/TR/xforms/slice6.html#model-prop-type
11989 + */
11990 + nsClassHashtable<nsISupportsHashKey, nsString> mNodeToType;
11992 + /**
11993 + * P3P type information for nodes, with their type set through
11994 + * \<xforms:bind\>.
11996 + * @see http://www.w3.org/TR/xforms/slice6.html#model-prop-p3ptype
11997 + */
11998 + nsClassHashtable<nsISupportsHashKey, nsString> mNodeToP3PType;
12002 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsRangeAccessors.cpp mozilla.new/extensions/xforms/nsXFormsRangeAccessors.cpp
12003 --- mozilla/extensions/xforms/nsXFormsRangeAccessors.cpp 1970-01-01 01:00:00.000000000 +0100
12004 +++ mozilla.new/extensions/xforms/nsXFormsRangeAccessors.cpp 2006-02-07 16:30:11.000000000 +0100
12005 @@ -0,0 +1,108 @@
12006 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
12007 +/* ***** BEGIN LICENSE BLOCK *****
12008 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
12010 + * The contents of this file are subject to the Mozilla Public License Version
12011 + * 1.1 (the "License"); you may not use this file except in compliance with
12012 + * the License. You may obtain a copy of the License at
12013 + * http://www.mozilla.org/MPL/
12015 + * Software distributed under the License is distributed on an "AS IS" basis,
12016 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12017 + * for the specific language governing rights and limitations under the
12018 + * License.
12020 + * The Original Code is Mozilla XForms support.
12022 + * The Initial Developer of the Original Code is
12023 + * Novell, Inc.
12024 + * Portions created by the Initial Developer are Copyright (C) 2005
12025 + * the Initial Developer. All Rights Reserved.
12027 + * Contributor(s):
12028 + * Allan Beaufour <abeaufour@novell.com>
12030 + * Alternatively, the contents of this file may be used under the terms of
12031 + * either the GNU General Public License Version 2 or later (the "GPL"), or
12032 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
12033 + * in which case the provisions of the GPL or the LGPL are applicable instead
12034 + * of those above. If you wish to allow use of your version of this file only
12035 + * under the terms of either the GPL or the LGPL, and not to allow others to
12036 + * use your version of this file under the terms of the MPL, indicate your
12037 + * decision by deleting the provisions above and replace them with the notice
12038 + * and other provisions required by the GPL or the LGPL. If you do not delete
12039 + * the provisions above, a recipient may use your version of this file under
12040 + * the terms of any one of the MPL, the GPL or the LGPL.
12042 + * ***** END LICENSE BLOCK ***** */
12044 +#include "nsXFormsRangeAccessors.h"
12045 +#include "nsDOMString.h"
12046 +#include "nsIDOMElement.h"
12047 +#include "nsString.h"
12048 +#include "nsXFormsUtils.h"
12050 +NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsRangeAccessors,
12051 + nsXFormsAccessors,
12052 + nsIXFormsRangeAccessors,
12053 + nsIClassInfo)
12055 +// nsXFormsRangeAccessors
12056 +nsresult
12057 +nsXFormsRangeAccessors::AttributeGetter(const nsAString &aAttr, nsAString &aVal)
12059 + nsAutoString val;
12060 + if (mElement) {
12061 + mElement->GetAttribute(aAttr, val);
12063 + if (val.IsEmpty()) {
12064 + SetDOMStringToNull(aVal);
12065 + } else {
12066 + aVal = val;
12069 + return NS_OK;
12073 +// nsIXFormsRangeElement
12075 +// XXX this should do a max(type.minumum, @start)
12076 +NS_IMETHODIMP
12077 +nsXFormsRangeAccessors::GetRangeStart(nsAString &aMin)
12079 + return AttributeGetter(NS_LITERAL_STRING("start"), aMin);
12082 +// XXX this should do min(type.maximu, @end)
12083 +NS_IMETHODIMP
12084 +nsXFormsRangeAccessors::GetRangeEnd(nsAString &aMax)
12086 + return AttributeGetter(NS_LITERAL_STRING("end"), aMax);
12089 +// XXX if step is not set, it should be set to something "smart" and also
12090 +// needs to be something that is valid for the given type. This could be
12091 +// pushed to the widget though.
12092 +NS_IMETHODIMP
12093 +nsXFormsRangeAccessors::GetRangeStep(nsAString &aStep)
12095 + return AttributeGetter(NS_LITERAL_STRING("step"), aStep);
12099 +// nsIClassInfo implementation
12101 +static const nsIID sScriptingIIDs[] = {
12102 + NS_IXFORMSACCESSORS_IID,
12103 + NS_IXFORMSRANGEACCESSORS_IID,
12107 +NS_IMETHODIMP
12108 +nsXFormsRangeAccessors::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
12110 + return nsXFormsUtils::CloneScriptingInterfaces(sScriptingIIDs,
12111 + NS_ARRAY_LENGTH(sScriptingIIDs),
12112 + aCount, aArray);
12114 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsRangeAccessors.h mozilla.new/extensions/xforms/nsXFormsRangeAccessors.h
12115 --- mozilla/extensions/xforms/nsXFormsRangeAccessors.h 1970-01-01 01:00:00.000000000 +0100
12116 +++ mozilla.new/extensions/xforms/nsXFormsRangeAccessors.h 2006-02-07 16:30:11.000000000 +0100
12117 @@ -0,0 +1,74 @@
12118 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
12119 +/* ***** BEGIN LICENSE BLOCK *****
12120 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
12122 + * The contents of this file are subject to the Mozilla Public License Version
12123 + * 1.1 (the "License"); you may not use this file except in compliance with
12124 + * the License. You may obtain a copy of the License at
12125 + * http://www.mozilla.org/MPL/
12127 + * Software distributed under the License is distributed on an "AS IS" basis,
12128 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12129 + * for the specific language governing rights and limitations under the
12130 + * License.
12132 + * The Original Code is Mozilla XForms support.
12134 + * The Initial Developer of the Original Code is
12135 + * Novell, Inc.
12136 + * Portions created by the Initial Developer are Copyright (C) 2005
12137 + * the Initial Developer. All Rights Reserved.
12139 + * Contributor(s):
12140 + * Allan Beaufour <abeaufour@novell.com>
12142 + * Alternatively, the contents of this file may be used under the terms of
12143 + * either the GNU General Public License Version 2 or later (the "GPL"), or
12144 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
12145 + * in which case the provisions of the GPL or the LGPL are applicable instead
12146 + * of those above. If you wish to allow use of your version of this file only
12147 + * under the terms of either the GPL or the LGPL, and not to allow others to
12148 + * use your version of this file under the terms of the MPL, indicate your
12149 + * decision by deleting the provisions above and replace them with the notice
12150 + * and other provisions required by the GPL or the LGPL. If you do not delete
12151 + * the provisions above, a recipient may use your version of this file under
12152 + * the terms of any one of the MPL, the GPL or the LGPL.
12154 + * ***** END LICENSE BLOCK ***** */
12156 +#include "nsIXFormsRangeAccessors.h"
12157 +#include "nsXFormsAccessors.h"
12159 +/**
12160 + * Implementation for the accessors for a range element,
12161 + * nsIXFormsRangeAccessors.
12163 + * @todo Support out-of/in-range events (XXX)
12164 + */
12165 +class nsXFormsRangeAccessors : public nsIXFormsRangeAccessors,
12166 + public nsXFormsAccessors
12168 +public:
12169 + NS_DECL_ISUPPORTS_INHERITED
12170 + NS_DECL_NSIXFORMSRANGEACCESSORS
12171 + NS_FORWARD_NSIXFORMSACCESSORS(nsXFormsAccessors::)
12173 + // Constructor
12174 + nsXFormsRangeAccessors(nsIDelegateInternal* aDelegate,
12175 + nsIDOMElement* aElement)
12176 + : nsXFormsAccessors(aDelegate, aElement)
12180 + // nsIClassInfo overrides
12181 + NS_IMETHOD GetInterfaces(PRUint32 *aCount, nsIID * **aArray);
12183 +protected:
12184 + /**
12185 + * Gets the value of an attribute on the element (mElement).
12187 + * @param aAttr The attribute
12188 + * @param aVal The returned value ("DOMNull"s it if it's not there or empty)
12189 + */
12190 + nsresult AttributeGetter(const nsAString &aAttr, nsAString &aVal);
12192 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsRangeElement.cpp mozilla.new/extensions/xforms/nsXFormsRangeElement.cpp
12193 --- mozilla/extensions/xforms/nsXFormsRangeElement.cpp 1970-01-01 01:00:00.000000000 +0100
12194 +++ mozilla.new/extensions/xforms/nsXFormsRangeElement.cpp 2006-02-07 16:30:11.000000000 +0100
12195 @@ -0,0 +1,87 @@
12196 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
12197 +/* ***** BEGIN LICENSE BLOCK *****
12198 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
12200 + * The contents of this file are subject to the Mozilla Public License Version
12201 + * 1.1 (the "License"); you may not use this file except in compliance with
12202 + * the License. You may obtain a copy of the License at
12203 + * http://www.mozilla.org/MPL/
12205 + * Software distributed under the License is distributed on an "AS IS" basis,
12206 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12207 + * for the specific language governing rights and limitations under the
12208 + * License.
12210 + * The Original Code is Mozilla XForms support.
12212 + * The Initial Developer of the Original Code is
12213 + * Novell, Inc.
12214 + * Portions created by the Initial Developer are Copyright (C) 2005
12215 + * the Initial Developer. All Rights Reserved.
12217 + * Contributor(s):
12218 + * Allan Beaufour <allan@beaufour.dk>
12220 + * Alternatively, the contents of this file may be used under the terms of
12221 + * either the GNU General Public License Version 2 or later (the "GPL"), or
12222 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
12223 + * in which case the provisions of the GPL or the LGPL are applicable instead
12224 + * of those above. If you wish to allow use of your version of this file only
12225 + * under the terms of either the GPL or the LGPL, and not to allow others to
12226 + * use your version of this file under the terms of the MPL, indicate your
12227 + * decision by deleting the provisions above and replace them with the notice
12228 + * and other provisions required by the GPL or the LGPL. If you do not delete
12229 + * the provisions above, a recipient may use your version of this file under
12230 + * the terms of any one of the MPL, the GPL or the LGPL.
12232 + * ***** END LICENSE BLOCK ***** */
12234 +#include "nsXFormsDelegateStub.h"
12235 +#include "nsXFormsRangeAccessors.h"
12237 +/**
12238 + * Implementation of the XForms \<range\> element
12239 + * @see http://www.w3.org/TR/xforms/slice8.html#ui-range
12241 + * @todo Check data binding restrictions (XXX)
12242 + */
12243 +class nsXFormsRangeElement : public nsXFormsDelegateStub
12245 +public:
12247 + // nsIXFormsDelegate overrides
12248 + NS_IMETHOD GetXFormsAccessors(nsIXFormsAccessors **aAccessor);
12250 +#ifdef DEBUG_smaug
12251 + virtual const char* Name() { return "range"; }
12252 +#endif
12255 +// nsIXFormsDelegate
12257 +NS_IMETHODIMP
12258 +nsXFormsRangeElement::GetXFormsAccessors(nsIXFormsAccessors **aAccessor)
12260 + if (!mAccessor) {
12261 + mAccessor = new nsXFormsRangeAccessors(this, mElement);
12262 + if (!mAccessor) {
12263 + return NS_ERROR_OUT_OF_MEMORY;
12266 + NS_ADDREF(*aAccessor = mAccessor);
12267 + return NS_OK;
12271 +// Creator
12273 +NS_HIDDEN_(nsresult)
12274 +NS_NewXFormsRangeElement(nsIXTFElement **aResult)
12276 + *aResult = new nsXFormsRangeElement();
12277 + if (!*aResult)
12278 + return NS_ERROR_OUT_OF_MEMORY;
12280 + NS_ADDREF(*aResult);
12281 + return NS_OK;
12283 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsRepeatElement.cpp mozilla.new/extensions/xforms/nsXFormsRepeatElement.cpp
12284 --- mozilla/extensions/xforms/nsXFormsRepeatElement.cpp 2005-10-04 20:28:24.000000000 +0200
12285 +++ mozilla.new/extensions/xforms/nsXFormsRepeatElement.cpp 2006-02-14 10:01:13.000000000 +0100
12286 @@ -766,11 +766,14 @@ nsXFormsRepeatElement::Refresh()
12287 rv = result->SnapshotItem(i - 1, getter_AddRefs(contextNode));
12288 NS_ENSURE_SUCCESS(rv, rv);
12290 - nsCOMPtr<nsIDOMElement> contextElement = do_QueryInterface(contextNode);
12291 - NS_ENSURE_TRUE(contextElement, NS_ERROR_FAILURE);
12293 // Set context node, position, and size
12294 - rv = riContext->SetContext(contextElement, i, contextSize);
12295 + rv = riContext->SetContext(contextNode, i, contextSize);
12296 + NS_ENSURE_SUCCESS(rv, rv);
12298 + // We need to insert the context node before adding the children, or the
12299 + // children will fail to set up their proper XForms context.
12300 + nsCOMPtr<nsIDOMNode> domNode;
12301 + rv = mHTMLElement->AppendChild(riElement, getter_AddRefs(domNode));
12302 NS_ENSURE_SUCCESS(rv, rv);
12304 // Iterate over template children, clone them, and append them to <contextcontainer>
12305 @@ -778,6 +781,8 @@ nsXFormsRepeatElement::Refresh()
12306 rv = mElement->GetFirstChild(getter_AddRefs(child));
12307 NS_ENSURE_SUCCESS(rv, rv);
12308 while (child) {
12309 + /// XXX the node probably refreshes itself twice here, once on cloning
12310 + /// and once when it's inserted ... that's not necessary.
12311 nsCOMPtr<nsIDOMNode> childClone;
12312 rv = CloneNode(child, getter_AddRefs(childClone));
12313 NS_ENSURE_SUCCESS(rv, rv);
12314 @@ -790,16 +795,6 @@ nsXFormsRepeatElement::Refresh()
12315 NS_ENSURE_SUCCESS(rv, rv);
12316 child = newNode;
12319 - // Append node
12320 - nsCOMPtr<nsIDOMNode> domNode;
12321 - rv = mHTMLElement->AppendChild(riElement, getter_AddRefs(domNode));
12322 - NS_ENSURE_SUCCESS(rv, rv);
12324 - // There is an awfull lot of evaluating being done by all the
12325 - // children, as they are created and inserted into the different
12326 - // places in the DOM, the only refresh necessary is the one when they
12327 - // are appended in mHTMLElement.
12330 if (!mParent && !mCurrentIndex && mMaxIndex) {
12331 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsSchemaValidator.cpp mozilla.new/extensions/xforms/nsXFormsSchemaValidator.cpp
12332 --- mozilla/extensions/xforms/nsXFormsSchemaValidator.cpp 2005-07-26 22:18:35.000000000 +0200
12333 +++ mozilla.new/extensions/xforms/nsXFormsSchemaValidator.cpp 2006-02-14 10:01:13.000000000 +0100
12334 @@ -227,7 +227,7 @@ nsXFormsSchemaValidator::IsValidSchemaLi
12335 PRBool isValid = PR_FALSE;
12337 // listItem is like a string, but no whitespace. listItems is a whitespace
12338 - // delimeted list of listItem, so therefore just need to see if it is a valid
12339 + // delimited list of listItem, so therefore just need to see if it is a valid
12340 // xsd:string
12341 mSchemaValidator->ValidateString(aValue, NS_LITERAL_STRING("string"),
12342 NS_LITERAL_STRING("http://www.w3.org/1999/XMLSchema"),
12343 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsSubmissionElement.cpp mozilla.new/extensions/xforms/nsXFormsSubmissionElement.cpp
12344 --- mozilla/extensions/xforms/nsXFormsSubmissionElement.cpp 2005-10-23 18:30:13.000000000 +0200
12345 +++ mozilla.new/extensions/xforms/nsXFormsSubmissionElement.cpp 2006-02-24 11:16:23.000000000 +0100
12346 @@ -74,7 +74,6 @@
12347 #include "nsIMultiplexInputStream.h"
12348 #include "nsIMIMEInputStream.h"
12349 #include "nsINameSpaceManager.h"
12350 -#include "nsIDocument.h"
12351 #include "nsIContent.h"
12352 #include "nsIFileURL.h"
12353 #include "nsIMIMEService.h"
12354 @@ -93,12 +92,10 @@
12355 #include "nsIPermissionManager.h"
12356 #include "nsIPrefBranch.h"
12357 #include "nsIPrefService.h"
12358 +#include "nsIExternalProtocolService.h"
12359 +#include "nsEscape.h"
12361 // namespace literals
12362 -#define NAMESPACE_XML_SCHEMA \
12363 - NS_LITERAL_STRING("http://www.w3.org/2001/XMLSchema")
12364 -#define NAMESPACE_XML_SCHEMA_INSTANCE \
12365 - NS_LITERAL_STRING("http://www.w3.org/2001/XMLSchema-instance")
12366 #define kXMLNSNameSpaceURI \
12367 NS_LITERAL_STRING("http://www.w3.org/2000/xmlns/")
12369 @@ -382,7 +379,7 @@ nsXFormsSubmissionElement::OnChannelRedi
12370 nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
12371 NS_ENSURE_STATE(doc);
12373 - if (!CheckSameOrigin(doc->GetDocumentURI(), newURI)) {
12374 + if (!CheckSameOrigin(doc, newURI)) {
12375 nsXFormsUtils::ReportError(NS_LITERAL_STRING("submitSendOrigin"),
12376 mElement);
12377 return NS_ERROR_ABORT;
12378 @@ -904,7 +901,7 @@ nsXFormsSubmissionElement::SerializeData
12381 PRBool
12382 -nsXFormsSubmissionElement::CheckSameOrigin(nsIURI *aBaseURI, nsIURI *aTestURI)
12383 +nsXFormsSubmissionElement::CheckSameOrigin(nsIDocument *aBaseDocument, nsIURI *aTestURI)
12385 // we default to true to allow regular posts to work like html forms.
12386 PRBool allowSubmission = PR_TRUE;
12387 @@ -923,21 +920,22 @@ nsXFormsSubmissionElement::CheckSameOrig
12389 // if same origin is required, default to false
12390 allowSubmission = PR_FALSE;
12391 + nsIURI *baseURI = aBaseDocument->GetDocumentURI();
12393 // if we don't replace the instance, we allow file:// to submit data anywhere
12394 if (!mIsReplaceInstance) {
12395 - aBaseURI->SchemeIs("file", &allowSubmission);
12396 + baseURI->SchemeIs("file", &allowSubmission);
12399 // let's check the permission manager
12400 if (!allowSubmission) {
12401 - allowSubmission = CheckPermissionManager(aBaseURI);
12402 + allowSubmission = CheckPermissionManager(baseURI);
12405 // if none of the above checks have allowed the submission, we do a
12406 // same origin check.
12407 if (!allowSubmission) {
12408 - allowSubmission = nsXFormsUtils::CheckSameOrigin(aBaseURI, aTestURI);
12409 + allowSubmission = nsXFormsUtils::CheckSameOrigin(aBaseDocument, aTestURI);
12413 @@ -1229,14 +1227,14 @@ nsXFormsSubmissionElement::CopyChildren(
12414 return NS_ERROR_ILLEGAL_VALUE;
12417 - // if |destChild| is an element node of type 'xsd:anyURI', and if we have
12418 - // an attachments array, then we need to perform multipart/related
12419 + // If |currentNode| is an element node of type 'xsd:anyURI', and if we
12420 + // have an attachments array, then we need to perform multipart/related
12421 // processing (i.e., generate a ContentID for the child of this element,
12422 // and append a new attachment to the attachments array).
12424 PRUint32 encType;
12425 if (attachments &&
12426 - NS_SUCCEEDED(GetElementEncodingType(destChild, &encType)) &&
12427 + NS_SUCCEEDED(GetElementEncodingType(currentNode, &encType, model)) &&
12428 encType == ELEMENT_ENCTYPE_URI)
12430 // ok, looks like we have a local file to upload
12431 @@ -1445,7 +1443,8 @@ nsXFormsSubmissionElement::SerializeData
12433 nsCOMPtr<nsIInputStream> xml;
12434 SubmissionAttachmentArray attachments;
12435 - SerializeDataXML(data, getter_AddRefs(xml), type, &attachments);
12436 + nsresult rv = SerializeDataXML(data, getter_AddRefs(xml), type, &attachments);
12437 + NS_ENSURE_SUCCESS(rv, rv);
12439 // XXX we should output a 'charset=' with the 'Content-Type' header
12441 @@ -1454,7 +1453,7 @@ nsXFormsSubmissionElement::SerializeData
12442 + NS_LITERAL_CSTRING("\r\nContent-Type: ") + type
12443 + NS_LITERAL_CSTRING("\r\nContent-ID: <") + start
12444 + NS_LITERAL_CSTRING(">\r\n\r\n");
12445 - nsresult rv = AppendPostDataChunk(postDataChunk, multiStream);
12446 + rv = AppendPostDataChunk(postDataChunk, multiStream);
12447 NS_ENSURE_SUCCESS(rv, rv);
12449 multiStream->AppendStream(xml);
12450 @@ -1657,7 +1656,7 @@ nsXFormsSubmissionElement::AppendMultipa
12452 else
12454 - // for base64binary and hexBinary types, we assume that the data is
12455 + // for base64Binary and hexBinary types, we assume that the data is
12456 // already encoded. this assumption is based on section 8.1.6 of the
12457 // xforms spec.
12459 @@ -1700,47 +1699,35 @@ nsXFormsSubmissionElement::AppendPostDat
12462 nsresult
12463 -nsXFormsSubmissionElement::GetElementEncodingType(nsIDOMNode *node, PRUint32 *encType)
12464 +nsXFormsSubmissionElement::GetElementEncodingType(nsIDOMNode *node,
12465 + PRUint32 *encType,
12466 + nsIModelElementPrivate *aModel)
12468 *encType = ELEMENT_ENCTYPE_STRING; // default
12470 nsCOMPtr<nsIDOMElement> element = do_QueryInterface(node);
12471 NS_ENSURE_TRUE(element, NS_ERROR_UNEXPECTED);
12473 - nsAutoString type;
12474 - element->GetAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_XML_SCHEMA_INSTANCE),
12475 - NS_LITERAL_STRING("type"), type);
12476 - if (!type.IsEmpty())
12478 - // check for 'xsd:base64binary', 'xsd:hexBinary', or 'xsd:anyURI'
12479 + // check for 'xsd:base64Binary', 'xsd:hexBinary', or 'xsd:anyURI'
12480 + nsAutoString type, nsuri;
12481 + nsresult rv;
12482 + if (aModel) {
12483 + rv = aModel->GetTypeFromNode(node, type, nsuri);
12484 + } else {
12485 + rv = nsXFormsUtils::ParseTypeFromNode(node, type, nsuri);
12487 + if (NS_SUCCEEDED(rv) &&
12488 + nsuri.EqualsLiteral(NS_NAMESPACE_XML_SCHEMA) &&
12489 + !type.IsEmpty())
12491 + if (type.Equals(NS_LITERAL_STRING("anyURI")))
12492 + *encType = ELEMENT_ENCTYPE_URI;
12493 + else if (type.Equals(NS_LITERAL_STRING("base64Binary")))
12494 + *encType = ELEMENT_ENCTYPE_BASE64;
12495 + else if (type.Equals(NS_LITERAL_STRING("hexBinary")))
12496 + *encType = ELEMENT_ENCTYPE_HEX;
12498 // XXX need to handle derived types (fixing bug 263384 will help)
12500 - // get 'xsd' namespace prefix
12501 - nsCOMPtr<nsIDOM3Node> dom3Node = do_QueryInterface(node);
12502 - NS_ENSURE_TRUE(dom3Node, NS_ERROR_UNEXPECTED);
12504 - nsAutoString prefix;
12505 - dom3Node->LookupPrefix(NS_LITERAL_STRING(NS_NAMESPACE_XML_SCHEMA), prefix);
12507 - if (prefix.IsEmpty())
12509 - NS_WARNING("namespace prefix not found! -- assuming 'xsd'");
12510 - prefix.AssignLiteral("xsd"); // XXX HACK HACK HACK
12513 - if (type.Length() > prefix.Length() &&
12514 - prefix.Equals(StringHead(type, prefix.Length())) &&
12515 - type.CharAt(prefix.Length()) == PRUnichar(':'))
12517 - const nsSubstring &tail = Substring(type, prefix.Length() + 1);
12518 - if (tail.Equals(NS_LITERAL_STRING("anyURI")))
12519 - *encType = ELEMENT_ENCTYPE_URI;
12520 - else if (tail.Equals(NS_LITERAL_STRING("base64binary")))
12521 - *encType = ELEMENT_ENCTYPE_BASE64;
12522 - else if (tail.Equals(NS_LITERAL_STRING("hexBinary")))
12523 - *encType = ELEMENT_ENCTYPE_HEX;
12527 return NS_OK;
12528 @@ -1803,7 +1790,89 @@ nsXFormsSubmissionElement::SendData(cons
12530 nsresult rv;
12532 - if (!CheckSameOrigin(doc->GetDocumentURI(), uri)) {
12533 + // handle mailto: submission
12534 + if (!mIsReplaceInstance) {
12535 + PRBool isMailto;
12536 + rv = uri->SchemeIs("mailto", &isMailto);
12537 + NS_ENSURE_SUCCESS(rv, rv);
12539 + if (isMailto) {
12540 + nsCOMPtr<nsIExternalProtocolService> extProtService =
12541 + do_GetService("@mozilla.org/uriloader/external-protocol-service;1");
12542 + NS_ENSURE_STATE(extProtService);
12544 + PRBool hasExposedMailClient;
12545 + rv = extProtService->ExternalProtocolHandlerExists("mailto",
12546 + &hasExposedMailClient);
12547 + NS_ENSURE_SUCCESS(rv, rv);
12549 + if (hasExposedMailClient) {
12550 + nsCAutoString mailtoUrl(uriSpec);
12552 + // A mailto url looks like this: mailto:foo@bar.com, which can be followed
12553 + // by parameters (subject and body). The first parameter has to have an
12554 + // "?" before it, and an additional one needs to have an "&".
12555 + // So if "?" already exists in the string, we use "&".
12557 + if (mailtoUrl.Find("&body=") != kNotFound ||
12558 + mailtoUrl.Find("?body=") != kNotFound) {
12559 + // body parameter already exists, so report a warning
12560 + nsXFormsUtils::ReportError(NS_LITERAL_STRING("warnMailtoBodyParam"),
12561 + mElement, nsIScriptError::warningFlag);
12564 + if (mailtoUrl.FindChar('?') != kNotFound)
12565 + mailtoUrl.AppendLiteral("&body=");
12566 + else
12567 + mailtoUrl.AppendLiteral("?body=");
12569 + // get the stream contents
12570 + PRUint32 len, read, numReadIn = 1;
12571 + stream->Available(&len);
12572 + char *buf = new char[len+1];
12573 + memset(buf, 0, len+1);
12575 + // Read returns 0 if eos
12576 + while (numReadIn != 0) {
12577 + numReadIn = stream->Read(buf, len, &read);
12578 + NS_EscapeURL(buf, esc_AlwaysCopy, read, mailtoUrl);
12581 + delete [] buf;
12583 + // create an nsIUri out of the string
12584 + nsCOMPtr<nsIURI> mailUri;
12585 + ios->NewURI(mailtoUrl,
12586 + nsnull,
12587 + nsnull,
12588 + getter_AddRefs(mailUri));
12589 + NS_ENSURE_STATE(mailUri);
12591 + // let the OS handle the uri
12592 + rv = extProtService->LoadURI(mailUri, nsnull);
12594 + if (NS_FAILED(rv)) {
12595 + // opening an mail client failed.
12596 + nsXFormsUtils::ReportError(NS_LITERAL_STRING("submitMailtoFailed"),
12597 + mElement);
12598 + EndSubmit(PR_FALSE);
12599 + } else {
12600 + // the protocol service succeeded
12601 + EndSubmit(PR_TRUE);
12604 + } else {
12605 + // no system mail client found
12606 + nsXFormsUtils::ReportError(NS_LITERAL_STRING("submitMailtoInit"),
12607 + mElement);
12608 + EndSubmit(PR_FALSE);
12611 + return NS_OK;
12615 + if (!CheckSameOrigin(doc, uri)) {
12616 nsXFormsUtils::ReportError(NS_LITERAL_STRING("submitSendOrigin"),
12617 mElement);
12618 return NS_ERROR_ABORT;
12619 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsSubmissionElement.h mozilla.new/extensions/xforms/nsXFormsSubmissionElement.h
12620 --- mozilla/extensions/xforms/nsXFormsSubmissionElement.h 2005-10-04 20:28:24.000000000 +0200
12621 +++ mozilla.new/extensions/xforms/nsXFormsSubmissionElement.h 2006-02-24 11:16:23.000000000 +0100
12622 @@ -49,6 +49,7 @@
12623 #include "nsIChannelEventSink.h"
12624 #include "nsIInterfaceRequestor.h"
12625 #include "nsHashSets.h"
12626 +#include "nsIDocument.h"
12629 class nsIMultiplexInputStream;
12630 @@ -110,7 +111,7 @@ public:
12631 NS_HIDDEN_(nsresult) SerializeDataMultipartFormData(nsIDOMNode *data, nsIInputStream **, nsCString &contentType);
12632 NS_HIDDEN_(nsresult) AppendMultipartFormData(nsIDOMNode *data, const nsCString &boundary, nsCString &buf, nsIMultiplexInputStream *);
12633 NS_HIDDEN_(nsresult) AppendPostDataChunk(nsCString &postDataChunk, nsIMultiplexInputStream *multiStream);
12634 - NS_HIDDEN_(nsresult) GetElementEncodingType(nsIDOMNode *data, PRUint32 *encType);
12635 + NS_HIDDEN_(nsresult) GetElementEncodingType(nsIDOMNode *data, PRUint32 *encType, nsIModelElementPrivate* aModel = nsnull);
12636 NS_HIDDEN_(nsresult) CreateFileStream(const nsString &absURI, nsIFile **file, nsIInputStream **stream);
12637 NS_HIDDEN_(nsresult) SendData(const nsCString &uri, nsIInputStream *stream, const nsCString &contentType);
12639 @@ -128,7 +129,7 @@ private:
12640 * @return true if aTestURI has the same origin as aBaseURI or if
12641 * there is no need for a same origin check.
12643 - PRBool CheckSameOrigin(nsIURI *aBaseURI, nsIURI *aTestURI);
12644 + PRBool CheckSameOrigin(nsIDocument *aBaseDocument, nsIURI *aTestURI);
12645 PRBool CheckPermissionManager(nsIURI *aBaseURI);
12646 nsresult AddNameSpaces(nsIDOMElement* aTarget, nsIDOMNode* aSource,
12647 nsStringHashSet* aPrefixHash);
12648 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsUploadElement.cpp mozilla.new/extensions/xforms/nsXFormsUploadElement.cpp
12649 --- mozilla/extensions/xforms/nsXFormsUploadElement.cpp 2005-10-23 18:30:13.000000000 +0200
12650 +++ mozilla.new/extensions/xforms/nsXFormsUploadElement.cpp 2006-02-24 11:16:24.000000000 +0100
12651 @@ -51,7 +51,6 @@
12652 #include "nsIDOMAbstractView.h"
12653 #include "nsIDOMWindowInternal.h"
12654 #include "nsIStringBundle.h"
12655 -#include "nsIDOM3Node.h"
12656 #include "nsAutoBuffer.h"
12657 #include "nsIEventStateManager.h"
12658 #include "prmem.h"
12659 @@ -147,26 +146,19 @@ nsBoundType
12660 nsXFormsUploadElement::GetBoundType()
12662 nsBoundType result = TYPE_DEFAULT;
12663 + if (!mModel)
12664 + return result;
12666 // get type bound to node
12667 - nsAutoString type, prefix, nsuri;
12668 - nsresult rv = nsXFormsUtils::ParseTypeFromNode(mBoundNode, type, prefix);
12670 - if (NS_SUCCEEDED(rv)) {
12671 - // get the namespace url from the prefix
12672 - nsCOMPtr<nsIDOM3Node> domNode3 = do_QueryInterface(mElement, &rv);
12673 - if (NS_SUCCEEDED(rv)) {
12674 - rv = domNode3->LookupNamespaceURI(prefix, nsuri);
12676 - if (NS_SUCCEEDED(rv) && nsuri.EqualsLiteral(NS_NAMESPACE_XML_SCHEMA)) {
12677 - if (type.EqualsLiteral("anyURI")) {
12678 - result = TYPE_ANYURI;
12679 - } else if (type.EqualsLiteral("base64Binary")) {
12680 - result = TYPE_BASE64;
12681 - } else if (type.EqualsLiteral("hexBinary")) {
12682 - result = TYPE_HEX;
12685 + nsAutoString type, nsuri;
12686 + nsresult rv = mModel->GetTypeFromNode(mBoundNode, type, nsuri);
12687 + if (NS_SUCCEEDED(rv) && nsuri.EqualsLiteral(NS_NAMESPACE_XML_SCHEMA)) {
12688 + if (type.EqualsLiteral("anyURI")) {
12689 + result = TYPE_ANYURI;
12690 + } else if (type.EqualsLiteral("base64Binary")) {
12691 + result = TYPE_BASE64;
12692 + } else if (type.EqualsLiteral("hexBinary")) {
12693 + result = TYPE_HEX;
12697 @@ -208,12 +200,9 @@ nsXFormsUploadElement::PickFile()
12699 // get nsIDOMWindowInternal
12700 nsCOMPtr<nsIDOMDocument> doc;
12701 + nsCOMPtr<nsIDOMWindowInternal> internal;
12702 mElement->GetOwnerDocument(getter_AddRefs(doc));
12703 - nsCOMPtr<nsIDOMDocumentView> dview = do_QueryInterface(doc);
12704 - NS_ENSURE_STATE(dview);
12705 - nsCOMPtr<nsIDOMAbstractView> aview;
12706 - dview->GetDefaultView(getter_AddRefs(aview));
12707 - nsCOMPtr<nsIDOMWindowInternal> internal = do_QueryInterface(aview);
12708 + rv = nsXFormsUtils::GetWindowFromDocument(doc, getter_AddRefs(internal));
12709 NS_ENSURE_STATE(internal);
12711 // init filepicker
12712 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsUtilityService.cpp mozilla.new/extensions/xforms/nsXFormsUtilityService.cpp
12713 --- mozilla/extensions/xforms/nsXFormsUtilityService.cpp 2005-08-04 23:15:37.000000000 +0200
12714 +++ mozilla.new/extensions/xforms/nsXFormsUtilityService.cpp 2006-02-14 10:01:13.000000000 +0100
12715 @@ -113,60 +113,33 @@ nsXFormsUtilityService::IsNodeAssocWithM
12716 PRBool *aModelAssocWithNode)
12719 - nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode);
12720 + nsCOMPtr<nsIDOMNode> modelNode;
12722 nsAutoString namespaceURI;
12723 aNode->GetNamespaceURI(namespaceURI);
12725 // If the node is in the XForms namespace and XTF based, then it should
12726 // be able to be handled by GetModel. Otherwise it is probably an instance
12727 // node in a instance document.
12728 if (namespaceURI.EqualsLiteral(NS_NAMESPACE_XFORMS)) {
12729 + nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode);
12730 nsCOMPtr<nsIModelElementPrivate> modelPriv = nsXFormsUtils::GetModel(element);
12731 - nsCOMPtr<nsIDOMNode> modelNode = do_QueryInterface(modelPriv);
12733 - if (modelNode && (modelNode == aModel)) {
12734 - *aModelAssocWithNode = PR_TRUE;
12735 - } else {
12736 - *aModelAssocWithNode = PR_FALSE;
12738 + modelNode = do_QueryInterface(modelPriv);
12739 } else {
12740 // We are assuming that if the node coming in isn't a proper XForms element,
12741 // then it is an instance element in an instance doc. Now we just have
12742 // to determine if the given model contains this instance document.
12743 - nsCOMPtr<nsIDOMDocument> document;
12744 - aNode->GetOwnerDocument(getter_AddRefs(document));
12745 - *aModelAssocWithNode = PR_FALSE;
12747 - // Guess that we'd better make sure that it is a model
12748 - nsCOMPtr<nsIXFormsModelElement> modelEle = do_QueryInterface(aModel);
12749 - if (modelEle) {
12750 - // OK, we know that this is a model element. So now we have to go
12751 - // instance element by instance element and find the associated
12752 - // document. If it is equal to the document that contains aNode,
12753 - // then aNode is associated with this aModel element and we can return
12754 - // true.
12755 - nsCOMPtr<nsIModelElementPrivate>model = do_QueryInterface(modelEle);
12756 - nsCOMPtr<nsIInstanceElementPrivate> instElement;
12757 - nsCOMPtr<nsIDOMDocument> instDocument;
12759 - nsCOMArray<nsIInstanceElementPrivate> *instList = nsnull;
12760 - model->GetInstanceList(&instList);
12761 - NS_ENSURE_TRUE(instList, NS_ERROR_FAILURE);
12763 - for (int i = 0; i < instList->Count(); ++i) {
12764 - instElement = instList->ObjectAt(i);
12766 - instElement->GetDocument(getter_AddRefs(instDocument));
12767 - if (instDocument) {
12768 - if (instDocument == document) {
12769 - *aModelAssocWithNode = PR_TRUE;
12770 - break;
12774 + nsCOMPtr<nsIDOMNode> instNode;
12775 + nsresult rv =
12776 + nsXFormsUtils::GetInstanceNodeForData(aNode, getter_AddRefs(instNode));
12777 + if (NS_SUCCEEDED(rv) && instNode) {
12778 + instNode->GetParentNode(getter_AddRefs(modelNode));
12782 + if (modelNode && (modelNode == aModel)) {
12783 + *aModelAssocWithNode = PR_TRUE;
12784 + } else {
12785 + *aModelAssocWithNode = PR_FALSE;
12788 return NS_OK;
12789 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsUtils.cpp mozilla.new/extensions/xforms/nsXFormsUtils.cpp
12790 --- mozilla/extensions/xforms/nsXFormsUtils.cpp 2005-10-23 18:30:13.000000000 +0200
12791 +++ mozilla.new/extensions/xforms/nsXFormsUtils.cpp 2006-02-24 11:16:25.000000000 +0100
12792 @@ -90,6 +90,16 @@
12793 #include "nsIDOMNamedNodeMap.h"
12794 #include "nsIParserService.h"
12796 +#include "nsIPrefBranch.h"
12797 +#include "nsIPrefService.h"
12798 +#include "nsIDOMDocumentView.h"
12799 +#include "nsIDOMAbstractView.h"
12800 +#include "nsPIDOMWindow.h"
12802 +#include "nsIDOMDocumentType.h"
12803 +#include "nsIDOMEntity.h"
12804 +#include "nsIDOMNotation.h"
12806 #define CANCELABLE 0x01
12807 #define BUBBLES 0x02
12809 @@ -386,10 +396,6 @@ nsXFormsUtils::EvaluateXPath(const nsASt
12810 nsCOMArray<nsIDOMNode> *aSet,
12811 nsStringArray *aIndexesUsed)
12813 - nsCOMPtr<nsIDOMDocument> doc;
12814 - aContextNode->GetOwnerDocument(getter_AddRefs(doc));
12815 - NS_ENSURE_TRUE(doc, nsnull);
12817 nsCOMPtr<nsIXFormsXPathEvaluator> eval =
12818 do_CreateInstance("@mozilla.org/dom/xforms-xpath-evaluator;1");
12819 NS_ENSURE_TRUE(eval, nsnull);
12820 @@ -505,7 +511,7 @@ nsXFormsUtils::EvaluateNodeBinding(nsIDO
12822 return NS_OK;
12823 } else {
12824 - // If there is a (outer) bind element, we retrive its nodeset.
12825 + // If there is a (outer) bind element, we retrieve its nodeset.
12826 bindElement->GetAttribute(NS_LITERAL_STRING("nodeset"), expr);
12828 } else {
12829 @@ -566,10 +572,10 @@ nsXFormsUtils::EvaluateNodeBinding(nsIDO
12832 if (NS_SUCCEEDED(rv)) {
12833 - nsCOMArray<nsIInstanceElementPrivate> *instList = nsnull;
12834 - (*aModel)->GetInstanceList(&instList);
12835 - nsCOMPtr<nsIInstanceElementPrivate> instance =
12836 - instList->ObjectAt(0);
12837 + nsCOMPtr<nsIInstanceElementPrivate> instance;
12838 + rv = (*aModel)->FindInstanceElement(EmptyString(),
12839 + getter_AddRefs(instance));
12840 + NS_ENSURE_SUCCESS(rv, rv);
12841 nsCOMPtr<nsIDOMDocument> domdoc;
12842 instance->GetDocument(getter_AddRefs(domdoc));
12843 nsCOMPtr<nsIDOMElement> instanceDataEle;
12844 @@ -590,6 +596,9 @@ nsXFormsUtils::EvaluateNodeBinding(nsIDO
12845 contextPosition, contextSize, aDeps,
12846 aIndexesUsed);
12847 } else {
12848 + const PRUnichar *strings[] = { expr.get() };
12849 + nsXFormsUtils::ReportError(NS_LITERAL_STRING("invalidQName"),
12850 + strings, 1, aElement, aElement);
12851 nsXFormsUtils::DispatchEvent(aElement, eEvent_BindingException);
12854 @@ -1102,28 +1111,54 @@ nsXFormsUtils::FindParentContext(nsIDOME
12857 /* static */ PRBool
12858 -nsXFormsUtils::CheckSameOrigin(nsIURI *aBaseURI, nsIURI *aTestURI)
12859 +nsXFormsUtils::CheckSameOrigin(nsIDocument *aBaseDocument, nsIURI *aTestURI)
12861 nsresult rv;
12863 - // check to see if we're allowed to load this URI
12864 + // get the base document's principal
12865 + nsIPrincipal *basePrincipal = aBaseDocument->GetPrincipal();
12867 + if (basePrincipal) {
12868 + // check for the UniversalBrowserRead capability.
12869 + PRBool crossSiteAccessEnabled;
12870 + rv = basePrincipal->IsCapabilityEnabled("UniversalBrowserRead", nsnull,
12871 + &crossSiteAccessEnabled);
12872 + if (NS_SUCCEEDED(rv) && crossSiteAccessEnabled)
12873 + return PR_TRUE;
12875 + // check the security manager and do a same original check on the principal
12876 nsCOMPtr<nsIScriptSecurityManager> secMan =
12877 do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
12878 if (secMan) {
12879 - rv = secMan->CheckSameOriginURI(aBaseURI, aTestURI);
12880 + // get a principal for the uri we are testing
12881 + nsCOMPtr<nsIPrincipal> testPrincipal;
12882 + rv = secMan->GetCodebasePrincipal(aTestURI, getter_AddRefs(testPrincipal));
12884 + if (NS_SUCCEEDED(rv)) {
12885 + rv = secMan->CheckSameOriginPrincipal(aBaseDocument->GetPrincipal(),
12886 + testPrincipal);
12887 if (NS_SUCCEEDED(rv))
12888 return PR_TRUE;
12893 // else, check with the permission manager to see if this host is
12894 // permitted to access sites from other domains.
12896 nsCOMPtr<nsIPermissionManager> permMgr =
12897 do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
12898 - PRUint32 perm;
12899 - rv = permMgr->TestPermission(aBaseURI, "xforms-load", &perm);
12900 - if (NS_SUCCEEDED(rv) && perm == nsIPermissionManager::ALLOW_ACTION)
12901 - return PR_TRUE;
12902 + NS_ENSURE_TRUE(permMgr, PR_FALSE);
12904 + nsCOMPtr<nsIURI> principalURI;
12905 + rv = basePrincipal->GetURI(getter_AddRefs(principalURI));
12907 + if (NS_SUCCEEDED(rv)) {
12908 + PRUint32 perm;
12909 + rv = permMgr->TestPermission(principalURI, "xforms-load", &perm);
12910 + if (NS_SUCCEEDED(rv) && perm == nsIPermissionManager::ALLOW_ACTION)
12911 + return PR_TRUE;
12914 return PR_FALSE;
12916 @@ -1230,67 +1265,26 @@ nsXFormsUtils::GetInstanceNodeForData(ns
12919 /* static */ nsresult
12920 -nsXFormsUtils::ParseTypeFromNode(nsIDOMNode *aInstanceData,
12921 - nsAString &aType, nsAString &aNSPrefix)
12922 +nsXFormsUtils::ParseTypeFromNode(nsIDOMNode *aInstanceData,
12923 + nsAString &aType,
12924 + nsAString &aNSUri)
12926 - nsresult rv = NS_OK;
12928 - // aInstanceData could be an instance data node or it could be an attribute
12929 - // on an instance data node (basically the node that a control is bound to).
12931 - nsAutoString *typeVal = nsnull;
12933 - // Get type stored directly on instance node
12934 - nsAutoString typeAttribute;
12935 - nsCOMPtr<nsIDOMElement> nodeElem(do_QueryInterface(aInstanceData));
12936 - if (nodeElem) {
12937 - nodeElem->GetAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_XML_SCHEMA_INSTANCE),
12938 - NS_LITERAL_STRING("type"), typeAttribute);
12939 - if (!typeAttribute.IsEmpty()) {
12940 - typeVal = &typeAttribute;
12944 - if (!typeVal) {
12945 - // Get MIP type bound to node
12946 - nsCOMPtr<nsIContent> nodeContent(do_QueryInterface(aInstanceData));
12947 - if (nodeContent) {
12948 - typeVal =
12949 - NS_STATIC_CAST(nsAutoString*,
12950 - nodeContent->GetProperty(nsXFormsAtoms::type, &rv));
12951 - } else {
12952 - nsCOMPtr<nsIAttribute> nodeAttribute(do_QueryInterface(aInstanceData));
12953 - if (!nodeAttribute)
12954 - // node is neither content or attribute!
12955 - return NS_ERROR_FAILURE;
12957 - typeVal =
12958 - NS_STATIC_CAST(nsAutoString*,
12959 - nodeAttribute->GetProperty(nsXFormsAtoms::type, &rv));
12963 - if (NS_FAILED(rv) || !typeVal) {
12964 - return NS_ERROR_NOT_AVAILABLE;
12967 - // split type (ns:type) into namespace and type.
12968 - PRInt32 separator = typeVal->FindChar(':');
12969 - if ((PRUint32) separator == (typeVal->Length() - 1)) {
12970 - const PRUnichar *strings[] = { typeVal->get() };
12971 - // XXX: get an element from the document this came from
12972 - ReportError(NS_LITERAL_STRING("missingTypeName"), strings, 1, nsnull, nsnull);
12973 - return NS_ERROR_UNEXPECTED;
12974 - } else if (separator == kNotFound) {
12975 - // no namespace prefix, which is valid;
12976 - aNSPrefix.AssignLiteral("");
12977 - aType.Assign(*typeVal);
12978 - } else {
12979 - aNSPrefix.Assign(Substring(*typeVal, 0, separator));
12980 - aType.Assign(Substring(*typeVal, ++separator, typeVal->Length()));
12983 - return NS_OK;
12984 + nsresult rv;
12986 + // Find the model for the instance data node
12987 + nsCOMPtr<nsIDOMNode> instanceNode;
12988 + rv = nsXFormsUtils::GetInstanceNodeForData(aInstanceData,
12989 + getter_AddRefs(instanceNode));
12990 + NS_ENSURE_SUCCESS(rv, rv);
12992 + nsCOMPtr<nsIDOMNode> modelNode;
12993 + rv = instanceNode->GetParentNode(getter_AddRefs(modelNode));
12994 + NS_ENSURE_SUCCESS(rv, rv);
12996 + nsCOMPtr<nsIModelElementPrivate> model(do_QueryInterface(modelNode));
12997 + NS_ENSURE_STATE(model);
12999 + return model->GetTypeFromNode(aInstanceData, aType, aNSUri);
13002 /* static */ void
13003 @@ -1548,3 +1542,441 @@ nsXFormsUtils::GetElementById(nsIDOMDocu
13005 return NS_OK;
13009 +/* static */
13010 +PRBool
13011 +nsXFormsUtils::HandleBindingException(nsIDOMElement *aElement)
13013 + if (!aElement) {
13014 + return PR_FALSE;
13016 + nsCOMPtr<nsIDOMDocument> doc;
13017 + aElement->GetOwnerDocument(getter_AddRefs(doc));
13019 + nsCOMPtr<nsIDocument> iDoc(do_QueryInterface(doc));
13020 + if (!iDoc) {
13021 + return PR_FALSE;
13024 + // check for fatalError property, enforcing that only one fatal error will
13025 + // be shown to the user
13026 + if (iDoc->GetProperty(nsXFormsAtoms::fatalError)) {
13027 + return PR_FALSE;
13029 + iDoc->SetProperty(nsXFormsAtoms::fatalError, iDoc);
13031 + // Check for preference, disabling this popup
13032 + PRBool disablePopup = PR_FALSE;
13033 + nsresult rv;
13034 + nsCOMPtr<nsIPrefBranch> pref = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
13035 + if (NS_SUCCEEDED(rv) && pref) {
13036 + PRBool val;
13037 + if (NS_SUCCEEDED(pref->GetBoolPref("xforms.disablePopup", &val)))
13038 + disablePopup = val;
13040 + if (disablePopup)
13041 + return PR_FALSE;
13043 + // Get nsIDOMWindowInternal
13044 + nsCOMPtr<nsIDOMWindowInternal> internal;
13045 + rv = nsXFormsUtils::GetWindowFromDocument(doc, getter_AddRefs(internal));
13046 + if (NS_FAILED(rv) || !internal) {
13047 + return PR_FALSE;
13051 + // Show popup
13052 + nsCOMPtr<nsIDOMWindow> messageWindow;
13053 + rv = internal->OpenDialog(NS_LITERAL_STRING("chrome://xforms/content/bindingex.xul"),
13054 + NS_LITERAL_STRING("XFormsBindingException"),
13055 + NS_LITERAL_STRING("modal,dialog,chrome,dependent"),
13056 + nsnull, getter_AddRefs(messageWindow));
13057 + return NS_SUCCEEDED(rv);
13060 +/* static */ PRBool
13061 +nsXFormsUtils::AreEntitiesEqual(nsIDOMNamedNodeMap *aEntities1,
13062 + nsIDOMNamedNodeMap *aEntities2)
13064 + if (!aEntities1 && !aEntities2) {
13065 + return PR_TRUE;
13068 + if (!aEntities1 || !aEntities2) {
13069 + return PR_FALSE;
13072 + PRUint32 entLength1, entLength2;
13073 + nsresult rv1 = aEntities1->GetLength(&entLength1);
13074 + nsresult rv2 = aEntities2->GetLength(&entLength2);
13075 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || entLength1 != entLength2) {
13076 + return PR_FALSE;
13079 + nsAutoString buffer1, buffer2;
13080 + for (PRUint32 i = 0; i < entLength1; ++i) {
13081 + nsCOMPtr<nsIDOMNode> entNode1, entNode2;
13083 + rv1 = aEntities1->Item(i, getter_AddRefs(entNode1));
13084 + rv2 = aEntities2->Item(i, getter_AddRefs(entNode2));
13085 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !entNode1 || !entNode2) {
13086 + return PR_FALSE;
13089 + nsCOMPtr<nsIDOMEntity> ent1, ent2;
13090 + ent1 = do_QueryInterface(entNode1);
13091 + ent2 = do_QueryInterface(entNode2);
13092 + if (!ent1 || !ent2) {
13093 + return PR_FALSE;
13096 + rv1 = ent1->GetPublicId(buffer1);
13097 + rv2 = ent2->GetPublicId(buffer2);
13098 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13099 + return PR_FALSE;
13102 + rv1 = ent1->GetSystemId(buffer1);
13103 + rv2 = ent2->GetSystemId(buffer2);
13104 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13105 + return PR_FALSE;
13108 + rv1 = ent1->GetNotationName(buffer1);
13109 + rv2 = ent2->GetNotationName(buffer2);
13110 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13111 + return PR_FALSE;
13114 + // XXX: These will need to be uncommented when Mozilla supports these from
13115 + // DOM3
13116 +#if 0
13117 + rv1 = ent1->GetInputEncoding(buffer1);
13118 + rv2 = ent2->GetInputEncoding(buffer2);
13119 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13120 + return PR_FALSE;
13123 + rv1 = ent1->GetXmlEncoding(buffer1);
13124 + rv2 = ent2->GetXmlEncoding(buffer2);
13125 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13126 + return PR_FALSE;
13128 + rv1 = ent1->GetXmlVersion(buffer1);
13129 + rv2 = ent2->GetXmlVersion(buffer2);
13130 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13131 + return PR_FALSE;
13133 +#endif
13136 + return PR_TRUE;
13139 +/* static */ PRBool
13140 +nsXFormsUtils::AreNotationsEqual(nsIDOMNamedNodeMap *aNotations1,
13141 + nsIDOMNamedNodeMap *aNotations2)
13143 + if (!aNotations1 && !aNotations2) {
13144 + return PR_TRUE;
13147 + if (!aNotations1 || !aNotations2) {
13148 + return PR_FALSE;
13151 + PRUint32 notLength1, notLength2;
13152 + nsresult rv1 = aNotations1->GetLength(&notLength1);
13153 + nsresult rv2 = aNotations2->GetLength(&notLength2);
13154 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || notLength1 != notLength2) {
13155 + return PR_FALSE;
13158 + nsAutoString buffer1, buffer2;
13159 + for (PRUint32 j = 0; j < notLength1; ++j) {
13160 + nsCOMPtr<nsIDOMNode> notNode1, notNode2;
13162 + rv1 = aNotations1->Item(j, getter_AddRefs(notNode1));
13163 + rv2 = aNotations2->Item(j, getter_AddRefs(notNode2));
13164 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !notNode1 || !notNode2) {
13165 + return PR_FALSE;
13168 + nsCOMPtr<nsIDOMNotation> notation1, notation2;
13169 + notation1 = do_QueryInterface(notNode1);
13170 + notation2 = do_QueryInterface(notNode2);
13171 + if (!notation1 || !notation2) {
13172 + return PR_FALSE;
13175 + rv1 = notation1->GetPublicId(buffer1);
13176 + rv2 = notation2->GetPublicId(buffer2);
13177 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13178 + return PR_FALSE;
13181 + rv1 = notation1->GetSystemId(buffer1);
13182 + rv2 = notation2->GetSystemId(buffer2);
13183 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13184 + return PR_FALSE;
13188 + return PR_TRUE;
13191 +/* static */ PRBool
13192 +nsXFormsUtils::AreNodesEqual(nsIDOMNode *aFirstNode, nsIDOMNode *aSecondNode,
13193 + PRBool aAlreadyNormalized)
13195 + if (!aFirstNode || !aSecondNode) {
13196 + return PR_FALSE;
13199 + nsresult rv1, rv2;
13200 + PRUint16 firstType, secondType;
13201 + rv1 = aFirstNode->GetNodeType(&firstType);
13202 + rv2 = aSecondNode->GetNodeType(&secondType);
13203 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || firstType != secondType) {
13204 + return PR_FALSE;
13207 + nsAutoString buffer1, buffer2;
13208 + if (firstType == nsIDOMNode::DOCUMENT_TYPE_NODE) {
13209 + nsCOMPtr<nsIDOMDocumentType> doc1 = do_QueryInterface(aFirstNode);
13210 + nsCOMPtr<nsIDOMDocumentType> doc2 = do_QueryInterface(aSecondNode);
13211 + if (!doc1 || !doc2) {
13212 + return PR_FALSE;
13215 + rv1 = doc1->GetName(buffer1);
13216 + rv2 = doc2->GetName(buffer2);
13217 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13218 + return PR_FALSE;
13221 + rv1 = doc1->GetPublicId(buffer1);
13222 + rv2 = doc2->GetPublicId(buffer2);
13223 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13224 + return PR_FALSE;
13227 + rv1 = doc1->GetSystemId(buffer1);
13228 + rv2 = doc2->GetSystemId(buffer2);
13229 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13230 + return PR_FALSE;
13233 + rv1 = doc1->GetInternalSubset(buffer1);
13234 + rv2 = doc2->GetInternalSubset(buffer2);
13235 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13236 + return PR_FALSE;
13239 + nsCOMPtr<nsIDOMNamedNodeMap> map1, map2;
13240 + rv1 = doc1->GetEntities(getter_AddRefs(map1));
13241 + rv2 = doc2->GetEntities(getter_AddRefs(map2));
13243 + // XXX need to handle the case where neither has entities?
13244 + if (NS_FAILED(rv1) || NS_FAILED(rv2)) {
13245 + return PR_FALSE;
13248 + PRBool equal = nsXFormsUtils::AreEntitiesEqual(map1, map2);
13249 + if (!equal) {
13250 + return PR_FALSE;
13253 + rv1 = doc1->GetNotations(getter_AddRefs(map1));
13254 + rv2 = doc2->GetNotations(getter_AddRefs(map2));
13255 + if (NS_FAILED(rv1) || NS_FAILED(rv2)) {
13256 + return PR_FALSE;
13259 + equal = nsXFormsUtils::AreNotationsEqual(map1, map2);
13260 + if (!equal) {
13261 + return PR_FALSE;
13266 + rv1 = aFirstNode->GetNodeName(buffer1);
13267 + rv2 = aSecondNode->GetNodeName(buffer2);
13268 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13269 + return PR_FALSE;
13272 + rv1 = aFirstNode->GetLocalName(buffer1);
13273 + rv2 = aSecondNode->GetLocalName(buffer2);
13274 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13275 + return PR_FALSE;
13278 + rv1 = aFirstNode->GetNamespaceURI(buffer1);
13279 + rv2 = aSecondNode->GetNamespaceURI(buffer2);
13280 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13281 + return PR_FALSE;
13284 + rv1 = aFirstNode->GetPrefix(buffer1);
13285 + rv2 = aSecondNode->GetPrefix(buffer2);
13286 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13287 + return PR_FALSE;
13290 + rv1 = aFirstNode->GetNodeValue(buffer1);
13291 + rv2 = aSecondNode->GetNodeValue(buffer2);
13292 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13293 + return PR_FALSE;
13296 + PRBool hasAttr1, hasAttr2;
13297 + rv1 = aFirstNode->HasAttributes(&hasAttr1);
13298 + rv2 = aSecondNode->HasAttributes(&hasAttr2);
13299 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || hasAttr1 != hasAttr2) {
13300 + return PR_FALSE;
13303 + if (hasAttr1) {
13304 + nsCOMPtr<nsIDOMNamedNodeMap> attrs1, attrs2;
13305 + PRUint32 attrLength1, attrLength2;
13307 + rv1 = aFirstNode->GetAttributes(getter_AddRefs(attrs1));
13308 + rv2 = aSecondNode->GetAttributes(getter_AddRefs(attrs2));
13309 + if (NS_FAILED(rv1) || NS_FAILED(rv2)) {
13310 + return PR_FALSE;
13313 + rv1 = attrs1->GetLength(&attrLength1);
13314 + rv2 = attrs2->GetLength(&attrLength2);
13315 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || attrLength1 != attrLength2) {
13316 + return PR_FALSE;
13319 + // the order of the attributes on the two nodes doesn't matter. But
13320 + // every attribute on node1 must exist on node2 (and no more)
13321 + for (PRUint32 i = 0; i < attrLength1; ++i) {
13322 + nsCOMPtr<nsIDOMNode> attr1, attr2;
13323 + rv1 = attrs1->Item(i, getter_AddRefs(attr1));
13324 + if (!attr1) {
13325 + return PR_FALSE;
13328 + attr1->GetLocalName(buffer1);
13329 + attr1->GetNamespaceURI(buffer2);
13330 + attrs2->GetNamedItemNS(buffer2, buffer1, getter_AddRefs(attr2));
13331 + if (!attr2) {
13332 + return PR_FALSE;
13335 + rv1 = attr1->GetNodeValue(buffer1);
13336 + rv2 = attr2->GetNodeValue(buffer2);
13337 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !buffer1.Equals(buffer2)) {
13338 + return PR_FALSE;
13343 + // now looking at the child nodes. They have to be 'equal' and at the same
13344 + // index inside each of the parent nodes.
13345 + PRBool hasChildren1, hasChildren2;
13346 + rv1 = aFirstNode->HasChildNodes(&hasChildren1);
13347 + rv2 = aSecondNode->HasChildNodes(&hasChildren2);
13348 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || hasChildren1 != hasChildren2) {
13349 + return PR_FALSE;
13352 + if (hasChildren1) {
13353 + nsCOMPtr<nsIDOMNodeList> children1, children2;
13354 + PRUint32 childrenLength1, childrenLength2;
13356 + rv1 = aFirstNode->GetChildNodes(getter_AddRefs(children1));
13357 + rv2 = aSecondNode->GetChildNodes(getter_AddRefs(children2));
13358 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || !children1 || !children2) {
13359 + return PR_FALSE;
13362 + rv1 = children1->GetLength(&childrenLength1);
13363 + rv2 = children2->GetLength(&childrenLength2);
13364 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || childrenLength1 != childrenLength2) {
13365 + return PR_FALSE;
13368 + nsCOMPtr<nsIDOMNode> clone1, clone2;
13369 + if (!aAlreadyNormalized) {
13370 + // well we avoided this as long as we can. If we haven't already
13371 + // normalized all children, now is the time to do it. We'll have to clone
13372 + // nodes since the normalization process actually changes the DOM.
13374 + rv1 = aFirstNode->CloneNode(PR_TRUE, getter_AddRefs(clone1));
13375 + if (NS_FAILED(rv1) || !clone1) {
13376 + return PR_FALSE;
13378 + rv2 = aSecondNode->CloneNode(PR_TRUE, getter_AddRefs(clone2));
13379 + if (NS_FAILED(rv2) || !clone2) {
13380 + return PR_FALSE;
13383 + rv1 = clone1->Normalize();
13384 + rv2 = clone2->Normalize();
13385 + if (NS_FAILED(rv1) || NS_FAILED(rv2)) {
13386 + return PR_FALSE;
13389 + // since this already worked once on the original nodes, won't bother
13390 + // checking the results for the clones
13391 + clone1->GetChildNodes(getter_AddRefs(children1));
13392 + clone2->GetChildNodes(getter_AddRefs(children2));
13394 + // get length again since normalizing may have eliminated some text nodes
13395 + rv1 = children1->GetLength(&childrenLength1);
13396 + rv2 = children2->GetLength(&childrenLength2);
13397 + if (NS_FAILED(rv1) || NS_FAILED(rv2) || childrenLength1 != childrenLength2) {
13398 + return PR_FALSE;
13402 + for (PRUint32 i = 0; i < childrenLength1; ++i) {
13403 + nsCOMPtr<nsIDOMNode> child1, child2;
13405 + rv1 = children1->Item(i, getter_AddRefs(child1));
13406 + rv2 = children2->Item(i, getter_AddRefs(child2));
13407 + if (NS_FAILED(rv1) || NS_FAILED(rv2)) {
13408 + return PR_FALSE;
13411 + PRBool areEqual = nsXFormsUtils::AreNodesEqual(child1, child2, PR_TRUE);
13412 + if (!areEqual) {
13413 + return PR_FALSE;
13418 + return PR_TRUE;
13423 +/* static */
13424 +nsresult
13425 +nsXFormsUtils::GetWindowFromDocument(nsIDOMDocument *aDoc,
13426 + nsIDOMWindowInternal **aWindow)
13428 + NS_ENSURE_ARG(aDoc);
13429 + NS_ENSURE_ARG_POINTER(aWindow);
13430 + *aWindow = nsnull;
13432 + // Get nsIDOMWindowInternal
13433 + nsCOMPtr<nsIDOMDocumentView> dview(do_QueryInterface(aDoc));
13434 + NS_ENSURE_STATE(dview);
13436 + nsCOMPtr<nsIDOMAbstractView> aview;
13437 + dview->GetDefaultView(getter_AddRefs(aview));
13439 + nsCOMPtr<nsIDOMWindowInternal> internal(do_QueryInterface(aview));
13440 + NS_ENSURE_STATE(internal);
13442 + NS_ADDREF(*aWindow = internal);
13443 + return NS_OK;
13445 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsUtils.h mozilla.new/extensions/xforms/nsXFormsUtils.h
13446 --- mozilla/extensions/xforms/nsXFormsUtils.h 2005-10-23 18:30:13.000000000 +0200
13447 +++ mozilla.new/extensions/xforms/nsXFormsUtils.h 2006-02-14 10:01:13.000000000 +0100
13448 @@ -44,10 +44,12 @@
13449 #include "nsCOMPtr.h"
13450 #include "nsCOMArray.h"
13451 #include "nsIDOMNode.h"
13452 +#include "nsIDocument.h"
13453 #include "nsIDOMXPathResult.h"
13454 #include "nsIModelElementPrivate.h"
13455 #include "nsIScriptError.h"
13456 #include "nsVoidArray.h"
13457 +#include "nsIDOMWindowInternal.h"
13459 class nsIDOMElement;
13460 class nsIXFormsModelElement;
13461 @@ -349,9 +351,9 @@ public:
13462 PRInt32 *aContextSize);
13465 - * @return true if aTestURI has the same origin as aBaseURI
13466 + * @return true if aTestURI has the same origin as aBaseDocument
13468 - static NS_HIDDEN_(PRBool) CheckSameOrigin(nsIURI *aBaseURI,
13469 + static NS_HIDDEN_(PRBool) CheckSameOrigin(nsIDocument *aBaseDocument,
13470 nsIURI *aTestURI);
13473 @@ -382,12 +384,16 @@ public:
13474 nsIDOMNode **aInstanceNode);
13477 - * This function takes an instance data node, finds the type bound to it, and
13478 - * returns the seperated out type (integer) and namespace prefix (xsd).
13479 + * Returns the type bound to the given node.
13481 + * @param aInstanceData An instance data node or attribute on an instance
13482 + * data node from which to retrieve type.
13483 + * @param aType On return, type of given node.
13484 + * @param aNSUri On return, namespace URI of aType.
13486 static NS_HIDDEN_(nsresult) ParseTypeFromNode(nsIDOMNode *aInstanceData,
13487 nsAString &aType,
13488 - nsAString &aNSPrefix);
13489 + nsAString &aNSUri);
13492 * Outputs to the JavaScript console.
13493 @@ -448,6 +454,60 @@ public:
13494 const PRBool aOnlyXForms,
13495 nsIDOMElement *aCaller,
13496 nsIDOMElement **aElement);
13499 + /**
13500 + * Shows an error dialog for the user the first time an
13501 + * xforms-binding-exception event is received by the control.
13503 + * The dialog can be disabled via the |xforms.disablePopup| preference.
13505 + * @param aElement Element the exception occured at
13506 + * @return Whether handling was successful
13507 + */
13508 + static PRBool HandleBindingException(nsIDOMElement *aElement);
13510 + /**
13511 + * Returns whether the given NamedNodeMaps of Entities are equal
13513 + */
13514 + static NS_HIDDEN_(PRBool) AreEntitiesEqual(nsIDOMNamedNodeMap *aEntities1,
13515 + nsIDOMNamedNodeMap *aEntities2);
13517 + /**
13518 + * Returns whether the given NamedNodeMaps of Notations are equal
13520 + */
13521 + static NS_HIDDEN_(PRBool) AreNotationsEqual(nsIDOMNamedNodeMap *aNotations1,
13522 + nsIDOMNamedNodeMap *aNotations2);
13524 + /**
13525 + * Returns whether the given nodes are equal as described in the isEqualNode
13526 + * function defined in the DOM Level 3 Core spec.
13527 + * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/DOM3-Core.html#core-Node3-isEqualNode
13529 + * XXX: this is just temporary until isEqualNode is implemented in Mozilla
13530 + * (https://bugzilla.mozilla.org/show_bug.cgi?id=159167)
13532 + * @param aFirstNode The first node to compare
13533 + * @param aSecondNode The second node to compare
13534 + * @param aAlreadyNormalized Whether the two nodes and their children, etc.
13535 + * have already been normalized to allow for
13536 + * more accurate child node comparisons, as
13537 + * recommended in the DOM Level 3 Core spec.
13538 + */
13539 + static NS_HIDDEN_(PRBool) AreNodesEqual(nsIDOMNode *aFirstNode,
13540 + nsIDOMNode *aSecondNode,
13541 + PRBool aAlreadyNormalized = PR_FALSE);
13543 + /**
13544 + * Retrieve the window object from the given document
13546 + * @param aDoc The document to get window object from
13547 + * @param aWindow The found window object
13548 + */
13549 + static NS_HIDDEN_(nsresult) GetWindowFromDocument(nsIDOMDocument *aDoc,
13550 + nsIDOMWindowInternal **aWindow);
13553 #endif
13554 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsXPathParser.cpp mozilla.new/extensions/xforms/nsXFormsXPathParser.cpp
13555 --- mozilla/extensions/xforms/nsXFormsXPathParser.cpp 2005-04-28 09:17:49.000000000 +0200
13556 +++ mozilla.new/extensions/xforms/nsXFormsXPathParser.cpp 2006-02-14 10:01:13.000000000 +0100
13557 @@ -584,6 +584,8 @@ nsXFormsXPathParser::PopToken()
13558 if (mPeek == nsXFormsXPathScanner::WHITESPACE) { // Skip whitespaces
13559 mPeek = mScanner.NextToken();
13561 + NS_WARN_IF_FALSE(mPeek != nsXFormsXPathScanner::ERRORXPATHTOKEN,
13562 + "Scanner returned ERROR token!");
13563 return temp;
13566 diff -uprN --exclude=CVS mozilla/extensions/xforms/nsXFormsXPathScanner.cpp mozilla.new/extensions/xforms/nsXFormsXPathScanner.cpp
13567 --- mozilla/extensions/xforms/nsXFormsXPathScanner.cpp 2005-02-24 17:18:46.000000000 +0100
13568 +++ mozilla.new/extensions/xforms/nsXFormsXPathScanner.cpp 2006-02-14 10:01:13.000000000 +0100
13569 @@ -363,29 +363,29 @@ nsXFormsXPathScanner::ScanQName()
13570 second = ScanNCName();
13573 - nsDependentSubstring image = Substring(mExpression, Offset());
13574 + nsDependentSubstring image = Substring(mExpression, Offset() + 1);
13576 if (SolveDiambiguate()) {
13577 - if (StringBeginsWith(image, NS_LITERAL_STRING(" and")))
13578 + if (StringBeginsWith(image, NS_LITERAL_STRING("and")))
13579 return AND;
13580 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" or")))
13581 + if (StringBeginsWith(image, NS_LITERAL_STRING("or")))
13582 return OR;
13583 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" mod")))
13584 + if (StringBeginsWith(image, NS_LITERAL_STRING("mod")))
13585 return MOD;
13586 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" div")))
13587 + if (StringBeginsWith(image, NS_LITERAL_STRING("div")))
13588 return DIV;
13589 return ERRORXPATHTOKEN;
13592 PRUnichar c = NextNonWhite();
13593 if (c == '(') {
13594 - if (StringBeginsWith(image, NS_LITERAL_STRING(" comment")))
13595 + if (StringBeginsWith(image, NS_LITERAL_STRING("comment")))
13596 return COMMENT;
13597 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" text")))
13598 + if (StringBeginsWith(image, NS_LITERAL_STRING("text")))
13599 return TEXT;
13600 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" processing-instruction")))
13601 + if (StringBeginsWith(image, NS_LITERAL_STRING("processing-instruction")))
13602 return PI;
13603 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" node")))
13604 + if (StringBeginsWith(image, NS_LITERAL_STRING("node")))
13605 return NODE;
13607 return FUNCTIONNAME;
13608 @@ -393,32 +393,33 @@ nsXFormsXPathScanner::ScanQName()
13610 PRInt32 of = GetOffsetForNonWhite();
13611 if (PeekChar(of) == ':' && PeekChar(of + 1) == ':') {
13612 - if (StringBeginsWith(image, NS_LITERAL_STRING(" ancestor")))
13613 + if (StringBeginsWith(image, NS_LITERAL_STRING("ancestor")))
13614 return ANCESTOR;
13615 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" ancestor-or-self")))
13616 + if (StringBeginsWith(image, NS_LITERAL_STRING("ancestor-or-self")))
13617 return ANCESTOR_OR_SELF;
13618 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" attribute")))
13619 + if (StringBeginsWith(image, NS_LITERAL_STRING("attribute")))
13620 return ATTRIBUTE;
13621 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" child")))
13622 + if (StringBeginsWith(image, NS_LITERAL_STRING("child")))
13623 return CHILD;
13624 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" descendant")))
13625 + if (StringBeginsWith(image, NS_LITERAL_STRING("descendant")))
13626 return DESCENDANT;
13627 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" descendant-or-self")))
13628 + if (StringBeginsWith(image, NS_LITERAL_STRING("descendant-or-self")))
13629 return DESCENDANT_OR_SELF;
13630 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" following")))
13631 + if (StringBeginsWith(image, NS_LITERAL_STRING("following")))
13632 return FOLLOWING;
13633 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" following-sibling")))
13634 + if (StringBeginsWith(image, NS_LITERAL_STRING("following-sibling")))
13635 return FOLLOWING_SIBLING;
13636 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" namespace")))
13637 + if (StringBeginsWith(image, NS_LITERAL_STRING("namespace")))
13638 return NAMESPACE;
13639 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" parent")))
13640 + if (StringBeginsWith(image, NS_LITERAL_STRING("parent")))
13641 return PARENT;
13642 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" preceding")))
13643 + if (StringBeginsWith(image, NS_LITERAL_STRING("preceding")))
13644 return PRECEDING;
13645 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" preceding-sibling")))
13646 + if (StringBeginsWith(image, NS_LITERAL_STRING("preceding-sibling")))
13647 return PRECEDING_SIBLING;
13648 - else if (StringBeginsWith(image, NS_LITERAL_STRING(" self")))
13649 + if (StringBeginsWith(image, NS_LITERAL_STRING("self")))
13650 return SELF;
13652 return ERRORXPATHTOKEN;
13654 return second != NONE ? QNAME : NCNAME;
13655 diff -uprN --exclude=CVS mozilla/extensions/xforms/resources/content/bindingex.xul mozilla.new/extensions/xforms/resources/content/bindingex.xul
13656 --- mozilla/extensions/xforms/resources/content/bindingex.xul 2005-10-04 20:28:26.000000000 +0200
13657 +++ mozilla.new/extensions/xforms/resources/content/bindingex.xul 2006-02-14 10:01:13.000000000 +0100
13658 @@ -43,7 +43,22 @@
13659 title="&xforms.bindingdialog.title;"
13660 buttons="accept"
13661 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
13662 - onload="document.getElementById('XFormsBindingDialog').getButton('accept').focus();">
13663 + onload="document.documentElement.getButton('accept').focus();">
13665 + <script type="application/x-javascript">
13666 + function toJSConsole() {
13667 + var js = Components.classes["@mozilla.org/appshell/window-mediator;1"]
13668 + .getService(Components.interfaces.nsIWindowMediator)
13669 + .getMostRecentWindow('global:console');
13670 + if (js)
13671 + js.focus();
13672 + else
13673 + Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
13674 + .getService(Components.interfaces.nsIWindowWatcher)
13675 + .openWindow(null, "chrome://global/content/console.xul",
13676 + "", "all,dialog=no", null);
13678 + </script>
13680 <hbox flex="1">
13681 <hbox align="start">
13682 @@ -54,7 +69,7 @@
13683 <description class="header descr1">
13684 &xforms.bindingdialog.description1;
13685 </description>
13686 - <label class="descr2 text-link" onclick="open('chrome://global/content/console.xul', 'global:console', 'menubar=no,resizable=yes')">
13687 + <label class="descr2 text-link" onclick="toJSConsole()">
13688 &xforms.bindingdialog.description2;
13689 </label>
13690 </vbox>
13691 Dateien mozilla/extensions/xforms/resources/content/calendar.png und mozilla.new/extensions/xforms/resources/content/calendar.png sind verschieden.
13692 diff -uprN --exclude=CVS mozilla/extensions/xforms/resources/content/range.xml mozilla.new/extensions/xforms/resources/content/range.xml
13693 --- mozilla/extensions/xforms/resources/content/range.xml 1970-01-01 01:00:00.000000000 +0100
13694 +++ mozilla.new/extensions/xforms/resources/content/range.xml 2006-02-07 16:30:12.000000000 +0100
13695 @@ -0,0 +1,492 @@
13696 +<?xml version="1.0" encoding="utf-8"?>
13697 +<!-- ***** BEGIN LICENSE BLOCK *****
13698 + - Version: MPL 1.1/GPL 2.0/LGPL 2.1
13700 + - The contents of this file are subject to the Mozilla Public License Version
13701 + - 1.1 (the "License"); you may not use this file except in compliance with
13702 + - the License. You may obtain a copy of the License at
13703 + - http://www.mozilla.org/MPL/
13705 + - Software distributed under the License is distributed on an "AS IS" basis,
13706 + - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13707 + - for the specific language governing rights and limitations under the
13708 + - License.
13710 + - The Original Code is Mozilla XForms support.
13712 + - The Initial Developer of the Original Code is
13713 + - Novell, Inc.
13714 + - Portions created by the Initial Developer are Copyright (C) 2005
13715 + - the Initial Developer. All Rights Reserved.
13717 + - Contributor(s):
13718 + - Allan Beaufour <abeaufour@novell.com>
13720 + - Alternatively, the contents of this file may be used under the terms of
13721 + - either the GNU General Public License Version 2 or later (the "GPL"), or
13722 + - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
13723 + - in which case the provisions of the GPL or the LGPL are applicable instead
13724 + - of those above. If you wish to allow use of your version of this file only
13725 + - under the terms of either the GPL or the LGPL, and not to allow others to
13726 + - use your version of this file under the terms of the MPL, indicate your
13727 + - decision by deleting the provisions above and replace them with the notice
13728 + - and other provisions required by the GPL or the LGPL. If you do not delete
13729 + - the provisions above, a recipient may use your version of this file under
13730 + - the terms of any one of the MPL, the GPL or the LGPL.
13732 + - ***** END LICENSE BLOCK ***** -->
13734 +<!--
13735 + ASSUMPTIONS:
13736 + *> @begin is valid, @end and @init value might not be
13737 + this means that steps and ticks are calculated with begin as starting point
13738 + *> Takes integers and floats
13740 + TODO: XXX
13741 + *> limit amount of ticks
13742 + *> handle undefined begin / end
13743 + *> handle end < begin (including negative steps)
13744 + *> @incremental should round if it is bound to integer
13746 + BUGS: XXX
13747 + *> leaves a trace behind, hor.bar gets darker, etc... fix transparency
13748 +-->
13750 +<bindings xmlns="http://www.mozilla.org/xbl"
13751 + xmlns:html="http://www.w3.org/1999/xhtml">
13753 + <binding id="xformswidget-range"
13754 + extends="chrome://xforms/content/xforms.xml#xformswidget-base">
13755 + <content>
13756 + <children includes="label"/>
13757 + <html:span anonid="labelBegin" style="margin-right: 3px;"></html:span>
13758 + <!-- width and height set by CSS? -->
13759 + <html:canvas tabindex="0" anonid="canvas" width="260" height="40"
13760 + onkeydown="this.parentNode.handleKey(event)"
13761 + onmousedown="this.parentNode.handleMouseDown(event)"
13762 + onmouseup="this.parentNode.handleMouseUp(event)"
13763 + onmouseout="this.parentNode.handleMouseOut(event)"
13764 + onmousemove="this.parentNode.handleMouseMove(event)">
13765 + </html:canvas>
13766 + <html:span anonid="labelEnd" style="margin-left: 3px;"> </html:span>
13767 + <children/>
13768 + </content>
13770 + <implementation implements="nsIXFormsUIWidget">
13771 + <!-- The "skin", should be set via CSS -->
13772 + <field name="strokeStyle" readonly="true">"#8f9ca4"</field>
13773 + <field name="strokeStyleMove" readonly="true">"red"</field>
13774 + <field name="fillStyle" readonly="true">"#eff3f1"</field>
13776 + <!-- Is the range initialized -->
13777 + <field name="isInitialized">false</field>
13779 + <!-- out of range -->
13780 + <field name="outOfRange">false</field>
13782 + <!-- are we currently moving the slider? -->
13783 + <field name="isMoving">false</field>
13785 + <!-- creates the sliderpath -->
13786 + <method name="sliderPath">
13787 + <parameter name="aPos"/>
13788 + <body>
13789 + this.ctx.beginPath();
13790 + var h = this.height - this.tickheight;
13791 + this.ctx.moveTo(aPos, h);
13792 + this.ctx.lineTo(aPos - this.sliderwidth, h - this.slidertip);
13793 + this.ctx.lineTo(aPos - this.sliderwidth, this.tickheight);
13794 + this.ctx.lineTo(aPos + this.sliderwidth, this.tickheight);
13795 + this.ctx.lineTo(aPos + this.sliderwidth, h - this.slidertip);
13796 + this.ctx.closePath();
13797 + </body>
13798 + </method>
13800 + <!-- creates the sliderpath -->
13801 + <method name="drawSlider">
13802 + <parameter name="aPos"/>
13803 + <parameter name="aMove"/>
13804 + <body>
13805 + this.ctx.save();
13807 + // do path
13808 + this.ctx.lineWidth = 1;
13809 + this.sliderPath(aPos);
13810 + this.ctx.strokeStyle = aMove ? this.strokeStyleMove : this.strokeStyle;
13811 + this.ctx.stroke();
13812 + this.sliderPath(aPos);
13813 + this.ctx.fillStyle = this.fillStyle;
13814 + this.ctx.fill();
13816 + this.ctx.restore();
13817 + </body>
13818 + </method>
13820 + <!-- takes a value and calculates the x position -->
13821 + <method name="calcPos">
13822 + <parameter name="val"/>
13823 + <body>
13824 + var pos = val - this.rBegin;
13825 + if (this.rStep) {
13826 + pos = (pos / this.rStep) * this.stepsp;
13827 + } else {
13828 + pos = (pos / (this.rEnd - this.rBegin)) * this.barwidth;
13830 + return Math.round(pos) + this.margin;
13831 + </body>
13832 + </method>
13834 + <!-- sets the slider to a new value -->
13835 + <method name="setSlider">
13836 + <!-- The new value -->
13837 + <parameter name="aVal"/>
13838 + <!-- The mode:
13839 + - move: just moving the slider around, not setting the value
13841 + - set: enforce slider position from instance data,
13842 + ie. do not correct it to fit a step, etc.
13844 + - [default]: set the slider to the given value, adjusting it
13845 + to fit inside the allowed range
13846 + -->
13847 + <parameter name="aMode"/>
13849 + <body>
13850 + <![CDATA[
13852 + aVal = parseFloat(aVal);
13853 + if (aMode != "set" && isNaN(aVal)) {
13854 + return this.delegate.reportError("rangeSetSliderNaN");
13857 + var outOfRange = false;
13858 + if (aMode != "move") {
13859 + if (aMode == "set" &&
13860 + (isNaN(aVal) || aVal > this.adjEnd || aVal < this.rBegin)) {
13861 + outOfRange = true;
13862 + } else {
13863 + if (this.rStep) {
13864 + // adjust aVal to limits
13865 + valmod = (aVal - this.rBegin) % this.rStep;
13866 + if (valmod) {
13867 + if (aMode == "set") {
13868 + outOfRange = true;
13869 + } else if (valmod < (this.rStep / 2)) {
13870 + aVal -= valmod;
13871 + } else {
13872 + aVal += this.rStep - valmod;
13876 + if (aVal > this.adjEnd) {
13877 + aVal = this.adjEnd;
13878 + } else if (aVal < this.rBegin) {
13879 + aVal = this.rBegin;
13884 + if (!outOfRange && (aMode != "move" || this.isIncremental)) {
13885 + // Store new value
13886 + this.accessors.setValue(aVal);
13889 + if (this.rVal == aVal && !this.justMoved) {
13890 + // slider is already drawn at correct position
13891 + return;
13894 + this.ctx.save();
13896 + // clear old slider
13897 + this.ctx.clearRect(this.calcPos(this.rVal) - this.sliderwidth - 1, this.tickheight - 1,
13898 + this.sliderwidth * 2 + 2, this.tickheight * 3 + 2);
13900 + // (re)draw horisontal bar
13901 + this.ctx.lineWidth = 1;
13902 + this.ctx.fillStyle = this.fillStyle;
13903 + this.ctx.strokeStyle = this.strokeStyle;
13904 + mid = Math.round(this.height / 2);
13905 + // XXX only needs to be redrawn for old slider pos
13906 + this.ctx.fillRect(this.margin, mid - 1, this.barwidth, 3);
13907 + this.ctx.strokeRect(this.margin, mid - 1, this.barwidth, 3);
13909 + // check whether out-of-range state has changed, and dispatch event if it has
13910 + if (outOfRange != this.outOfRange) {
13911 + // XXX we need to set the style too
13912 + this.outOfRange = outOfRange;
13913 + var event = outOfRange ? "xforms-out-of-range" : "xforms-in-range";
13914 + this.dispatchXFormsNotificationEvent(event, this);
13917 + // if out-of-range, we cannot represent the value
13918 + if (outOfRange) {
13919 + this.rVal = null;
13920 + return null;
13923 + // draw slider at new position
13924 + this.justMoved = (aMode == "move");
13925 + this.drawSlider(this.calcPos(aVal), this.justMoved);
13927 + this.ctx.restore();
13929 + // Store new value
13930 + return this.rVal = aVal;
13931 + ]]>
13932 + </body>
13933 + </method>
13935 + <!-- get x,y offset for mouse events -->
13936 + <method name="getOffset">
13937 + <parameter name="event"/>
13938 + <body>
13939 + var obj;
13940 + if (document.getBoxObjectFor) {
13941 + obj = document.getBoxObjectFor(this.canvas);
13942 + } else {
13943 + obj = { x: event.target.offsetLeft, y: event.target.offsetTop };
13945 + return obj;
13946 + </body>
13947 + </method>
13949 + <!-- calculate slider position from mouse position -->
13950 + <method name="calcMousePos">
13951 + <parameter name="obj"/>
13952 + <parameter name="x"/>
13953 + <body>
13954 + x -= obj.margin;
13955 + if (obj.rStep) {
13956 + x = (x / obj.stepsp) * obj.rStep;
13957 + } else {
13958 + x = (x / this.barwidth) * (this.rEnd - this.rBegin);
13960 + return x + obj.rBegin;
13961 + </body>
13962 + </method>
13964 + <!-- handle mouse down -->
13965 + <method name="handleMouseDown">
13966 + <parameter name="event"/>
13967 + <body>
13968 + <![CDATA[
13969 + if (event.button == 0) {
13970 + this.currentOffset = this.getOffset(event);
13971 + this.originalVal = this.rVal;
13972 + this.isMoving = true;
13973 + var xpos = event.clientX - this.currentOffset.x;
13974 + if (xpos < this.margin) {
13975 + xpos = this.margin;
13977 + if (xpos > (this.barwidth + this.margin)) {
13978 + xpos = this.barwidth;
13980 + this.setSlider(this.calcMousePos(this, xpos), "move");
13981 + return;
13983 + ]]>
13984 + </body>
13985 + </method>
13987 + <!-- handle mouse up -->
13988 + <method name="handleMouseUp">
13989 + <parameter name="event"/>
13990 + <body>
13991 + if (event.button != 0 || !this.isMoving) {
13992 + return;
13994 + var x = event.clientX - this.currentOffset.x;
13995 + this.setSlider(this.calcMousePos(this, x));
13996 + this.isMoving = false;
13997 + </body>
13998 + </method>
14000 + <!-- handle mouse moves -->
14001 + <method name="handleMouseMove">
14002 + <parameter name="event"/>
14003 + <body>
14004 + <![CDATA[
14005 + if (!this.isMoving) {
14006 + return;
14008 + var xpos = event.clientX - this.currentOffset.x;
14009 + if (xpos < this.margin) {
14010 + xpos = this.margin;
14012 + if (xpos > (this.barwidth + this.margin)) {
14013 + xpos = this.barwidth + this.margin;
14015 + this.setSlider(this.calcMousePos(this, xpos), "move");
14016 + ]]>
14017 + </body>
14018 + </method>
14020 + <!-- handle mouse out -->
14021 + <method name="handleMouseOut">
14022 + <parameter name="event"/>
14023 + <body>
14024 + if (!this.isMoving) {
14025 + return;
14027 + this.isMoving = false;
14028 + this.setSlider(this.originalVal);
14029 + </body>
14030 + </method>
14032 + <method name="handleKey">
14033 + <parameter name="event"/>
14034 + <body>
14035 + var move;
14036 + if (this.rStep) {
14037 + move = this.rStep;
14038 + } else {
14039 + move = (this.rEnd - this.rBegin) / 20;
14042 + if (event.keyCode == event.DOM_VK_LEFT) {
14043 + this.setSlider(this.rVal - move);
14044 + } else if (event.keyCode == event.DOM_VK_RIGHT) {
14045 + this.setSlider(this.rVal + move);
14046 + } else if (event.keyCode == event.DOM_VK_PAGE_DOWN) {
14047 + this.setSlider(this.rVal - move * 2);
14048 + } else if (event.keyCode == event.DOM_VK_PAGE_UP) {
14049 + this.setSlider(this.rVal + move * 2);
14050 + } else if (event.keyCode == event.DOM_VK_HOME) {
14051 + this.setSlider(this.rBegin);
14052 + } else if (event.keyCode == event.DOM_VK_END) {
14053 + this.setSlider(this.rEnd);
14055 + </body>
14056 + </method>
14058 + <method name="refresh">
14059 + <body>
14060 + <![CDATA[
14061 + if (!this.isInitialized) {
14062 + if (!this.delegate) {
14063 + return;
14065 + var labelBegin = document.getAnonymousElementByAttribute(this, "anonid", "labelBegin");
14066 + var labelEnd = document.getAnonymousElementByAttribute(this, "anonid", "labelEnd");
14067 + var canvas = document.getAnonymousElementByAttribute(this, "anonid", "canvas");
14068 + this.isInitialized = this.createRange(canvas, labelBegin, labelEnd,
14069 + this.accessors.getRangeStart(),
14070 + this.accessors.getRangeEnd(),
14071 + this.accessors.getRangeStep());
14074 + // XXX: does not clear range if bound node "disappears"
14075 + if (this.isInitialized && this.accessors.hasBoundNode()) {
14076 + this.setSlider(this.accessors.getValue(), "set");
14078 + ]]>
14079 + </body>
14080 + </method>
14082 + <method name="focus">
14083 + <body>
14084 + this.canvas.focus();
14085 + return true;
14086 + </body>
14087 + </method>
14089 + <!-- create new range object -->
14090 + <method name="createRange">
14091 + <parameter name="aCanvas"/>
14092 + <parameter name="aLabelBegin"/>
14093 + <parameter name="aLabelEnd"/>
14094 + <parameter name="aBegin"/>
14095 + <parameter name="aEnd"/>
14096 + <parameter name="aStep"/>
14097 + <body>
14098 + <![CDATA[
14099 + if (!(aCanvas && aLabelBegin && aLabelEnd)) {
14100 + this.delegate.reportError("rangeNullObjects");
14101 + return false;
14104 + this.rBegin = parseFloat(aBegin);
14105 + this.rEnd = parseFloat(aEnd);
14106 + this.rStep = parseFloat(aStep);
14107 + this.rVal = this.rBegin;
14108 + this.isIncremental = this.getAttribute("incremental") == "true";
14109 + this.justMoved = false;
14111 + if (isNaN(this.rBegin) || isNaN(this.rEnd)) {
14112 + this.delegate.reportError("rangeNullInit");
14113 + return false;
14116 + // XXX should we handle this?
14117 + if (this.rBegin >= this.rEnd) {
14118 + this.delegate.reportError("rangeBeginEndError");
14119 + return false;
14122 + if (isNaN(this.rStep)) {
14123 + this.rStep = null;
14124 + } else if (this.rStep < 0) {
14125 + // XXX better handling
14126 + this.rStep = -this.rStep;
14129 + // set labels
14130 + aLabelBegin.appendChild(document.createTextNode(this.rBegin));
14131 + aLabelEnd.appendChild(document.createTextNode(this.rEnd));
14133 + // get canvas
14134 + this.canvas = aCanvas;
14135 + this.height = this.canvas.height;
14137 + // get and set context
14138 + this.ctx = this.canvas.getContext("2d");
14139 + this.ctx.globalAlpha = 1.0;
14140 + this.ctx.lineWidth = 1;
14142 + // size of horisontal bar
14143 + this.margin = Math.round(this.canvas.width / 45);
14144 + if (this.margin < 4) {
14145 + this.margin = 4;
14147 + this.barwidth = this.canvas.width - (2 * this.margin);
14149 + // slider size
14150 + this.sliderwidth = this.margin - 1;
14151 + if (this.sliderwidth < 4) {
14152 + this.sliderwidth = 4;
14154 + this.slidertip = Math.round(this.height / 10);
14155 + this.tickheight = this.slidertip * 2;
14157 + if (!this.rStep) {
14158 + this.adjEnd = this.rEnd;
14159 + return true;
14162 + // begin and end might not be a step
14163 + this.adjEnd = this.rEnd - ((this.rEnd - this.rBegin) % this.rStep);
14164 + this.steps = (this.adjEnd - this.rBegin) / this.rStep;
14165 + this.stepsp = (this.barwidth * (this.adjEnd / this.rEnd)) / this.steps;
14166 + this.width = this.steps * this.stepsp;
14168 + // ticks (== steps for the moment)
14169 + this.ticks = this.steps;
14170 + this.ticksp = this.stepsp;
14172 + for (var i = 0; i <= this.ticks; ++i) {
14173 + var pos = Math.round(this.margin + i * this.ticksp);
14174 + this.ctx.moveTo(pos, this.height - this.tickheight + 1);
14175 + this.ctx.lineTo(pos, this.height);
14176 + this.ctx.closePath();
14177 + this.ctx.stroke();
14181 + return true;
14182 + ]]>
14183 + </body>
14184 + </method>
14185 + </implementation>
14186 + </binding>
14187 +</bindings>
14188 diff -uprN --exclude=CVS mozilla/extensions/xforms/resources/content/select1.xml mozilla.new/extensions/xforms/resources/content/select1.xml
14189 --- mozilla/extensions/xforms/resources/content/select1.xml 2005-10-25 20:23:25.000000000 +0200
14190 +++ mozilla.new/extensions/xforms/resources/content/select1.xml 2006-02-24 11:16:25.000000000 +0100
14191 @@ -62,12 +62,13 @@
14192 anonid="container"><html:input
14193 class="-moz-xforms-select1-input"
14194 anonid="control"
14195 + xbl:inherits="accesskey"
14196 onfocus="this.parentNode.parentNode.dispatchDOMUIEvent('DOMFocusIn')"
14197 onblur="this.parentNode.parentNode.handleBlur(); this.parentNode.parentNode.dispatchDOMUIEvent('DOMFocusOut');"
14198 onclick="this.parentNode.parentNode.handleControlClick();"
14199 onkeypress="this.parentNode.parentNode.handleKeyPress(event);"
14200 onkeyup="this.parentNode.parentNode.handleKeyUp(event);"
14201 - /><html:input class="-moz-xforms-select1-dropdown"
14202 + /><html:input class="-moz-xforms-select1-dropdown xf-value"
14203 type="button"
14204 anonid="dropmarker"
14205 tabindex="-1"
14206 @@ -87,6 +88,7 @@
14207 <!-- This is either an nsIXFormsItemElement or null. -->
14208 <field name="_selected">null</field>
14209 <field name="_tmpSelected">null</field>
14210 + <field name="_lastSelectedItem">null</field>
14211 <field name="popupOpen">false</field>
14212 <field name="shouldHandleBlur">true</field>
14214 @@ -153,7 +155,7 @@
14215 <![CDATA[
14216 if (this.selectionOpen && !this._selected) {
14217 if (this.getAttribute("incremental") != "false") {
14218 - this.delegate.value = this.inputField.value;
14219 + this._handleSelection();
14221 } else {
14222 this.togglePopup();
14223 @@ -172,7 +174,26 @@
14224 this.togglePopup();
14225 if (open && this._selected) {
14226 this.updateInputField();
14227 - this.delegate.value = this._selected.value;
14228 + this._handleSelection();
14230 + // need to keep the xforms-select and xforms-deselect event
14231 + // dispatching after _handleSelection. That function might
14232 + // deselect this._selected if this user selected item is a
14233 + // copyItem bound to a non-element node. We don't want to
14234 + // dispatch a xforms-select/deselect in that case since it
14235 + // really isn't considered to be a valid selection to begin with
14236 + // (causes a xforms-binding-exception).
14237 + if (this._lastSelectedItem != this._selected) {
14238 + if (this._lastSelectedItem) {
14239 + this.dispatchSelectEvent(this._lastSelectedItem, "xforms-deselect");
14242 + if (this._selected) {
14243 + this.dispatchSelectEvent(this._selected, "xforms-select");
14246 + this._lastSelectedItem = this._selected;
14249 } else if (key == aEvent.DOM_VK_UP ||
14250 key == aEvent.DOM_VK_DOWN) {
14251 @@ -187,9 +208,26 @@
14252 if (!this.popupOpen && this.getAttribute("incremental") != "false") {
14253 if (this._selected) {
14254 this.updateInputField();
14255 - this.delegate.value = this._selected.value;
14256 - } else if (this.selectionOpen) {
14257 - this.delegate.value = this.inputField.value;
14259 + this._handleSelection();
14261 + // need to keep the xforms-select and xforms-deselect event
14262 + // dispatching after _handleSelection. That function might
14263 + // deselect this._selected if the selected item is a copyItem
14264 + // bound to a non-element node. We don't want to dispatch a
14265 + // xforms-select/deselect in that case since it really isn't
14266 + // considered to be a valid selection to begin with (causes
14267 + // a xforms-binding-exception).
14268 + if (this._lastSelectedItem != this._selected) {
14269 + if (this._lastSelectedItem) {
14270 + this.dispatchSelectEvent(this._lastSelectedItem, "xforms-deselect");
14273 + if (this._selected) {
14274 + this.dispatchSelectEvent(this._selected, "xforms-select");
14277 + this._lastSelectedItem = this._selected;
14280 } else if (key == aEvent.DOM_VK_TAB) {
14281 @@ -231,7 +269,7 @@
14282 this._selected = null;
14284 if (this.getAttribute("incremental") != "false") {
14285 - this.delegate.value = this.inputField.value;
14286 + this._handleSelection();
14290 @@ -323,7 +361,7 @@
14291 <body>
14292 <![CDATA[
14293 var label = null;
14294 - var next = null;
14295 + var next = null, nextItem = null;
14296 var node = this.firstChild;
14297 while (node) {
14298 if (node.namespaceURI == this.XFORMS_NS &&
14299 @@ -345,12 +383,14 @@
14300 next = this.findNextSelectable(node, aDown);
14301 if (next) {
14302 if (this._selected) {
14303 + this._lastSelected = this._selected;
14304 this._selected.setActive(false);
14305 this._selected = null;
14308 - this._selected = next.QueryInterface(Components.interfaces.nsIXFormsItemElement);
14309 - if (this._selected) {
14310 + nextItem = next.QueryInterface(Components.interfaces.nsIXFormsItemElement);
14311 + if (nextItem) {
14312 + this._selected = nextItem;
14313 this._selected.setActive(true);
14314 this.updateInputField();
14316 @@ -391,8 +431,26 @@
14318 if (this._selected) {
14319 this.updateInputField();
14320 - this.delegate.value =
14321 - this._selected.value;
14322 + this._handleSelection();
14324 + // need to keep the xforms-select and xforms-deselect event
14325 + // dispatching after _handleSelection. That function might
14326 + // deselect this._selected if the selected item is a copyItem
14327 + // bound to a non-element node. We don't want to dispatch a
14328 + // xforms-select/deselect in that case since it really isn't
14329 + // considered to be a valid selection to begin with (causes
14330 + // a xforms-binding-exception).
14331 + if (this._lastSelectedItem != this._selected) {
14332 + if (this._lastSelectedItem) {
14333 + this.dispatchSelectEvent(this._lastSelectedItem, "xforms-deselect");
14336 + if (this._selected) {
14337 + this.dispatchSelectEvent(this._selected, "xforms-select");
14340 + this._lastSelectedItem = this._selected;
14343 this.inputField.focus();
14345 @@ -461,7 +519,7 @@
14346 <method name="togglePopup">
14347 <body>
14348 <![CDATA[
14349 - if (!this.popupOpen && !this.delegate.isReadonly) {
14350 + if (!this.popupOpen && !this.accessors.isReadonly()) {
14351 // Calculating the size and position of the popup.
14352 var style = "";
14353 var containerBox = document.getBoxObjectFor(this.container);
14354 @@ -545,27 +603,112 @@
14355 <body>
14356 <![CDATA[
14357 try {
14358 - var newValue = this.stringValue;
14359 + var nodeValue = null, newValue = null;
14360 + var boundNode = this.accessors.getBoundNode();
14361 + var outOfRange = false;
14362 + if (boundNode && boundNode.hasChildNodes()) {
14363 + // Since this is a select1, there should normally be just one
14364 + // child node here. But no guarantee that a select1 generated
14365 + // the value coming in. So we'll look for text node with
14366 + // non-whitespace characters to compare with an item's xf:value.
14367 + // Any other node that we encounter we look to match with an
14368 + // item's xf:copy. If more than one of either of these exists
14369 + // in the instance data, we need to generate a xforms-out-of-range
14370 + // event and style the select1 as out-of-range since by
14371 + // definition a select1 can not select more than one item.
14372 + var child = boundNode.firstChild;
14373 + while (child) {
14374 + var type = child.nodeType;
14375 + if (type == Node.TEXT_NODE) {
14376 + // if child is a text node completely filled with
14377 + // whitespace let's ignore it and get the next node
14378 + var string = child.nodeValue;
14379 + var nonWhitespace = false;
14380 + if (string) {
14381 + // this regexp tests whether only whitespace is contained
14382 + // between the beginning and ending of the string.
14383 + nonWhitespace = !(/^\s*$/.test(string));
14385 + if (nonWhitespace) {
14386 + if (newValue || nodeValue) {
14387 + // oh oh! We've already found a selectable node in the
14388 + // instance data and now we have another. That shouldn't
14389 + // happen.
14390 + // XXX generate xforms-out-of-range exception and style
14391 + // control as out-of-range
14392 + outOfRange = true;
14394 + newValue = string;
14396 + } else {
14397 + // if it's not a text node, we'll assume that we are looking at
14398 + // a node worth comparing. As such, look for an
14399 + // item with a copy element that might match this node.
14400 + if (newValue || nodeValue) {
14401 + // oh oh! We've already found a selectable node in the
14402 + // instance data and now we have another. That shouldn't
14403 + // happen.
14404 + // XXX generate xforms-out-of-range exception and style
14405 + // control as out-of-range
14406 + outOfRange = true;
14408 + nodeValue = child;
14411 + if (child == boundNode.lastChild) {
14412 + break;
14414 + child = child.nextSibling;
14418 - if (!this.selectionOpen || this.delegate.isReadonly) {
14419 + if (outOfRange) {
14420 + // can't possibly work, no sense continuing.
14421 + this.inputField.value = "";
14422 + this._selected.setActive(false);
14423 + this._selected = null;
14424 + return false;
14427 + if (!this.selectionOpen || this.accessors.isReadonly()) {
14428 this.inputField.setAttribute("readonly", "readonly");
14429 } else {
14430 this.inputField.removeAttribute("readonly");
14433 - if (this._selected) {
14434 - if (newValue ==
14435 - this._selected.value) {
14436 - return true;
14437 + if (this._selected && !this._selected.isCopyItem) {
14438 + var envelope = this._getSelectedValue();
14439 + if (envelope) {
14440 + var textNode = null;
14441 + if (envelope.nodeType == Node.ELEMENT_NODE) {
14442 + textNode = envelope.firstChild;
14443 + if (newValue == textNode.nodeValue) {
14444 + // value in instance data already selected. Nothin' left
14445 + // to do.
14446 + return true;
14448 + } else {
14449 + if (newValue == contentEnvelope.nodeValue) {
14450 + // value in instance data already selected. Nothin' left
14451 + // to do.
14452 + return true;
14456 this._selected.setActive(false);
14457 this._selected = null;
14458 + this._lastSelectedItem = null;
14461 - this.selectItemByValue(newValue);
14462 + if (newValue) {
14463 + this.selectItemByValue(newValue);
14464 + } else if (nodeValue) {
14465 + this.selectItemByNode(nodeValue);
14468 if (this._selected) {
14469 this.updateInputField();
14470 + this._lastSelectedItem = this._selected;
14471 } else if (this.selectionOpen) {
14472 this.inputField.value = newValue;
14473 } else {
14474 @@ -596,7 +739,8 @@
14475 item = null;
14476 try {
14477 if (node.nodeType == document.ELEMENT_NODE &&
14478 - node.namespaceURI == this.XFORMS_NS && node.localName != "label") {
14479 + node.namespaceURI == this.XFORMS_NS &&
14480 + node.localName != "label") {
14482 item = node.QueryInterface(Components.interfaces.nsIXFormsSelectChild);
14483 if (item) {
14484 @@ -621,6 +765,45 @@
14485 </body>
14486 </method>
14488 + <method name="selectItemByNode">
14489 + <parameter name="aNode"/>
14490 + <body>
14491 + <![CDATA[
14493 + // select the copyItem in this select1 whose copyNode equals aNode
14495 + var node = this.firstChild;
14496 + var item;
14497 + while (node) {
14498 + item = null;
14499 + try {
14500 + if (node.nodeType == document.ELEMENT_NODE &&
14501 + node.namespaceURI == this.XFORMS_NS &&
14502 + node.localName != "label") {
14504 + item = node.QueryInterface(Components.interfaces.nsIXFormsSelectChild);
14505 + if (item) {
14506 + item = item.selectItemByNode(aNode);
14507 + if (item) {
14508 + if (this._selected) {
14509 + this._selected.setActive(false);
14510 + this._selected = null;
14512 + this._selected = item.QueryInterface(Components.interfaces.nsIXFormsItemElement);
14513 + if (this._selected) {
14514 + this._selected.setActive(true);
14515 + return;
14520 + } catch (ex) {}
14521 + node = node.nextSibling;
14523 + ]]>
14524 + </body>
14525 + </method>
14527 <method name="handleBlur">
14528 <body>
14529 <![CDATA[
14530 @@ -640,16 +823,169 @@
14531 return;
14534 - if (this.selectionOpen && !this._selected) {
14535 - this.delegate.value = this.inputField.value;
14536 - } else if (this._selected) {
14537 + if (this._selected) {
14538 this.updateInputField();
14539 - this.delegate.value = this._selected.value;
14542 + this._handleSelection(true);
14544 + ]]>
14545 + </body>
14546 + </method>
14548 + <!-- _handleSelection updates the bound node with the value from the
14549 + currently selected item's value element or copy element. -->
14550 + <method name="_handleSelection">
14551 + <parameter name="aInBlur"/>
14552 + <body>
14553 + <![CDATA[
14554 + var boundNode = this.accessors.getBoundNode();
14555 + if (!boundNode) {
14556 + return;
14559 + if (this.selectionOpen && !this._selected) {
14560 + this.accessors.setValue(this.inputField.value);
14561 + return;
14564 + if (!this._selected) {
14565 + // no reason to continue
14566 + return;
14569 + if (aInBlur && aInBlur == true) {
14570 + // if _handleSelection is called due to a blur, we only really care
14571 + // about making sure the bound node is in sync if @incremental is
14572 + // false. Otherwise the bound node is already up to date so might
14573 + // as well return.
14574 + if (this.getAttribute("incremental") != "false") {
14575 + return;
14579 + if (boundNode.nodeType != boundNode.ELEMENT_NODE) {
14580 + // if the boundNode type isn't an ELEMENT_NODE, then contentEnvelope
14581 + // isn't an ELEMENT_NODE (since it is a clone of the bound node).
14582 + // So if contentEnvelope has a value, it will be the nodeValue.
14583 + var envelope = this._getSelectedValue();
14584 + if (envelope) {
14585 + this.accessors.setValue(envelope.nodeValue);
14586 + return;
14589 + // not allowed to copy a node under a non ELEMENT node, so
14590 + // generating a binding exception per spec.
14591 + var ev = document.createEvent("Events");
14592 + ev.initEvent("xforms-binding-exception", true, false);
14593 + this.dispatchEvent(ev);
14595 + // well, whatever we had selected isn't going to cut it. But the
14596 + // user did choose to deselect the previous item in favor of this
14597 + // this item, so we really shouldn't go back to what
14598 + // was there before. So we'll go to nothing. Make sure bound
14599 + // node reflects this. Seems to be consistent with what Novell
14600 + // and formsPlayer does, too.
14601 + this._selected.setActive(false);
14602 + this._selected = null;
14603 + this.inputField.value = "";
14604 + this.accessors.setValue("");
14605 + return;
14608 + var contentEnvelope = this._getSelectedValue();
14609 + var copyInvolved = this._selected.isCopyItem;
14610 + if (!copyInvolved && this._lastSelectedItem) {
14611 + copyInvolved = this._lastSelectedItem.isCopyItem;
14613 + if (!copyInvolved) {
14614 + // Since we aren't selecting a copyItem nor causing a copyItem to
14615 + // be deselected, no sense using setContent. Too expensive.
14616 + this.accessors.setValue(contentEnvelope.textContent);
14617 + } else {
14618 + this.accessors.setContent(contentEnvelope, true);
14623 </body>
14624 </method>
14626 + <method name="dispatchSelectEvent">
14627 + <parameter name="aElement"/>
14628 + <parameter name="aName"/>
14629 + <body>
14630 + var ev = document.createEvent("Events");
14631 + ev.initEvent(aName, true, false);
14633 + var elm = aElement;
14635 + // per http://www.w3.org/TR/2005/PER-xforms-20051006/index-all.html#evt-select
14636 + // we send the event to the itemset if it is a parent.
14637 + if (elm.parentNode.localName == "itemset")
14638 + elm = elm.parentNode;
14640 + elm.dispatchEvent(ev);
14641 + return true;
14642 + </body>
14643 + </method>
14645 + <method name="_getSelectedValue">
14646 + <body>
14647 + <![CDATA[
14648 + // The purpose of this function is to return the select1's currently
14649 + // selected item's value in a contentEnvelope. It achieves this by
14650 + // cloning the bound node to create the contentEnvelope which will be
14651 + // returned. If the contentEnvelope is an element node, the contents
14652 + // of the selected item's value will be inserted as a child of the
14653 + // contentEnvelope. If it is a textnode, the selected item value will
14654 + // be put in the contentEnvelope.nodeValue.
14656 + if (!this._selected) {
14657 + // this will probably only happen if there was an exception
14658 + // somewhere else first. But no sense continuing below and adding
14659 + // more exceptions to the console.
14660 + return null;
14663 + var boundNode = this.accessors.getBoundNode();
14664 + if (!boundNode) {
14665 + return;
14668 + var contentEnvelope = boundNode.cloneNode(false);
14669 + if (!contentEnvelope) {
14670 + return null;
14673 + if (contentEnvelope.nodeType == Node.ELEMENT_NODE) {
14674 + var contentNode = null;
14675 + if (this._selected.isCopyItem) {
14676 + var copyNode = this._selected.copyNode;
14677 + if (copyNode) {
14678 + contentNode = copyNode.cloneNode(true);
14680 + } else {
14681 + contentNode = document.createTextNode(this._selected.value);
14684 + contentEnvelope.appendChild(contentNode);
14685 + } else {
14686 + // if the selected item is not a copyItem, then we'll just put the
14687 + // item's value in the nodeValue for the contentEnvelope. Otherwise
14688 + // we are stuck trying to stick an element node under a non-element
14689 + // node and that ainna gonna work.
14690 + if (!this._selected.isCopyItem) {
14691 + contentEnvelope.nodeValue = this._selected.value;
14692 + } else {
14693 + contentEnvelope = null;
14697 + return contentEnvelope;
14698 + ]]>
14699 + </body>
14700 + </method>
14701 </implementation>
14702 </binding>
14704 diff -uprN --exclude=CVS mozilla/extensions/xforms/resources/content/select.xml mozilla.new/extensions/xforms/resources/content/select.xml
14705 --- mozilla/extensions/xforms/resources/content/select.xml 2005-10-25 20:23:25.000000000 +0200
14706 +++ mozilla.new/extensions/xforms/resources/content/select.xml 2006-02-24 11:16:25.000000000 +0100
14707 @@ -82,7 +82,8 @@
14708 <html:span>
14709 <children includes="label"/>
14710 </html:span>
14711 - <html:select xbl:inherits="style"
14712 + <html:select xbl:inherits="style, accesskey"
14713 + class="xf-value"
14714 onchange="this.parentNode.parentNode.selectionChanged();"
14715 onfocus="this.parentNode.parentNode.dispatchDOMUIEvent('DOMFocusIn');"
14716 onblur="this.parentNode.parentNode.handleBlur(); this.parentNode.parentNode.dispatchDOMUIEvent('DOMFocusOut');"
14717 @@ -117,7 +118,7 @@
14718 </setter>
14719 </property>
14721 - <field name="_delegateValueCache">null</field>
14722 + <field name="_accessorValueCache">null</field>
14724 <field name="_refreshing">false</field>
14725 <method name="refresh">
14726 @@ -128,33 +129,57 @@
14727 if (this._refreshing)
14728 return;
14730 - if (this.delegate.isReadonly) {
14731 + if (this.accessors.isReadonly()) {
14732 this.uiElement.setAttribute("readonly", "readonly");
14733 } else {
14734 this.uiElement.removeAttribute("readonly");
14737 - if (!this.delegate.hasBoundNode)
14738 - return;
14740 this._refreshing = true;
14742 + // if this node contains a non TEXT node, then we have to throw
14743 + // the 'just string values' logic out the window
14744 + var boundNode = this.accessors.getBoundNode();
14745 + var containsNonText = false;
14746 + if (boundNode && boundNode.hasChildNodes()) {
14747 + var child = boundNode.firstChild;
14748 + while (child) {
14749 + var type = child.nodeType;
14750 + if (type != Node.TEXT_NODE && type != Node.CDATA_SECTION_NODE) {
14751 + containsNonText = true;
14752 + this._accessorValueCache = null;
14753 + break;
14755 + child = child.nextSibling;
14759 // We detect if the instance data we bind to has changed. If it has,
14760 // changed, we simply update the selection. If it hasn't, that means
14761 // we rebuild the select UI. We also rebuild if the delegate cache is
14762 // null (first load).
14763 - if (this._delegateValueCache == null ||
14764 - this._delegateValueCache == this.delegate.value) {
14765 - // refresh was not called due to instance data changing, so build the
14766 - // UI.
14767 - this._buildSelect();
14768 - } else {
14769 + if (this._accessorValueCache == null ||
14770 + this._accessorValueCache == this.accessors.getValue() ||
14771 + containsNonText) {
14772 + // if we reached here and the instance data only contains text
14773 + // nodes, then we need to rebuild the control since we know it
14774 + // wasn't due to a simple instance data changing scenario. But if
14775 + // the bound node contains non TEXT nodes, then it is too expensive
14776 + // to figure out if this was because a child node changed somewhere
14777 + // along the way. We'd basically have to cache the whole bound node
14778 + // subtree to compare against. To avoid this we'll just rebuild the
14779 + // control from scratch.
14781 + // XXX at a future time we need to figure out which will be more
14782 + // efficient give the most probable use cases.
14783 + this._buildSelect(containsNonText);
14784 + } else if (!containsNonText) {
14785 // update selection
14786 this._updateSelection();
14789 - // store the delegate value
14790 - this._delegateValueCache = this.delegate.value;
14791 + // store the delegate value
14792 + this._accessorValueCache = this.accessors.getValue();
14795 this._refreshing = false;
14797 @@ -165,25 +190,92 @@
14799 <field name="_controlArraySize">0</field>
14800 <field name="_controlArray">new Array()</field>
14801 + <field name="_selectedElementSize">0</field>
14802 + <field name="_selectedElementArray">new Array()</field>
14803 <field name="_defaultHash">null</field>
14805 <method name="_buildSelect">
14806 + <parameter name="aContainsNonText"/>
14807 <body>
14808 <![CDATA[
14809 // select builds its own UI by parsing it's children.
14811 - // replace new line (\n), tabs (\t) and carriage returns (\r) with "".
14812 - var value = this.delegate.value.replace(/\n|\t|\r/g, " ");
14813 + // if delegate.value has something, then only text node(s) should
14814 + // exist under the bound node
14816 - // get an array of values selected in the bound node
14817 - var selectedArray = value.split(" ");
14818 + // holds an array of DOMElements that exist under bound node,
14819 + this._selectedElementSize = 0;
14820 + this._selectedElementArray = new Array();
14822 + if (!aContainsNonText) {
14823 + // replace new line (\n), tabs (\t) and carriage returns (\r) with
14824 + // "".
14825 + var value = "";
14826 + var accessValue = this.accessors.getValue();
14828 + if (accessValue)
14829 + value = accessValue.replace(/\n|\t|\r/g, " ");
14831 + // get an array of values selected in the bound node
14832 + var selectedArray = value.split(" ");
14834 + // create a hash from the default values so we can store how often
14835 + // we encountered them. This allows us to figure out later if any
14836 + // were not hit, which requires us to send an event.
14837 + this._defaultHash = new Object();
14838 + for (var run = 0; run < selectedArray.length; run++) {
14839 + this._defaultHash[selectedArray[run]] = {hits: 0}
14841 + } else {
14842 + var boundNode = this.accessors.getBoundNode();
14843 + var child = boundNode ? boundNode.firstChild : null;
14844 + this._defaultHash = null;
14845 + while (child) {
14846 + var type = child.nodeType;
14847 + if (type == Node.TEXT_NODE ||
14848 + type == Node.CDATA_SECTION_NODE) {
14849 + // if child is a text node completely filled with
14850 + // whitespace let's ignore it and get the next node
14851 + var string = child.nodeValue;
14852 + var nonWhitespace = false;
14853 + if (string) {
14854 + // this regexp tests whether only whitespace is contained
14855 + // between the beginning and ending of the string.
14856 + nonWhitespace = !(/^\s*$/.test(string));
14858 + if (nonWhitespace) {
14859 + // replace new line (\n), tabs (\t) and carriage returns (\r)
14860 + // with " ".
14861 + var value = string.replace(/\n|\t|\r/g, " ");
14863 + // get an array of values selected in the bound node
14864 + var selectedArray = value.split(" ");
14866 + // create a hash from the default values so we can store how
14867 + // often we encountered them. This allows us to figure out
14868 + // later if any were not hit, which requires us to send an
14869 + // event.
14870 + if (!this._defaultHash) {
14871 + this._defaultHash = new Object();
14873 + for (var run = 0; run < selectedArray.length; run++) {
14874 + this._defaultHash[selectedArray[run]] = {hits: 0}
14877 + } else {
14878 + // if it's not a text node, we'll assume that we are looking at
14879 + // a node worth comparing. As such, look for an
14880 + // item with a copy element that might match this node.
14881 + this._selectedElementArray[this._selectedElementSize] =
14882 + {element: child, hits: 0}
14883 + this._selectedElementSize++;
14886 - // create a hash from the default values so we can store how often
14887 - // we encountered them. This allows us to figure out later if any were
14888 - // not hit, which requires us to send an event.
14889 - this._defaultHash = new Object();
14890 - for (var run = 0; run < selectedArray.length; run++) {
14891 - this._defaultHash[selectedArray[run]] = {hits: 0}
14892 + if (child == boundNode.lastChild) {
14893 + break;
14895 + child = child.nextSibling;
14899 // clear the UI children
14900 @@ -223,12 +315,13 @@
14901 var uiElement =
14902 child.QueryInterface(Components.interfaces.nsIXFormsItemSetUIElement);
14903 var containers = uiElement.anonymousItemSetContent.childNodes;
14905 + // go through each item in the itemset and add it to the
14906 + // html:select. Select any of the items that contain a value
14907 + // that also appears under the bound node.
14908 for (var y = 0; y < containers.length; y++) {
14909 if (containers[y].nodeType == containers[y].ELEMENT_NODE) {
14910 - var value = this._addItemSetItem(containers[y]);
14912 - // check if we should pre-select this option
14913 - this.preselectItem(value);
14914 + this._addItemSetItem(containers[y]);
14918 @@ -245,6 +338,18 @@
14922 + // check if any default elements were not found
14923 + for (var j = 0; j < this._selectedElementSize; j++) {
14924 + if (this._selectedElementArray[j].hits == 0) {
14925 + // XXX: some of default values not found, we need to throw an
14926 + // xforms-out-of-range event, but only if the select is 'closed'.
14927 + // If the select is open, the missing elements should be added
14928 + // and selected per 8.1.10 in the spec.
14934 return true;
14936 </body>
14937 @@ -295,7 +400,7 @@
14939 // add to the control array
14940 this._controlArray[this._controlArraySize] =
14941 - {control: aControl, option: option, type: "item"}
14942 + {control: aControl, option: option, type: "item", wasSelected: false}
14943 this._controlArraySize++;
14945 return option;
14946 @@ -342,7 +447,7 @@
14948 // add to the control array
14949 this._controlArray[this._controlArraySize] =
14950 - {control: child, option: option, type: "item"}
14951 + {control: child, option: option, type: "item", wasSelected: false}
14952 this._controlArraySize++;
14954 // check if we should pre-select this option
14955 @@ -363,18 +468,47 @@
14956 <body>
14957 <![CDATA[
14958 var itemElm = aItemElement.QueryInterface(Components.interfaces.nsIXFormsItemElement);
14959 - var itemValue = itemElm.value;
14960 + var copyItem = itemElm.isCopyItem;
14961 + var itemValue = copyItem ? "" : itemElm.value;
14962 var itemLabel = itemElm.labelText;
14964 - var option = this._buildSelectItem(itemLabel, itemValue, aItemElement, true);
14965 + var option = this._buildSelectItem(itemLabel, itemValue, aItemElement,
14966 + true);
14968 + // if this item contains a copy element AND if the bound node contains
14969 + // non-text elements, then see if any of these non-text elements match
14970 + // this copyItem's node.
14971 + if (copyItem && this._selectedElementSize > 0) {
14972 + var item = aItemElement.QueryInterface(Components.interfaces.nsIXFormsSelectChild);
14973 + for (var j = 0; j < this._selectedElementSize; j++ ) {
14974 + var selectedItem =
14975 + item.selectItemByNode(this._selectedElementArray[j].element);
14976 + if (selectedItem) {
14977 + this._selectedElementArray[j].hits++;
14978 + option.selected = true;
14979 + // XXX It is possible that two identical elements are under the
14980 + // bound node. I guess we shouldn't mark one and not the other
14981 + // if there is an item in the select that matches it. So we'll
14982 + // go through the whole list. But this is quite an edge case
14983 + // and will cause more inefficiency just to prevent an errant
14984 + // xforms-out-of-range.
14989 // add to the control array
14990 this._controlArray[this._controlArraySize] =
14991 - {control: aItemElement, option: option, type: "item"}
14992 + {control: aItemElement, option: option, type: "item", wasSelected: option.selected}
14993 this._controlArraySize++;
14995 this.uiElement.appendChild(option);
14997 + if (!copyItem) {
14998 + // if this item contains a value element, then make sure to select
14999 + // this item if its value exists under the bound node.
15000 + this.preselectItem(itemValue);
15003 return itemValue;
15005 </body>
15006 @@ -386,44 +520,211 @@
15007 <![CDATA[
15008 // if incremental, change instance data and send the value-changed event
15009 if (this.incremental) {
15010 - this._setBoundValue();
15011 + this._handleSelection();
15012 + } else {
15013 + // per the spec, if not incremental, we still need to send the
15014 + // deselect/select events. which _getSelectedValues() does for us
15015 + this._getSelectedValues();
15018 </body>
15019 </method>
15021 - <method name="_setBoundValue">
15022 + <method name="_handleSelection">
15023 <body>
15024 <![CDATA[
15025 - this.delegate.value = this._getSelectedValues();
15026 + var boundNode = this.accessors.getBoundNode();
15027 + if (!boundNode) {
15028 + return;
15031 + // if a copy item is selected or deselected, then we need to replace
15032 + // ALL of the current content with the newly selected content. Which
15033 + // means calling setContent. setValue only messes with the first
15034 + // textnode under the bound node.
15035 + var copySelectedOrDeselected = new Boolean();
15036 + copySelectedOrDeselected.value = false;
15037 + var contentEnvelope = this._getSelectedValues(copySelectedOrDeselected);
15038 + if (contentEnvelope) {
15039 + if (boundNode.nodeType == Node.ELEMENT_NODE) {
15040 + // we shouldn't call setContent if we haven't selected any
15041 + // copyItems. We can't just test for a single text node under
15042 + // the bound node because this could still have been the result
15043 + // of a copyItem being selected. And if a copyItem is selected,
15044 + // then we need to do the whole rebuild, recalculate, revalidate,
15045 + // refresh process according to the spec...whether we really need
15046 + // to or not.
15047 + if (copySelectedOrDeselected.value == false) {
15048 + this.accessors.setValue(contentEnvelope.textContent);
15049 + } else {
15050 + this.accessors.setContent(contentEnvelope, true);
15052 + } else {
15053 + // if some copyItems were selected by the user prior to the call
15054 + // to _getSelectedValues, then we would not have set up
15055 + // _delegateValueCache. Since the node we are bound to can't
15056 + // be set by copyItems (its not an ELEMENT_NODE), any copyItems
15057 + // in this select would have been deselected during
15058 + // _getSelectedValues. Thus, anything in the contentEnvelope at
15059 + // this point should just be strings and so we can set
15060 + // delegate.value directly and use _delegateValueCache after all.
15062 + this.accessors.setValue(contentEnvelope.nodeValue);
15063 + this._accessorValueCache = contentEnvelope.nodeValue;
15067 </body>
15068 </method>
15070 <method name="_getSelectedValues">
15071 + <parameter name="aIsACopyItemSelectedOrDeselected"/>
15072 <body>
15073 <![CDATA[
15074 var selectedValues = "";
15075 + var newSelectedControls = new Array();
15077 // select if found, unselect if not
15078 var options = this._controlArray;
15080 + if (aIsACopyItemSelectedOrDeselected) {
15081 + aIsACopyItemSelectedOrDeselected.value = false;
15084 + var boundNode = this.accessors.getBoundNode();
15085 + if (!boundNode) {
15086 + return;
15089 + // we are cloning boundNode to create a node that we will return.
15090 + // By the end of this function, assuming all went well,
15091 + // contentEnvelope will contain the values and copyNodes that are
15092 + // represented by the selected items in this xf:select. Cloning
15093 + // the boundNode to use as the envelope so that the caller could
15094 + // just pass the results straight into accessors.setContent().
15095 + var contentEnvelope = null;
15096 + contentEnvelope = boundNode.cloneNode(false);
15097 + if (!contentEnvelope) {
15098 + return;
15100 + var boundType = boundNode.nodeType;
15101 + var copyNode;
15103 + // keep in mind, to maintain compatibility with XSmiles and Novell, we
15104 + // ultimately need to end up with all 'value' elements contained in a
15105 + // text node and this text node needs to be the first child of the
15106 + // bound node.
15107 for (var i = 0; i < options.length; i++) {
15108 var isSelected =
15109 options[i].option ? options[i].option.selected : options[i].checkbox.checked;
15111 if (isSelected) {
15112 - // space delimeted list
15113 + // space delimited list
15114 if (selectedValues.length > 0) {
15115 selectedValues += " ";
15118 - selectedValues +=
15119 - options[i].control.QueryInterface(Components.interfaces.nsIXFormsSelectChild).value;
15120 + var item = options[i].control.QueryInterface(Components.interfaces.nsIXFormsItemElement);
15121 + if (item.isCopyItem) {
15122 + if (boundType && (boundType != Node.ELEMENT_NODE)) {
15123 + // if we are trying to do a copy without being bound to an
15124 + // element node, then we need to throw a binding exception
15125 + // per spec.
15126 + bindingException = document.createEvent("Events");
15127 + bindingException.initEvent("xforms-binding-exception", true, false);
15128 + this.dispatchEvent(bindingException);
15130 + // we should probably un-select the option so that the list
15131 + // of selected data is accurate. This WON'T cause a
15132 + // xforms-select/deselect to fire. Since the user just
15133 + // selected this item and we are automatically deselecting
15134 + // it from underneath the user, we'll treat it like nothing
15135 + // happened.
15136 + if (options[i].option) {
15137 + options[i].option.selected = false;
15138 + } else {
15139 + options[i].checkbox.checked = false;
15141 + } else {
15142 + copyNode = item.copyNode;
15143 + if (copyNode) {
15144 + var clone = copyNode.cloneNode(true);
15145 + contentEnvelope.appendChild(clone);
15148 + // if it wasn't selected before add to the list of newly
15149 + // selected items
15150 + if (!options[i].wasSelected) {
15151 + newSelectedControls.push(options[i].control);
15152 + if (aIsACopyItemSelectedOrDeselected &&
15153 + aIsACopyItemSelectedOrDeselected.value != true) {
15154 + aIsACopyItemSelectedOrDeselected.value = true;
15158 + options[i].wasSelected = true;
15160 + } else {
15161 + // not a copyItem, so grab the item's value and append it to our
15162 + // space seperated list.
15163 + selectedValues +=
15164 + options[i].control.QueryInterface(Components.interfaces.nsIXFormsSelectChild).value;
15166 + // if it wasn't selected before add to the list of newly
15167 + // selected items
15168 + if (!options[i].wasSelected) {
15169 + newSelectedControls.push(options[i].control);
15172 + options[i].wasSelected = true;
15174 + } else {
15175 + // it was selected before, but now unselected
15176 + if (options[i].wasSelected) {
15177 + this.dispatchSelectEvent(options[i].control, "xforms-deselect")
15179 + // if a copyItem was deselected, we need to make sure to do a
15180 + // rebuild. By setting aIsACopyItemSelectedOrDeselected, this
15181 + // should tell _handleSelection to use setContent with
15182 + // aForceUpdate = true
15183 + var item = options[i].control.QueryInterface(Components.interfaces.nsIXFormsItemElement);
15184 + if (item.isCopyItem) {
15185 + if (aIsACopyItemSelectedOrDeselected &&
15186 + aIsACopyItemSelectedOrDeselected.value != true) {
15187 + aIsACopyItemSelectedOrDeselected.value = true;
15192 + options[i].wasSelected = false;
15196 + // write out the text nodes before we handle copy
15197 + if (boundType == Node.ELEMENT_NODE) {
15198 + if (selectedValues.length > 0) {
15199 + var textNode = document.createTextNode(selectedValues);
15200 + if (copyNode) {
15201 + // making sure all selected 'values' are in the first text node
15202 + // under the bound node.
15203 + var firstChild = contentEnvelope.firstChild;
15204 + contentEnvelope.insertBefore(textNode, firstChild);
15205 + } else {
15206 + contentEnvelope.appendChild(textNode);
15209 + } else {
15210 + contentEnvelope.nodeValue = selectedValues;
15213 + selectedValues = "";
15215 + // we send xforms-select after all deselect events are thrown
15216 + for (var i = 0; i < newSelectedControls.length; i++) {
15217 + this.dispatchSelectEvent(newSelectedControls[i], "xforms-select")
15220 - return selectedValues;
15221 + return contentEnvelope;
15223 </body>
15224 </method>
15225 @@ -431,8 +732,15 @@
15226 <method name="_updateSelection">
15227 <body>
15228 <![CDATA[
15229 + // this function only looks through the text values that are stored
15230 + // under the bound node and selects the xf:items that have
15231 + // corresponding values to that list. As such, copyItems will
15232 + // be ignored.
15234 // get an array of values selected in the bound node
15235 - var selectedArray = this.delegate.value.split(" ");
15236 + var selectedArray = new Array();
15237 + if (this.accessors.getValue())
15238 + selectedArray = this.accessors.getValue().split(" ");
15240 // store the values in a hash for quick access
15241 this._defaultHash = new Object();
15242 @@ -444,8 +752,11 @@
15243 var options = this._controlArray;
15245 for (var i = 0; i < options.length; i++) {
15246 - var value =
15247 - options[i].control.QueryInterface(Components.interfaces.nsIXFormsSelectChild).value;
15248 + var item = options[i].control.QueryInterface(Components.interfaces.nsIXFormsSelectChild);
15249 + if (item.isCopyItem) {
15250 + break;
15252 + var value = item.value;
15253 var selectionValue = (this._defaultHash[value] != null);
15255 // either a checkbox or an option
15256 @@ -491,7 +802,7 @@
15257 <![CDATA[
15258 // update instance data if we are not incremental
15259 if (!this.incremental) {
15260 - this._setBoundValue();
15261 + this._handleSelection();
15264 </body>
15265 @@ -502,15 +813,37 @@
15266 <body>
15267 <![CDATA[
15268 // check if we should pre-select this option
15269 - if (this._defaultHash[aValue] != null) {
15270 + if (this._defaultHash && this._defaultHash[aValue] != null) {
15271 var control = this._controlArray[this._controlArraySize - 1]
15272 this._setItemSelection(control, true);
15274 + // tell the control it was selected
15275 + control.wasSelected = true;
15277 this._defaultHash[aValue].hits++;
15280 </body>
15281 </method>
15283 + <method name="dispatchSelectEvent">
15284 + <parameter name="aElement"/>
15285 + <parameter name="aName"/>
15286 + <body>
15287 + var ev = document.createEvent("Events");
15288 + ev.initEvent(aName, true, false);
15290 + var elm = aElement;
15292 + // per http://www.w3.org/TR/2005/PER-xforms-20051006/index-all.html#evt-select
15293 + // we send the event to the itemset if it is a parent.
15294 + if (elm.parentNode.localName == "itemset")
15295 + elm = elm.parentNode;
15297 + elm.dispatchEvent(ev);
15298 + return true;
15299 + </body>
15300 + </method>
15301 </implementation>
15302 </binding>
15304 @@ -525,6 +858,7 @@
15305 <children includes="label"/>
15306 </html:td>
15307 <html:td anonid="checkbox-group"
15308 + class="xf-value"
15309 onchange="this.parentNode.parentNode.parentNode.selectionChanged();">
15310 </html:td>
15311 </html:tr>
15312 @@ -600,7 +934,7 @@
15314 // add to the control array
15315 this._controlArray[this._controlArraySize] =
15316 - {control: aControl, checkbox: item.firstChild, type: "item"}
15317 + {control: aControl, checkbox: item.firstChild, type: "item", wasSelected: false}
15318 this._controlArraySize++;
15320 </body>
15321 @@ -652,7 +986,7 @@
15323 // add to the control array
15324 this._controlArray[this._controlArraySize] =
15325 - {control: child, checkbox: item.firstChild, type: "item"}
15326 + {control: child, checkbox: item.firstChild, type: "item", wasSelected: false}
15327 this._controlArraySize++;
15329 // check if we should pre-select this option
15330 @@ -674,18 +1008,47 @@
15331 <body>
15332 <![CDATA[
15333 var itemElm = aItemElement.QueryInterface(Components.interfaces.nsIXFormsItemElement);
15334 + var copyItem = itemElm.isCopyItem;
15335 var itemValue = itemElm.value;
15336 - var itemLabel = itemElm.labelText;
15338 - var item = this._buildSelectItem(itemLabel, itemValue, aItemElement, true);
15339 + var itemLabel = copyItem ? "" : itemElm.labelText;
15341 + var item = this._buildSelectItem(itemLabel, itemValue, aItemElement,
15342 + true);
15344 // add to the control array
15345 this._controlArray[this._controlArraySize] =
15346 - {control: aItemElement, checkbox: item.firstChild, type: "item"}
15347 + {control: aItemElement, checkbox: item.firstChild, type: "item", wasSelected: false}
15348 this._controlArraySize++;
15350 this.uiElement.appendChild(item);
15352 + // if this item contains a copy element AND if the bound node contains
15353 + // non-text elements, then see if any of these non-text elements match
15354 + // this copyItem's node.
15355 + if (copyItem && this._selectedElementSize > 0) {
15356 + var item = aItemElement.QueryInterface(Components.interfaces.nsIXFormsSelectChild);
15357 + for (var j = 0; j < this._selectedElementSize; j++ ) {
15358 + var selectedItem =
15359 + item.selectItemByNode(this._selectedElementArray[j].element);
15360 + if (selectedItem) {
15361 + this._selectedElementArray[j].hits++;
15362 + item.firstChild.checked = true;
15364 + this._controlArray[this._controlArraySize - 1].wasSelected = true;
15365 + // XXX It is possible that two identical elements are under the
15366 + // bound node. I guess we shouldn't mark one and not the other
15367 + // if there is an item in the select that matches it. So we'll
15368 + // go through the whole list. But this is quite an edge case
15369 + // and will cause more inefficiency just to prevent an errant
15370 + // xforms-out-of-range.
15373 + } else if (!copyItem) {
15374 + // if this item contains a value element, then make sure to select
15375 + // this item if its value exists under the bound node.
15376 + this.preselectItem(itemValue);
15379 return itemValue;
15381 </body>
15382 diff -uprN --exclude=CVS mozilla/extensions/xforms/resources/content/xforms.css mozilla.new/extensions/xforms/resources/content/xforms.css
15383 --- mozilla/extensions/xforms/resources/content/xforms.css 2005-10-23 18:30:14.000000000 +0200
15384 +++ mozilla.new/extensions/xforms/resources/content/xforms.css 2006-02-14 10:01:13.000000000 +0100
15385 @@ -1,38 +1,41 @@
15386 -# ***** BEGIN LICENSE BLOCK *****
15387 -# Version: MPL 1.1/GPL 2.0/LGPL 2.1
15389 -# The contents of this file are subject to the Mozilla Public License Version
15390 -# 1.1 (the "License"); you may not use this file except in compliance with
15391 -# the License. You may obtain a copy of the License at
15392 -# http://www.mozilla.org/MPL/
15394 -# Software distributed under the License is distributed on an "AS IS" basis,
15395 -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15396 -# for the specific language governing rights and limitations under the
15397 -# License.
15399 -# The Original Code is Mozilla XForms support.
15401 -# The Initial Developer of the Original Code is
15402 -# IBM Corporation.
15403 -# Portions created by the Initial Developer are Copyright (C) 2005
15404 -# the Initial Developer. All Rights Reserved.
15406 -# Contributor(s):
15408 -# Alternatively, the contents of this file may be used under the terms of
15409 -# either the GNU General Public License Version 2 or later (the "GPL"), or
15410 -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
15411 -# in which case the provisions of the GPL or the LGPL are applicable instead
15412 -# of those above. If you wish to allow use of your version of this file only
15413 -# under the terms of either the GPL or the LGPL, and not to allow others to
15414 -# use your version of this file under the terms of the MPL, indicate your
15415 -# decision by deleting the provisions above and replace them with the notice
15416 -# and other provisions required by the GPL or the LGPL. If you do not delete
15417 -# the provisions above, a recipient may use your version of this file under
15418 -# the terms of any one of the MPL, the GPL or the LGPL.
15420 -# ***** END LICENSE BLOCK *****
15422 + * ***** BEGIN LICENSE BLOCK *****
15423 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
15425 + * The contents of this file are subject to the Mozilla Public License Version
15426 + * 1.1 (the "License"); you may not use this file except in compliance with
15427 + * the License. You may obtain a copy of the License at
15428 + * http://www.mozilla.org/MPL/
15430 + * Software distributed under the License is distributed on an "AS IS" basis,
15431 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15432 + * for the specific language governing rights and limitations under the
15433 + * License.
15435 + * The Original Code is Mozilla XForms support.
15437 + * The Initial Developer of the Original Code is
15438 + * IBM Corporation.
15439 + * Portions created by the Initial Developer are Copyright (C) 2005
15440 + * the Initial Developer. All Rights Reserved.
15442 + * Contributor(s):
15444 + * Alternatively, the contents of this file may be used under the terms of
15445 + * either the GNU General Public License Version 2 or later (the "GPL"), or
15446 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
15447 + * in which case the provisions of the GPL or the LGPL are applicable instead
15448 + * of those above. If you wish to allow use of your version of this file only
15449 + * under the terms of either the GPL or the LGPL, and not to allow others to
15450 + * use your version of this file under the terms of the MPL, indicate your
15451 + * decision by deleting the provisions above and replace them with the notice
15452 + * and other provisions required by the GPL or the LGPL. If you do not delete
15453 + * the provisions above, a recipient may use your version of this file under
15454 + * the terms of any one of the MPL, the GPL or the LGPL.
15456 + * ***** END LICENSE BLOCK *****
15457 + */
15459 @namespace url(http://www.w3.org/2002/xforms);
15460 @namespace html url(http://www.w3.org/1999/xhtml);
15461 @namespace mozType url(http://www.mozilla.org/projects/xforms/2005/type);
15462 @@ -77,6 +80,10 @@ output {
15463 -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-output');
15466 +range {
15467 + -moz-binding: url('chrome://xforms/content/range.xml#xformswidget-range');
15470 input {
15471 -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-input');
15473 @@ -85,6 +92,81 @@ input[mozType|type="http://www.w3.org/20
15474 -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-input-boolean');
15477 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] {
15478 + -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-input-date');
15481 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|input[anonid="dropmarker"] {
15482 + min-width:27px;
15483 + min-height: 1.3em;
15484 + background-image: url(chrome://xforms/content/calendar.png) !important;
15485 + background-position: center !important;
15486 + background-repeat: no-repeat !important;
15489 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|div[anonid="picker"] {
15490 + border: 1px outset black !important;
15491 + background-color: -moz-Field;
15492 + font: -moz-list;
15493 + text-align: start;
15496 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td {
15497 + border: 1px solid transparent;
15498 + text-align: center;
15501 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.prevMonth,
15502 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.nextMonth {
15503 + color: GrayText;
15506 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.prevMonth:hover,
15507 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.nextMonth:hover {
15508 + background-color: grey;
15509 + cursor: pointer;
15512 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.currentMonth {
15513 + color: black;
15516 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.currentMonth:hover {
15517 + color: HighlightText;
15518 + background-color: Highlight;
15519 + cursor: pointer;
15522 +input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td[tabindex="0"] {
15523 + border: 1px solid black;
15526 +html|input.-moz-date-back-button {
15527 + width: 20px;
15528 + background-image: url("chrome://global/skin/arrow/arrow-lft.gif") !important;
15529 + background-repeat: no-repeat !important;
15530 + background-position: center !important;
15533 +html|input.-moz-date-fwd-button {
15534 + width: 20px;
15535 + background-image: url("chrome://global/skin/arrow/arrow-rit.gif") !important;
15536 + background-repeat: no-repeat !important;
15537 + background-position: center !important;
15540 +input[mozType|type="http://www.w3.org/2001/XMLSchema#gMonth"] {
15541 + -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-input-month');
15544 +input[mozType|type="http://www.w3.org/2001/XMLSchema#gDay"] {
15545 + -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-input-day');
15548 +input[mozType|type="http://www.w3.org/2001/XMLSchema#gYear"] {
15549 + -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-input-year');
15552 secret {
15553 -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-secret');
15555 @@ -109,6 +191,17 @@ label {
15556 -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-label');
15559 +input > label,
15560 +secret > label,
15561 +textarea > label,
15562 +trigger > label,
15563 +submit > label,
15564 +select > label,
15565 +select1 > label,
15566 +upload > label {
15567 + -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-label-accesskey');
15570 select1 {
15571 -moz-binding: url('chrome://xforms/content/select1.xml#xformswidget-select1');
15573 @@ -125,6 +218,8 @@ select1 item {
15574 white-space : nowrap;
15578 +html|input.-moz-xforms-date-dropdown,
15579 html|input.-moz-xforms-select1-dropdown {
15580 width: 12px;
15581 height: 1.3em;
15582 @@ -164,6 +259,7 @@ html|input.-moz-xforms-select1-input:foc
15583 border: 1px dotted black;
15586 +html|span.-moz-date-container,
15587 html|span.-moz-select1-container {
15588 margin: 0px;
15589 margin-bottom: 1px;
15590 @@ -268,3 +364,7 @@ upload[mozType|type="http://www.w3.org/2
15591 -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-upload');
15594 +/* default MIP styling */
15595 +*:disabled {
15596 + display: none;
15598 diff -uprN --exclude=CVS mozilla/extensions/xforms/resources/content/xforms.xml mozilla.new/extensions/xforms/resources/content/xforms.xml
15599 --- mozilla/extensions/xforms/resources/content/xforms.xml 2005-10-25 20:23:25.000000000 +0200
15600 +++ mozilla.new/extensions/xforms/resources/content/xforms.xml 2006-02-14 10:01:13.000000000 +0100
15601 @@ -65,16 +65,17 @@
15603 <destructor>
15604 this._delegate = null;
15605 + this._accessors = null;
15606 </destructor>
15608 - <field name="_delegate">null</field>
15610 <property name="XFORMS_NS" readonly="true">
15611 <getter>
15612 return "http://www.w3.org/2002/xforms";
15613 </getter>
15614 </property>
15616 + <field name="_delegate">null</field>
15618 <property name="delegate" readonly="true">
15619 <getter>
15620 if (!this._delegate)
15621 @@ -83,9 +84,21 @@
15622 </getter>
15623 </property>
15625 + <field name="_accessors">null</field>
15627 + <property name="accessors" readonly="true">
15628 + <getter>
15629 + <![CDATA[
15630 + if (!this._accessors && this.delegate)
15631 + this._accessors = this.delegate.getXFormsAccessors();
15632 + return this._accessors;
15633 + ]]>
15634 + </getter>
15635 + </property>
15637 <property name="stringValue" readonly="true">
15638 <getter>
15639 - var value = this.delegate.value;
15640 + var value = this.accessors.getValue();
15641 return value != null ? value : "";
15642 </getter>
15643 </property>
15644 @@ -109,6 +122,7 @@
15645 </body>
15646 </method>
15648 + <!-- Dispatch UI Event to the control itself -->
15649 <method name="dispatchDOMUIEvent">
15650 <parameter name="aType"/>
15651 <body>
15652 @@ -119,6 +133,20 @@
15653 </body>
15654 </method>
15656 + <!--
15657 + Dispatch an _XForms notification event_ to a node.
15658 + See http://www.w3.org/TR/xforms/slice4.html#evt-notify
15659 + -->
15660 + <method name="dispatchXFormsNotificationEvent">
15661 + <parameter name="aEventName"/>
15662 + <parameter name="aTarget"/>
15663 + <body>
15664 + var ev = document.createEvent("Events");
15665 + ev.initEvent(aEventName, true, false);
15666 + aTarget.dispatchEvent(ev);
15667 + return true;
15668 + </body>
15669 + </method>
15670 </implementation>
15671 </binding>
15673 @@ -127,15 +155,23 @@
15674 extends="chrome://xforms/content/xforms.xml#xformswidget-base">
15675 <content>
15676 <children includes="label"/>
15677 - <html:span anonid="content"></html:span>
15678 + <!-- XXX initialize span with a space until repeat is xbl-ized. Part
15679 + of workaround for bug 322975
15680 + -->
15681 + <html:span class="xf-value" anonid="content"> </html:span>
15682 <children/>
15683 </content>
15685 <implementation implements="nsIXFormsUIWidget">
15686 <method name="refresh">
15687 <body>
15688 - document.getAnonymousElementByAttribute(this, "anonid", "content").textContent =
15689 + // XXX changing from setting textContent to setting nodeValue of
15690 + // first child (text node created by space character initializer
15691 + // above). Workaround for bug 322975. Probably should be changed
15692 + // back after repeat is xbl-ized
15693 + document.getAnonymousElementByAttribute(this, "anonid", "content").firstChild.nodeValue =
15694 this.stringValue;
15696 return true;
15697 </body>
15698 </method>
15699 @@ -157,7 +193,7 @@
15700 var anoncontent =
15701 document.getAnonymousElementByAttribute(this, "anonid", "anoncontent");
15703 - if (this.delegate.hasBoundNode || this.delegate.value != null) {
15704 + if (this.accessors.hasBoundNode() || this.accessors.getValue() != null) {
15705 anoncontent.setAttribute("style", "display:none;");
15706 } else {
15707 anoncontent.removeAttribute("style");
15708 @@ -170,17 +206,86 @@
15709 </method>
15710 </implementation>
15711 </binding>
15714 + <!-- LABEL: <ACCESKEY SUPPORT> -->
15715 + <binding id="xformswidget-label-accesskey"
15716 + extends="chrome://xforms/content/xforms.xml#xformswidget-base">
15717 + <content>
15718 + <html:span anonid="content"></html:span>
15719 + <html:span anonid="anoncontent" style="display:none;">
15720 + <children/>
15721 + </html:span>
15722 + </content>
15723 + <implementation implements="nsIXFormsUIWidget">
15724 + <method name="refresh">
15725 + <body>
15726 + <![CDATA[
15727 + // we cannot access the <children/> content in XBL1, so we switch to
15728 + // always cloning the content into the content span.
15729 + var content =
15730 + document.getAnonymousElementByAttribute(this, "anonid", "content");
15732 + var hasElementChildren = false;
15733 + var hasBoundValue = false;
15735 + if (this.accessors.hasBoundNode() || this.accessors.getValue() != null) {
15736 + content.textContent = this.stringValue;
15737 + hasBoundValue = true;
15738 + } else {
15739 + // clone the contents child by child
15740 + var node;
15741 + for (var i = 0; i < this.childNodes.length; i++) {
15742 + if (!hasElementChildren && this.childNodes[i].nodeType == Node.ELEMENT_NODE)
15743 + hasElementChildren = true;
15745 + content.appendChild(this.childNodes[i].cloneNode(true));
15749 + // XXX: if label has element node children, we skip accesskey underlining
15750 + if (!hasElementChildren && this.parentNode.hasAttribute("accesskey")) {
15751 + var accesskey = this.parentNode.getAttribute("accesskey");
15753 + // bail if no accesskey or accesskey is longer than 1 character
15754 + if (!accesskey || accesskey.length != 1)
15755 + return true;
15757 + var str = content.textContent;
15758 + var location = str.indexOf(accesskey);
15760 + if (location > -1) {
15761 + // we create a range around the character we want and surround it
15762 + // with an <html:u>
15763 + var range = document.createRange();
15764 + range.setStart(content.firstChild, location)
15765 + range.setEnd(content.firstChild, location+1)
15767 + var u = document.createElementNS("http://www.w3.org/1999/xhtml", "u");
15768 + range.surroundContents(u);
15769 + } else {
15770 + // if we didn't find the accesskey, append it to the end
15771 + content.textContent += "(" + accesskey + ")";
15775 + return true;
15776 + ]]>
15777 + </body>
15778 + </method>
15779 + </implementation>
15780 + </binding>
15782 <!-- INPUT: <DEFAULT> -->
15783 <binding id="xformswidget-input"
15784 extends="chrome://xforms/content/xforms.xml#xformswidget-base">
15785 <content>
15786 <children includes="label"/>
15787 <html:input anonid="control"
15788 - onblur="this.parentNode.delegate.value = this.value; this.parentNode.dispatchDOMUIEvent('DOMFocusOut')"
15789 + class="xf-value"
15790 + onblur="this.parentNode.accessors.setValue(this.value); this.parentNode.dispatchDOMUIEvent('DOMFocusOut')"
15791 onfocus="this.parentNode.dispatchDOMUIEvent('DOMFocusIn')"
15792 onclick="this.parentNode._change();"
15793 - onkeyup="this.parentNode._change();"
15794 + onkeyup="if (event.keyCode != event.DOM_VK_TAB) this.parentNode._change();"
15795 onkeypress="if (event.keyCode == event.DOM_VK_RETURN) this.parentNode.dispatchDOMUIEvent('DOMActivate');"
15796 xbl:inherits="accesskey"/>
15797 <children/>
15798 @@ -202,7 +307,7 @@
15799 <method name="_change">
15800 <body>
15801 if (this.getAttribute("incremental") == "true") {
15802 - this.delegate.value = this.inputField.value;
15803 + this.accessors.setValue(this.inputField.value);
15805 return true;
15806 </body>
15807 @@ -211,7 +316,7 @@
15808 <method name="refresh">
15809 <body>
15810 this.inputField.value = this.stringValue;
15811 - if (this.delegate.isReadonly) {
15812 + if (this.accessors.isReadonly()) {
15813 this.inputField.setAttribute("readonly", "readonly");
15814 } else {
15815 this.inputField.removeAttribute("readonly");
15816 @@ -244,7 +349,7 @@
15819 this.inputField.value = value;
15820 - if (this.delegate.isReadonly) {
15821 + if (this.accessors.isReadonly()) {
15822 this.inputField.setAttribute("readonly", "readonly");
15823 } else {
15824 this.inputField.removeAttribute("readonly");
15825 @@ -261,9 +366,9 @@
15826 <body>
15827 if (this.getAttribute("incremental") != "false") {
15828 if (this.inputField.checked) {
15829 - this.delegate.value = "true";
15830 + this.accessors.setValue("true");
15831 } else {
15832 - this.delegate.value = "false";
15833 + this.accessors.setValue("false");
15836 </body>
15837 @@ -271,6 +376,698 @@
15838 </implementation>
15839 </binding>
15841 + <!-- INPUT: DATE -->
15842 + <binding id="xformswidget-input-date"
15843 + extends="chrome://xforms/content/xforms.xml#xformswidget-input">
15844 + <content>
15845 + <children/>
15846 + <html:input anonid="control"
15847 + onblur="this.parentNode.accessors.setValue(this.value); this.parentNode.dispatchDOMUIEvent('DOMFocusOut');"
15848 + onfocus="this.parentNode.dispatchDOMUIEvent('DOMFocusIn'); this.parentNode._hidePicker(true);"
15849 + onclick="this.parentNode._change(); this.parentNode._hidePicker(true);"
15850 + onkeypress="if (event.keyCode == event.DOM_VK_RETURN) this.parentNode.dispatchDOMUIEvent('DOMActivate');"
15851 + xbl:inherits="accesskey" size="10"/>
15852 + <html:input type="button" anonid="dropmarker" title="&xforms.datepicker.title;"
15853 + onkeypress="if (event.keyCode == event.DOM_VK_ENTER) this.parentNode._togglePicker();"
15854 + onclick="this.parentNode._togglePicker();"/>
15855 + <html:div style="position:absolute; display:none;" anonid="picker">
15856 + <html:table>
15857 + <html:tbody anonid="tbody">
15858 + <html:tr>
15859 + <html:td colspan="1">
15860 + <html:input type="button" anonid="back-button"
15861 + class="-moz-date-back-button" title="Previous Month"
15862 + onclick="this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.goBack(true);"/>
15863 + </html:td>
15864 + <html:td colspan="5" align="center">
15865 + <html:span anonid="date"/>
15866 + </html:td>
15867 + <html:td colspan="1">
15868 + <html:input type="button" anonid="fwd-button"
15869 + class="-moz-date-fwd-button" title="Next Month"
15870 + onclick="this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.goForward(true);"/>
15871 + </html:td>
15872 + </html:tr>
15873 + </html:tbody>
15874 + </html:table>
15875 + </html:div>
15876 + </content>
15878 + <implementation>
15879 + <method name="refresh">
15880 + <body>
15881 + return true;
15882 + </body>
15883 + </method>
15885 + <field name="_picker">null</field>
15886 + <property name="picker" readonly="true">
15887 + <getter>
15888 + if (!this._picker) {
15889 + this._picker =
15890 + document.getAnonymousElementByAttribute(this, "anonid", "picker");
15892 + return this._picker;
15893 + </getter>
15894 + </property>
15896 + <field name="_dateField">null</field>
15898 + <property name="dateField" readonly="true">
15899 + <getter>
15900 + if (!this._dateField) {
15901 + this._dateField =
15902 + document.getAnonymousElementByAttribute(this, "anonid", "date");
15904 + return this._dateField;
15905 + </getter>
15906 + </property>
15908 + <field name="_uibuilt">false</field>
15909 + <field name="_isPickerVisible">false</field>
15910 + <field name="_cells">null</field>
15911 + <field name="_date">null</field>
15913 + <field name="_currentCellIndex">-1</field>
15915 + <method name="_togglePicker">
15916 + <body>
15917 + <![CDATA[
15918 + if (this._isPickerVisible)
15919 + this._hidePicker(true);
15920 + else
15921 + this._showPicker();
15922 + ]]>
15923 + </body>
15924 + </method>
15927 + <method name="_showPicker">
15928 + <body>
15929 + <![CDATA[
15930 + // show the picker
15931 + var picker = this.picker;
15933 + if (this._isPickerVisible) {
15934 + return;
15937 + picker.style.display = "block";
15938 + this._isPickerVisible = true;
15940 + var value = this.inputField.value;
15941 + // js date likes YYYY/MM/DD, schema's is YYYY-MM-DD
15942 + value = value.replace(/-/g, "/");
15944 + // we check if the delgate is valid since javascript Date()
15945 + // returns a valid date for 2005-04-56.
15946 + var tmpDate = new Date(value);
15947 + if (!this.accessors.isValid() || tmpDate == "Invalid Date")
15948 + this._date = new Date();
15949 + else
15950 + this._date = tmpDate;
15952 + if (!this._uibuilt)
15953 + this._buildUI(this._date);
15955 + // position the dropdown, aligning it's right side with the calendar
15956 + // button's right side
15957 + var dropmarker = document.getAnonymousElementByAttribute(this, "anonid", "dropmarker");
15958 + var dropmarkerBox = document.getBoxObjectFor(dropmarker);
15959 + var width = document.getBoxObjectFor(picker).width;
15961 + var position = dropmarkerBox.x - width + dropmarkerBox.width;
15963 + // reset position if it will bleed to the left or right
15964 + if (position < 0) {
15965 + position = 0;
15966 + } else if ((position + width) > window.innerWidth) {
15967 + // we use window.innerWidth because XHTML documents are not always
15968 + // 100% width, and innerWidth will always give use the browser size.
15969 + position = window.innerWidth - width;
15972 + picker.style.left = position + "px";
15974 + this._refreshCells(this._date, this._date.getDate());
15975 + ]]>
15976 + </body>
15977 + </method>
15979 + <method name="_hidePicker">
15980 + <parameter name="aFocusInput"/>
15981 + <body>
15982 + <![CDATA[
15983 + if (!this._isPickerVisible)
15984 + return;
15986 + this._cells[this._currentCellIndex].node.setAttribute("tabindex", "-1");
15987 + this._currentCellIndex = -1;
15988 + this.picker.style.display = "none";
15989 + this._isPickerVisible = false;
15991 + if (aFocusInput)
15992 + this.inputField.focus();
15993 + ]]>
15994 + </body>
15995 + </method>
15997 + <method name="_buildUI">
15998 + <parameter name="aDate"/>
15999 + <body>
16000 + <![CDATA[
16001 + var xhtmlNS = "http://www.w3.org/1999/xhtml";
16003 + // shortname defaults
16004 + var dayShort = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
16006 + // try to get localized short names.
16007 + // May 2005's first day is a Sunday - also, month is 0-indexed in JS
16008 + var day;
16009 + for (var i = 0; i < 7; i++) {
16010 + day = new Date(2005, 4, i+1).toLocaleFormat("%a");
16011 + if (day)
16012 + dayShort[i] = day;
16015 + var month = aDate.getMonth();
16016 + var year = aDate.getFullYear();
16018 + // clear the cells array
16019 + this._cells = new Array();
16021 + var table = document.getAnonymousElementByAttribute(this, "anonid", "tbody");
16022 + var row, cell, header, caption;
16024 + // create the table headers
16025 + row = document.createElementNS(xhtmlNS, "tr");
16027 + for (var i = 0; i < 7; i++) {
16028 + header = document.createElementNS(xhtmlNS, "th");
16029 + // day shorthands
16030 + header.textContent = dayShort[i];
16031 + row.appendChild(header);
16034 + table.appendChild(row);
16036 + // create a table of 7 columns, 6 rows
16037 + for (var i = 0; i < 6; i++) {
16038 + row = document.createElementNS(xhtmlNS, "tr");
16040 + for (var y = 0; y < 7; y++) {
16041 + cell = document.createElementNS(xhtmlNS, "td");
16042 + cell.setAttribute("num", this._cells.length)
16043 + this._cells[this._cells.length] = {row:i, col:y, node: cell};
16045 + row.appendChild(cell);
16048 + table.appendChild(row);
16051 + this._uibuilt = true;
16052 + ]]>
16053 + </body>
16054 + </method>
16056 + <method name="_refreshCells">
16057 + <parameter name="aDate"/>
16058 + <parameter name="aDayToSelect"/>
16059 + <parameter name="aSkipFocus"/>
16060 + <body>
16061 + <![CDATA[
16062 + var month = aDate.getMonth();
16063 + var year = aDate.getFullYear();
16065 + var totaldays = this._getDaysInMonth(month, year);
16067 + // first day of month is?
16068 + var firstDay = new Date(year, month, 1).getDay();
16070 + // get the previous month's date so we can prefill that section. The
16071 + // next month is easy, we go from 1..x as far as we need
16072 + var prevDate = this._getPrevDate(month, year);
16073 + var showsPrevDays = 0;
16075 + // init cells
16076 + for (var i = 0; i < this._cells.length; i++) {
16077 + if (i < firstDay || i >= (firstDay + totaldays)) {
16078 + // either previous or next month
16079 + if (i < firstDay) {
16080 + // previous month
16081 + var prevyear = prevDate.getFullYear();
16082 + var prevmonth = prevDate.getMonth();
16084 + var maxprev = this._getDaysInMonth(prevmonth, prevyear);
16085 + this._cells[i].node.textContent = maxprev - firstDay + i + 1;
16087 + this._cells[i].node.className = "prevMonth"
16088 + showsPrevDays++;
16089 + } else {
16090 + // next month
16091 + this._cells[i].node.textContent = i - (firstDay + totaldays) + 1;
16092 + this._cells[i].node.className = "nextMonth"
16094 + } else {
16095 + // current month
16096 + // this._cells add one since the first day is 1, not 0!
16097 + this._cells[i].node.textContent = i - firstDay + 1;
16098 + this._cells[i].node.className = "currentMonth";
16101 + this._cells[i].node.setAttribute("tabindex", "-1");
16104 + // first time
16105 + if (this._currentCellIndex == -1) {
16106 + // select the current day
16107 + this._currentCellIndex = aDate.getDate() + showsPrevDays - 1;
16108 + } else {
16109 + // if the day is larger that the total days in this month
16110 + if (aDayToSelect > totaldays)
16111 + aDayToSelect = totaldays;
16113 + this._currentCellIndex = aDayToSelect + showsPrevDays - 1;
16116 + this._cells[this._currentCellIndex].node.setAttribute("tabindex", "0");
16118 + if (!aSkipFocus)
16119 + this._cells[this._currentCellIndex].node.focus();
16121 + // update the month year heading
16122 + this.dateField.textContent = this._date.toLocaleFormat("%B %Y");
16123 + ]]>
16124 + </body>
16125 + </method>
16127 + <method name="_getPrevDate">
16128 + <parameter name="aMonth"/>
16129 + <parameter name="aYear"/>
16130 + <body>
16131 + var month, year = aYear;
16133 + if (aMonth == 0) {
16134 + month = 11
16135 + year--;
16136 + } else {
16137 + month = aMonth - 1;
16140 + return new Date(year, month);
16141 + </body>
16142 + </method>
16144 + <method name="_getNextDate">
16145 + <parameter name="aMonth"/>
16146 + <parameter name="aYear"/>
16147 + <body>
16148 + var month, year = aYear;
16150 + if (aMonth == 11) {
16151 + month = 0
16152 + year++;
16153 + } else {
16154 + month = aMonth + 1;
16157 + return new Date(year, month);
16158 + </body>
16159 + </method>
16161 + <method name="_getDaysInMonth">
16162 + <parameter name="aMonth"/>
16163 + <parameter name="aYear"/>
16164 + <body>
16165 + <![CDATA[
16166 + var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
16168 + // check for leap year
16169 + if ((aYear % 4 == 0 && aYear % 100 != 0) || aYear % 400 == 0)
16170 + days[1] = 29;
16172 + return days[aMonth];
16173 + ]]>
16174 + </body>
16175 + </method>
16177 + <method name="goBack">
16178 + <parameter name="aCalledFromButton"/>
16179 + <body>
16180 + <![CDATA[
16181 + var day = parseInt(this._cells[this._currentCellIndex].node.textContent);
16182 + this._date = this._getPrevDate(this._date.getMonth(), this._date.getFullYear());
16183 + this._refreshCells(this._date, day, aCalledFromButton);
16184 + ]]>
16185 + </body>
16186 + </method>
16188 + <method name="goForward">
16189 + <parameter name="aCalledFromButton"/>
16190 + <body>
16191 + <![CDATA[
16192 + var day = parseInt(this._cells[this._currentCellIndex].node.textContent);
16193 + this._date = this._getNextDate(this._date.getMonth(), this._date.getFullYear());
16194 + this._refreshCells(this._date, day, aCalledFromButton);
16195 + ]]>
16196 + </body>
16197 + </method>
16199 + <method name="selectCell">
16200 + <parameter name="aCellNum"/>
16201 + <body>
16202 + <![CDATA[
16203 + if (aCellNum == this._currentCellIndex)
16204 + return;
16206 + this._cells[this._currentCellIndex].node.setAttribute("tabindex", "-1");
16208 + this._currentCellIndex = aCellNum;
16210 + this._cells[this._currentCellIndex].node.setAttribute("tabindex", "0");
16211 + this._cells[this._currentCellIndex].node.focus();
16212 + ]]>
16213 + </body>
16214 + </method>
16216 + <method name="_valueSet">
16217 + <body>
16218 + <![CDATA[
16219 + // called when a cell is choosen (enter or mouse click)
16220 + var value = this._cells[this._currentCellIndex].node.textContent;
16222 + var date = new Date(this._date.getFullYear(), this._date.getMonth(),
16223 + parseInt(value));
16224 + this.inputField.value = date.toLocaleFormat("%Y-%m-%d");
16226 + this._hidePicker(true);
16227 + ]]>
16228 + </body>
16229 + </method>
16231 + </implementation>
16233 + <handlers>
16234 + <handler event="keypress">
16235 + <![CDATA[
16236 + // first we handle events that will always toggle the picker dropdown -
16237 + // F4 and alt-down/up
16238 + if (event.keyCode == event.DOM_VK_F4 ||
16239 + event.altKey && (event.keyCode == event.DOM_VK_DOWN ||
16240 + event.keyCode == event.DOM_VK_UP)) {
16241 + // first set the accessor value, since the input's value hasn't
16242 + // been validated yet, and forcing this will.
16243 + this.accessors.setValue(this.inputField.value);
16245 + this._togglePicker();
16246 + } else if (this._isPickerVisible) {
16247 + // handle events if the picker dropdown is visible - we always
16248 + // hide the picker if focus returns to the input
16249 + var index = this._currentCellIndex;
16250 + var currentElement = event.originalTarget;
16252 + if (event.keyCode == event.DOM_VK_DOWN) {
16253 + if (currentElement.localName == "input") {
16254 + // if we are on the button, down should focus the current selected
16255 + // cell
16256 + this.selectCell(this._currentCellIndex);
16257 + } else if ((index + 7) < this._cells.length) {
16258 + this.selectCell(index + 7);
16260 + } else if (event.keyCode == event.DOM_VK_UP) {
16261 + // td means we are on a cell
16262 + if (currentElement.localName == "td" && (index - 7) >= 0) {
16263 + this.selectCell(index - 7);
16264 + } else {
16265 + // focus the back button
16266 + document.getAnonymousElementByAttribute(this, "anonid", "back-button").focus();
16268 + } else if (event.keyCode == event.DOM_VK_LEFT) {
16269 + // ctrl-left goes back a month
16270 + if (event.ctrlKey) {
16271 + this.goBack();
16272 + } else if (currentElement.localName == "input") {
16273 + // input means we are on one of the back/fwd buttons
16274 + document.getAnonymousElementByAttribute(this, "anonid", "back-button").focus();
16275 + } else if ((index - 1) >= 0) {
16276 + this.selectCell(index - 1);
16278 + } else if (event.keyCode == event.DOM_VK_RIGHT) {
16279 + // ctrl-right goes forward a month
16280 + if (event.ctrlKey) {
16281 + this.goForward();
16282 + } else if (currentElement.localName == "input") {
16283 + // input means we are on one of the back/fwd buttons
16284 + document.getAnonymousElementByAttribute(this, "anonid", "fwd-button").focus();
16285 + } else if ((index + 1) < this._cells.length) {
16286 + this.selectCell(index + 1);
16288 + } else if (event.keyCode == event.DOM_VK_RETURN &&
16289 + event.originalTarget.localName == "td") {
16290 + var type = event.originalTarget.className;
16291 + if (type == "currentMonth") {
16292 + this.selectCell(event.originalTarget.getAttribute("num"));
16293 + this._valueSet();
16294 + } else if (type == "prevMonth") {
16295 + this.goBack();
16296 + } else if (type == "nextMonth") {
16297 + this.goForward();
16299 + } else if (event.keyCode == event.DOM_VK_ESCAPE) {
16300 + this._hidePicker(true);
16302 + } else {
16303 + // pressing down if the picker is hidden will show it
16304 + if (event.keyCode == event.DOM_VK_DOWN)
16305 + // first set the accessor value, since the input's value hasn't
16306 + // been validated yet, and forcing this will.
16307 + this.accessors.setValue(this.inputField.value);
16309 + this._showPicker();
16312 + ]]>
16313 + </handler>
16315 + <handler event="mousedown">
16316 + <![CDATA[
16317 + if (event.originalTarget.localName == "td") {
16318 + var type = event.originalTarget.className;
16319 + var cell = parseInt(event.originalTarget.getAttribute("num"));
16321 + if (type == "currentMonth") {
16322 + this.selectCell(cell);
16323 + this._valueSet();
16324 + } else if (type == "prevMonth") {
16325 + this._currentCellIndex = cell;
16326 + this.goBack();
16327 + } else if (type == "nextMonth") {
16328 + this._currentCellIndex = cell;
16329 + this.goForward();
16332 + ]]>
16333 + </handler>
16335 + <handler event="xforms-next">
16336 + <![CDATA[
16337 + this._hidePicker(false);
16338 + ]]>
16339 + </handler>
16341 + <handler event="xforms-previous">
16342 + <![CDATA[
16343 + this._hidePicker(false);
16344 + ]]>
16345 + </handler>
16346 + </handlers>
16347 + </binding>
16349 + <!-- INPUT: Month -->
16350 + <binding id="xformswidget-input-month"
16351 + extends="chrome://xforms/content/xforms.xml#xformswidget-base">
16352 + <content>
16353 + <children/>
16354 + <html:select anonid="control" xbl:inherits="style, accesskey"
16355 + onchange="this.parentNode._change();"
16356 + onblur="this.parentNode._setValue()">
16357 + <html:option value=""></html:option>
16358 + </html:select>
16359 + </content>
16361 + <implementation implements="nsIXFormsUIWidget">
16363 + <constructor>
16364 + <![CDATA[
16365 + this._build();
16366 + ]]>
16367 + </constructor>
16369 + <method name="refresh">
16370 + <body>
16371 + <![CDATA[
16372 + this.select.readonly = this.accessors.isReadonly();
16374 + if (this.accessors.isValid())
16375 + this.select.value = this.stringValue.substr(2,2)
16376 + else
16377 + this.select.value = "";
16379 + return true;
16380 + ]]>
16381 + </body>
16382 + </method>
16384 + <method name="_build">
16385 + <body>
16386 + <![CDATA[
16387 + // create the select options
16388 + var xhtmlNS = "http://www.w3.org/1999/xhtml";
16390 + var date = new Date();
16391 + var option, monthName;
16392 + for (var i = 0; i < 12; i++) {
16393 + option = document.createElementNS(xhtmlNS, "option");
16395 + var value = i + 1;
16396 + if (value < 10)
16397 + value = "0" + value;
16398 + option.setAttribute("value", value);
16400 + date.setMonth(i);
16401 + monthName = date.toLocaleFormat("%B");
16403 + var txt = document.createTextNode(monthName);
16404 + option.appendChild(txt);
16405 + this.select.appendChild(option);
16408 + this.refresh();
16409 + ]]>
16410 + </body>
16411 + </method>
16413 + <method name="_change">
16414 + <body>
16415 + if (this.getAttribute("incremental") == "true") {
16416 + this._setValue();
16418 + </body>
16419 + </method>
16421 + <method name="_setValue">
16422 + <body>
16423 + if (this.select.value != "")
16424 + this.accessors.setValue("--" + this.select.value);
16425 + else
16426 + this.accessors.setValue("");
16427 + </body>
16428 + </method>
16430 + <field name="_select">null</field>
16431 + <property name="select" readonly="true">
16432 + <getter>
16433 + if (!this._select) {
16434 + this._select =
16435 + document.getAnonymousElementByAttribute(this, "anonid", "control");
16437 + return this._select;
16438 + </getter>
16439 + </property>
16440 + </implementation>
16441 + </binding>
16443 + <!-- INPUT: Day -->
16444 + <binding id="xformswidget-input-day"
16445 + extends="chrome://xforms/content/xforms.xml#xformswidget-base">
16446 + <content>
16447 + <children/>
16448 + <html:select anonid="control" xbl:inherits="style, accesskey"
16449 + onchange="this.parentNode._change();"
16450 + onblur="this.parentNode._setValue()">
16451 + <html:option value=""></html:option>
16452 + </html:select>
16453 + </content>
16455 + <implementation implements="nsIXFormsUIWidget">
16457 + <constructor>
16458 + <![CDATA[
16459 + this._build();
16460 + ]]>
16461 + </constructor>
16463 + <method name="refresh">
16464 + <body>
16465 + <![CDATA[
16466 + this.select.readonly = this.accessors.isReadonly();
16468 + if (this.accessors.isValid())
16469 + this.select.value = this.stringValue.substr(3,2)
16470 + else
16471 + this.select.value = "";
16473 + return true;
16474 + ]]>
16475 + </body>
16476 + </method>
16478 + <method name="_build">
16479 + <body>
16480 + <![CDATA[
16481 + // create the select options
16482 + var xhtmlNS = "http://www.w3.org/1999/xhtml";
16484 + var date = new Date();
16485 + var option, monthName;
16486 + for (var i = 0; i < 31; i++) {
16487 + option = document.createElementNS(xhtmlNS, "option");
16489 + var value = i + 1;
16490 + option.textContent = value;
16492 + if (value < 10)
16493 + value = "0" + value;
16494 + option.setAttribute("value", value);
16496 + this.select.appendChild(option);
16499 + this.refresh();
16500 + ]]>
16501 + </body>
16502 + </method>
16504 + <method name="_change">
16505 + <body>
16506 + if (this.getAttribute("incremental") == "true") {
16507 + this._setValue();
16509 + </body>
16510 + </method>
16512 + <method name="_setValue">
16513 + <body>
16514 + if (this.select.value != "")
16515 + this.accessors.setValue("---" + this.select.value);
16516 + else
16517 + this.accessors.setValue("");
16518 + </body>
16519 + </method>
16521 + <field name="_select">null</field>
16522 + <property name="select" readonly="true">
16523 + <getter>
16524 + if (!this._select) {
16525 + this._select =
16526 + document.getAnonymousElementByAttribute(this, "anonid", "control");
16528 + return this._select;
16529 + </getter>
16530 + </property>
16531 + </implementation>
16532 + </binding>
16534 <!-- SECRET: <DEFAULT> -->
16535 <binding id="xformswidget-secret"
16536 @@ -280,7 +1077,7 @@
16537 <body>
16538 this.inputField.setAttribute("type","password");
16539 this.inputField.value = this.stringValue;
16540 - this.inputField.readonly = this.delegate.isReadonly;
16541 + this.inputField.readonly = this.accessors.isReadonly();
16542 return true;
16543 </body>
16544 </method>
16545 @@ -293,7 +1090,8 @@
16546 <content>
16547 <children includes="label"/>
16548 <html:textarea anonid="control"
16549 - onblur="this.parentNode.delegate.value = this.value; this.parentNode.dispatchDOMUIEvent('DOMFocusOut')"
16550 + class="xf-value"
16551 + onblur="this.parentNode.accessors.setValue(this.value); this.parentNode.dispatchDOMUIEvent('DOMFocusOut')"
16552 onfocus="this.parentNode.dispatchDOMUIEvent('DOMFocusIn')"
16553 onkeyup="this.parentNode._change();"
16554 xbl:inherits="accesskey"/>
16555 @@ -315,7 +1113,11 @@
16557 <method name="refresh">
16558 <body>
16559 - this.controlField.readonly = this.delegate.isReadonly;
16560 + if (this.accessors.isReadonly()) {
16561 + this.controlField.setAttribute("readonly", "readonly");
16562 + } else {
16563 + this.controlField.removeAttribute("readonly");
16565 // If the value has not changed, no need to update the
16566 // value of the control, because that makes the textarea widget
16567 // to scroll up.
16568 @@ -329,7 +1131,7 @@
16569 <method name="_change">
16570 <body>
16571 if (this.getAttribute("incremental") == "true") {
16572 - this.delegate.value = this.controlField.value;
16573 + this.accessors.setValue(this.controlField.value);
16575 return true;
16576 </body>
16577 @@ -455,8 +1257,8 @@
16578 <content>
16579 <children includes="label"/>
16580 <html:input anonid="upload_text_control"
16581 - readonly="true"
16582 - xbl:inherits="accesskey"/>
16583 + class="xf-value"
16584 + readonly="true"/>
16585 <html:button anonid="upload_browse_button"
16586 type="button"
16587 onclick="this.parentNode.uploadElem.pickFile();"
16588 @@ -466,7 +1268,7 @@
16589 type="button"
16590 onclick="this.parentNode.uploadElem.clearFile();"
16591 onkeypress="if (event.keyCode == event.DOM_VK_RETURN) this.parentNode.dispatchDOMUIEvent('DOMActivate');"
16592 - xbl:inherits="accesskey"> &xforms.upload.cleartext; </html:button>
16593 + > &xforms.upload.cleartext; </html:button>
16594 <children/>
16595 </content>
16597 @@ -544,6 +1346,7 @@
16598 <content>
16599 <children includes="label"/>
16600 <html:input readonly="true"
16601 + class="xf-value"
16602 xbl:inherits="accesskey"/>
16603 <html:button type="button"
16604 disabled="true"
16605 diff -uprN --exclude=CVS mozilla/extensions/xforms/resources/locale/en-US/xforms.dtd mozilla.new/extensions/xforms/resources/locale/en-US/xforms.dtd
16606 --- mozilla/extensions/xforms/resources/locale/en-US/xforms.dtd 2005-10-23 18:30:14.000000000 +0200
16607 +++ mozilla.new/extensions/xforms/resources/locale/en-US/xforms.dtd 2006-02-14 10:01:13.000000000 +0100
16608 @@ -46,3 +46,5 @@
16610 <!ENTITY xforms.upload.browsetext "Browse...">
16611 <!ENTITY xforms.upload.cleartext "Clear">
16613 +<!ENTITY xforms.datepicker.title "Show Date Picker">
16614 diff -uprN --exclude=CVS mozilla/extensions/xforms/resources/locale/en-US/xforms.properties mozilla.new/extensions/xforms/resources/locale/en-US/xforms.properties
16615 --- mozilla/extensions/xforms/resources/locale/en-US/xforms.properties 2005-10-23 18:30:14.000000000 +0200
16616 +++ mozilla.new/extensions/xforms/resources/locale/en-US/xforms.properties 2006-02-24 11:16:25.000000000 +0100
16617 @@ -58,8 +58,19 @@ labelLink2Error = XForms Error (19)
16618 invalidSeparator = XForms Error (20): Submission separator may only be either "&" or ";", but found "%S".
16619 instanceBindError = XForms Error (21): Submission failed trying to replace instance document '%S'. Instance document doesn't exist in same model as submission element.
16620 instanceInstanceLoad = XForms Error (22): Instance document trying to load external instance: %S
16621 -encodingMemoryError = XForms Error (23): Not enough available memory to encode file %S, size = %S.
16622 -uploadBoundTypeError = XForms Error (24): Upload element not bound to valid datatype. Must be bound to datatype 'xsd:anyURI', 'xsd:base64Binary', or 'xsd:hexBinary'.
16623 +rangeSetSliderNaN = XForms Error (23): NaN passed to setSlider()
16624 +rangeNullObjects = XForms Error (24): One or more of the passed objects were null
16625 +rangeNullInit = XForms Error (25): One or more init() parameters is NaN
16626 +rangeBeginEndError = XForms Error (26): Begin is higher than end?
16627 +encodingMemoryError = XForms Error (27): Not enough available memory to encode file %S, size = %S.
16628 +uploadBoundTypeError = XForms Error (28): Upload element not bound to valid datatype. Must be bound to datatype 'xsd:anyURI', 'xsd:base64Binary', or 'xsd:hexBinary'.
16629 +copyError = XForms Error (29): A copy element was found whose parent is not an itemset element
16630 +submitMailtoInit = XForms Error (30): No mailto: handler found
16631 +submitMailtoFailed = XForms Error (31): Failed to load a mail client for a mailto: submission
16632 +invalidQName = XForms Error (32): Failed to create node. %S is not a valid QName.
16634 +# Warning Messages:
16635 +warnMailtoBodyParam = XForms Warning (1): The submission action uri already contains a body parameter.
16637 # XForms Permission Messages:
16638 xformsXDPermissionDialogTitle = Allowed Sites - XForms Cross Domain Access
16639 diff -uprN --exclude=CVS mozilla/gfx/public/nsTransform2D.h mozilla.new/gfx/public/nsTransform2D.h
16640 --- mozilla/gfx/public/nsTransform2D.h 2004-05-18 20:09:12.000000000 +0200
16641 +++ mozilla.new/gfx/public/nsTransform2D.h 2006-03-03 07:14:21.000000000 +0100
16642 @@ -250,6 +250,9 @@ public:
16645 void AddScale(float ptX, float ptY);
16647 +private:
16648 + nscoord ToCoordRound(float aCoord);
16651 #endif
16652 diff -uprN --exclude=CVS mozilla/gfx/src/gtk/nsFontMetricsPango.cpp mozilla.new/gfx/src/gtk/nsFontMetricsPango.cpp
16653 --- mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 2005-09-16 08:16:02.000000000 +0200
16654 +++ mozilla.new/gfx/src/gtk/nsFontMetricsPango.cpp 2006-02-24 11:16:41.000000000 +0100
16655 @@ -36,6 +36,7 @@
16657 * ***** END LICENSE BLOCK ***** */
16659 +#include <strings.h>
16660 #include "nsFont.h"
16661 #include "nsIDeviceContext.h"
16662 #include "nsICharsetConverterManager.h"
16663 @@ -981,7 +982,7 @@ nsFontMetricsPango::GetPosition(const PR
16665 // Jump to the end if it's not found.
16666 if (!found) {
16667 - if (inx = 0)
16668 + if (inx == 0)
16669 retval = 0;
16670 else if (trailing)
16671 retval = aLength;
16672 diff -uprN --exclude=CVS mozilla/gfx/src/nsTransform2D.cpp mozilla.new/gfx/src/nsTransform2D.cpp
16673 --- mozilla/gfx/src/nsTransform2D.cpp 2005-03-28 23:03:01.000000000 +0200
16674 +++ mozilla.new/gfx/src/nsTransform2D.cpp 2006-03-03 07:14:21.000000000 +0100
16675 @@ -433,7 +433,12 @@ void nsTransform2D :: TransformCoord(nsc
16677 case MG_2DSCALE | MG_2DTRANSLATION:
16678 *ptX = NSToCoordRound(*ptX * m00 + m20);
16680 +#if defined(_MSC_VER) && _MSC_VER < 1300
16681 + *ptY = ToCoordRound(*ptY * m11 + m21);
16682 +#else
16683 *ptY = NSToCoordRound(*ptY * m11 + m21);
16684 +#endif
16685 break;
16687 default:
16688 @@ -575,3 +580,9 @@ void nsTransform2D :: AddScale(float ptX
16690 type |= MG_2DSCALE;
16693 +nscoord nsTransform2D::ToCoordRound(float aCoord)
16695 + return NSToCoordRound(aCoord);
16698 diff -uprN --exclude=CVS mozilla/gfx/src/windows/nsDrawingSurfaceWin.cpp mozilla.new/gfx/src/windows/nsDrawingSurfaceWin.cpp
16699 --- mozilla/gfx/src/windows/nsDrawingSurfaceWin.cpp 2005-03-07 03:35:47.000000000 +0100
16700 +++ mozilla.new/gfx/src/windows/nsDrawingSurfaceWin.cpp 2006-02-24 11:16:41.000000000 +0100
16701 @@ -565,17 +565,17 @@ BITMAPINFO * nsDrawingSurfaceWin :: Crea
16702 mPixFormat.mGreenZeroMask = 0xff;
16703 mPixFormat.mBlueZeroMask = 0xff;
16704 mPixFormat.mAlphaZeroMask = 0;
16705 - mPixFormat.mRedMask = 0xff;
16706 + mPixFormat.mRedMask = 0xff0000;
16707 mPixFormat.mGreenMask = 0xff00;
16708 - mPixFormat.mBlueMask = 0xff0000;
16709 + mPixFormat.mBlueMask = 0xff;
16710 mPixFormat.mAlphaMask = 0;
16711 mPixFormat.mRedCount = 8;
16712 mPixFormat.mGreenCount = 8;
16713 mPixFormat.mBlueCount = 8;
16714 mPixFormat.mAlphaCount = 0;
16715 - mPixFormat.mRedShift = 0;
16716 + mPixFormat.mRedShift = 16;
16717 mPixFormat.mGreenShift = 8;
16718 - mPixFormat.mBlueShift = 16;
16719 + mPixFormat.mBlueShift = 0;
16720 mPixFormat.mAlphaShift = 0;
16722 break;
16723 diff -uprN --exclude=CVS mozilla/gfx/src/windows/nsFontMetricsWin.cpp mozilla.new/gfx/src/windows/nsFontMetricsWin.cpp
16724 --- mozilla/gfx/src/windows/nsFontMetricsWin.cpp 2005-08-30 02:28:18.000000000 +0200
16725 +++ mozilla.new/gfx/src/windows/nsFontMetricsWin.cpp 2006-02-24 11:16:41.000000000 +0100
16726 @@ -1305,7 +1305,7 @@ static PRUint8 gBitToUnicodeRange[] =
16727 /* 66 */ kRangeArabic, // fe50 - fe6f Small Form Variants
16728 /* 67 */ kRangeArabic, // fe70 - fefe Arabic Presen. FormsB
16729 /* 68 */ kRangeSetCJK, // ff00 - ffef Half/Fullwidth Forms
16730 - /* 69 */ kRangeSetCJK, // fff0 - fffd Specials
16731 + /* 69 */ kRangeSpecials, // fff0 - fffd Specials
16732 /* 70 */ kRangeTibetan, // 0f00 - 0fcf Tibetan
16733 /* 71 */ kRangeSyriac, // 0700 - 074f Syriac
16734 /* 72 */ kRangeThaana, // 0780 - 07bf Thaana
16735 @@ -2716,6 +2716,9 @@ nsFontMetricsWin::SameAsPreviousMap(int
16736 if (tmp->flags & NS_GLOBALFONT_SKIP) {
16737 continue;
16739 + if (!tmp->ccmap) {
16740 + continue;
16742 if (tmp->ccmap == font->ccmap) {
16743 font->flags |= NS_GLOBALFONT_SKIP;
16744 return 1;
16745 @@ -2730,6 +2733,24 @@ nsFontMetricsWin::SameAsPreviousMap(int
16746 return 0;
16749 +#ifndef WINCE
16750 +static
16751 +void BitFromUnicodeRange(PRUint32 range, DWORD* usb)
16753 + for (int i = 0, dword = 0; dword < 3; ++dword) {
16754 + for (int bit = 0; bit < sizeof(DWORD) * 8; ++bit, ++i) {
16755 + if (range == gBitToUnicodeRange[i]) {
16756 + usb[dword] |= 1 << bit;
16761 +#endif
16763 +#ifdef DEBUG_emk
16764 +static LARGE_INTEGER freq, prev;
16765 +#endif
16767 nsFontWin*
16768 nsFontMetricsWin::FindGlobalFont(HDC aDC, PRUint32 c)
16770 @@ -2739,6 +2760,12 @@ nsFontMetricsWin::FindGlobalFont(HDC aDC
16771 return nsnull;
16774 +#ifndef WINCE
16775 + PRUint32 range = (c <= 0xFFFF) ? FindCharUnicodeRange(c) : kRangeSurrogate;
16776 + DWORD usb[4];
16777 + memset(usb, 0, sizeof(usb));
16778 + BitFromUnicodeRange(range, usb);
16779 +#endif
16780 int count = gGlobalFonts->Count();
16781 for (int i = 0; i < count; ++i) {
16782 nsGlobalFont* font = (nsGlobalFont*)gGlobalFonts->ElementAt(i);
16783 @@ -2746,6 +2773,15 @@ nsFontMetricsWin::FindGlobalFont(HDC aDC
16784 continue;
16786 if (!font->ccmap) {
16787 +#ifndef WINCE
16788 + // bail out if Unicode range indicates the font have no glyph
16789 + if (font->flags & NS_GLOBALFONT_TRUETYPE &&
16790 + !(font->signature.fsUsb[0] & usb[0]) &&
16791 + !(font->signature.fsUsb[1] & usb[1]) &&
16792 + !(font->signature.fsUsb[2] & usb[2])) {
16793 + continue;
16795 +#endif
16796 // don't adjust here, we just want to quickly get the CMAP. Adjusting
16797 // is meant to only happen when loading the final font in LoadFont()
16798 HFONT hfont = ::CreateFontIndirect(&font->logFont);
16799 @@ -2761,14 +2797,28 @@ nsFontMetricsWin::FindGlobalFont(HDC aDC
16800 font->flags |= NS_GLOBALFONT_SKIP;
16801 continue;
16803 +#ifdef DEBUG_emk
16804 + LARGE_INTEGER now;
16805 + QueryPerformanceCounter(&now);
16806 + printf("CCMAP loaded: %g sec, %s [%08X][%08X][%08X]\n", (now.QuadPart - prev.QuadPart) / (double)freq.QuadPart,
16807 + font->logFont.lfFaceName, font->signature.fsUsb[0], font->signature.fsUsb[1], font->signature.fsUsb[2]);
16808 + prev = now;
16809 +#endif
16810 if (SameAsPreviousMap(i)) {
16811 continue;
16814 if (CCMAP_HAS_CHAR_EXT(font->ccmap, c)) {
16815 +#ifdef DEBUG_emk
16816 + printf("font found:[%s]\n", font->logFont.lfFaceName);
16817 + printf("U+%04X (%d)[%08X][%08X][%08X]\n", c, range, usb[0], usb[1], usb[2]);
16818 +#endif
16819 return LoadGlobalFont(aDC, font);
16822 +#ifdef DEBUG_emk
16823 + printf("U+%04X (%d)[%08X][%08X][%08X]\n", c, range, usb[0], usb[1], usb[2]);
16824 +#endif
16825 return nsnull;
16828 @@ -3541,6 +3591,11 @@ nsFontMetricsWin::FindPrefFont(HDC aDC,
16829 nsFontWin*
16830 nsFontMetricsWin::FindFont(HDC aDC, PRUint32 aChar)
16832 +#ifdef DEBUG_emk
16833 + LARGE_INTEGER start, end;
16834 + QueryPerformanceFrequency(&freq);
16835 + QueryPerformanceCounter(&start);
16836 +#endif
16837 // the first font should be for invisible ignorable characters
16838 if (mLoadedFonts.Count() < 1)
16839 mLoadedFonts.AppendElement(gFontForIgnorable);
16840 @@ -3555,8 +3610,15 @@ nsFontMetricsWin::FindFont(HDC aDC, PRUi
16841 if (!font) {
16842 font = FindPrefFont(aDC, aChar);
16843 if (!font) {
16844 +#ifdef DEBUG_emk
16845 + QueryPerformanceCounter(&prev);
16846 +#endif
16847 font = FindGlobalFont(aDC, aChar);
16848 if (!font) {
16849 +#ifdef DEBUG_emk
16850 + QueryPerformanceCounter(&end);
16851 + printf("%g sec.\n", (end.QuadPart - start.QuadPart) / (double)freq.QuadPart);
16852 +#endif
16853 font = FindSubstituteFont(aDC, aChar);
16856 @@ -4622,27 +4684,40 @@ GenerateSingleByte(nsCharsetInfo* aSelf)
16857 int i;
16859 memset(map, 0, sizeof(map));
16860 - memset(mb + 128, 0, 160 - 128);
16861 - for (i = 0; i < 127; ++i) {
16862 - mb[i] = i;
16864 - mb[145] = 145;
16865 - mb[146] = 146;
16867 - if (aSelf->mCodePage == 1250) {
16868 - mb[138] = 138;
16869 - mb[140] = 140;
16870 - mb[141] = 141;
16871 - mb[142] = 142;
16872 - mb[143] = 143;
16873 - mb[154] = 154;
16874 - mb[156] = 156;
16875 - mb[158] = 158;
16876 - mb[159] = 159;
16878 + if (UseAFunctions()) {
16879 + // A-functions use this function for TrueType
16880 + for (i = 0; i <= 255; ++i) {
16881 + mb[i] = i;
16883 + } else {
16884 + memset(mb + 128, 0, 160 - 128);
16885 + for (i = 0; i <= 127; ++i) {
16886 + mb[i] = i;
16888 + mb[145] = 145;
16889 + mb[146] = 146;
16891 + if (aSelf->mCodePage == 1250) {
16892 + mb[138] = 138;
16893 + mb[140] = 140;
16894 + mb[141] = 141;
16895 + mb[142] = 142;
16896 + mb[143] = 143;
16897 + mb[154] = 154;
16898 + mb[156] = 156;
16899 + mb[158] = 158;
16900 + mb[159] = 159;
16903 + for (i = 160; i <= 255; ++i) {
16904 + mb[i] = i;
16907 - for (i = 160; i < 255; ++i) {
16908 - mb[i] = i;
16909 + //win95/98 have problem in some raster fonts (MS Sans Serif and MS Serif) in
16910 + //rendering 0xb7. So let's skip this in charmap, that will let system resort
16911 + //to other fonts.
16912 + if (IsWin95OrWin98())
16913 + mb[0xb7] = 0;
16916 int len = MultiByteToWideChar(aSelf->mCodePage, 0, (char*) mb, 256, wc, 256);
16917 @@ -4651,12 +4726,7 @@ GenerateSingleByte(nsCharsetInfo* aSelf)
16918 printf("%s: MultiByteToWideChar returned %d\n", aSelf->mName, len);
16920 #endif
16921 - for (i = 0; i < 256; ++i) {
16922 - //win95/98 have problem in some raster fonts (MS Sans Serif and MS Serif) in
16923 - //rendering 0xb7. So let's skip this in charmap, that will let system resort
16924 - //to other fonts.
16925 - if ( i == 0x00b7 && IsWin95OrWin98() && !UseAFunctions())
16926 - continue;
16927 + for (i = 0; i <= 255; ++i) {
16928 ADD_GLYPH(map, wc[i]);
16930 return MapToCCMap(map);
16931 @@ -5594,7 +5664,23 @@ SignatureMatchesLangGroup(FONTSIGNATURE*
16932 static int
16933 FontMatchesGenericType(nsGlobalFont* aFont, const char* aGeneric)
16935 - switch (aFont->logFont.lfPitchAndFamily & 0xF0) {
16936 + PRUint8 family = aFont->logFont.lfPitchAndFamily & 0xF0;
16937 + PRUint8 pitch = aFont->logFont.lfPitchAndFamily & 0x0F;
16939 + // Japanese 'Mincho' fonts do not belong to FF_MODERN even if
16940 + // they are fixed pitch because they have variable stroke width.
16941 + if (family == FF_ROMAN && pitch & FIXED_PITCH) {
16942 + return !strcmp(aGeneric, "monospace");
16945 + // Japanese 'Gothic' fonts do not belong to FF_SWISS even if
16946 + // they are variable pitch because they have constant stroke width.
16947 + if (family == FF_MODERN && pitch & VARIABLE_PITCH) {
16948 + return !strcmp(aGeneric, "sans-serif");
16951 + // All other fonts will be grouped correctly using family...
16952 + switch (family) {
16953 case FF_DONTCARE: return 1;
16954 case FF_ROMAN: return !strcmp(aGeneric, "serif");
16955 case FF_SWISS: return !strcmp(aGeneric, "sans-serif");
16956 diff -uprN --exclude=CVS mozilla/gfx/src/windows/nsUnicodeRange.cpp mozilla.new/gfx/src/windows/nsUnicodeRange.cpp
16957 --- mozilla/gfx/src/windows/nsUnicodeRange.cpp 2005-04-30 04:57:56.000000000 +0200
16958 +++ mozilla.new/gfx/src/windows/nsUnicodeRange.cpp 2006-02-24 11:16:41.000000000 +0100
16959 @@ -206,7 +206,7 @@ const char *gUnicodeRangeToLangGroupTabl
16963 -#define NUM_OF_SUBTABLES 7
16964 +#define NUM_OF_SUBTABLES 8
16965 #define SUBTABLE_SIZE 16
16967 static PRUint8 gUnicodeSubrangeTable[NUM_OF_SUBTABLES][SUBTABLE_SIZE] =
16968 @@ -339,8 +339,26 @@ static PRUint8 gUnicodeSubrangeTable[NUM
16969 // CJK compatibility forms,
16970 // small form variants
16972 - kRangeSetCJK, //uffxx, halfwidth and fullwidth forms, includes Special
16974 + kRangeTableBase+7, //uffxx, halfwidth and fullwidth forms, includes Special
16975 + },
16976 + { //table for 0xff00 - 0xffff
16977 + kRangeSetCJK, //uff0x, fullwidth latin
16978 + kRangeSetCJK, //uff1x, fullwidth latin
16979 + kRangeSetCJK, //uff2x, fullwidth latin
16980 + kRangeSetCJK, //uff3x, fullwidth latin
16981 + kRangeSetCJK, //uff4x, fullwidth latin
16982 + kRangeSetCJK, //uff5x, fullwidth latin
16983 + kRangeSetCJK, //uff6x, halfwidth katakana
16984 + kRangeSetCJK, //uff7x, halfwidth katakana
16985 + kRangeSetCJK, //uff8x, halfwidth katakana
16986 + kRangeSetCJK, //uff9x, halfwidth katakana
16987 + kRangeSetCJK, //uffax, halfwidth hangul jamo
16988 + kRangeSetCJK, //uffbx, halfwidth hangul jamo
16989 + kRangeSetCJK, //uffcx, halfwidth hangul jamo
16990 + kRangeSetCJK, //uffdx, halfwidth hangul jamo
16991 + kRangeSetCJK, //uffex, fullwidth symbols
16992 + kRangeSpecials, //ufffx, Specials
16993 + },
16996 // Most scripts between U+0700 and U+16FF are assigned a chunk of 128 (0x80)
16997 @@ -407,9 +425,11 @@ PRUint32 FindCharUnicodeRange(PRUnichar
16999 // otherwise, we have one more table to look at
17000 range = gUnicodeSubrangeTable[range - kRangeTableBase][(ch & 0x0f00) >> 8];
17001 + if (range < kRangeTableBase)
17002 + return range;
17003 if (range < kRangeTertiaryTable)
17004 - return range;
17005 + return gUnicodeSubrangeTable[range - kRangeTableBase][(ch & 0x00f0) >> 4];
17007 // Yet another table to look at : U+0700 - U+16FF : 128 code point blocks
17008 - return gUnicodeTertiaryRangeTable[(ch - 0x0700) >> 7];
17009 + return gUnicodeTertiaryRangeTable[(ch - 0x0700) >> 7];
17011 diff -uprN --exclude=CVS mozilla/gfx/src/windows/nsUnicodeRange.h mozilla.new/gfx/src/windows/nsUnicodeRange.h
17012 --- mozilla/gfx/src/windows/nsUnicodeRange.h 2005-04-30 04:57:56.000000000 +0200
17013 +++ mozilla.new/gfx/src/windows/nsUnicodeRange.h 2006-02-24 11:16:41.000000000 +0100
17014 @@ -102,6 +102,7 @@ const PRUint8 kRangeDingbats
17015 const PRUint8 kRangeBraillePattern = 54;
17016 const PRUint8 kRangeYi = 55;
17017 const PRUint8 kRangeCombiningDiacriticalMarks = 56;
17018 +const PRUint8 kRangeSpecials = 57;
17020 const PRUint8 kRangeTableBase = 128; //values over 127 are reserved for internal use only
17021 const PRUint8 kRangeTertiaryTable = 145; // leave room for 16 subtable
17022 diff -uprN --exclude=CVS mozilla/js/src/jsapi.c mozilla.new/js/src/jsapi.c
17023 --- mozilla/js/src/jsapi.c 2005-11-01 03:18:51.000000000 +0100
17024 +++ mozilla.new/js/src/jsapi.c 2006-02-24 11:16:27.000000000 +0100
17025 @@ -1877,6 +1877,19 @@ JS_IsAboutToBeFinalized(JSContext *cx, v
17026 return js_IsAboutToBeFinalized(cx, thing);
17029 +JS_PUBLIC_API(void)
17030 +JS_SetGCParameter(JSRuntime *rt, JSGCParamKey key, uint32 value)
17032 + switch (key) {
17033 + case JSGC_MAX_BYTES:
17034 + rt->gcMaxBytes = value;
17035 + break;
17036 + case JSGC_MAX_MALLOC_BYTES:
17037 + rt->gcMaxMallocBytes = value;
17038 + break;
17042 JS_PUBLIC_API(intN)
17043 JS_AddExternalStringFinalizer(JSStringFinalizeOp finalizer)
17045 @@ -2001,6 +2014,7 @@ JS_InitClass(JSContext *cx, JSObject *ob
17047 JSAtom *atom;
17048 JSObject *proto, *ctor;
17049 + JSTempValueRooter tvr;
17050 jsval cval, rval;
17051 JSBool named;
17052 JSFunction *fun;
17053 @@ -2015,8 +2029,8 @@ JS_InitClass(JSContext *cx, JSObject *ob
17054 if (!proto)
17055 return NULL;
17057 - if (!js_EnterLocalRootScope(cx))
17058 - goto bad2;
17059 + /* After this point, control must exit via label bad or out. */
17060 + JS_PUSH_SINGLE_TEMP_ROOT(cx, OBJECT_TO_JSVAL(proto), &tvr);
17062 if (!constructor) {
17063 /* Lacking a constructor, name the prototype (e.g., Math). */
17064 @@ -2078,17 +2092,16 @@ JS_InitClass(JSContext *cx, JSObject *ob
17065 (static_fs && !JS_DefineFunctions(cx, ctor, static_fs))) {
17066 goto bad;
17068 - js_LeaveLocalRootScope(cx);
17070 +out:
17071 + JS_POP_TEMP_ROOT(cx, &tvr);
17072 return proto;
17074 bad:
17075 - js_LeaveLocalRootScope(cx);
17076 if (named)
17077 (void) OBJ_DELETE_PROPERTY(cx, obj, ATOM_TO_JSID(atom), &rval);
17079 -bad2:
17080 - cx->newborn[GCX_OBJECT] = NULL;
17081 - return NULL;
17082 + proto = NULL;
17083 + goto out;
17086 #ifdef JS_THREADSAFE
17087 @@ -4145,7 +4158,7 @@ JS_CallFunctionName(JSContext *cx, JSObj
17088 return JS_FALSE;
17089 ok = js_InternalCall(cx, obj, fval, argc, argv, rval);
17090 LAST_FRAME_CHECKS(cx, ok);
17091 - return JS_TRUE;
17092 + return ok;
17095 JS_PUBLIC_API(JSBool)
17096 diff -uprN --exclude=CVS mozilla/js/src/jsapi.h mozilla.new/js/src/jsapi.h
17097 --- mozilla/js/src/jsapi.h 2005-10-22 01:30:15.000000000 +0200
17098 +++ mozilla.new/js/src/jsapi.h 2006-02-24 11:16:27.000000000 +0100
17099 @@ -739,6 +739,14 @@ JS_SetGCCallbackRT(JSRuntime *rt, JSGCCa
17100 extern JS_PUBLIC_API(JSBool)
17101 JS_IsAboutToBeFinalized(JSContext *cx, void *thing);
17103 +typedef enum JSGCParamKey {
17104 + JSGC_MAX_BYTES = 0, /* maximum nominal heap before last ditch GC */
17105 + JSGC_MAX_MALLOC_BYTES = 1 /* # of JS_malloc bytes before last ditch GC */
17106 +} JSGCParamKey;
17108 +extern JS_PUBLIC_API(void)
17109 +JS_SetGCParameter(JSRuntime *rt, JSGCParamKey key, uint32 value);
17112 * Add a finalizer for external strings created by JS_NewExternalString (see
17113 * below) using a type-code returned from this function, and that understands
17114 diff -uprN --exclude=CVS mozilla/js/src/jscntxt.h mozilla.new/js/src/jscntxt.h
17115 --- mozilla/js/src/jscntxt.h 2006-01-11 23:04:47.000000000 +0100
17116 +++ mozilla.new/js/src/jscntxt.h 2006-02-24 11:16:27.000000000 +0100
17117 @@ -84,6 +84,7 @@ struct JSRuntime {
17118 uint32 gcBytes;
17119 uint32 gcLastBytes;
17120 uint32 gcMaxBytes;
17121 + uint32 gcMaxMallocBytes;
17122 uint32 gcLevel;
17123 uint32 gcNumber;
17124 JSPackedBool gcPoke;
17125 @@ -362,6 +363,62 @@ typedef struct JSLocalRootStack {
17127 #define JSLRS_NULL_MARK ((uint32) -1)
17129 +typedef struct JSTempValueRooter JSTempValueRooter;
17132 + * If count is -1, then u.value contains the single value to root. Otherwise
17133 + * u.array points to a stack-allocated vector of jsvals. Note that the vector
17134 + * may have length 0 or 1 for full generality, so we need -1 to discriminate
17135 + * the union.
17137 + * If you need to protect a result value that flows out of a C function across
17138 + * several layers of other functions, use the js_LeaveLocalRootScopeWithResult
17139 + * internal API (see further below) instead.
17140 + */
17141 +struct JSTempValueRooter {
17142 + JSTempValueRooter *down;
17143 + jsint count;
17144 + union {
17145 + jsval value;
17146 + jsval *array;
17147 + } u;
17150 +#define JS_PUSH_TEMP_ROOT_COMMON(cx,tvr) \
17151 + JS_BEGIN_MACRO \
17152 + JS_ASSERT((cx)->tempValueRooters != (tvr)); \
17153 + (tvr)->down = (cx)->tempValueRooters; \
17154 + (cx)->tempValueRooters = (tvr); \
17155 + JS_END_MACRO
17157 +#define JS_PUSH_SINGLE_TEMP_ROOT(cx,val,tvr) \
17158 + JS_BEGIN_MACRO \
17159 + JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \
17160 + (tvr)->count = -1; \
17161 + (tvr)->u.value = (val); \
17162 + JS_END_MACRO
17164 +#define JS_PUSH_TEMP_ROOT(cx,cnt,arr,tvr) \
17165 + JS_BEGIN_MACRO \
17166 + JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \
17167 + (tvr)->count = (cnt); \
17168 + (tvr)->u.array = (arr); \
17169 + JS_END_MACRO
17171 +#define JS_POP_TEMP_ROOT(cx,tvr) \
17172 + JS_BEGIN_MACRO \
17173 + JS_ASSERT((cx)->tempValueRooters == (tvr)); \
17174 + (cx)->tempValueRooters = (tvr)->down; \
17175 + JS_END_MACRO
17177 +#define JS_TEMP_ROOT_EVAL(cx,cnt,val,expr) \
17178 + JS_BEGIN_MACRO \
17179 + JSTempValueRooter tvr; \
17180 + JS_PUSH_TEMP_ROOT(cx, cnt, val, &tvr); \
17181 + (expr); \
17182 + JS_POP_TEMP_ROOT(cx, &tvr); \
17183 + JS_END_MACRO
17185 struct JSContext {
17186 JSCList links;
17188 @@ -482,8 +539,11 @@ struct JSContext {
17189 /* PDL of stack headers describing stack slots not rooted by argv, etc. */
17190 JSStackHeader *stackHeaders;
17192 - /* Optional stack of scoped local GC roots. */
17193 + /* Optional stack of heap-allocated scoped local GC roots. */
17194 JSLocalRootStack *localRootStack;
17196 + /* Stack of thread-stack-allocated temporary GC roots. */
17197 + JSTempValueRooter *tempValueRooters;
17201 diff -uprN --exclude=CVS mozilla/js/src/jsdhash.h mozilla.new/js/src/jsdhash.h
17202 --- mozilla/js/src/jsdhash.h 2005-08-19 21:36:57.000000000 +0200
17203 +++ mozilla.new/js/src/jsdhash.h 2006-02-24 11:16:27.000000000 +0100
17204 @@ -45,7 +45,7 @@
17206 JS_BEGIN_EXTERN_C
17208 -#if defined(__GNUC__) && defined(__i386__) && (__GNUC__ >= 3) && !defined(XP_OS2) && !defined(XP_MACOSX)
17209 +#if defined(__GNUC__) && defined(__i386__) && (__GNUC__ >= 3) && !defined(XP_OS2)
17210 #define JS_DHASH_FASTCALL __attribute__ ((regparm (3),stdcall))
17211 #else
17212 #define JS_DHASH_FASTCALL
17213 diff -uprN --exclude=CVS mozilla/js/src/jsemit.c mozilla.new/js/src/jsemit.c
17214 --- mozilla/js/src/jsemit.c 2006-01-11 23:04:47.000000000 +0100
17215 +++ mozilla.new/js/src/jsemit.c 2006-03-03 07:13:06.000000000 +0100
17216 @@ -546,7 +546,7 @@ BuildSpanDepTable(JSContext *cx, JSCodeG
17217 const JSCodeSpec *cs;
17218 ptrdiff_t len, off;
17220 - pc = CG_BASE(cg);
17221 + pc = CG_BASE(cg) + cg->spanDepTodo;
17222 end = CG_NEXT(cg);
17223 while (pc < end) {
17224 op = (JSOp)*pc;
17225 @@ -611,6 +611,7 @@ BuildSpanDepTable(JSContext *cx, JSCodeG
17226 #endif /* JS_HAS_SWITCH_STATEMENT */
17229 + JS_ASSERT(len > 0);
17230 pc += len;
17233 @@ -1037,6 +1038,7 @@ OptimizeSpanDeps(JSContext *cx, JSCodeGe
17237 + cg->main.lastNoteOffset += growth;
17240 * Fix try/catch notes (O(numTryNotes * log2(numSpanDeps)), but it's
17241 @@ -1130,6 +1132,7 @@ OptimizeSpanDeps(JSContext *cx, JSCodeGe
17242 FreeJumpTargets(cg, cg->jumpTargets);
17243 cg->jumpTargets = NULL;
17244 cg->numSpanDeps = cg->numJumpTargets = 0;
17245 + cg->spanDepTodo = CG_OFFSET(cg);
17246 return JS_TRUE;
17249 @@ -3264,6 +3267,12 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
17251 /* FALL THROUGH */
17253 +#if JS_HAS_XML_SUPPORT
17254 + case TOK_UNARYOP:
17255 +#endif
17256 +#if JS_HAS_LVALUE_RETURN
17257 + case TOK_LP:
17258 +#endif
17259 case TOK_LB:
17261 * We separate the first/next bytecode from the enumerator
17262 @@ -3289,6 +3298,27 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
17263 if (beq < 0)
17264 return JS_FALSE;
17266 +#if JS_HAS_LVALUE_RETURN
17267 + if (pn3->pn_type == TOK_LP) {
17268 + JS_ASSERT(pn3->pn_op == JSOP_SETCALL);
17269 + if (!js_EmitTree(cx, cg, pn3))
17270 + return JS_FALSE;
17271 + if (!js_Emit1(cx, cg, JSOP_ENUMELEM))
17272 + return JS_FALSE;
17273 + break;
17275 +#endif
17276 +#if JS_HAS_XML_SUPPORT
17277 + if (pn3->pn_type == TOK_UNARYOP) {
17278 + JS_ASSERT(pn3->pn_op == JSOP_BINDXMLNAME);
17279 + if (!js_EmitTree(cx, cg, pn3))
17280 + return JS_FALSE;
17281 + if (!js_Emit1(cx, cg, JSOP_ENUMELEM))
17282 + return JS_FALSE;
17283 + break;
17285 +#endif
17287 /* Now that we're safely past the IFEQ, commit side effects. */
17288 if (!EmitElemOp(cx, pn3, JSOP_ENUMELEM, cg))
17289 return JS_FALSE;
17290 diff -uprN --exclude=CVS mozilla/js/src/jsemit.h mozilla.new/js/src/jsemit.h
17291 --- mozilla/js/src/jsemit.h 2005-10-22 01:30:15.000000000 +0200
17292 +++ mozilla.new/js/src/jsemit.h 2006-03-03 07:13:06.000000000 +0100
17293 @@ -186,11 +186,13 @@ struct JSJumpTarget {
17295 struct JSCodeGenerator {
17296 JSTreeContext treeContext; /* base state: statement info stack, etc. */
17298 JSArenaPool *codePool; /* pointer to thread code arena pool */
17299 JSArenaPool *notePool; /* pointer to thread srcnote arena pool */
17300 void *codeMark; /* low watermark in cg->codePool */
17301 void *noteMark; /* low watermark in cg->notePool */
17302 void *tempMark; /* low watermark in cx->tempPool */
17304 struct {
17305 jsbytecode *base; /* base of JS bytecode vector */
17306 jsbytecode *limit; /* one byte beyond end of bytecode */
17307 @@ -201,20 +203,27 @@ struct JSCodeGenerator {
17308 ptrdiff_t lastNoteOffset; /* code offset for last source note */
17309 uintN currentLine; /* line number for tree-based srcnote gen */
17310 } prolog, main, *current;
17312 const char *filename; /* null or weak link to source filename */
17313 uintN firstLine; /* first line, for js_NewScriptFromCG */
17314 JSPrincipals *principals; /* principals for constant folding eval */
17315 JSAtomList atomList; /* literals indexed for mapping */
17317 intN stackDepth; /* current stack depth in script frame */
17318 uintN maxStackDepth; /* maximum stack depth so far */
17320 JSTryNote *tryBase; /* first exception handling note */
17321 JSTryNote *tryNext; /* next available note */
17322 size_t tryNoteSpace; /* # of bytes allocated at tryBase */
17324 JSSpanDep *spanDeps; /* span dependent instruction records */
17325 JSJumpTarget *jumpTargets; /* AVL tree of jump target offsets */
17326 JSJumpTarget *jtFreeList; /* JT_LEFT-linked list of free structs */
17327 uintN numSpanDeps; /* number of span dependencies */
17328 uintN numJumpTargets; /* number of jump targets */
17329 + ptrdiff_t spanDepTodo; /* offset from main.base of potentially
17330 + unoptimized spandeps */
17332 uintN emitLevel; /* js_EmitTree recursion level */
17333 JSAtomList constList; /* compile time constants */
17334 JSCodeGenerator *parent; /* Enclosing function or global context */
17335 diff -uprN --exclude=CVS mozilla/js/src/jsfun.c mozilla.new/js/src/jsfun.c
17336 --- mozilla/js/src/jsfun.c 2006-01-11 23:04:47.000000000 +0100
17337 +++ mozilla.new/js/src/jsfun.c 2006-02-24 11:16:27.000000000 +0100
17338 @@ -722,7 +722,7 @@ static JSBool
17339 call_enumerate(JSContext *cx, JSObject *obj)
17341 JSStackFrame *fp;
17342 - JSObject *funobj;
17343 + JSObject *funobj, *pobj;
17344 JSScope *scope;
17345 JSScopeProperty *sprop, *cprop;
17346 JSPropertyOp getter;
17347 @@ -771,9 +771,20 @@ call_enumerate(JSContext *cx, JSObject *
17348 JS_ASSERT(atom->flags & ATOM_HIDDEN);
17349 atom = atom->entry.value;
17351 - if (!js_LookupProperty(cx, obj, ATOM_TO_JSID(atom), &obj, &prop))
17352 + if (!js_LookupProperty(cx, obj, ATOM_TO_JSID(atom), &pobj, &prop))
17353 return JS_FALSE;
17354 - JS_ASSERT(obj && prop);
17356 + /*
17357 + * If we found the property in a different object, don't try sticking
17358 + * it into wrong slots vector. This can occur because we have a mutable
17359 + * __proto__ slot, and cloned function objects rely on their __proto__
17360 + * to delegate to the object that contains the var and arg properties.
17361 + */
17362 + if (!prop || pobj != obj) {
17363 + if (prop)
17364 + OBJ_DROP_PROPERTY(cx, pobj, prop);
17365 + continue;
17367 cprop = (JSScopeProperty *)prop;
17368 LOCKED_OBJ_SET_SLOT(obj, cprop->slot, vec[(uint16) sprop->shortid]);
17369 OBJ_DROP_PROPERTY(cx, obj, prop);
17370 @@ -1032,8 +1043,8 @@ fun_enumerate(JSContext *cx, JSObject *o
17371 prototypeId = ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom);
17372 if (!OBJ_LOOKUP_PROPERTY(cx, obj, prototypeId, &pobj, &prop))
17373 return JS_FALSE;
17374 - JS_ASSERT(prop);
17375 - OBJ_DROP_PROPERTY(cx, pobj, prop);
17376 + if (prop)
17377 + OBJ_DROP_PROPERTY(cx, pobj, prop);
17378 return JS_TRUE;
17381 @@ -1502,6 +1513,7 @@ static JSBool
17382 fun_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
17384 jsval fval, *sp, *oldsp;
17385 + JSString *str;
17386 JSObject *tmp;
17387 void *mark;
17388 uintN i;
17389 @@ -1513,10 +1525,13 @@ fun_call(JSContext *cx, JSObject *obj, u
17390 fval = argv[-1];
17392 if (!JSVAL_IS_FUNCTION(cx, fval)) {
17393 - JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
17394 - JSMSG_INCOMPATIBLE_PROTO,
17395 - js_Function_str, call_str,
17396 - JS_GetStringBytes(JS_ValueToString(cx, fval)));
17397 + str = JS_ValueToString(cx, fval);
17398 + if (str) {
17399 + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
17400 + JSMSG_INCOMPATIBLE_PROTO,
17401 + js_Function_str, call_str,
17402 + JS_GetStringBytes(str));
17404 return JS_FALSE;
17407 @@ -1562,6 +1577,7 @@ static JSBool
17408 fun_apply(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
17410 jsval fval, *sp, *oldsp;
17411 + JSString *str;
17412 JSObject *aobj;
17413 jsuint length;
17414 void *mark;
17415 @@ -1579,10 +1595,13 @@ fun_apply(JSContext *cx, JSObject *obj,
17416 fval = argv[-1];
17418 if (!JSVAL_IS_FUNCTION(cx, fval)) {
17419 - JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
17420 - JSMSG_INCOMPATIBLE_PROTO,
17421 - js_Function_str, "apply",
17422 - JS_GetStringBytes(JS_ValueToString(cx, fval)));
17423 + str = JS_ValueToString(cx, fval);
17424 + if (str) {
17425 + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
17426 + JSMSG_INCOMPATIBLE_PROTO,
17427 + js_Function_str, "apply",
17428 + JS_GetStringBytes(str));
17430 return JS_FALSE;
17433 @@ -1757,7 +1776,7 @@ Function(JSContext *cx, JSObject *obj, u
17436 /* Belt-and-braces: check that the caller has access to parent. */
17437 - if (!js_CheckPrincipalsAccess(cx, parent, principals, "Function"))
17438 + if (!js_CheckPrincipalsAccess(cx, parent, principals, js_Function_str))
17439 return JS_FALSE;
17441 n = argc ? argc - 1 : 0;
17442 @@ -2121,6 +2140,7 @@ js_ValueToFunctionObject(JSContext *cx,
17443 JSFunction *fun;
17444 JSObject *funobj;
17445 JSStackFrame *caller;
17446 + JSPrincipals *principals;
17448 if (JSVAL_IS_FUNCTION(cx, *vp))
17449 return JSVAL_TO_OBJECT(*vp);
17450 @@ -2132,10 +2152,21 @@ js_ValueToFunctionObject(JSContext *cx,
17451 *vp = OBJECT_TO_JSVAL(funobj);
17453 caller = JS_GetScriptedCaller(cx, cx->fp);
17454 - if (caller &&
17455 - !js_CheckPrincipalsAccess(cx, funobj,
17456 - caller->script->principals,
17457 - JS_GetFunctionName(fun))) {
17458 + if (caller) {
17459 + principals = caller->script->principals;
17460 + } else {
17461 + /* No scripted caller, don't allow access. */
17462 + principals = NULL;
17465 + /*
17466 + * FIXME: Reparameterize so we don't call js_AtomToPrintableString unless
17467 + * there is an error (bug 324694).
17468 + */
17469 + if (!js_CheckPrincipalsAccess(cx, funobj, principals,
17470 + fun->atom
17471 + ? js_AtomToPrintableString(cx, fun->atom)
17472 + : js_anonymous_str)) {
17473 return NULL;
17475 return funobj;
17476 diff -uprN --exclude=CVS mozilla/js/src/jsgc.c mozilla.new/js/src/jsgc.c
17477 --- mozilla/js/src/jsgc.c 2005-11-01 03:21:39.000000000 +0100
17478 +++ mozilla.new/js/src/jsgc.c 2006-03-03 07:13:06.000000000 +0100
17479 @@ -333,17 +333,20 @@ js_InitGC(JSRuntime *rt, uint32 maxbytes
17480 JS_ASSERT(GC_FLAGS_SIZE >= GC_PAGE_SIZE);
17481 JS_ASSERT(sizeof(JSStackHeader) >= 2 * sizeof(jsval));
17483 - for (i = 0; i < GC_NUM_FREELISTS; i++) {
17484 - JS_InitArenaPool(&rt->gcArenaPool[i], "gc-arena", GC_ARENA_SIZE,
17485 - GC_FREELIST_NBYTES(i));
17487 + for (i = 0; i < GC_NUM_FREELISTS; i++)
17488 + JS_InitArenaPool(&rt->gcArenaPool[i], "gc-arena", GC_ARENA_SIZE, 1);
17489 if (!JS_DHashTableInit(&rt->gcRootsHash, JS_DHashGetStubOps(), NULL,
17490 sizeof(JSGCRootHashEntry), GC_ROOTS_SIZE)) {
17491 rt->gcRootsHash.ops = NULL;
17492 return JS_FALSE;
17494 rt->gcLocksHash = NULL; /* create lazily */
17495 - rt->gcMaxBytes = maxbytes;
17497 + /*
17498 + * Separate gcMaxMallocBytes from gcMaxBytes but initialize to maxbytes
17499 + * for default backward API compatibility.
17500 + */
17501 + rt->gcMaxBytes = rt->gcMaxMallocBytes = maxbytes;
17502 return JS_TRUE;
17505 @@ -589,7 +592,7 @@ retry:
17506 METER(rt->gcStats.recycle[i]++);
17507 } else {
17508 if (rt->gcBytes < rt->gcMaxBytes &&
17509 - (tried_gc || rt->gcMallocBytes < rt->gcMaxBytes))
17510 + (tried_gc || rt->gcMallocBytes < rt->gcMaxMallocBytes))
17513 * Inline form of JS_ARENA_ALLOCATE adapted to truncate the current
17514 @@ -1530,6 +1533,7 @@ js_GC(JSContext *cx, uintN gcflags)
17515 JSStackFrame *fp, *chain;
17516 uintN i, depth, nslots, type;
17517 JSStackHeader *sh;
17518 + JSTempValueRooter *tvr;
17519 size_t nbytes, nflags;
17520 JSArena *a, **ap;
17521 uint8 flags, *flagp, *split;
17522 @@ -1799,6 +1803,16 @@ restart:
17524 if (acx->localRootStack)
17525 js_MarkLocalRoots(cx, acx->localRootStack);
17526 + for (tvr = acx->tempValueRooters; tvr; tvr = tvr->down) {
17527 + if (tvr->count < 0) {
17528 + if (JSVAL_IS_GCTHING(tvr->u.value)) {
17529 + GC_MARK(cx, JSVAL_TO_GCTHING(tvr->u.value), "tvr->u.value",
17530 + NULL);
17532 + } else {
17533 + GC_MARK_JSVALS(cx, tvr->count, tvr->u.array, "tvr->u.array");
17537 #ifdef DUMP_CALL_TABLE
17538 js_DumpCallTable(cx);
17539 @@ -1819,7 +1833,6 @@ restart:
17541 js_SweepAtomState(&rt->atomState);
17542 js_SweepScopeProperties(rt);
17543 - js_SweepScriptFilenames(rt);
17544 for (i = 0; i < GC_NUM_FREELISTS; i++) {
17545 nbytes = GC_FREELIST_NBYTES(i);
17546 nflags = nbytes / sizeof(JSGCThing);
17547 @@ -1864,6 +1877,14 @@ restart:
17551 + * Sweep script filenames after sweeping functions in the generic loop
17552 + * above. In this way when scripted function's finalizer destroys script
17553 + * triggering a call to rt->destroyScriptHook, the hook can still access
17554 + * script's filename. See bug 323267.
17555 + */
17556 + js_SweepScriptFilenames(rt);
17558 + /*
17559 * Free phase.
17560 * Free any unused arenas and rebuild the JSGCThing freelist.
17562 diff -uprN --exclude=CVS mozilla/js/src/jsinterp.c mozilla.new/js/src/jsinterp.c
17563 --- mozilla/js/src/jsinterp.c 2006-01-11 23:04:48.000000000 +0100
17564 +++ mozilla.new/js/src/jsinterp.c 2006-02-24 11:16:27.000000000 +0100
17565 @@ -1982,6 +1982,17 @@ js_Interpret(JSContext *cx, jsbytecode *
17566 LOAD_INTERRUPT_HANDLER(rt);
17570 +#if JS_HAS_CALL_OBJECT
17571 + /*
17572 + * If frame has a call object, sync values and clear the back-
17573 + * pointer. This can happen for a lightweight function if it
17574 + * calls eval unexpectedly (in a way that is hidden from the
17575 + * compiler). See bug 325540.
17576 + */
17577 + if (fp->callobj)
17578 + ok &= js_PutCallObject(cx, fp);
17579 +#endif
17580 #if JS_HAS_ARGS_OBJECT
17581 if (fp->argsobj)
17582 ok &= js_PutArgsObject(cx, fp);
17583 diff -uprN --exclude=CVS mozilla/js/src/jsobj.c mozilla.new/js/src/jsobj.c
17584 --- mozilla/js/src/jsobj.c 2006-01-11 23:04:48.000000000 +0100
17585 +++ mozilla.new/js/src/jsobj.c 2006-02-24 11:16:27.000000000 +0100
17586 @@ -1262,10 +1262,9 @@ obj_eval(JSContext *cx, JSObject *obj, u
17587 * caller's principals has access to scopeobj.
17589 ok = js_CheckPrincipalsAccess(cx, scopeobj, principals, js_eval_str);
17590 - if (!ok)
17591 - goto out;
17592 + if (ok)
17593 + ok = js_Execute(cx, scopeobj, script, caller, JSFRAME_EVAL, rval);
17595 - ok = js_Execute(cx, scopeobj, script, caller, JSFRAME_EVAL, rval);
17596 JS_DestroyScript(cx, script);
17598 out:
17599 @@ -2123,6 +2122,7 @@ js_ConstructObject(JSContext *cx, JSClas
17600 JSObject *parent, uintN argc, jsval *argv)
17602 jsval cval, rval;
17603 + JSTempValueRooter tvr;
17604 JSObject *obj, *ctor;
17606 if (!js_FindConstructor(cx, parent, clasp->name, &cval))
17607 @@ -2133,6 +2133,13 @@ js_ConstructObject(JSContext *cx, JSClas
17611 + * Protect cval in case a crazy getter for .prototype uproots it. After
17612 + * this point, all control flow must exit through label out with obj set.
17613 + */
17614 + JS_PUSH_SINGLE_TEMP_ROOT(cx, cval, &tvr);
17615 + obj = NULL;
17617 + /*
17618 * If proto or parent are NULL, set them to Constructor.prototype and/or
17619 * Constructor.__parent__, just like JSOP_NEW does.
17621 @@ -2144,7 +2151,7 @@ js_ConstructObject(JSContext *cx, JSClas
17622 ATOM_TO_JSID(cx->runtime->atomState
17623 .classPrototypeAtom),
17624 &rval)) {
17625 - return NULL;
17626 + goto out;
17628 if (JSVAL_IS_OBJECT(rval))
17629 proto = JSVAL_TO_OBJECT(rval);
17630 @@ -2152,14 +2159,19 @@ js_ConstructObject(JSContext *cx, JSClas
17632 obj = js_NewObject(cx, clasp, proto, parent);
17633 if (!obj)
17634 - return NULL;
17635 + goto out;
17637 - if (!js_InternalConstruct(cx, obj, cval, argc, argv, &rval))
17638 - goto bad;
17639 - return JSVAL_IS_OBJECT(rval) ? JSVAL_TO_OBJECT(rval) : obj;
17640 -bad:
17641 - cx->newborn[GCX_OBJECT] = NULL;
17642 - return NULL;
17643 + if (!js_InternalConstruct(cx, obj, cval, argc, argv, &rval)) {
17644 + cx->newborn[GCX_OBJECT] = NULL;
17645 + obj = NULL;
17646 + goto out;
17649 + if (!JSVAL_IS_PRIMITIVE(rval))
17650 + obj = JSVAL_TO_OBJECT(rval);
17651 +out:
17652 + JS_POP_TEMP_ROOT(cx, &tvr);
17653 + return obj;
17656 void
17657 @@ -2265,7 +2277,7 @@ js_FreeSlot(JSContext *cx, JSObject *obj
17658 #if JS_BUG_EMPTY_INDEX_ZERO
17659 #define CHECK_FOR_EMPTY_INDEX(id) \
17660 JS_BEGIN_MACRO \
17661 - if (JSSTRING_LENGTH(_str) == 0) \
17662 + if (JSSTRING_LENGTH(str_) == 0) \
17663 id = JSVAL_ZERO; \
17664 JS_END_MACRO
17665 #else
17666 diff -uprN --exclude=CVS mozilla/js/src/jsopcode.c mozilla.new/js/src/jsopcode.c
17667 --- mozilla/js/src/jsopcode.c 2006-01-09 06:48:37.000000000 +0100
17668 +++ mozilla.new/js/src/jsopcode.c 2006-03-03 07:13:06.000000000 +0100
17669 @@ -892,7 +892,7 @@ Decompile(SprintStack *ss, jsbytecode *p
17670 JSString *str;
17671 JSBool ok;
17672 #if JS_HAS_XML_SUPPORT
17673 - JSBool inXML, quoteAttr;
17674 + JSBool foreach, inXML, quoteAttr;
17675 #else
17676 #define inXML JS_FALSE
17677 #endif
17678 @@ -954,7 +954,7 @@ Decompile(SprintStack *ss, jsbytecode *p
17679 sn = NULL;
17680 rval = NULL;
17681 #if JS_HAS_XML_SUPPORT
17682 - inXML = quoteAttr = JS_FALSE;
17683 + foreach = inXML = quoteAttr = JS_FALSE;
17684 #endif
17686 while (pc < endpc) {
17687 @@ -1569,7 +1569,8 @@ Decompile(SprintStack *ss, jsbytecode *p
17689 do_forinbody:
17690 #if JS_HAS_XML_SUPPORT
17691 - if (lastop == JSOP_FOREACH) {
17692 + if (foreach) {
17693 + foreach = JS_FALSE;
17694 js_printf(jp, "\tfor %s (%s%s",
17695 js_each_str, VarPrefix(sn), lval);
17696 } else
17697 @@ -1581,10 +1582,10 @@ Decompile(SprintStack *ss, jsbytecode *p
17698 return JS_FALSE;
17699 RETRACT(&ss->sprinter, xval);
17700 js_printf(jp, *lval ? ".%s" : "%s", xval);
17701 - } else if (xval) {
17702 + } else if (xval && *xval) {
17703 js_printf(jp,
17704 (js_CodeSpec[lastop].format & JOF_XMLNAME)
17705 - ? ".%s%s"
17706 + ? ".%s"
17707 : "[%s]",
17708 xval);
17710 @@ -2380,6 +2381,7 @@ Decompile(SprintStack *ss, jsbytecode *p
17711 #if JS_HAS_LEXICAL_CLOSURE
17712 BEGIN_LITOPX_CASE(JSOP_CLOSURE)
17713 JS_ASSERT(ATOM_IS_OBJECT(atom));
17714 + todo = -2;
17715 goto do_function;
17716 END_LITOPX_CASE
17717 #endif
17718 @@ -2632,12 +2634,16 @@ Decompile(SprintStack *ss, jsbytecode *p
17719 inXML = JS_FALSE;
17720 break;
17722 + case JSOP_FOREACH:
17723 + foreach = JS_TRUE;
17724 + todo = -2;
17725 + break;
17727 case JSOP_TOXML:
17728 inXML = JS_FALSE;
17729 - /* fall through */
17730 + /* FALL THROUGH */
17732 case JSOP_XMLNAME:
17733 - case JSOP_FOREACH:
17734 case JSOP_FILTER:
17735 /* Conversion and prefix ops do nothing in the decompiler. */
17736 todo = -2;
17737 diff -uprN --exclude=CVS mozilla/js/src/jsparse.c mozilla.new/js/src/jsparse.c
17738 --- mozilla/js/src/jsparse.c 2006-01-11 23:04:48.000000000 +0100
17739 +++ mozilla.new/js/src/jsparse.c 2006-03-03 07:13:06.000000000 +0100
17740 @@ -1576,10 +1576,19 @@ Statement(JSContext *cx, JSTokenStream *
17741 stmtInfo.type = STMT_FOR_IN_LOOP;
17743 /* Check that the left side of the 'in' is valid. */
17744 + while (pn1->pn_type == TOK_RP)
17745 + pn1 = pn1->pn_kid;
17746 if ((pn1->pn_type == TOK_VAR)
17747 ? (pn1->pn_count > 1 || pn1->pn_op == JSOP_DEFCONST)
17748 : (pn1->pn_type != TOK_NAME &&
17749 pn1->pn_type != TOK_DOT &&
17750 +#if JS_HAS_LVALUE_RETURN
17751 + pn1->pn_type != TOK_LP &&
17752 +#endif
17753 +#if JS_HAS_XML_SUPPORT
17754 + (pn1->pn_type != TOK_UNARYOP ||
17755 + pn1->pn_op != JSOP_XMLNAME) &&
17756 +#endif
17757 pn1->pn_type != TOK_LB)) {
17758 js_ReportCompileErrorNumber(cx, ts,
17759 JSREPORT_TS | JSREPORT_ERROR,
17760 @@ -1597,6 +1606,14 @@ Statement(JSContext *cx, JSTokenStream *
17761 pn1->pn_extra |= PNX_POPVAR;
17762 } else {
17763 pn2 = pn1;
17764 +#if JS_HAS_LVALUE_RETURN
17765 + if (pn2->pn_type == TOK_LP)
17766 + pn2->pn_op = JSOP_SETCALL;
17767 +#endif
17768 +#if JS_HAS_XML_SUPPORT
17769 + if (pn2->pn_type == TOK_UNARYOP)
17770 + pn2->pn_op = JSOP_BINDXMLNAME;
17771 +#endif
17774 /* Beware 'for (arguments in ...)' with or without a 'var'. */
17775 @@ -4326,7 +4343,7 @@ FoldXMLConstants(JSContext *cx, JSParseN
17776 case TOK_XMLSPACE:
17777 case TOK_XMLTEXT:
17778 case TOK_STRING:
17779 - if (pn->pn_arity == PN_LIST)
17780 + if (pn2->pn_arity == PN_LIST)
17781 goto cantfold;
17782 str = ATOM_TO_STRING(pn2->pn_atom);
17783 break;
17784 diff -uprN --exclude=CVS mozilla/js/src/jsregexp.c mozilla.new/js/src/jsregexp.c
17785 --- mozilla/js/src/jsregexp.c 2005-10-14 21:00:39.000000000 +0200
17786 +++ mozilla.new/js/src/jsregexp.c 2006-02-24 11:16:28.000000000 +0100
17787 @@ -2034,10 +2034,6 @@ js_NewRegExpOpt(JSContext *cx, JSTokenSt
17788 return js_NewRegExp(cx, ts, str, flags, flat);
17792 -#define HOLD_REGEXP(cx, re) JS_ATOMIC_INCREMENT(&(re)->nrefs)
17793 -#define DROP_REGEXP(cx, re) js_DestroyRegExp(cx, re)
17796 * Save the current state of the match - the position in the input
17797 * text as well as the position in the bytecode. The state of any
17798 diff -uprN --exclude=CVS mozilla/js/src/jsregexp.h mozilla.new/js/src/jsregexp.h
17799 --- mozilla/js/src/jsregexp.h 2005-09-30 23:57:31.000000000 +0200
17800 +++ mozilla.new/js/src/jsregexp.h 2006-02-24 11:16:28.000000000 +0100
17801 @@ -117,6 +117,9 @@ extern JSRegExp *
17802 js_NewRegExpOpt(JSContext *cx, JSTokenStream *ts,
17803 JSString *str, JSString *opt, JSBool flat);
17805 +#define HOLD_REGEXP(cx, re) JS_ATOMIC_INCREMENT(&(re)->nrefs)
17806 +#define DROP_REGEXP(cx, re) js_DestroyRegExp(cx, re)
17808 extern void
17809 js_DestroyRegExp(JSContext *cx, JSRegExp *re);
17811 diff -uprN --exclude=CVS mozilla/js/src/jsstr.c mozilla.new/js/src/jsstr.c
17812 --- mozilla/js/src/jsstr.c 2005-11-01 01:31:26.000000000 +0100
17813 +++ mozilla.new/js/src/jsstr.c 2006-02-24 11:16:35.000000000 +0100
17814 @@ -1168,7 +1168,9 @@ match_or_replace(JSContext *cx, JSObject
17815 return JS_FALSE;
17816 reobj = NULL;
17818 + /* From here on, all control flow must reach the matching DROP. */
17819 data->regexp = re;
17820 + HOLD_REGEXP(cx, re);
17822 if (re->flags & JSREG_GLOB)
17823 data->flags |= GLOBAL_REGEXP;
17824 @@ -1184,23 +1186,23 @@ match_or_replace(JSContext *cx, JSObject
17825 if (reobj) {
17826 /* Set the lastIndex property's reserved slot to 0. */
17827 ok = js_SetLastIndex(cx, reobj, 0);
17828 - if (!ok)
17829 - return JS_FALSE;
17830 } else {
17831 ok = JS_TRUE;
17833 - length = JSSTRING_LENGTH(str);
17834 - for (count = 0; index <= length; count++) {
17835 - ok = js_ExecuteRegExp(cx, re, str, &index, JS_TRUE, rval);
17836 - if (!ok || *rval != JSVAL_TRUE)
17837 - break;
17838 - ok = glob(cx, count, data);
17839 - if (!ok)
17840 - break;
17841 - if (cx->regExpStatics.lastMatch.length == 0) {
17842 - if (index == length)
17843 + if (ok) {
17844 + length = JSSTRING_LENGTH(str);
17845 + for (count = 0; index <= length; count++) {
17846 + ok = js_ExecuteRegExp(cx, re, str, &index, JS_TRUE, rval);
17847 + if (!ok || *rval != JSVAL_TRUE)
17848 break;
17849 - index++;
17850 + ok = glob(cx, count, data);
17851 + if (!ok)
17852 + break;
17853 + if (cx->regExpStatics.lastMatch.length == 0) {
17854 + if (index == length)
17855 + break;
17856 + index++;
17860 } else {
17861 @@ -1241,6 +1243,7 @@ match_or_replace(JSContext *cx, JSObject
17862 ok = js_ExecuteRegExp(cx, re, str, &index, test, rval);
17865 + DROP_REGEXP(cx, re);
17866 if (reobj) {
17867 /* Tell our caller that it doesn't need to destroy data->regexp. */
17868 data->flags &= ~KEEP_REGEXP;
17869 @@ -1249,6 +1252,7 @@ match_or_replace(JSContext *cx, JSObject
17870 data->regexp = NULL;
17871 js_DestroyRegExp(cx, re);
17874 return ok;
17877 diff -uprN --exclude=CVS mozilla/js/src/jsxml.c mozilla.new/js/src/jsxml.c
17878 --- mozilla/js/src/jsxml.c 2006-01-11 23:04:49.000000000 +0100
17879 +++ mozilla.new/js/src/jsxml.c 2006-03-03 07:13:08.000000000 +0100
17880 @@ -1225,7 +1225,12 @@ XMLArrayTruncate(JSContext *cx, JSXMLArr
17881 #define XMLARRAY_HAS_MEMBER(a,e,f) (XMLArrayFindMember(a, (void *)(e), f) != \
17882 XML_NOT_FOUND)
17883 #define XMLARRAY_MEMBER(a,i,t) ((t *) (a)->vector[i])
17884 -#define XMLARRAY_SET_MEMBER(a,i,e) ((a)->vector[i] = (void *)(e))
17885 +#define XMLARRAY_SET_MEMBER(a,i,e) \
17886 + JS_BEGIN_MACRO \
17887 + if ((a)->length <= (i)) \
17888 + (a)->length = (i) + 1; \
17889 + ((a)->vector[i] = (void *)(e)); \
17890 + JS_END_MACRO
17891 #define XMLARRAY_ADD_MEMBER(x,a,i,e)XMLArrayAddMember(x, a, i, (void *)(e))
17892 #define XMLARRAY_INSERT(x,a,i,n) XMLArrayInsert(x, a, i, n)
17893 #define XMLARRAY_APPEND(x,a,e) XMLARRAY_ADD_MEMBER(x, a, (a)->length, (e))
17894 @@ -1258,6 +1263,12 @@ enum xml_static_tinyid {
17897 static JSBool
17898 +xml_setting_getter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
17900 + return JS_TRUE;
17903 +static JSBool
17904 xml_setting_setter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
17906 JSBool b;
17907 @@ -1277,16 +1288,16 @@ xml_setting_setter(JSContext *cx, JSObje
17909 static JSPropertySpec xml_static_props[] = {
17910 {js_ignoreComments_str, XML_IGNORE_COMMENTS, JSPROP_PERMANENT,
17911 - NULL, xml_setting_setter},
17912 + xml_setting_getter, xml_setting_setter},
17913 {js_ignoreProcessingInstructions_str,
17914 XML_IGNORE_PROCESSING_INSTRUCTIONS, JSPROP_PERMANENT,
17915 - NULL, xml_setting_setter},
17916 + xml_setting_getter, xml_setting_setter},
17917 {js_ignoreWhitespace_str, XML_IGNORE_WHITESPACE, JSPROP_PERMANENT,
17918 - NULL, xml_setting_setter},
17919 + xml_setting_getter, xml_setting_setter},
17920 {js_prettyPrinting_str, XML_PRETTY_PRINTING, JSPROP_PERMANENT,
17921 - NULL, xml_setting_setter},
17922 + xml_setting_getter, xml_setting_setter},
17923 {js_prettyIndent_str, XML_PRETTY_INDENT, JSPROP_PERMANENT,
17924 - NULL, NULL},
17925 + xml_setting_getter, NULL},
17926 {0,0,0,0,0}
17929 @@ -1483,8 +1494,10 @@ ParseNodeToXML(JSContext *cx, JSParseNod
17930 xml = ParseNodeToXML(cx, pn2, inScopeNSes, flags);
17931 if (!xml)
17932 goto fail;
17933 - flags &= ~XSF_PRECOMPILED_ROOT;
17934 + if (js_PushLocalRoot(cx, cx->localRootStack, (jsval)xml) < 0)
17935 + goto fail;
17937 + flags &= ~XSF_PRECOMPILED_ROOT;
17938 n = pn->pn_count;
17939 JS_ASSERT(n >= 2);
17940 n -= 2;
17941 @@ -1511,10 +1524,8 @@ ParseNodeToXML(JSContext *cx, JSParseNod
17942 continue;
17945 - if (!kid) {
17946 - xml->xml_kids.length = i;
17947 + if (!kid)
17948 goto fail;
17951 /* Store kid in xml right away, to protect it from GC. */
17952 XMLARRAY_SET_MEMBER(&xml->xml_kids, i, kid);
17953 @@ -1532,7 +1543,6 @@ ParseNodeToXML(JSContext *cx, JSParseNod
17956 JS_ASSERT(i == n);
17957 - xml->xml_kids.length = n;
17958 if (n < pn->pn_count - 2)
17959 XMLArrayTrim(&xml->xml_kids);
17960 XMLARRAY_TRUNCATE(cx, inScopeNSes, length);
17961 @@ -1565,16 +1575,13 @@ ParseNodeToXML(JSContext *cx, JSParseNod
17962 continue;
17965 - if (!kid) {
17966 - xml->xml_kids.length = i;
17967 + if (!kid)
17968 goto fail;
17971 XMLARRAY_SET_MEMBER(&xml->xml_kids, i, kid);
17972 ++i;
17975 - xml->xml_kids.length = n;
17976 if (n < pn->pn_count)
17977 XMLArrayTrim(&xml->xml_kids);
17978 break;
17979 @@ -1583,7 +1590,7 @@ ParseNodeToXML(JSContext *cx, JSParseNod
17980 case TOK_XMLPTAGC:
17981 length = inScopeNSes->length;
17982 pn2 = pn->pn_head;
17983 - JS_ASSERT(pn2->pn_type = TOK_XMLNAME);
17984 + JS_ASSERT(pn2->pn_type == TOK_XMLNAME);
17985 if (pn2->pn_arity == PN_LIST)
17986 goto syntax;
17988 @@ -1732,10 +1739,8 @@ ParseNodeToXML(JSContext *cx, JSParseNod
17989 JS_ASSERT(pn2->pn_type == TOK_XMLATTR);
17991 attr = js_NewXML(cx, JSXML_CLASS_ATTRIBUTE);
17992 - if (!attr) {
17993 - xml->xml_attrs.length = i;
17994 + if (!attr)
17995 goto fail;
17998 XMLARRAY_SET_MEMBER(&xml->xml_attrs, i, attr);
17999 attr->parent = xml;
18000 @@ -1743,8 +1748,6 @@ ParseNodeToXML(JSContext *cx, JSParseNod
18001 attr->xml_value = ATOM_TO_STRING(pn2->pn_atom);
18004 - xml->xml_attrs.length = n;
18006 /* Point tag closes its own namespace scope. */
18007 if (pn->pn_type == TOK_XMLPTAGC)
18008 XMLARRAY_TRUNCATE(cx, inScopeNSes, length);
18009 @@ -1834,23 +1837,44 @@ GetXMLSetting(JSContext *cx, const char
18012 static JSBool
18013 -GetBooleanXMLSetting(JSContext *cx, const char *name, JSBool *bp)
18014 +FillSettingsCache(JSContext *cx)
18016 int i;
18017 + const char *name;
18018 jsval v;
18019 + JSBool isSet;
18021 - if (cx->xmlSettingFlags & XSF_CACHE_VALID) {
18022 - for (i = 0; xml_static_props[i].name; i++) {
18023 - if (!strcmp(xml_static_props[i].name, name)) {
18024 - *bp = (cx->xmlSettingFlags & JS_BIT(i)) != 0;
18025 - return JS_TRUE;
18028 - *bp = JS_FALSE;
18029 - return JS_TRUE;
18030 + /* Note: XML_PRETTY_INDENT is not a boolean setting. */
18031 + for (i = XML_IGNORE_COMMENTS; i < XML_PRETTY_INDENT; i++) {
18032 + name = xml_static_props[i].name;
18033 + if (!GetXMLSetting(cx, name, &v) || !js_ValueToBoolean(cx, v, &isSet))
18034 + return JS_FALSE;
18035 + if (isSet)
18036 + cx->xmlSettingFlags |= JS_BIT(i);
18037 + else
18038 + cx->xmlSettingFlags &= ~JS_BIT(i);
18041 - return GetXMLSetting(cx, name, &v) && js_ValueToBoolean(cx, v, bp);
18042 + cx->xmlSettingFlags |= XSF_CACHE_VALID;
18043 + return JS_TRUE;
18046 +static JSBool
18047 +GetBooleanXMLSetting(JSContext *cx, const char *name, JSBool *bp)
18049 + int i;
18051 + if (!(cx->xmlSettingFlags & XSF_CACHE_VALID) && !FillSettingsCache(cx))
18052 + return JS_FALSE;
18054 + for (i = 0; xml_static_props[i].name; i++) {
18055 + if (!strcmp(xml_static_props[i].name, name)) {
18056 + *bp = (cx->xmlSettingFlags & JS_BIT(i)) != 0;
18057 + return JS_TRUE;
18060 + *bp = JS_FALSE;
18061 + return JS_TRUE;
18064 static JSBool
18065 @@ -2886,7 +2910,7 @@ XMLToXMLString(JSContext *cx, JSXML *xml
18066 str = js_NewString(cx, sb.base, STRING_BUFFER_OFFSET(&sb), 0);
18067 out:
18068 JS_LeaveLocalRootScope(cx);
18069 - if (!str)
18070 + if (!str && STRING_BUFFER_OK(&sb))
18071 js_FinishStringBuffer(&sb);
18072 XMLArrayFinish(cx, &decls);
18073 if (ancdecls.capacity != 0)
18074 @@ -3050,7 +3074,7 @@ construct:
18075 out:
18076 qn = (JSXMLQName *) JS_GetPrivate(cx, obj);
18077 atom = cx->runtime->atomState.lazy.functionNamespaceURIAtom;
18078 - if (atom &&
18079 + if (qn->uri && atom &&
18080 (qn->uri == ATOM_TO_STRING(atom) ||
18081 !js_CompareStrings(qn->uri, ATOM_TO_STRING(atom)))) {
18082 if (!JS_ValueToId(cx, STRING_TO_JSVAL(qn->localName), funidp))
18083 @@ -3141,7 +3165,6 @@ Append(JSContext *cx, JSXML *list, JSXML
18084 kid = XMLARRAY_MEMBER(&xml->xml_kids, j, JSXML);
18085 XMLARRAY_SET_MEMBER(&list->xml_kids, i + j, kid);
18087 - list->xml_kids.length = k;
18088 return JS_TRUE;
18091 @@ -3234,12 +3257,12 @@ DeepCopySetInLRS(JSContext *cx, JSXMLArr
18092 kid2->xml_value = str;
18095 - XMLARRAY_SET_MEMBER(to, j++, kid2);
18096 + XMLARRAY_SET_MEMBER(to, j, kid2);
18097 + ++j;
18098 if (parent->xml_class != JSXML_CLASS_LIST)
18099 kid2->parent = parent;
18102 - to->length = j;
18103 if (j < n)
18104 XMLArrayTrim(to);
18105 return JS_TRUE;
18106 @@ -3297,7 +3320,6 @@ DeepCopyInLRS(JSContext *cx, JSXML *xml,
18108 XMLARRAY_SET_MEMBER(&copy->xml_namespaces, i, ns2);
18110 - copy->xml_namespaces.length = n;
18112 ok = DeepCopySetInLRS(cx, &xml->xml_attrs, &copy->xml_attrs, copy,
18114 @@ -3566,6 +3588,8 @@ Replace(JSContext *cx, JSXML *xml, jsval
18115 static JSBool
18116 CheckCycle(JSContext *cx, JSXML *xml, JSXML *kid)
18118 + JS_ASSERT(kid->xml_class != JSXML_CLASS_LIST);
18120 do {
18121 if (xml == kid) {
18122 JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
18123 @@ -3599,8 +3623,6 @@ Insert(JSContext *cx, JSXML *xml, jsval
18124 vobj = JSVAL_TO_OBJECT(v);
18125 if (OBJECT_IS_XML(cx, vobj)) {
18126 vxml = (JSXML *) JS_GetPrivate(cx, vobj);
18127 - if (!CheckCycle(cx, xml, vxml))
18128 - return JS_FALSE;
18129 if (vxml->xml_class == JSXML_CLASS_LIST)
18130 n = vxml->xml_kids.length;
18132 @@ -3615,6 +3637,8 @@ Insert(JSContext *cx, JSXML *xml, jsval
18133 if (vxml && vxml->xml_class == JSXML_CLASS_LIST) {
18134 for (j = 0; j < n; j++) {
18135 kid = XMLARRAY_MEMBER(&vxml->xml_kids, j, JSXML);
18136 + if (!CheckCycle(cx, xml, kid))
18137 + return JS_FALSE;
18138 kid->parent = xml;
18139 XMLARRAY_SET_MEMBER(&xml->xml_kids, i + j, kid);
18141 @@ -4318,7 +4342,6 @@ PutProperty(JSContext *cx, JSObject *obj
18142 kid2 = XMLARRAY_MEMBER(&vxml->xml_kids, k, JSXML);
18143 XMLARRAY_SET_MEMBER(&copy->xml_kids, k, kid2);
18145 - copy->xml_kids.length = n;
18147 JS_ASSERT(parent != xml);
18148 if (parent) {
18149 @@ -4593,6 +4616,7 @@ PutProperty(JSContext *cx, JSObject *obj
18151 /* 12. */
18152 k = n = xml->xml_kids.length;
18153 + kid2 = NULL;
18154 while (k != 0) {
18155 --k;
18156 kid = XMLARRAY_MEMBER(&xml->xml_kids, k, JSXML);
18157 @@ -4605,9 +4629,32 @@ PutProperty(JSContext *cx, JSObject *obj
18158 ok = IndexToIdVal(cx, k, &id);
18159 if (!ok)
18160 goto out;
18161 + kid2 = kid;
18165 + /*
18166 + * Erratum: ECMA-357 specified child insertion inconsistently:
18167 + * insertChildBefore and insertChildAfter insert an arbitrary XML
18168 + * instance, and therefore can create cycles, but appendChild as
18169 + * specified by the "Overview" of 13.4.4.3 calls [[DeepCopy]] on
18170 + * its argument. But the "Semantics" in 13.4.4.3 do not include
18171 + * any [[DeepCopy]] call.
18173 + * Fixing this (https://bugzilla.mozilla.org/show_bug.cgi?id=312692)
18174 + * required adding cycle detection, and allowing duplicate kids to
18175 + * be created (see comment 6 in the bug). Allowing duplicate kid
18176 + * references means the loop above will delete all but the lowest
18177 + * indexed reference, and each [[DeleteByIndex]] nulls the kid's
18178 + * parent. Thus the need to restore parent here. This is covered
18179 + * by https://bugzilla.mozilla.org/show_bug.cgi?id=327564.
18180 + */
18181 + if (kid2) {
18182 + JS_ASSERT(kid2->parent == xml || !kid2->parent);
18183 + if (!kid2->parent)
18184 + kid2->parent = xml;
18187 /* 13. */
18188 if (JSVAL_IS_VOID(id)) {
18189 /* 13(a). */
18190 @@ -4694,6 +4741,7 @@ ResolveValue(JSContext *cx, JSXML *list,
18192 JSXML *target, *base;
18193 JSXMLQName *targetprop;
18194 + JSObject *targetpropobj;
18195 jsval id, tv;
18197 /* Our caller must be protecting newborn objects. */
18198 @@ -4708,10 +4756,15 @@ ResolveValue(JSContext *cx, JSXML *list,
18200 target = list->xml_target;
18201 targetprop = list->xml_targetprop;
18202 - if (!target ||
18203 - !targetprop ||
18204 - OBJ_GET_CLASS(cx, targetprop->object) == &js_AttributeNameClass ||
18205 - IS_STAR(targetprop->localName)) {
18206 + if (!target || !targetprop || IS_STAR(targetprop->localName)) {
18207 + *result = NULL;
18208 + return JS_TRUE;
18211 + targetpropobj = js_GetXMLQNameObject(cx, targetprop);
18212 + if (!targetpropobj)
18213 + return JS_FALSE;
18214 + if (OBJ_GET_CLASS(cx, targetpropobj) == &js_AttributeNameClass) {
18215 *result = NULL;
18216 return JS_TRUE;
18218 @@ -4725,7 +4778,7 @@ ResolveValue(JSContext *cx, JSXML *list,
18219 if (!js_GetXMLObject(cx, base))
18220 return JS_FALSE;
18222 - id = OBJECT_TO_JSVAL(targetprop->object);
18223 + id = OBJECT_TO_JSVAL(targetpropobj);
18224 if (!GetProperty(cx, base->object, id, &tv))
18225 return JS_FALSE;
18226 target = (JSXML *) JS_GetPrivate(cx, JSVAL_TO_OBJECT(tv));
18227 @@ -6097,7 +6150,6 @@ xml_namespace(JSContext *cx, JSObject *o
18228 XMLARRAY_SET_MEMBER(&inScopeNSes, i, ns);
18231 - inScopeNSes.length = i;
18232 ns = ok ? GetNamespace(cx, xml->name, &inScopeNSes) : NULL;
18233 XMLArrayFinish(cx, &inScopeNSes);
18234 if (!ns)
18235 @@ -7175,9 +7227,9 @@ xml_mark_tail(JSContext *cx, JSXML *xml,
18237 if (xml->xml_class == JSXML_CLASS_LIST) {
18238 if (xml->xml_target)
18239 - js_MarkXML(cx, xml->xml_target, arg);
18240 + JS_MarkGCThing(cx, xml->xml_target, "target", arg);
18241 if (xml->xml_targetprop)
18242 - js_MarkXMLQName(cx, xml->xml_targetprop, arg);
18243 + JS_MarkGCThing(cx, xml->xml_targetprop, "targetprop", arg);
18244 } else {
18245 namespace_mark_vector(cx,
18246 (JSXMLNamespace **) xml->xml_namespaces.vector,
18247 diff -uprN --exclude=CVS mozilla/js/src/Makefile.in mozilla.new/js/src/Makefile.in
18248 --- mozilla/js/src/Makefile.in 2005-06-01 16:26:26.000000000 +0200
18249 +++ mozilla.new/js/src/Makefile.in 2006-02-24 11:16:27.000000000 +0100
18250 @@ -370,14 +370,32 @@ ifdef HOST_NSPR_MDCPUCFG
18251 HOST_CC := $(HOST_CC) -DMDCPUCFG=$(TARGET_NSPR_MDCPUCFG)
18252 endif
18254 +ifdef CROSS_COMPILE
18255 +# jscpucfg needs to know when it's supposed to produce a config for the target
18256 +JSCPUCFG_DEFINES = -DCROSS_COMPILE=1
18258 +# This is incredibly hacky. Darwin NSPR uses the same MDCPUCFG for multiple
18259 +# processors, and determines which processor to configure for based on
18260 +# #ifdef i386. This macro is among the NSPR defines, but is also automatically
18261 +# defined by the compiler when building for i386. It therefore needs to be
18262 +# defined here if targeting i386, and explicitly undefined otherwise.
18263 +ifeq ($(OS_ARCH),Darwin)
18264 +ifeq ($(TARGET_CPU),powerpc)
18265 +DEFINES += -Ui386
18266 +else
18267 +DEFINES += -Di386=1
18268 +endif
18269 +endif
18270 +endif
18272 ifeq ($(OS_ARCH),QNX)
18273 ifneq ($(OS_TARGET),NTO)
18274 # QNX's compiler apparently can't build a binary directly from a source file.
18275 jscpucfg.o: jscpucfg.c Makefile.in
18276 - $(HOST_CC) $(HOST_CFLAGS) -c $(DEFINES) $(NSPR_CFLAGS) -o $@ $<
18277 + $(HOST_CC) $(HOST_CFLAGS) -c $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) -o $@ $<
18279 jscpucfg: jscpucfg.o
18280 - $(HOST_CC) $(HOST_CFLAGS) $(DEFINES) -o $@ $<
18281 + $(HOST_CC) $(HOST_CFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) -o $@ $<
18282 endif
18283 else
18284 ifeq ($(OS_ARCH),WINCE)
18285 @@ -385,7 +403,7 @@ jscpucfg$(HOST_BIN_SUFFIX):
18286 echo no need to build jscpucfg $<
18287 else
18288 jscpucfg$(HOST_BIN_SUFFIX): jscpucfg.c Makefile.in
18289 - $(HOST_CC) $(HOST_CFLAGS) $(DEFINES) $(NSPR_CFLAGS) $(OUTOPTION)$@ $<
18290 + $(HOST_CC) $(HOST_CFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) $(OUTOPTION)$@ $<
18291 endif
18292 endif
18294 diff -uprN --exclude=CVS mozilla/js/src/xpconnect/src/xpccallcontext.cpp mozilla.new/js/src/xpconnect/src/xpccallcontext.cpp
18295 --- mozilla/js/src/xpconnect/src/xpccallcontext.cpp 2005-01-12 20:20:01.000000000 +0100
18296 +++ mozilla.new/js/src/xpconnect/src/xpccallcontext.cpp 2006-02-24 11:16:36.000000000 +0100
18297 @@ -345,7 +345,11 @@ XPCCallContext::~XPCCallContext()
18299 else
18301 - JS_ClearNewbornRoots(mJSContext);
18302 + // Don't clear newborns if JS frames (compilation or execution)
18303 + // are active! Doing so violates ancient invariants in the JS
18304 + // engine, and it's not necessary to fix JS component leaks.
18305 + if (!mJSContext->fp)
18306 + JS_ClearNewbornRoots(mJSContext);
18310 diff -uprN --exclude=CVS mozilla/js/src/xpconnect/src/xpccomponents.cpp mozilla.new/js/src/xpconnect/src/xpccomponents.cpp
18311 --- mozilla/js/src/xpconnect/src/xpccomponents.cpp 2005-11-03 04:14:00.000000000 +0100
18312 +++ mozilla.new/js/src/xpconnect/src/xpccomponents.cpp 2006-02-24 11:16:36.000000000 +0100
18313 @@ -2244,10 +2244,16 @@ nsXPCComponents_utils_Sandbox::CallOrCon
18314 if(NS_FAILED(rv))
18315 return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval);
18317 - JSObject *sandbox = JS_NewObject(cx, &SandboxClass, nsnull, nsnull);
18318 + XPCAutoJSContext tempcx(JS_NewContext(JS_GetRuntime(cx), 1024), PR_FALSE);
18319 + if (!tempcx)
18320 + return ThrowAndFail(NS_ERROR_OUT_OF_MEMORY, cx, _retval);
18322 + JSObject *sandbox = JS_NewObject(tempcx, &SandboxClass, nsnull, nsnull);
18323 if (!sandbox)
18324 return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval);
18326 + JS_SetGlobalObject(tempcx, sandbox);
18328 rv = xpc->InitClasses(cx, sandbox);
18329 if (NS_SUCCEEDED(rv) &&
18330 !JS_DefineFunctions(cx, sandbox, SandboxFunctions)) {
18331 @@ -2400,7 +2406,7 @@ nsXPCComponents_Utils::EvalInSandbox(con
18332 return NS_ERROR_FAILURE;
18335 - JSContext *sandcx = JS_NewContext(JS_GetRuntime(cx), 1024);
18336 + XPCAutoJSContext sandcx(JS_NewContext(JS_GetRuntime(cx), 1024), false);
18337 if(!sandcx) {
18338 JS_ReportError(cx, "Can't prepare context for evalInSandbox");
18339 JSPRINCIPALS_DROP(cx, jsPrincipals);
18340 @@ -2417,7 +2423,6 @@ nsXPCComponents_Utils::EvalInSandbox(con
18341 JS_ReportError(cx,
18342 "Unable to initialize XPConnect with the sandbox context");
18343 JSPRINCIPALS_DROP(cx, jsPrincipals);
18344 - JS_DestroyContextNoGC(sandcx);
18345 return NS_ERROR_FAILURE;
18348 @@ -2434,7 +2439,7 @@ nsXPCComponents_Utils::EvalInSandbox(con
18349 JSStackFrame frame;
18350 memset(&frame, 0, sizeof frame);
18352 - sandcx->fp = &frame;
18353 + NS_STATIC_CAST(JSContext *, sandcx)->fp = &frame;
18355 // Get the current source info from xpc. Use the codebase as a fallback,
18356 // though.
18357 @@ -2457,7 +2462,6 @@ nsXPCComponents_Utils::EvalInSandbox(con
18358 PromiseFlatString(source).get()),
18359 source.Length(), filename.get(),
18360 lineNo, rval)) {
18362 jsval exn;
18363 if (JS_GetPendingException(sandcx, &exn)) {
18364 JS_SetPendingException(cx, exn);
18365 @@ -2473,7 +2477,6 @@ nsXPCComponents_Utils::EvalInSandbox(con
18366 stack->Pop(nsnull);
18369 - JS_DestroyContextNoGC(sandcx);
18370 JSPRINCIPALS_DROP(cx, jsPrincipals);
18371 return rv;
18372 #endif /* !XPCONNECT_STANDALONE */
18373 diff -uprN --exclude=CVS mozilla/js/src/xpconnect/src/xpcconvert.cpp mozilla.new/js/src/xpconnect/src/xpcconvert.cpp
18374 --- mozilla/js/src/xpconnect/src/xpcconvert.cpp 2005-06-01 03:21:23.000000000 +0200
18375 +++ mozilla.new/js/src/xpconnect/src/xpcconvert.cpp 2006-03-12 20:04:08.000000000 +0100
18376 @@ -1169,6 +1169,12 @@ XPCConvert::JSObject2NativeInterface(XPC
18378 // else...
18380 + // XXX E4X breaks the world. Don't try wrapping E4X objects!
18381 + // This hack can be removed (or changed accordingly) when the
18382 + // DOM <-> E4X bindings are complete, see bug 270553
18383 + if(JS_TypeOfValue(cx, OBJECT_TO_JSVAL(src)) == JSTYPE_XML)
18384 + return JS_FALSE;
18386 // Does the JSObject have 'nsISupportness'?
18387 // XXX hmm, I wonder if this matters anymore with no
18388 // oldstyle DOM objects around.
18389 diff -uprN --exclude=CVS mozilla/js/src/xpconnect/src/XPCNativeWrapper.cpp mozilla.new/js/src/xpconnect/src/XPCNativeWrapper.cpp
18390 --- mozilla/js/src/xpconnect/src/XPCNativeWrapper.cpp 2006-01-11 23:04:49.000000000 +0100
18391 +++ mozilla.new/js/src/xpconnect/src/XPCNativeWrapper.cpp 2006-02-24 11:16:36.000000000 +0100
18392 @@ -1211,10 +1211,6 @@ XPC_NW_Equality(JSContext *cx, JSObject
18393 return JS_TRUE;
18396 -extern JSBool JS_DLL_CALLBACK
18397 -XPC_WN_Shared_ToString(JSContext *cx, JSObject *obj,
18398 - uintN argc, jsval *argv, jsval *vp);
18400 JS_STATIC_DLL_CALLBACK(JSBool)
18401 XPC_NW_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
18402 jsval *rval)
18403 @@ -1233,6 +1229,10 @@ XPC_NW_toString(JSContext *cx, JSObject
18404 return JS_FALSE;
18406 jsid id = rt->GetStringID(XPCJSRuntime::IDX_TO_STRING);
18407 + jsval idAsVal;
18408 + if (!::JS_IdToValue(cx, id, &idAsVal)) {
18409 + return JS_FALSE;
18412 XPCWrappedNative *wrappedNative =
18413 XPCNativeWrapper::GetWrappedNative(cx, obj);
18414 @@ -1249,49 +1249,71 @@ XPC_NW_toString(JSContext *cx, JSObject
18415 return JS_TRUE;
18418 + // Someone is trying to call toString on our wrapped object.
18419 JSObject *wn_obj = wrappedNative->GetFlatJSObject();
18420 - jsval toStringVal;
18422 - // Check whether toString has been overridden from its XPCWrappedNative
18423 - // default native method.
18424 - if (!OBJ_GET_PROPERTY(cx, wn_obj, id, &toStringVal)) {
18425 - return JS_FALSE;
18426 + XPCCallContext ccx(JS_CALLER, cx, wn_obj, nsnull, idAsVal);
18427 + if (!ccx.IsValid()) {
18428 + // Shouldn't really happen.
18429 + return ThrowException(NS_ERROR_FAILURE, cx);
18432 - JSBool overridden = JS_TypeOfValue(cx, toStringVal) != JSTYPE_FUNCTION;
18433 - if (!overridden) {
18434 - JSObject *toStringFunObj = JSVAL_TO_OBJECT(toStringVal);
18435 - JSFunction *toStringFun = (JSFunction*) ::JS_GetPrivate(cx, toStringFunObj);
18436 + XPCNativeInterface *iface = ccx.GetInterface();
18437 + XPCNativeMember *member = ccx.GetMember();
18438 + JSBool overridden = JS_FALSE;
18439 + jsval toStringVal;
18441 - overridden =
18442 - ::JS_GetFunctionNative(cx, toStringFun) != XPC_WN_Shared_ToString;
18443 + // First, try to see if the object declares a toString in its IDL. If it does,
18444 + // then we need to defer to that.
18445 + if (iface && member) {
18446 + if (!member->GetValue(ccx, iface, &toStringVal)) {
18447 + return JS_FALSE;
18450 + overridden = member->IsMethod();
18453 - JSString* str;
18454 + JSString* str = nsnull;
18455 if (overridden) {
18456 - // Something overrides XPCWrappedNative.prototype.toString, we
18457 - // should defer to it.
18458 + // Defer to the IDL-declared toString.
18460 - str = ::JS_ValueToString(cx, OBJECT_TO_JSVAL(wn_obj));
18461 - } else {
18462 + AUTO_MARK_JSVAL(ccx, toStringVal);
18464 + JSObject *funobj = xpc_CloneJSFunction(ccx, JSVAL_TO_OBJECT(toStringVal),
18465 + wn_obj);
18466 + if (!funobj) {
18467 + return JS_FALSE;
18470 + jsval v;
18471 + if (!::JS_CallFunctionValue(cx, wn_obj, OBJECT_TO_JSVAL(funobj), argc, argv,
18472 + &v)) {
18473 + return JS_FALSE;
18476 + if (JSVAL_IS_STRING(v)) {
18477 + str = JSVAL_TO_STRING(v);
18481 + if (!str) {
18482 // Ok, we do no damage, and add value, by returning our own idea
18483 // of what toString() should be.
18484 + // Note: We can't just call JS_ValueToString on the wrapped object. Instead,
18485 + // we need to call the wrapper's ToString in order to safely convert our
18486 + // object to a string.
18488 nsAutoString resultString;
18489 resultString.AppendLiteral("[object XPCNativeWrapper");
18491 - if (wrappedNative) {
18492 - JSString *str = ::JS_ValueToString(cx, OBJECT_TO_JSVAL(wn_obj));
18493 - if (!str) {
18494 - return JS_FALSE;
18497 - resultString.Append(' ');
18498 - resultString.Append(NS_REINTERPRET_CAST(PRUnichar *,
18499 - ::JS_GetStringChars(str)),
18500 - ::JS_GetStringLength(str));
18501 + char *wrapperStr = wrappedNative->ToString(ccx);
18502 + if (!wrapperStr) {
18503 + return JS_FALSE;
18506 + resultString.Append(' ');
18507 + resultString.AppendASCII(wrapperStr);
18508 + JS_smprintf_free(wrapperStr);
18510 resultString.Append(']');
18512 str = ::JS_NewUCStringCopyN(cx, NS_REINTERPRET_CAST(const jschar *,
18513 diff -uprN --exclude=CVS mozilla/js/src/xpconnect/src/xpcprivate.h mozilla.new/js/src/xpconnect/src/xpcprivate.h
18514 --- mozilla/js/src/xpconnect/src/xpcprivate.h 2005-10-19 23:48:32.000000000 +0200
18515 +++ mozilla.new/js/src/xpconnect/src/xpcprivate.h 2006-02-24 11:16:36.000000000 +0100
18516 @@ -385,6 +385,34 @@ private:
18517 static void operator delete(void* /*memory*/) {}
18520 +// A helper class to deal with temporary JS contexts. It destroys the context
18521 +// when it goes out of scope.
18522 +class XPCAutoJSContext
18524 +public:
18525 + XPCAutoJSContext(JSContext *aContext, PRBool aGCOnDestroy)
18526 + : mContext(aContext), mGCOnDestroy(aGCOnDestroy)
18530 + ~XPCAutoJSContext()
18532 + if(!mContext)
18533 + return;
18535 + if(mGCOnDestroy)
18536 + JS_DestroyContext(mContext);
18537 + else
18538 + JS_DestroyContextNoGC(mContext);
18541 + operator JSContext * () {return mContext;}
18543 +private:
18544 + JSContext *mContext;
18545 + PRBool mGCOnDestroy;
18548 /***************************************************************************
18549 ****************************************************************************
18551 @@ -3106,6 +3134,31 @@ private:
18552 jsrefcount mDepth;
18555 +class AutoJSSuspendRequestWithNoCallContext
18557 +public:
18558 + AutoJSSuspendRequestWithNoCallContext(JSContext *aCX)
18559 + : mCX(aCX) {SuspendRequest();}
18560 + ~AutoJSSuspendRequestWithNoCallContext() {ResumeRequest();}
18562 + void ResumeRequest() {
18563 + if(mCX) {
18564 + JS_ResumeRequest(mCX, mDepth);
18565 + mCX = nsnull;
18568 +private:
18569 + void SuspendRequest() {
18570 + if(JS_GetContextThread(mCX))
18571 + mDepth = JS_SuspendRequest(mCX);
18572 + else
18573 + mCX = nsnull;
18575 +private:
18576 + JSContext* mCX;
18577 + jsrefcount mDepth;
18580 /*****************************************/
18582 class AutoJSRequestWithNoCallContext
18583 diff -uprN --exclude=CVS mozilla/js/src/xpconnect/src/xpcruntimesvc.cpp mozilla.new/js/src/xpconnect/src/xpcruntimesvc.cpp
18584 --- mozilla/js/src/xpconnect/src/xpcruntimesvc.cpp 2005-05-12 05:55:41.000000000 +0200
18585 +++ mozilla.new/js/src/xpconnect/src/xpcruntimesvc.cpp 2006-02-24 11:16:36.000000000 +0100
18586 @@ -140,6 +140,14 @@ nsJSRuntimeServiceImpl::GetRuntime(JSRun
18587 mRuntime = JS_NewRuntime(gGCSize);
18588 if(!mRuntime)
18589 return NS_ERROR_OUT_OF_MEMORY;
18591 + // Unconstrain the runtime's threshold on nominal heap size, to avoid
18592 + // triggering GC too often if operating continuously near an arbitrary
18593 + // finite threshold (0xffffffff is infinity for uint32 parameters).
18594 + // This leaves the maximum-JS_malloc-bytes threshold still in effect
18595 + // to cause period, and we hope hygienic, last-ditch GCs from within
18596 + // the GC's allocator.
18597 + JS_SetGCParameter(mRuntime, JSGC_MAX_BYTES, 0xffffffff);
18599 *runtime = mRuntime;
18600 return NS_OK;
18601 diff -uprN --exclude=CVS mozilla/js/src/xpconnect/src/xpcwrappedjsclass.cpp mozilla.new/js/src/xpconnect/src/xpcwrappedjsclass.cpp
18602 --- mozilla/js/src/xpconnect/src/xpcwrappedjsclass.cpp 2005-11-03 05:33:58.000000000 +0100
18603 +++ mozilla.new/js/src/xpconnect/src/xpcwrappedjsclass.cpp 2006-03-03 07:13:08.000000000 +0100
18604 @@ -1337,6 +1337,9 @@ pre_call_clean_up:
18605 // Make sure "this" doesn't get deleted during this call.
18606 nsCOMPtr<nsIXPCWrappedJSClass> kungFuDeathGrip(this);
18608 + result = JSVAL_NULL;
18609 + AUTO_MARK_JSVAL(ccx, &result);
18611 if(!readyToDoTheCall)
18612 goto done;
18614 diff -uprN --exclude=CVS mozilla/js/src/xpconnect/src/xpcwrappednativejsops.cpp mozilla.new/js/src/xpconnect/src/xpcwrappednativejsops.cpp
18615 --- mozilla/js/src/xpconnect/src/xpcwrappednativejsops.cpp 2005-10-11 23:17:10.000000000 +0200
18616 +++ mozilla.new/js/src/xpconnect/src/xpcwrappednativejsops.cpp 2006-02-24 11:16:36.000000000 +0100
18617 @@ -119,7 +119,7 @@ ToStringGuts(XPCCallContext& ccx)
18619 /***************************************************************************/
18621 -JSBool JS_DLL_CALLBACK
18622 +JS_STATIC_DLL_CALLBACK(JSBool)
18623 XPC_WN_Shared_ToString(JSContext *cx, JSObject *obj,
18624 uintN argc, jsval *argv, jsval *vp)
18626 diff -uprN --exclude=CVS mozilla/layout/base/nsCSSFrameConstructor.cpp mozilla.new/layout/base/nsCSSFrameConstructor.cpp
18627 --- mozilla/layout/base/nsCSSFrameConstructor.cpp 2006-01-09 06:48:53.000000000 +0100
18628 +++ mozilla.new/layout/base/nsCSSFrameConstructor.cpp 2006-03-12 20:04:19.000000000 +0100
18629 @@ -22,6 +22,7 @@
18631 * Contributor(s):
18632 * Dan Rosen <dr@netscape.com>
18633 + * Mats Palmgren <mats.palmgren@bredband.net>
18635 * Alternatively, the contents of this file may be used under the terms of
18636 * either of the GNU General Public License Version 2 or later (the "GPL"),
18637 @@ -273,7 +274,7 @@ static FrameCtorDebugFlags gFlags[] = {
18638 #include "nsPopupSetFrame.h"
18639 #include "nsTreeColFrame.h"
18640 #include "nsIBoxObject.h"
18641 -#include "nsIListBoxObject.h"
18642 +#include "nsPIListBoxObject.h"
18643 #include "nsListBoxBodyFrame.h"
18644 #include "nsListItemFrame.h"
18646 @@ -390,6 +391,11 @@ static PRInt32 FFWC_nextInFlows=0;
18647 static PRInt32 FFWC_slowSearchForText=0;
18648 #endif
18650 +static nsresult
18651 +DeletingFrameSubtree(nsPresContext* aPresContext,
18652 + nsFrameManager* aFrameManager,
18653 + nsIFrame* aFrame);
18655 #ifdef MOZ_SVG
18657 // Test to see if this language is supported
18658 @@ -526,7 +532,11 @@ GetIBContainingBlockFor(nsIFrame* aFrame
18659 return aFrame;
18662 - if (!IsFrameSpecial(parentFrame))
18663 + // Note that we ignore non-special frames which have a pseudo on their
18664 + // style context -- they're not the frames we're looking for! In
18665 + // particular, they may be hiding a real parent that _is_ special.
18666 + if (!IsFrameSpecial(parentFrame) &&
18667 + !parentFrame->GetStyleContext()->GetPseudoType())
18668 break;
18670 aFrame = parentFrame;
18671 @@ -1106,12 +1116,18 @@ public:
18672 ~nsFrameConstructorState();
18674 // Function to push the existing absolute containing block state and
18675 - // create a new scope.
18676 + // create a new scope. Code that uses this function should get matching
18677 + // logic in GetAbsoluteContainingBlock.
18678 void PushAbsoluteContainingBlock(nsIFrame* aNewAbsoluteContainingBlock,
18679 nsFrameConstructorSaveState& aSaveState);
18681 // Function to push the existing float containing block state and
18682 - // create a new scope
18683 + // create a new scope. Code that uses this function should get matching
18684 + // logic in GetFloatContainingBlock.
18685 + // Pushing a null float containing block forbids any frames from being
18686 + // floated until a new float containing block is pushed.
18687 + // XXX we should get rid of null float containing blocks and teach the
18688 + // various frame classes to deal with floats instead.
18689 void PushFloatContainingBlock(nsIFrame* aNewFloatContainingBlock,
18690 nsFrameConstructorSaveState& aSaveState,
18691 PRBool aFirstLetterStyle,
18692 @@ -5320,9 +5336,14 @@ nsCSSFrameConstructor::ConstructTextFram
18694 #ifdef MOZ_SVG
18695 nsresult rv;
18696 - nsCOMPtr<nsISVGTextContainerFrame> svg_parent = do_QueryInterface(aParentFrame);
18697 - if (svg_parent)
18699 + if (aParentFrame->IsFrameOfType(nsIFrame::eSVG)) {
18700 + nsCOMPtr<nsISVGTextContainerFrame> svg_parent = do_QueryInterface(aParentFrame);
18701 + if (!svg_parent) {
18702 + return NS_OK;
18704 rv = NS_NewSVGGlyphFrame(mPresShell, aContent, aParentFrame, &newFrame);
18706 else
18707 rv = NS_NewTextFrame(mPresShell, &newFrame);
18708 #else
18709 @@ -5880,6 +5901,11 @@ nsCSSFrameConstructor::ConstructXULFrame
18710 PRBool isXULNS = (aNameSpaceID == kNameSpaceID_XUL);
18711 PRBool isXULDisplay = IsXULDisplayType(display);
18713 + // don't apply xul display types to tag based frames
18714 + if (isXULDisplay && !isXULNS) {
18715 + isXULDisplay = !IsSpecialContent(aContent, aTag, aNameSpaceID);
18718 if (isXULNS || isXULDisplay) {
18719 PRBool mayBeScrollable = PR_FALSE;
18721 @@ -7059,6 +7085,10 @@ nsCSSFrameConstructor::ConstructMathMLFr
18722 return rv;
18725 + // Push a null float containing block to disable floating within mathml
18726 + nsFrameConstructorSaveState saveState;
18727 + aState.PushFloatContainingBlock(nsnull, saveState, PR_FALSE, PR_FALSE);
18729 // MathML frames are inline frames, so just process their kids
18730 nsFrameItems childItems;
18731 rv = ProcessChildren(aState, aContent, newFrame, PR_TRUE,
18732 @@ -7714,6 +7744,19 @@ nsCSSFrameConstructor::ConstructFrameInt
18733 return ConstructTextFrame(aState, aContent, adjParentFrame, styleContext,
18734 *frameItems, pseudoParent);
18736 +#ifdef MOZ_SVG
18737 + // Don't create frames for non-SVG children of SVG elements
18738 + if (aNameSpaceID != kNameSpaceID_SVG &&
18739 + aParentFrame &&
18740 + aParentFrame->IsFrameOfType(nsIFrame::eSVG)
18741 +#ifdef MOZ_SVG_FOREIGNOBJECT
18742 + && !aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)
18743 +#endif
18744 + ) {
18745 + return NS_OK;
18747 +#endif
18749 // Style resolution can normally happen lazily. However, getting the
18750 // Visibility struct can cause |SetBidiEnabled| to be called on the
18751 // pres context, and this needs to happen before we start reflow, so
18752 @@ -7981,7 +8024,7 @@ nsCSSFrameConstructor::GetFloatContainin
18754 // Starting with aFrame, look for a frame that is a float containing block
18755 for (nsIFrame* containingBlock = aFrame;
18756 - containingBlock;
18757 + containingBlock && !containingBlock->IsFrameOfType(nsIFrame::eMathML);
18758 containingBlock = containingBlock->GetParent()) {
18759 if (containingBlock->IsFloatContainingBlock()) {
18760 return containingBlock;
18761 @@ -8879,13 +8922,6 @@ nsCSSFrameConstructor::AddDummyFrameToSe
18762 return NS_ERROR_FAILURE;
18765 -// defined below
18766 -static nsresult
18767 -DeletingFrameSubtree(nsPresContext* aPresContext,
18768 - nsIPresShell* aPresShell,
18769 - nsFrameManager* aFrameManager,
18770 - nsIFrame* aFrame);
18772 nsresult
18773 nsCSSFrameConstructor::RemoveDummyFrameFromSelect(nsIContent* aContainer,
18774 nsIContent* aChild,
18775 @@ -8913,8 +8949,8 @@ nsCSSFrameConstructor::RemoveDummyFrameF
18776 nsIFrame* parentFrame = dummyFrame->GetParent();
18778 nsFrameManager *frameManager = mPresShell->FrameManager();
18779 - DeletingFrameSubtree(mPresShell->GetPresContext(), mPresShell,
18780 - frameManager, dummyFrame);
18781 + ::DeletingFrameSubtree(mPresShell->GetPresContext(),
18782 + frameManager, dummyFrame);
18783 frameManager->RemoveFrame(parentFrame, nsnull, dummyFrame);
18784 return NS_OK;
18786 @@ -9061,19 +9097,24 @@ PRBool NotifyListBoxBody(nsPresContext*
18787 nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(aContainer);
18788 nsCOMPtr<nsIBoxObject> boxObject;
18789 xulElement->GetBoxObject(getter_AddRefs(boxObject));
18790 - nsCOMPtr<nsIListBoxObject> listBoxObject = do_QueryInterface(boxObject);
18791 + nsCOMPtr<nsPIListBoxObject> listBoxObject = do_QueryInterface(boxObject);
18792 if (listBoxObject) {
18793 - nsIListBoxObject* listboxBody;
18794 - listBoxObject->GetListboxBody(&listboxBody);
18795 + nsIListBoxObject* listboxBody = listBoxObject->GetListBoxBody();
18796 if (listboxBody) {
18797 nsListBoxBodyFrame *listBoxBodyFrame = NS_STATIC_CAST(nsListBoxBodyFrame*, listboxBody);
18798 - if (aOperation == CONTENT_REMOVED)
18799 - listBoxBodyFrame->OnContentRemoved(aPresContext, aChildFrame, aIndexInContainer);
18800 - else
18801 + if (aOperation == CONTENT_REMOVED) {
18802 + // Except if we have an aChildFrame and its parent is not the right
18803 + // thing, then we don't do this. Pseudo frames are so much fun....
18804 + if (!aChildFrame || aChildFrame->GetParent() == listBoxBodyFrame) {
18805 + listBoxBodyFrame->OnContentRemoved(aPresContext, aChildFrame,
18806 + aIndexInContainer);
18807 + return PR_TRUE;
18809 + } else {
18810 listBoxBodyFrame->OnContentInserted(aPresContext, aChild);
18811 - //NS_RELEASE(listBoxBodyFrame); frames aren't refcounted
18812 + return PR_TRUE;
18815 - return PR_TRUE;
18819 @@ -9556,15 +9597,12 @@ nsCSSFrameConstructor::ReinsertContent(n
18821 static nsresult
18822 DoDeletingFrameSubtree(nsPresContext* aPresContext,
18823 - nsIPresShell* aPresShell,
18824 - nsFrameManager* aFrameManager,
18825 - nsVoidArray& aDestroyQueue,
18826 - nsIFrame* aRemovedFrame,
18827 - nsIFrame* aFrame)
18828 + nsFrameManager* aFrameManager,
18829 + nsVoidArray& aDestroyQueue,
18830 + nsIFrame* aRemovedFrame,
18831 + nsIFrame* aFrame)
18833 - NS_PRECONDITION(aFrameManager, "no frame manager");
18835 - // Remove the mapping from the content object to its frame
18836 + // Remove the mapping from the content object to its frame.
18837 nsIContent* content = aFrame->GetContent();
18838 if (content) {
18839 aFrameManager->SetPrimaryFrameFor(content, nsnull);
18840 @@ -9572,58 +9610,54 @@ DoDeletingFrameSubtree(nsPresContext* a
18841 aFrameManager->ClearAllUndisplayedContentIn(content);
18844 - // Walk aFrame's child frames
18845 nsIAtom* childListName = nsnull;
18846 PRInt32 childListIndex = 0;
18848 do {
18849 - // Walk aFrame's child frames looking for placeholder frames
18850 + // Walk aFrame's normal flow child frames looking for placeholder frames.
18851 nsIFrame* childFrame = aFrame->GetFirstChild(childListName);
18852 - while (childFrame) {
18853 - // The subtree we need to follow to get to the children; by
18854 - // default, the childFrame.
18855 - nsIFrame* subtree = childFrame;
18857 - // See if it's a placeholder frame
18858 - if (nsLayoutAtoms::placeholderFrame == childFrame->GetType()) {
18859 - // Get the out-of-flow frame
18860 + for (; childFrame; childFrame = childFrame->GetNextSibling()) {
18861 + if (NS_LIKELY(nsLayoutAtoms::placeholderFrame != childFrame->GetType())) {
18862 + DoDeletingFrameSubtree(aPresContext, aFrameManager, aDestroyQueue,
18863 + aRemovedFrame, childFrame);
18865 + } else {
18866 nsIFrame* outOfFlowFrame =
18867 nsPlaceholderFrame::GetRealFrameForPlaceholder(childFrame);
18869 - // Remove the mapping from the out-of-flow frame to its placeholder
18870 + // Remove the mapping from the out-of-flow frame to its placeholder.
18871 aFrameManager->UnregisterPlaceholderFrame((nsPlaceholderFrame*)childFrame);
18873 - // Destroy the out-of-flow frame only if aRemovedFrame is _not_
18874 + ((nsPlaceholderFrame*)childFrame)->SetOutOfFlowFrame(nsnull);
18876 + // Queue the out-of-flow frame to be destroyed only if aRemovedFrame is _not_
18877 // one of its ancestor frames or if it is a popup frame.
18878 // If aRemovedFrame is an ancestor of the out-of-flow frame, then
18879 // the out-of-flow frame will be destroyed by aRemovedFrame.
18880 - const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
18881 - if (display->mDisplay == NS_STYLE_DISPLAY_POPUP ||
18882 + if (outOfFlowFrame->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_POPUP ||
18883 !nsLayoutUtils::IsProperAncestorFrame(aRemovedFrame, outOfFlowFrame)) {
18884 - if (aDestroyQueue.IndexOf(outOfFlowFrame) < 0)
18885 - aDestroyQueue.AppendElement(outOfFlowFrame);
18887 - // We want to descend into the out-of-flow frame's subtree,
18888 - // not the placeholder frame's!
18889 - subtree = outOfFlowFrame;
18890 + NS_ASSERTION(aDestroyQueue.IndexOf(outOfFlowFrame) == kNotFound,
18891 + "out-of-flow is already in the destroy queue");
18892 + aDestroyQueue.AppendElement(outOfFlowFrame);
18893 + // Recurse into the out-of-flow, it is now the aRemovedFrame.
18894 + DoDeletingFrameSubtree(aPresContext, aFrameManager, aDestroyQueue,
18895 + outOfFlowFrame, outOfFlowFrame);
18897 + else {
18898 + // Also recurse into the out-of-flow when it's a descendant of aRemovedFrame
18899 + // since we don't walk those lists, see |childListName| increment below.
18900 + DoDeletingFrameSubtree(aPresContext, aFrameManager, aDestroyQueue,
18901 + aRemovedFrame, outOfFlowFrame);
18904 - // Note that if outOfFlowFrame is aRemovedFrame's descendant we don't
18905 - // need to explicitly recurse into outOfFlowFrame here, since we'll do
18906 - // it whenever we recurse into the appropriate child and into its
18907 - // appropriate child list.
18910 - // Recursively find and delete any of its out-of-flow frames,
18911 - // and remove the mapping from content objects to frames
18912 - DoDeletingFrameSubtree(aPresContext, aPresShell, aFrameManager, aDestroyQueue,
18913 - aRemovedFrame, subtree);
18915 - // Get the next sibling child frame
18916 - childFrame = childFrame->GetNextSibling();
18919 - childListName = aFrame->GetAdditionalChildListName(childListIndex++);
18920 + // Move to next child list but skip lists with frames we should have
18921 + // a placeholder for.
18922 + do {
18923 + childListName = aFrame->GetAdditionalChildListName(childListIndex++);
18924 + } while (childListName == nsLayoutAtoms::floatList ||
18925 + childListName == nsLayoutAtoms::absoluteList ||
18926 + childListName == nsLayoutAtoms::fixedList);
18927 } while (childListName);
18929 return NS_OK;
18930 @@ -9635,80 +9669,76 @@ DoDeletingFrameSubtree(nsPresContext* a
18932 static nsresult
18933 DeletingFrameSubtree(nsPresContext* aPresContext,
18934 - nsIPresShell* aPresShell,
18935 - nsFrameManager* aFrameManager,
18936 - nsIFrame* aFrame)
18937 + nsFrameManager* aFrameManager,
18938 + nsIFrame* aFrame)
18940 - // If there's no frame manager it's probably because the pres shell is
18941 - // being destroyed
18942 NS_ENSURE_TRUE(aFrame, NS_OK); // XXXldb Remove this sometime in the future.
18943 - if (aFrameManager) {
18944 - nsAutoVoidArray destroyQueue;
18946 - // If it's a "special" block-in-inline frame, then we need to
18947 - // remember to delete our special siblings, too. Since every one of
18948 - // the next-in-flows has the same special sibling, just do this
18949 - // once, rather than in the loop below.
18950 - if (IsFrameSpecial(aFrame)) {
18951 - nsIFrame* specialSibling;
18952 - GetSpecialSibling(aFrameManager, aFrame, &specialSibling);
18953 - if (specialSibling)
18954 - DeletingFrameSubtree(aPresContext, aPresShell, aFrameManager,
18955 - specialSibling);
18957 + // If there's no frame manager it's probably because the pres shell is
18958 + // being destroyed.
18959 + if (NS_UNLIKELY(!aFrameManager)) {
18960 + return NS_OK;
18963 - do {
18964 - DoDeletingFrameSubtree(aPresContext, aPresShell, aFrameManager,
18965 - destroyQueue, aFrame, aFrame);
18966 + nsAutoVoidArray destroyQueue;
18968 + // If it's a "special" block-in-inline frame, then we can't really deal.
18969 + // That really shouldn't be happening.
18970 + NS_ASSERTION(!IsFrameSpecial(aFrame),
18971 + "DeletingFrameSubtree on a special frame. Prepare to crash.");
18973 + do {
18974 + DoDeletingFrameSubtree(aPresContext, aFrameManager, destroyQueue,
18975 + aFrame, aFrame);
18977 - // If it's split, then get the continuing frame. Note that we only do
18978 - // this for the top-most frame being deleted. Don't do it if we're
18979 - // recursing over a subtree, because those continuing frames should be
18980 - // found as part of the walk over the top-most frame's continuing frames.
18981 - // Walking them again will make this an N^2/2 algorithm
18982 - aFrame = aFrame->GetNextInFlow();
18983 - } while (aFrame);
18985 - // Now destroy any frames that have been enqueued for destruction.
18986 - for (PRInt32 i = destroyQueue.Count() - 1; i >= 0; --i) {
18987 - nsIFrame* outOfFlowFrame = NS_STATIC_CAST(nsIFrame*, destroyQueue[i]);
18988 + // If it's split, then get the continuing frame. Note that we only do
18989 + // this for the top-most frame being deleted. Don't do it if we're
18990 + // recursing over a subtree, because those continuing frames should be
18991 + // found as part of the walk over the top-most frame's continuing frames.
18992 + // Walking them again will make this an N^2/2 algorithm.
18993 + aFrame = aFrame->GetNextInFlow();
18994 + } while (aFrame);
18996 + // Now destroy any out-of-flow frames that have been enqueued for destruction.
18997 + for (PRInt32 i = destroyQueue.Count() - 1; i >= 0; --i) {
18998 + nsIFrame* outOfFlowFrame = NS_STATIC_CAST(nsIFrame*, destroyQueue[i]);
19000 #ifdef MOZ_XUL
19001 - const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
19002 - if (display->mDisplay == NS_STYLE_DISPLAY_POPUP) {
19003 - // Locate the root popup set and remove ourselves from the popup set's list
19004 - // of popup frames.
19005 - nsIFrame* rootFrame = aFrameManager->GetRootFrame();
19006 - if (rootFrame)
19007 - rootFrame = rootFrame->GetFirstChild(nsnull);
19008 - nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
19009 - NS_ASSERTION(rootBox, "unexpected null pointer");
19010 - if (rootBox) {
19011 - nsIFrame* popupSetFrame;
19012 - rootBox->GetPopupSetFrame(&popupSetFrame);
19013 - NS_ASSERTION(popupSetFrame, "unexpected null pointer");
19014 - if (popupSetFrame) {
19015 - nsCOMPtr<nsIPopupSetFrame> popupSet(do_QueryInterface(popupSetFrame));
19016 - NS_ASSERTION(popupSet, "unexpected null pointer");
19017 - if (popupSet)
19018 - popupSet->RemovePopupFrame(outOfFlowFrame);
19020 + const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
19021 + if (display->mDisplay == NS_STYLE_DISPLAY_POPUP) {
19022 + // Locate the root popup set and remove ourselves from the popup set's list
19023 + // of popup frames.
19024 + nsIFrame* rootFrame = aFrameManager->GetRootFrame();
19025 + if (rootFrame)
19026 + rootFrame = rootFrame->GetFirstChild(nsnull);
19027 + nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
19028 + NS_ASSERTION(rootBox, "unexpected null pointer");
19029 + if (rootBox) {
19030 + nsIFrame* popupSetFrame;
19031 + rootBox->GetPopupSetFrame(&popupSetFrame);
19032 + NS_ASSERTION(popupSetFrame, "unexpected null pointer");
19033 + if (popupSetFrame) {
19034 + nsCOMPtr<nsIPopupSetFrame> popupSet(do_QueryInterface(popupSetFrame));
19035 + NS_ASSERTION(popupSet, "unexpected null pointer");
19036 + if (popupSet)
19037 + popupSet->RemovePopupFrame(outOfFlowFrame);
19039 - } else
19041 + } else
19042 #endif
19044 - // Get the out-of-flow frame's parent
19045 - nsIFrame* parentFrame = outOfFlowFrame->GetParent();
19047 + // Get the out-of-flow frame's parent
19048 + nsIFrame* parentFrame = outOfFlowFrame->GetParent();
19050 - // Get the child list name for the out-of-flow frame
19051 - nsCOMPtr<nsIAtom> listName;
19052 - GetChildListNameFor(parentFrame, outOfFlowFrame,
19053 - getter_AddRefs(listName));
19055 - // Ask the parent to delete the out-of-flow frame
19056 - aFrameManager->RemoveFrame(parentFrame,
19057 - listName, outOfFlowFrame);
19059 + // Get the child list name for the out-of-flow frame
19060 + nsCOMPtr<nsIAtom> listName;
19061 + GetChildListNameFor(parentFrame, outOfFlowFrame,
19062 + getter_AddRefs(listName));
19064 + // Ask the out-of-flow's parent to delete the out-of-flow
19065 + // frame from the right list.
19066 + aFrameManager->RemoveFrame(parentFrame,
19067 + listName, outOfFlowFrame);
19071 @@ -9722,8 +9752,8 @@ nsCSSFrameConstructor::RemoveMappingsFor
19072 // Save the frame tree's state before deleting it
19073 CaptureStateFor(aRemovedFrame, mTempFrameTreeState);
19075 - return DeletingFrameSubtree(mPresShell->GetPresContext(), mPresShell,
19076 - mPresShell->FrameManager(), aRemovedFrame);
19077 + return ::DeletingFrameSubtree(mPresShell->GetPresContext(),
19078 + mPresShell->FrameManager(), aRemovedFrame);
19081 nsresult
19082 @@ -9881,7 +9911,7 @@ nsCSSFrameConstructor::ContentRemoved(ns
19084 // Walk the frame subtree deleting any out-of-flow frames, and
19085 // remove the mapping from content objects to frames
19086 - DeletingFrameSubtree(presContext, mPresShell, frameManager, childFrame);
19087 + ::DeletingFrameSubtree(presContext, frameManager, childFrame);
19089 // See if the child frame is a floating frame
19090 // (positioned frames are handled below in the "else" clause)
19091 @@ -9916,8 +9946,7 @@ nsCSSFrameConstructor::ContentRemoved(ns
19092 // that it doesn't retain a dangling pointer to memory)
19093 if (placeholderFrame) {
19094 parentFrame = placeholderFrame->GetParent();
19095 - DeletingFrameSubtree(presContext, mPresShell, frameManager,
19096 - placeholderFrame);
19097 + ::DeletingFrameSubtree(presContext, frameManager, placeholderFrame);
19098 frameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame);
19099 return NS_OK;
19101 @@ -9953,8 +9982,7 @@ nsCSSFrameConstructor::ContentRemoved(ns
19102 // that it doesn't retain a dangling pointer to memory)
19103 if (placeholderFrame) {
19104 parentFrame = placeholderFrame->GetParent();
19105 - DeletingFrameSubtree(presContext, mPresShell, frameManager,
19106 - placeholderFrame);
19107 + DeletingFrameSubtree(presContext, frameManager, placeholderFrame);
19108 rv = frameManager->RemoveFrame(parentFrame,
19109 nsnull, placeholderFrame);
19111 @@ -10077,7 +10105,6 @@ UpdateViewsForTree(nsPresContext* aPresC
19112 // get out of flow frame and start over there
19113 nsIFrame* outOfFlowFrame =
19114 nsPlaceholderFrame::GetRealFrameForPlaceholder(child);
19115 - NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame");
19117 DoApplyRenderingChangeToTree(aPresContext, outOfFlowFrame,
19118 aViewManager, aFrameManager, aChange);
19119 @@ -10877,8 +10904,8 @@ nsCSSFrameConstructor::CantRenderReplace
19121 // Replace the old frame with the new frame
19123 - DeletingFrameSubtree(mPresShell->GetPresContext(), mPresShell,
19124 - frameManager, aFrame);
19125 + ::DeletingFrameSubtree(mPresShell->GetPresContext(), frameManager,
19126 + aFrame);
19128 // Reset the primary frame mapping
19129 frameManager->SetPrimaryFrameFor(content, newFrame);
19130 @@ -11027,8 +11054,7 @@ nsCSSFrameConstructor::CantRenderReplace
19131 newFrame = state.mFloatedItems.childList;
19132 state.mFloatedItems.childList = nsnull;
19134 - DeletingFrameSubtree(state.mPresContext, mPresShell,
19135 - state.mFrameManager, aFrame);
19136 + ::DeletingFrameSubtree(state.mPresContext, state.mFrameManager, aFrame);
19137 state.mFrameManager->ReplaceFrame(parentFrame, listName, aFrame,
19138 newFrame);
19140 @@ -11701,7 +11727,7 @@ nsCSSFrameConstructor::GetInsertionPoint
19142 nsIBindingManager *bindingManager = mDocument->BindingManager();
19144 - nsCOMPtr<nsIContent> insertionElement;
19145 + nsIContent* insertionElement;
19146 if (aChildContent) {
19147 // We've got an explicit insertion child. Check to see if it's
19148 // anonymous.
19149 @@ -11746,6 +11772,16 @@ nsCSSFrameConstructor::GetInsertionPoint
19153 + // fieldsets have multiple insertion points. Note that we might
19154 + // have to look at insertionElement here...
19155 + if (aMultiple && !*aMultiple) {
19156 + nsIContent* content = insertionElement ? insertionElement : container;
19157 + if (content->IsContentOfType(nsIContent::eHTML) &&
19158 + content->Tag() == nsHTMLAtoms::fieldset) {
19159 + *aMultiple = PR_TRUE;
19163 return NS_OK;
19166 @@ -12606,8 +12642,8 @@ nsCSSFrameConstructor::WrapFramesInFirst
19168 else {
19169 // Take the old textFrame out of the inline parents child list
19170 - DeletingFrameSubtree(aState.mPresContext, mPresShell,
19171 - aState.mFrameManager, textFrame);
19172 + ::DeletingFrameSubtree(aState.mPresContext, aState.mFrameManager,
19173 + textFrame);
19174 parentFrame->RemoveFrame(nsnull, textFrame);
19176 // Insert in the letter frame(s)
19177 @@ -12760,8 +12796,7 @@ nsCSSFrameConstructor::RemoveFloatingFir
19178 nsIFrame* nextTextParent = nextTextFrame->GetParent();
19179 if (nextTextParent) {
19180 nsSplittableFrame::BreakFromPrevFlow(nextTextFrame);
19181 - DeletingFrameSubtree(aPresContext, aPresShell,
19182 - aFrameManager, nextTextFrame);
19183 + ::DeletingFrameSubtree(aPresContext, aFrameManager, nextTextFrame);
19184 aFrameManager->RemoveFrame(nextTextParent, nsnull, nextTextFrame);
19187 @@ -12786,7 +12821,7 @@ nsCSSFrameConstructor::RemoveFloatingFir
19188 aFrameManager->UnregisterPlaceholderFrame(placeholderFrame);
19190 // Remove the float frame
19191 - DeletingFrameSubtree(aPresContext, aPresShell, aFrameManager, floatFrame);
19192 + ::DeletingFrameSubtree(aPresContext, aFrameManager, floatFrame);
19193 aFrameManager->RemoveFrame(aBlockFrame, nsLayoutAtoms::floatList,
19194 floatFrame);
19196 @@ -12837,13 +12872,11 @@ nsCSSFrameConstructor::RemoveFirstLetter
19197 textFrame->Init(aPresContext, textContent, aFrame, newSC, nsnull);
19199 // Next rip out the kid and replace it with the text frame
19200 - nsFrameManager* frameManager = aFrameManager;
19201 - DeletingFrameSubtree(aPresContext, aPresShell, frameManager, kid);
19202 - frameManager->RemoveFrame(aFrame, nsnull, kid);
19203 + ::DeletingFrameSubtree(aPresContext, aFrameManager, kid);
19204 + aFrameManager->RemoveFrame(aFrame, nsnull, kid);
19206 // Insert text frame in its place
19207 - frameManager->InsertFrames(aFrame, nsnull,
19208 - prevSibling, textFrame);
19209 + aFrameManager->InsertFrames(aFrame, nsnull, prevSibling, textFrame);
19211 *aStopLooking = PR_TRUE;
19212 break;
19213 @@ -12903,8 +12936,8 @@ nsCSSFrameConstructor::RecoverLetterFram
19215 if (parentFrame) {
19216 // Take the old textFrame out of the parents child list
19217 - DeletingFrameSubtree(aState.mPresContext, mPresShell,
19218 - aState.mFrameManager, textFrame);
19219 + ::DeletingFrameSubtree(aState.mPresContext, aState.mFrameManager,
19220 + textFrame);
19221 parentFrame->RemoveFrame(nsnull, textFrame);
19223 // Insert in the letter frame(s)
19224 @@ -13418,6 +13451,18 @@ nsCSSFrameConstructor::WipeContainingBlo
19225 tmp.SetFrames(aState.mFloatedItems.childList);
19226 tmp.DestroyFrames(presContext);
19227 aState.mFloatedItems.childList = nsnull;
19229 + // If we don't have a containing block, try to find our closest non-inline
19230 + // ancestor. We're guaranteed to have one, since
19231 + // nsStyleContext::ApplyStyleFixups enforces that the root is display:none,
19232 + // display:table, or display:block.
19233 + if (!aContainingBlock) {
19234 + aContainingBlock = aFrame;
19235 + do {
19236 + aContainingBlock = aContainingBlock->GetParent();
19237 + NS_ASSERTION(aContainingBlock, "Must have non-inline frame as root!");
19238 + } while (IsInlineFrame(aContainingBlock));
19241 // Tell parent of the containing block to reformulate the
19242 // entire block. This is painful and definitely not optimal
19243 @@ -13441,8 +13486,8 @@ nsCSSFrameConstructor::WipeContainingBlo
19244 if (parentContainer) {
19245 ReinsertContent(parentContainer, blockContent);
19247 - else {
19248 - NS_ERROR("uh oh. the block we need to reframe has no parent!");
19249 + else if (blockContent->GetCurrentDoc() == mDocument) {
19250 + ReconstructDocElementHierarchy();
19252 return PR_TRUE;
19254 @@ -13552,8 +13597,16 @@ nsCSSFrameConstructor::SplitToContaining
19255 if (! aBlockChildFrame)
19256 return NS_ERROR_NULL_POINTER;
19258 - if (IsBlockFrame(aFrame)) {
19259 - // If aFrame is a block frame, then we're done: make
19260 + // Check whether the frame is an inline. Here "an inline" is an
19261 + // actual inline frame (positioned or not) or a lineframe
19262 + // (corresponding to :first-line), since the latter should stop at
19263 + // the first block it runs into and we might be inserting one in the
19264 + // middle of it.
19265 + nsIAtom* frameType = aFrame->GetType();
19266 + if (frameType != nsLayoutAtoms::inlineFrame &&
19267 + frameType != nsLayoutAtoms::positionedInlineFrame &&
19268 + frameType != nsLayoutAtoms::lineFrame) {
19269 + // If aFrame is a block-like frame, then we're done: make
19270 // aBlockChildFrame and aRightInlineChildFrame children of aFrame,
19271 // and insert aBlockChildFrame and aRightInlineChildFrame after
19272 // aLeftInlineChildFrame
19273 @@ -13780,8 +13833,8 @@ nsresult nsCSSFrameConstructor::RemoveFi
19274 mPresShell->GetPlaceholderFrameFor(fixedChild, &placeholderFrame);
19275 NS_ASSERTION(placeholderFrame, "no placeholder for fixed-pos frame");
19276 nsIFrame* placeholderParent = placeholderFrame->GetParent();
19277 - DeletingFrameSubtree(aState.mPresContext, mPresShell, aState.mFrameManager,
19278 - placeholderFrame);
19279 + ::DeletingFrameSubtree(aState.mPresContext, aState.mFrameManager,
19280 + placeholderFrame);
19281 rv = aState.mFrameManager->RemoveFrame(placeholderParent, nsnull,
19282 placeholderFrame);
19283 if (NS_FAILED(rv)) {
19284 @@ -13789,8 +13842,8 @@ nsresult nsCSSFrameConstructor::RemoveFi
19285 break;
19288 - DeletingFrameSubtree(aState.mPresContext, mPresShell, aState.mFrameManager,
19289 - fixedChild);
19290 + ::DeletingFrameSubtree(aState.mPresContext, aState.mFrameManager,
19291 + fixedChild);
19292 rv = aState.mFrameManager->RemoveFrame(mFixedContainingBlock,
19293 nsLayoutAtoms::fixedList,
19294 fixedChild);
19295 diff -uprN --exclude=CVS mozilla/layout/base/nsImageLoader.cpp mozilla.new/layout/base/nsImageLoader.cpp
19296 --- mozilla/layout/base/nsImageLoader.cpp 2004-12-08 20:39:48.000000000 +0100
19297 +++ mozilla.new/layout/base/nsImageLoader.cpp 2006-02-24 11:16:42.000000000 +0100
19298 @@ -123,7 +123,13 @@ nsImageLoader::Load(imgIRequest *aImage)
19299 mRequest = nsnull;
19302 - return aImage->Clone(this, getter_AddRefs(mRequest));
19303 + // Make sure to clone into a temporary, then set mRequest, since
19304 + // cloning may notify and we don't want to trigger paints from this
19305 + // code.
19306 + nsCOMPtr<imgIRequest> newRequest;
19307 + nsresult rv = aImage->Clone(this, getter_AddRefs(newRequest));
19308 + mRequest.swap(newRequest);
19309 + return rv;
19313 diff -uprN --exclude=CVS mozilla/layout/generic/nsBlockFrame.cpp mozilla.new/layout/generic/nsBlockFrame.cpp
19314 --- mozilla/layout/generic/nsBlockFrame.cpp 2006-01-09 06:48:54.000000000 +0100
19315 +++ mozilla.new/layout/generic/nsBlockFrame.cpp 2006-02-24 11:16:42.000000000 +0100
19316 @@ -5659,14 +5659,10 @@ found_frame:;
19317 NS_ASSERTION(this == aDeletedFrame->GetParent(), "messed up delete code");
19318 NS_ASSERTION(line->Contains(aDeletedFrame), "frame not in line");
19320 - // See if the frame being deleted is the last one on the line
19321 - PRBool isLastFrameOnLine = PR_FALSE;
19322 - if (1 == line->GetChildCount()) {
19323 - isLastFrameOnLine = PR_TRUE;
19325 - else if (line->LastChild() == aDeletedFrame) {
19326 - isLastFrameOnLine = PR_TRUE;
19328 + // If the frame being deleted is the last one on the line then
19329 + // optimize away the line->Contains(next-in-flow) call below.
19330 + PRBool isLastFrameOnLine = (1 == line->GetChildCount() ||
19331 + line->LastChild() == aDeletedFrame);
19333 // Remove aDeletedFrame from the line
19334 nsIFrame* nextFrame = aDeletedFrame->GetNextSibling();
19335 @@ -5703,7 +5699,8 @@ found_frame:;
19336 // to destroy that too.
19337 nsIFrame* deletedNextInFlow = aDeletedFrame->GetNextInFlow();
19338 #ifdef NOISY_REMOVE_FRAME
19339 - printf("DoRemoveFrame: line=%p frame=", line.get());
19340 + printf("DoRemoveFrame: %s line=%p frame=",
19341 + searchingOverflowList?"overflow":"normal", line.get());
19342 nsFrame::ListTag(stdout, aDeletedFrame);
19343 printf(" prevSibling=%p deletedNextInFlow=%p\n", prevSibling, deletedNextInFlow);
19344 #endif
19345 @@ -5714,8 +5711,13 @@ found_frame:;
19347 aDeletedFrame = deletedNextInFlow;
19349 + PRBool haveAdvancedToNextLine = PR_FALSE;
19350 // If line is empty, remove it now.
19351 if (0 == lineChildCount) {
19352 +#ifdef NOISY_REMOVE_FRAME
19353 + printf("DoRemoveFrame: %s line=%p became empty so it will be removed\n",
19354 + searchingOverflowList?"overflow":"normal", line.get());
19355 +#endif
19356 nsLineBox *cur = line;
19357 if (!searchingOverflowList) {
19358 line = mLines.erase(line);
19359 @@ -5726,7 +5728,8 @@ found_frame:;
19360 nsRect lineCombinedArea(cur->GetCombinedArea());
19361 #ifdef NOISY_BLOCK_INVALIDATE
19362 printf("%p invalidate 10 (%d, %d, %d, %d)\n",
19363 - this, lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height);
19364 + this, lineCombinedArea.x, lineCombinedArea.y,
19365 + lineCombinedArea.width, lineCombinedArea.height);
19366 #endif
19367 Invalidate(lineCombinedArea);
19368 } else {
19369 @@ -5745,16 +5748,19 @@ found_frame:;
19370 if (line != line_end) {
19371 line->MarkPreviousMarginDirty();
19373 + haveAdvancedToNextLine = PR_TRUE;
19374 } else {
19375 // Make the line that just lost a frame dirty, and advance to
19376 // the next line.
19377 - if (!deletedNextInFlow || !line->Contains(deletedNextInFlow)) {
19378 + if (!deletedNextInFlow || isLastFrameOnLine ||
19379 + !line->Contains(deletedNextInFlow)) {
19380 line->MarkDirty();
19381 ++line;
19382 + haveAdvancedToNextLine = PR_TRUE;
19386 - if (nsnull != deletedNextInFlow) {
19387 + if (deletedNextInFlow) {
19388 // Continuations for placeholder frames don't always appear in
19389 // consecutive lines. So for placeholders, just continue the slow easy way.
19390 if (isPlaceholder) {
19391 @@ -5769,15 +5775,22 @@ found_frame:;
19392 break;
19395 - // If we just removed the last frame on the line then we need
19396 - // to advance to the next line.
19397 - if (isLastFrameOnLine) {
19398 - TryAllLines(&line, &line_end, &searchingOverflowList);
19399 - // Detect the case when we've run off the end of the normal line
19400 - // list and we're starting the overflow line list
19401 - if (prevSibling && !prevSibling->GetNextSibling()) {
19402 + // If we advanced to the next line then check if we should switch to the
19403 + // overflow line list.
19404 + if (haveAdvancedToNextLine) {
19405 + if (line != line_end && !searchingOverflowList &&
19406 + !line->Contains(deletedNextInFlow)) {
19407 + // We have advanced to the next *normal* line but the next-in-flow
19408 + // is not there - force a switch to the overflow line list.
19409 + line = line_end;
19410 prevSibling = nsnull;
19412 + TryAllLines(&line, &line_end, &searchingOverflowList);
19413 +#ifdef NOISY_REMOVE_FRAME
19414 + printf("DoRemoveFrame: now on %s line=%p prevSibling=%p\n",
19415 + searchingOverflowList?"overflow":"normal", line.get(),
19416 + prevSibling);
19417 +#endif
19421 diff -uprN --exclude=CVS mozilla/layout/generic/nsContainerFrame.cpp mozilla.new/layout/generic/nsContainerFrame.cpp
19422 --- mozilla/layout/generic/nsContainerFrame.cpp 2005-09-06 23:15:12.000000000 +0200
19423 +++ mozilla.new/layout/generic/nsContainerFrame.cpp 2006-03-12 20:04:19.000000000 +0100
19424 @@ -541,6 +541,7 @@ SyncFrameViewGeometryDependentProperties
19425 if (doc) {
19426 nsIContent *rootElem = doc->GetRootContent();
19427 if (!doc->GetParentDocument() &&
19428 + (nsCOMPtr<nsISupports>(doc->GetContainer())) &&
19429 rootElem && rootElem->IsContentOfType(nsIContent::eXUL)) {
19430 // we're XUL at the root of the document hierarchy. Try to make our
19431 // window translucent.
19432 diff -uprN --exclude=CVS mozilla/layout/generic/nsFrame.cpp mozilla.new/layout/generic/nsFrame.cpp
19433 --- mozilla/layout/generic/nsFrame.cpp 2006-01-09 06:48:54.000000000 +0100
19434 +++ mozilla.new/layout/generic/nsFrame.cpp 2006-02-24 11:16:42.000000000 +0100
19435 @@ -4473,6 +4473,19 @@ GetIBSpecialSibling(nsPresContext* aPres
19436 return NS_OK;
19439 +static PRBool
19440 +IsTablePseudo(nsIAtom* aPseudo)
19442 + return
19443 + aPseudo == nsCSSAnonBoxes::tableOuter ||
19444 + aPseudo == nsCSSAnonBoxes::table ||
19445 + aPseudo == nsCSSAnonBoxes::tableRowGroup ||
19446 + aPseudo == nsCSSAnonBoxes::tableRow ||
19447 + aPseudo == nsCSSAnonBoxes::tableCell ||
19448 + aPseudo == nsCSSAnonBoxes::tableColGroup ||
19449 + aPseudo == nsCSSAnonBoxes::tableCol;
19453 * Get the parent, corrected for the mangled frame tree resulting from
19454 * having a block within an inline. The result only differs from the
19455 @@ -4490,17 +4503,22 @@ GetCorrectedParent(nsPresContext* aPresC
19456 nsIFrame *parent = aFrame->GetParent();
19457 *aSpecialParent = parent;
19458 if (parent) {
19459 - nsIAtom* parentPseudo = parent->GetStyleContext()->GetPseudoType();
19460 + nsIAtom* pseudo = aFrame->GetStyleContext()->GetPseudoType();
19462 // if this frame itself is not scrolled-content, then skip any scrolled-content
19463 // parents since they're basically anonymous as far as the style system goes
19464 - if (parentPseudo == nsCSSAnonBoxes::scrolledContent) {
19465 - nsIAtom* pseudo = aFrame->GetStyleContext()->GetPseudoType();
19466 - if (pseudo != nsCSSAnonBoxes::scrolledContent) {
19467 - do {
19468 - parent = parent->GetParent();
19469 - parentPseudo = parent->GetStyleContext()->GetPseudoType();
19470 - } while (parentPseudo == nsCSSAnonBoxes::scrolledContent);
19471 + if (pseudo != nsCSSAnonBoxes::scrolledContent) {
19472 + while (parent->GetStyleContext()->GetPseudoType() ==
19473 + nsCSSAnonBoxes::scrolledContent) {
19474 + parent = parent->GetParent();
19478 + // If the frame is not a table pseudo frame, we want to move up
19479 + // the tree till we get to a non-table-pseudo frame.
19480 + if (!IsTablePseudo(pseudo)) {
19481 + while (IsTablePseudo(parent->GetStyleContext()->GetPseudoType())) {
19482 + parent = parent->GetParent();
19486 diff -uprN --exclude=CVS mozilla/layout/generic/nsIFrame.h mozilla.new/layout/generic/nsIFrame.h
19487 --- mozilla/layout/generic/nsIFrame.h 2005-09-02 22:25:54.000000000 +0200
19488 +++ mozilla.new/layout/generic/nsIFrame.h 2006-03-03 07:14:34.000000000 +0100
19489 @@ -1074,6 +1074,25 @@ public:
19491 virtual nsIAtom* GetType() const = 0;
19494 + /**
19495 + * Bit-flags to pass to IsFrameOfType()
19496 + */
19497 + enum {
19498 + eMathML = 1 << 0,
19499 + eSVG = 1 << 1,
19500 + eSVGForeignObject = 1 << 2
19501 + };
19503 + /**
19504 + * API for doing a quick check if a frame is of a given
19505 + * type. Returns true if the frame matches ALL flags passed in.
19506 + */
19507 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const
19509 + return !aFlags;
19513 * Is this frame a containing block for non-positioned elements?
19515 diff -uprN --exclude=CVS mozilla/layout/generic/nsSelection.cpp mozilla.new/layout/generic/nsSelection.cpp
19516 --- mozilla/layout/generic/nsSelection.cpp 2005-08-28 02:45:04.000000000 +0200
19517 +++ mozilla.new/layout/generic/nsSelection.cpp 2006-02-14 10:01:27.000000000 +0100
19518 @@ -4235,10 +4235,8 @@ nsSelection::SetDelayedCaretData(nsMouse
19519 mDelayedMouseEventValid = PR_TRUE;
19520 mDelayedMouseEvent = *aMouseEvent;
19522 - // XXX: Hmmm, should we AddRef mDelayedMouseEvent->widget?
19523 - // Doing so might introduce a leak if things in the app
19524 - // are not released in the correct order though, so for now
19525 - // don't do anything.
19526 + // Don't cache the widget. We don't need it and it could go away.
19527 + mDelayedMouseEvent.widget = nsnull;
19529 else
19530 mDelayedMouseEventValid = PR_FALSE;
19531 diff -uprN --exclude=CVS mozilla/layout/generic/nsTextFrame.cpp mozilla.new/layout/generic/nsTextFrame.cpp
19532 --- mozilla/layout/generic/nsTextFrame.cpp 2006-01-09 06:48:54.000000000 +0100
19533 +++ mozilla.new/layout/generic/nsTextFrame.cpp 2006-02-14 10:01:28.000000000 +0100
19534 @@ -807,6 +807,23 @@ public:
19535 TextPaintStyle& aStyle,
19536 nscoord dx, nscoord dy);
19538 + /**
19539 + * ComputeTotalWordDimensions and ComputeWordFragmentDimensions work
19540 + * together to measure a text that spans multiple frames, e.g., as in
19541 + * "baseText<b>moreText<i>moreDeepText</i></b>moreAlsoHere"
19542 + * where the total text shoudn't be broken (or the joined pieces should be
19543 + * passed to the linebreaker for examination, especially in i18n cases).
19545 + * ComputeTotalWordDimensions will loop over ComputeWordFragmentDimensions
19546 + * to look-ahead and accumulate the joining fragments.
19548 + * @param aNextFrame is the first textFrame after the baseText's textFrame.
19550 + * @param aBaseDimensions is the dimension of baseText.
19552 + * @param aCanBreakBefore is false when it is not possible to break before
19553 + * the baseText (e.g., when this is the first word on the line).
19554 + */
19555 nsTextDimensions ComputeTotalWordDimensions(nsPresContext* aPresContext,
19556 nsILineBreaker* aLineBreaker,
19557 nsLineLayout& aLineLayout,
19558 @@ -818,6 +835,19 @@ public:
19559 PRUint32 aWordBufSize,
19560 PRBool aCanBreakBefore);
19562 + /**
19563 + * @param aNextFrame is the textFrame following the current fragment.
19565 + * @param aMoreSize plays a double role. The process should continue
19566 + * normally when it is zero. But when it returns -1, it means that there is
19567 + * no more fragment of interest and the look-ahead should be stopped. When
19568 + * it returns a positive value, it means that the current buffer (aWordBuf
19569 + * of size aWordBufSize) is not big enough to accumulate the current fragment.
19570 + * The returned positive value is the shortfall.
19572 + * @param aWordBufLen is the accumulated length of the fragments that have
19573 + * been accounted for so far.
19574 + */
19575 nsTextDimensions ComputeWordFragmentDimensions(nsPresContext* aPresContext,
19576 nsILineBreaker* aLineBreaker,
19577 nsLineLayout& aLineLayout,
19578 @@ -825,7 +855,7 @@ public:
19579 nsIFrame* aNextFrame,
19580 nsIContent* aContent,
19581 nsITextContent* aText,
19582 - PRBool* aStop,
19583 + PRInt32* aMoreSize,
19584 const PRUnichar* aWordBuf,
19585 PRUint32 &aWordBufLen,
19586 PRUint32 aWordBufSize,
19587 @@ -6206,20 +6236,19 @@ nsTextFrame::ComputeTotalWordDimensions(
19589 nsCOMPtr<nsITextContent> tc(do_QueryInterface(content));
19590 if (tc) {
19591 - PRBool stop = PR_FALSE;
19592 + PRInt32 moreSize = 0;
19593 nsTextDimensions moreDimensions;
19594 moreDimensions = ComputeWordFragmentDimensions(aPresContext,
19595 aLineBreaker,
19596 aLineLayout,
19597 aReflowState,
19598 aNextFrame, content, tc,
19599 - &stop,
19600 + &moreSize,
19601 newWordBuf,
19602 aWordLen,
19603 newWordBufSize,
19604 aCanBreakBefore);
19605 - if (moreDimensions.width < 0) {
19606 - PRUint32 moreSize = -moreDimensions.width;
19607 + if (moreSize > 0) {
19608 //Oh, wordBuf is too small, we have to grow it
19609 newWordBufSize += moreSize;
19610 if (newWordBuf != aWordBuf) {
19611 @@ -6237,13 +6266,13 @@ nsTextFrame::ComputeTotalWordDimensions(
19612 moreDimensions =
19613 ComputeWordFragmentDimensions(aPresContext, aLineBreaker,
19614 aLineLayout, aReflowState,
19615 - aNextFrame, content, tc, &stop,
19616 + aNextFrame, content, tc, &moreSize,
19617 newWordBuf, aWordLen, newWordBufSize,
19618 aCanBreakBefore);
19619 - NS_ASSERTION((moreDimensions.width >= 0),
19620 - "ComputeWordFragmentWidth is returning negative");
19621 + NS_ASSERTION((moreSize <= 0),
19622 + "ComputeWordFragmentDimensions is asking more buffer");
19623 } else {
19624 - stop = PR_TRUE;
19625 + moreSize = -1;
19626 moreDimensions.Clear();
19629 @@ -6253,7 +6282,7 @@ nsTextFrame::ComputeTotalWordDimensions(
19630 printf(" moreWidth=%d (addedWidth=%d) stop=%c\n", moreDimensions.width,
19631 addedDimensions.width, stop?'T':'F');
19632 #endif
19633 - if (stop) {
19634 + if (moreSize == -1) {
19635 goto done;
19638 @@ -6287,7 +6316,7 @@ nsTextFrame::ComputeWordFragmentDimensio
19639 nsIFrame* aNextFrame,
19640 nsIContent* aContent,
19641 nsITextContent* aText,
19642 - PRBool* aStop,
19643 + PRInt32* aMoreSize,
19644 const PRUnichar* aWordBuf,
19645 PRUint32& aRunningWordLen,
19646 PRUint32 aWordBufSize,
19647 @@ -6307,6 +6336,7 @@ nsTextFrame::ComputeWordFragmentDimensio
19648 wordLen = -1;
19650 #endif // IBMBIDI
19651 + *aMoreSize = 0;
19652 PRUnichar* bp = tx.GetNextWord(PR_TRUE, &wordLen, &contentLen, &isWhitespace, &wasTransformed);
19653 if (!bp) {
19654 //empty text node, but we need to continue lookahead measurement
19655 @@ -6318,17 +6348,18 @@ nsTextFrame::ComputeWordFragmentDimensio
19657 if (isWhitespace) {
19658 // Don't bother measuring nothing
19659 - *aStop = PR_TRUE;
19660 + *aMoreSize = -1; // flag that we should stop now
19661 return dimensions; // 0
19664 - // We need to adjust the length by look at the two pieces together
19665 - // but if we have to grow aWordBuf, ask caller do it by return a negative value of size
19666 + // We need to adjust the length by looking at the two pieces together. But if
19667 + // we have to grow aWordBuf, ask the caller to do it by returning the shortfall
19668 if ((wordLen + aRunningWordLen) > aWordBufSize) {
19669 - dimensions.width = aWordBufSize - wordLen - aRunningWordLen;
19670 - return dimensions;
19671 + *aMoreSize = wordLen + aRunningWordLen - aWordBufSize;
19672 + return dimensions; // 0
19674 - *aStop = contentLen < tx.GetContentLength();
19675 + if (contentLen < tx.GetContentLength())
19676 + *aMoreSize = -1;
19678 // Convert any spaces in the current word back to nbsp's. This keeps
19679 // the breaking logic happy.
19680 @@ -6352,14 +6383,14 @@ nsTextFrame::ComputeWordFragmentDimensio
19681 wordLen = breakP - aRunningWordLen;
19682 if(wordLen < 0)
19683 wordLen = 0;
19684 - *aStop = PR_TRUE;
19685 + *aMoreSize = -1;
19689 // if we don't stop, we need to extend the buf so the next one can
19690 // see this part otherwise, it does not matter since we will stop
19691 // anyway
19692 - if(! *aStop)
19693 + if (*aMoreSize != -1)
19694 aRunningWordLen += wordLen;
19697 @@ -6370,11 +6401,11 @@ nsTextFrame::ComputeWordFragmentDimensio
19698 nsresult lres = aLineBreaker->BreakInBetween(aWordBuf, aRunningWordLen, bp, wordLen, &canBreak);
19699 if (NS_SUCCEEDED(lres) && canBreak) {
19700 wordLen = 0;
19701 - *aStop = PR_TRUE;
19702 + *aMoreSize = -1;
19706 - if((*aStop) && (wordLen == 0))
19707 + if ((*aMoreSize == -1) && (wordLen == 0))
19708 return dimensions; // 0;
19710 nsStyleContext* sc = aNextFrame->GetStyleContext();
19711 @@ -6411,7 +6442,7 @@ nsTextFrame::ComputeWordFragmentDimensio
19712 return dimensions;
19715 - *aStop = PR_TRUE;
19716 + *aMoreSize = -1;
19717 return dimensions; // 0
19720 diff -uprN --exclude=CVS mozilla/layout/mathml/base/src/nsMathMLChar.cpp mozilla.new/layout/mathml/base/src/nsMathMLChar.cpp
19721 --- mozilla/layout/mathml/base/src/nsMathMLChar.cpp 2005-10-24 05:25:21.000000000 +0200
19722 +++ mozilla.new/layout/mathml/base/src/nsMathMLChar.cpp 2006-02-24 11:16:42.000000000 +0100
19723 @@ -63,7 +63,7 @@
19724 #include "prprf.h" // For PR_snprintf()
19726 #include "nsIDOMWindow.h"
19727 -#include "nsIDialogParamBlock.h"
19728 +#include "nsINonBlockingAlertService.h"
19729 #include "nsIWindowWatcher.h"
19730 #include "nsIStringBundle.h"
19731 #include "nsDoubleHashtable.h"
19732 @@ -168,30 +168,15 @@ AlertMissingFonts(nsString& aMissingFont
19733 if (!wwatch)
19734 return;
19736 - nsCOMPtr<nsIDialogParamBlock> paramBlock(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
19737 - if (!paramBlock)
19738 - return;
19740 - // copied from nsICommonDialogs.idl which curiously isn't part of the build
19741 - // (mozilla/xpfe/appshell/public/nsICommonDialogs.idl)
19742 - enum {eMsg=0, eCheckboxMsg=1, eIconClass=2, eTitleMessage=3, eEditfield1Msg=4,
19743 - eEditfield2Msg=5, eEditfield1Value=6, eEditfield2Value=7, eButton0Text=8,
19744 - eButton1Text=9, eButton2Text=10, eButton3Text=11,eDialogTitle=12};
19745 - enum {eButtonPressed=0, eCheckboxState=1, eNumberButtons=2, eNumberEditfields=3,
19746 - eEditField1Password=4};
19748 - paramBlock->SetInt(eNumberButtons, 1);
19749 - paramBlock->SetString(eIconClass, NS_LITERAL_STRING("alert-icon").get());
19750 - paramBlock->SetString(eDialogTitle, title.get());
19751 - paramBlock->SetString(eMsg, message.get());
19753 nsCOMPtr<nsIDOMWindow> parent;
19754 wwatch->GetActiveWindow(getter_AddRefs(parent));
19755 + nsresult rv;
19756 + nsCOMPtr<nsINonBlockingAlertService> prompter =
19757 + do_GetService("@mozilla.org/embedcomp/nbalert-service;1", &rv);
19759 - nsCOMPtr<nsIDOMWindow> dialog;
19760 - wwatch->OpenWindow(parent, "chrome://global/content/commonDialog.xul", "_blank",
19761 - "dependent,centerscreen,chrome,titlebar", paramBlock,
19762 - getter_AddRefs(dialog));
19763 + if (prompter && parent) {
19764 + prompter->ShowNonBlockingAlert(parent, title.get(), message.get());
19768 // helper to trim off comments from data in a MathFont Property File
19769 diff -uprN --exclude=CVS mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp mozilla.new/layout/mathml/base/src/nsMathMLContainerFrame.cpp
19770 --- mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp 2005-09-17 01:35:44.000000000 +0200
19771 +++ mozilla.new/layout/mathml/base/src/nsMathMLContainerFrame.cpp 2006-03-12 20:04:20.000000000 +0100
19772 @@ -694,51 +694,6 @@ nsMathMLContainerFrame::PropagateScriptS
19773 * =============================================================================
19776 -// We use this to wrap non-MathML frames so that foreign elements (e.g.,
19777 -// html:img) can mix better with other surrounding MathML markups.
19778 -// Currently we only wrap nsInlineFrames because problems were observed only
19779 -// in the presence of such frames. By construction, a foreign frame wrapper
19780 -// has one and only one child, and the life of the wrapper is bound to the
19781 -// life of that unique child. Not all child list operations are applicable
19782 -// with a wrapper. One must either use the parent (or the unique child)
19783 -// for such operations (@see nsMathMLForeignFrameWrapper).
19784 -nsresult
19785 -nsMathMLContainerFrame::WrapForeignFrames()
19787 - nsIFrame* next = mFrames.FirstChild();
19788 - nsPresContext* presContext = GetPresContext();
19789 - nsFrameManager *frameManager = presContext->FrameManager();
19791 - while (next) {
19792 - nsIFrame* child = next;
19793 - next = next->GetNextSibling();
19794 - nsInlineFrame* inlineFrame;
19795 - child->QueryInterface(kInlineFrameCID, (void**)&inlineFrame);
19796 - if (inlineFrame) {
19797 - // create a new wrapper frame to wrap this child
19798 - nsIFrame* wrapper;
19799 - nsresult rv = NS_NewMathMLForeignFrameWrapper(presContext->PresShell(),
19800 - &wrapper);
19801 - if (NS_FAILED(rv)) return rv;
19802 - nsRefPtr<nsStyleContext> newStyleContext;
19803 - newStyleContext = presContext->StyleSet()->
19804 - ResolvePseudoStyleFor(mContent,
19805 - nsCSSAnonBoxes::mozAnonymousBlock,
19806 - mStyleContext);
19807 - rv = wrapper->Init(presContext, mContent, this, newStyleContext, nsnull);
19808 - if (NS_FAILED(rv)) {
19809 - wrapper->Destroy(presContext);
19810 - return rv;
19812 - mFrames.ReplaceFrame(this, child, wrapper, PR_FALSE);
19813 - child->SetParent(wrapper);
19814 - child->SetNextSibling(nsnull);
19815 - frameManager->ReParentStyleContext(child, newStyleContext);
19816 - wrapper->SetInitialChildList(presContext, nsnull, child);
19819 - return NS_OK;
19822 NS_IMETHODIMP
19823 nsMathMLContainerFrame::Paint(nsPresContext* aPresContext,
19824 @@ -813,22 +768,8 @@ nsMathMLContainerFrame::SetInitialChildL
19825 nsIAtom* aListName,
19826 nsIFrame* aChildList)
19828 - // First, let the base class do its job
19829 - nsresult rv = nsHTMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
19831 - // Next, since we are an inline frame, and since we are a container, we have to
19832 - // be very careful with the way we treat our children. Things look okay when
19833 - // all of our children are only MathML frames. But there are problems if one of
19834 - // our children happens to be an nsInlineFrame, e.g., from generated content such
19835 - // as :before { content: open-quote } or :after { content: close-quote }
19836 - // The code asserts during reflow (in nsLineLayout::BeginSpan)
19837 - // Also there are problems when our children are hybrid, e.g., from html markups.
19838 - // In short, the nsInlineFrame class expects a number of *invariants* that are not
19839 - // met when we mix things.
19841 - // So wrap foreign children in nsMathMLForeignFrameWrapper frames
19842 - WrapForeignFrames();
19843 - return rv;
19844 + // let the base class do its job
19845 + return nsHTMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
19847 // ...We will build our automatic MathML data once the entire <math>...</math>
19848 // tree is constructed.
19849 @@ -864,10 +805,17 @@ nsMathMLContainerFrame::RebuildAutomatic
19850 /* static */ nsresult
19851 nsMathMLContainerFrame::ReLayoutChildren(nsIFrame* aParentFrame)
19853 + if (!aParentFrame)
19854 + return NS_OK;
19856 // walk-up to the first frame that is a MathML frame, stop if we reach <math>
19857 PRInt32 parentScriptLevel = 0;
19858 nsIFrame* frame = aParentFrame;
19859 - while (frame) {
19860 + while (1) {
19861 + nsIFrame* parent = frame->GetParent();
19862 + if (!parent || !parent->GetContent())
19863 + break;
19865 // stop if it is a MathML frame
19866 nsIMathMLFrame* mathMLFrame;
19867 frame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
19868 @@ -877,22 +825,20 @@ nsMathMLContainerFrame::ReLayoutChildren
19869 parentScriptLevel = parentData.scriptLevel;
19870 break;
19873 // stop if we reach the root <math> tag
19874 nsIContent* content = frame->GetContent();
19875 NS_ASSERTION(content, "dangling frame without a content node");
19876 if (!content)
19877 - return NS_ERROR_FAILURE;
19879 - if (content->Tag() == nsMathMLAtoms::math) {
19880 break;
19882 + if (content->Tag() == nsMathMLAtoms::math)
19883 + break;
19885 // mark the frame dirty, and continue to climb up
19886 frame->AddStateBits(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
19887 - frame = frame->GetParent();
19889 + frame = parent;
19891 - NS_ASSERTION(frame, "bad MathML markup - could not find the top <math> element");
19892 - if (!frame)
19893 - return NS_OK;
19895 // re-sync the presentation data and embellishment data of our children
19896 RebuildAutomaticDataForChildren(frame);
19897 @@ -924,10 +870,7 @@ nsMathMLContainerFrame::ReLayoutChildren
19898 nsresult
19899 nsMathMLContainerFrame::ChildListChanged(PRInt32 aModType)
19901 - if (aModType != nsIDOMMutationEvent::REMOVAL) {
19902 - // wrap any new foreign child that may have crept in
19903 - WrapForeignFrames();
19905 + mState |= NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN;
19907 // If this is an embellished frame we need to rebuild the
19908 // embellished hierarchy by walking-up to the parent of the
19909 @@ -936,6 +879,7 @@ nsMathMLContainerFrame::ChildListChanged
19910 if (mEmbellishData.coreFrame) {
19911 nsEmbellishData embellishData;
19912 for (frame = mParent; frame; frame = frame->GetParent()) {
19913 + frame->AddStateBits(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
19914 GetEmbellishDataFrom(frame, embellishData);
19915 if (embellishData.coreFrame != mEmbellishData.coreFrame)
19916 break;
19917 @@ -1044,6 +988,74 @@ nsMathMLContainerFrame::ReflowDirtyChild
19918 return NS_OK;
19921 +nsresult
19922 +nsMathMLContainerFrame::ReflowChild(nsIFrame* aChildFrame,
19923 + nsPresContext* aPresContext,
19924 + nsHTMLReflowMetrics& aDesiredSize,
19925 + const nsHTMLReflowState& aReflowState,
19926 + nsReflowStatus& aStatus)
19928 + aDesiredSize.width = aDesiredSize.height = 0;
19929 + aDesiredSize.ascent = aDesiredSize.descent = 0;
19930 + aDesiredSize.mBoundingMetrics.Clear();
19931 + aDesiredSize.mFlags |= NS_REFLOW_CALC_BOUNDING_METRICS;
19933 + // Having foreign/hybrid children, e.g., from html markups, is not defined by
19934 + // the MathML spec. But it can happen in practice, e.g., <html:img> allows us
19935 + // to do some cool demos... or we may have a child that is an nsInlineFrame
19936 + // from a generated content such as :before { content: open-quote } or
19937 + // :after { content: close-quote }. Unfortunately, the other frames out-there
19938 + // may expect their own invariants that are not met when we mix things.
19939 + // Hence we do not claim their support, but we will nevertheless attempt to keep
19940 + // them in the flow, if we can get their desired size. We observed that most
19941 + // frames may be reflowed generically, but nsInlineFrames need extra care.
19943 + nsInlineFrame* inlineFrame;
19944 + aChildFrame->QueryInterface(kInlineFrameCID, (void**)&inlineFrame);
19945 + if (!inlineFrame)
19946 + return nsHTMLContainerFrame::
19947 + ReflowChild(aChildFrame, aPresContext, aDesiredSize, aReflowState,
19948 + 0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
19950 + // extra care for an nsInlineFrame
19951 + return ReflowForeignChild(aChildFrame, aPresContext, aDesiredSize, aReflowState, aStatus);
19954 +nsresult
19955 +nsMathMLContainerFrame::ReflowForeignChild(nsIFrame* aChildFrame,
19956 + nsPresContext* aPresContext,
19957 + nsHTMLReflowMetrics& aDesiredSize,
19958 + const nsHTMLReflowState& aReflowState,
19959 + nsReflowStatus& aStatus)
19961 + // don't bother trying to span words as if they were non-breaking beyond this point
19962 + if (aReflowState.mLineLayout)
19963 + aReflowState.mLineLayout->ForgetWordFrames();
19965 + // provide a local, self-contained linelayout where to reflow the nsInlineFrame
19966 + nsSize availSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
19967 + nsLineLayout ll(aPresContext, aReflowState.mSpaceManager, aReflowState.parentReflowState,
19968 + aDesiredSize.mComputeMEW);
19969 + ll.BeginLineReflow(0, 0, availSize.width, availSize.height, PR_FALSE, PR_FALSE);
19970 + PRBool pushedFrame;
19971 + ll.ReflowFrame(aChildFrame, aStatus, &aDesiredSize, pushedFrame);
19972 + NS_ASSERTION(!pushedFrame, "unexpected");
19973 + ll.EndLineReflow();
19975 + // make up the bounding metrics from the reflow metrics.
19976 + aDesiredSize.mBoundingMetrics.ascent = aDesiredSize.ascent;
19977 + aDesiredSize.mBoundingMetrics.descent = aDesiredSize.descent;
19978 + aDesiredSize.mBoundingMetrics.width = aDesiredSize.width;
19979 + aDesiredSize.mBoundingMetrics.rightBearing = aDesiredSize.width;
19981 + // Note: MathML's vertical & horizontal alignments happen much later in
19982 + // Place(), which is ultimately called from within FinalizeReflow().
19984 + aStatus = NS_FRAME_COMPLETE;
19985 + NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
19986 + return NS_OK;
19989 NS_IMETHODIMP
19990 nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext,
19991 nsHTMLReflowMetrics& aDesiredSize,
19992 @@ -1074,8 +1086,10 @@ printf("\n");
19993 aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS);
19994 nsIFrame* childFrame = mFrames.FirstChild();
19995 while (childFrame) {
19996 + nsReflowReason reason = (childFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)
19997 + ? eReflowReason_Initial : aReflowState.reason;
19998 nsHTMLReflowState childReflowState(aPresContext, aReflowState,
19999 - childFrame, availSize);
20000 + childFrame, availSize, reason);
20001 rv = ReflowChild(childFrame, aPresContext, childDesiredSize,
20002 childReflowState, childStatus);
20003 //NS_ASSERTION(NS_FRAME_IS_COMPLETE(childStatus), "bad status");
20004 @@ -1167,6 +1181,12 @@ nsMathMLContainerFrame::GetType() const
20005 return nsMathMLAtoms::ordinaryMathMLFrame;
20008 +PRBool
20009 +nsMathMLContainerFrame::IsFrameOfType(PRUint32 aFlags) const
20011 + return !(aFlags & ~nsIFrame::eMathML);
20014 enum eMathMLFrameType {
20015 eMathMLFrameType_UNKNOWN = -1,
20016 eMathMLFrameType_Ordinary,
20017 diff -uprN --exclude=CVS mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h mozilla.new/layout/mathml/base/src/nsMathMLContainerFrame.h
20018 --- mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h 2005-09-17 01:35:44.000000000 +0200
20019 +++ mozilla.new/layout/mathml/base/src/nsMathMLContainerFrame.h 2006-03-03 07:14:51.000000000 +0100
20020 @@ -116,6 +116,7 @@ public:
20021 // Overloaded nsHTMLContainerFrame methods -- see documentation in nsIFrame.h
20023 virtual nsIAtom* GetType() const;
20024 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20026 NS_IMETHOD
20027 Init(nsPresContext* aPresContext,
20028 @@ -205,11 +206,6 @@ public:
20029 virtual nsresult
20030 ChildListChanged(PRInt32 aModType);
20032 - // helper to wrap non-MathML frames so that foreign elements (e.g., html:img)
20033 - // can mix better with other surrounding MathML markups
20034 - virtual nsresult
20035 - WrapForeignFrames();
20037 // helper to get the preferred size that a container frame should use to fire
20038 // the stretch on its stretchy child frames.
20039 virtual void
20040 @@ -236,11 +232,14 @@ public:
20041 nsPresContext* aPresContext,
20042 nsHTMLReflowMetrics& aDesiredSize,
20043 const nsHTMLReflowState& aReflowState,
20044 - nsReflowStatus& aStatus)
20046 - return nsHTMLContainerFrame::ReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState,
20047 - 0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
20049 + nsReflowStatus& aStatus);
20051 + nsresult
20052 + ReflowForeignChild(nsIFrame* aKidFrame,
20053 + nsPresContext* aPresContext,
20054 + nsHTMLReflowMetrics& aDesiredSize,
20055 + const nsHTMLReflowState& aReflowState,
20056 + nsReflowStatus& aStatus);
20058 // helper to add the inter-spacing when <math> is the immediate parent.
20059 // Since we don't (yet) handle the root <math> element ourselves, we need to
20060 diff -uprN --exclude=CVS mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp mozilla.new/layout/mathml/base/src/nsMathMLmactionFrame.cpp
20061 --- mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp 2005-09-16 02:11:51.000000000 +0200
20062 +++ mozilla.new/layout/mathml/base/src/nsMathMLmactionFrame.cpp 2006-03-03 07:14:51.000000000 +0100
20063 @@ -310,7 +310,9 @@ nsMathMLmactionFrame::Reflow(nsPresConte
20064 nsIFrame* childFrame = GetSelectedFrame();
20065 if (childFrame) {
20066 nsReflowReason reason = aReflowState.reason;
20067 - if (mWasRestyled) {
20068 + if (childFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)
20069 + reason = eReflowReason_Initial;
20070 + else if (mWasRestyled) {
20071 mWasRestyled = PR_FALSE;
20072 // If we have just been restyled, make sure to reflow our
20073 // selected child with a StyleChange reflow reason so that
20074 diff -uprN --exclude=CVS mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp mozilla.new/layout/mathml/base/src/nsMathMLmfencedFrame.cpp
20075 --- mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp 2005-09-17 01:35:44.000000000 +0200
20076 +++ mozilla.new/layout/mathml/base/src/nsMathMLmfencedFrame.cpp 2006-03-03 07:14:51.000000000 +0100
20077 @@ -320,8 +320,10 @@ nsMathMLmfencedFrame::doReflow(nsPresCon
20078 fm->GetMaxDescent(aDesiredSize.descent);
20080 while (childFrame) {
20081 + nsReflowReason reason = (childFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)
20082 + ? eReflowReason_Initial : aReflowState.reason;
20083 nsHTMLReflowState childReflowState(aPresContext, aReflowState,
20084 - childFrame, availSize);
20085 + childFrame, availSize, reason);
20086 rv = mathMLFrame->ReflowChild(childFrame, aPresContext, childDesiredSize,
20087 childReflowState, childStatus);
20088 //NS_ASSERTION(NS_FRAME_IS_COMPLETE(childStatus), "bad status");
20089 diff -uprN --exclude=CVS mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp mozilla.new/layout/mathml/base/src/nsMathMLmrootFrame.cpp
20090 --- mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp 2005-02-07 02:57:50.000000000 +0100
20091 +++ mozilla.new/layout/mathml/base/src/nsMathMLmrootFrame.cpp 2006-03-03 07:14:51.000000000 +0100
20092 @@ -206,8 +206,10 @@ nsMathMLmrootFrame::Reflow(nsPresContext
20093 nsHTMLReflowMetrics indexSize(nsnull);
20094 nsIFrame* childFrame = mFrames.FirstChild();
20095 while (childFrame) {
20096 + nsReflowReason reason = (childFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)
20097 + ? eReflowReason_Initial : aReflowState.reason;
20098 nsHTMLReflowState childReflowState(aPresContext, aReflowState,
20099 - childFrame, availSize);
20100 + childFrame, availSize, reason);
20101 rv = ReflowChild(childFrame, aPresContext,
20102 childDesiredSize, childReflowState, childStatus);
20103 //NS_ASSERTION(NS_FRAME_IS_COMPLETE(childStatus), "bad status");
20104 diff -uprN --exclude=CVS mozilla/layout/mathml/base/src/nsMathMLmtableFrame.cpp mozilla.new/layout/mathml/base/src/nsMathMLmtableFrame.cpp
20105 --- mozilla/layout/mathml/base/src/nsMathMLmtableFrame.cpp 2005-09-16 02:11:52.000000000 +0200
20106 +++ mozilla.new/layout/mathml/base/src/nsMathMLmtableFrame.cpp 2006-03-03 07:14:51.000000000 +0100
20107 @@ -584,6 +584,12 @@ nsMathMLmtableOuterFrame::Reflow(nsPresC
20108 return rv;
20111 +PRBool
20112 +nsMathMLmtableOuterFrame::IsFrameOfType(PRUint32 aFlags) const
20114 + return !(aFlags & ~nsIFrame::eMathML);
20117 // --------
20118 // implementation of nsMathMLmtdFrame
20120 @@ -644,6 +650,12 @@ nsMathMLmtdFrame::GetColSpan()
20121 return colspan;
20124 +PRBool
20125 +nsMathMLmtdFrame::IsFrameOfType(PRUint32 aFlags) const
20127 + return !(aFlags & ~nsIFrame::eMathML);
20130 // --------
20131 // implementation of nsMathMLmtdInnerFrame
20133 @@ -707,3 +719,10 @@ nsMathMLmtdInnerFrame::Reflow(nsPresCont
20134 // ...
20135 return rv;
20138 +PRBool
20139 +nsMathMLmtdInnerFrame::IsFrameOfType(PRUint32 aFlags) const
20141 + return !(aFlags & ~nsIFrame::eMathML);
20144 diff -uprN --exclude=CVS mozilla/layout/mathml/base/src/nsMathMLmtableFrame.h mozilla.new/layout/mathml/base/src/nsMathMLmtableFrame.h
20145 --- mozilla/layout/mathml/base/src/nsMathMLmtableFrame.h 2005-02-07 02:57:50.000000000 +0100
20146 +++ mozilla.new/layout/mathml/base/src/nsMathMLmtableFrame.h 2006-03-03 07:14:51.000000000 +0100
20147 @@ -92,6 +92,8 @@ public:
20148 const nsHTMLReflowState& aReflowState,
20149 nsReflowStatus& aStatus);
20151 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20153 protected:
20154 nsMathMLmtableOuterFrame();
20155 virtual ~nsMathMLmtableOuterFrame();
20156 @@ -116,6 +118,7 @@ public:
20157 // overloaded nsTableCellFrame methods
20158 virtual PRInt32 GetRowSpan();
20159 virtual PRInt32 GetColSpan();
20160 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20162 protected:
20163 nsMathMLmtdFrame();
20164 @@ -166,6 +169,7 @@ public:
20165 nsHTMLReflowMetrics& aDesiredSize,
20166 const nsHTMLReflowState& aReflowState,
20167 nsReflowStatus& aStatus);
20168 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20170 protected:
20171 nsMathMLmtdInnerFrame();
20172 diff -uprN --exclude=CVS mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp mozilla.new/layout/mathml/base/src/nsMathMLTokenFrame.cpp
20173 --- mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp 2005-09-16 02:11:51.000000000 +0200
20174 +++ mozilla.new/layout/mathml/base/src/nsMathMLTokenFrame.cpp 2006-03-03 07:14:51.000000000 +0100
20175 @@ -180,8 +180,10 @@ printf("\n");
20176 PRInt32 count = 0;
20177 nsIFrame* childFrame = GetFirstChild(nsnull);
20178 while (childFrame) {
20179 + nsReflowReason reason = (childFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)
20180 + ? eReflowReason_Initial : aReflowState.reason;
20181 nsHTMLReflowState childReflowState(aPresContext, aReflowState,
20182 - childFrame, availSize);
20183 + childFrame, availSize, reason);
20184 rv = ReflowChild(childFrame, aPresContext, childDesiredSize,
20185 childReflowState, aStatus);
20186 //NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
20187 diff -uprN --exclude=CVS mozilla/layout/printing/nsPrintEngine.cpp mozilla.new/layout/printing/nsPrintEngine.cpp
20188 --- mozilla/layout/printing/nsPrintEngine.cpp 2006-01-11 23:05:52.000000000 +0100
20189 +++ mozilla.new/layout/printing/nsPrintEngine.cpp 2006-02-24 11:16:42.000000000 +0100
20190 @@ -2513,46 +2513,6 @@ nsPrintEngine::ReflowDocList(nsPrintObje
20191 return NS_OK;
20194 -PR_STATIC_CALLBACK(void *)
20195 -HandleBarrierEvent(PLEvent *aEvent)
20197 - PRBool *b = NS_STATIC_CAST(PRBool *, PL_GetEventOwner(aEvent));
20198 - *b = PR_TRUE;
20199 - return nsnull;
20202 -PR_STATIC_CALLBACK(void)
20203 -DestroyBarrierEvent(PLEvent *aEvent)
20207 -static void
20208 -FlushEventQueue()
20210 - PRBool hitBarrier = PR_FALSE;
20211 - nsCOMPtr<nsIEventQueue> eventQ;
20212 - nsresult rv = NS_GetMainEventQ(getter_AddRefs(eventQ));
20213 - if (NS_FAILED(rv))
20214 - return;
20216 - PLEvent evt;
20218 - PL_InitEvent(&evt, &hitBarrier, HandleBarrierEvent, DestroyBarrierEvent);
20220 - if (NS_FAILED(eventQ->PostEvent(&evt)))
20221 - return;
20223 - while (!hitBarrier) {
20224 - PLEvent *next;
20225 - eventQ->GetEvent(&next);
20226 - if (!next) {
20227 - NS_ERROR("barrier event not found!");
20228 - return;
20230 - eventQ->HandleEvent(next);
20234 //-------------------------------------------------------
20235 // Reflow a nsPrintObject
20236 nsresult
20237 @@ -2767,7 +2727,6 @@ nsPrintEngine::ReflowPrintObject(nsPrint
20239 aPO->mPresContext->SetPageDim(adjRect);
20240 rv = aPO->mPresShell->InitialReflow(width, height);
20241 - FlushEventQueue();
20242 if (NS_SUCCEEDED(rv)) {
20243 // Transfer Selection Ranges to the new Print PresShell
20244 nsCOMPtr<nsISelection> selection;
20245 diff -uprN --exclude=CVS mozilla/layout/style/forms.css mozilla.new/layout/style/forms.css
20246 --- mozilla/layout/style/forms.css 2006-01-09 06:48:55.000000000 +0100
20247 +++ mozilla.new/layout/style/forms.css 2006-02-24 11:16:42.000000000 +0100
20248 @@ -681,4 +681,14 @@ input[type="file"] > input[type="button"
20249 margin: 0px 0px 2px 5px !important;
20252 +/* make sure disabled images have transparent background */
20253 +input[type="image"][disabled] {
20254 + background-color: transparent;
20257 +/* avoid flickering size when file selector buttons with large text are activated */
20258 +input[type="file"] > input[type="button"]:active:hover {
20259 + font-size: inherit;
20262 #endif
20263 diff -uprN --exclude=CVS mozilla/layout/style/nsDOMCSSValueList.cpp mozilla.new/layout/style/nsDOMCSSValueList.cpp
20264 --- mozilla/layout/style/nsDOMCSSValueList.cpp 2004-12-08 20:39:47.000000000 +0100
20265 +++ mozilla.new/layout/style/nsDOMCSSValueList.cpp 2006-03-03 07:14:51.000000000 +0100
20266 @@ -57,6 +57,7 @@ NS_IMPL_RELEASE(nsDOMCSSValueList)
20267 NS_INTERFACE_MAP_BEGIN(nsDOMCSSValueList)
20268 NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValueList)
20269 NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValue)
20270 + NS_INTERFACE_MAP_ENTRY(nsISupports)
20271 NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CSSValueList)
20272 NS_INTERFACE_MAP_END
20274 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGDefsFrame.cpp mozilla.new/layout/svg/base/src/nsSVGDefsFrame.cpp
20275 --- mozilla/layout/svg/base/src/nsSVGDefsFrame.cpp 2005-08-09 15:53:01.000000000 +0200
20276 +++ mozilla.new/layout/svg/base/src/nsSVGDefsFrame.cpp 2006-03-03 07:14:58.000000000 +0100
20277 @@ -205,6 +205,12 @@ nsSVGDefsFrame::GetType() const
20278 return nsLayoutAtoms::svgDefsFrame;
20281 +PRBool
20282 +nsSVGDefsFrame::IsFrameOfType(PRUint32 aFlags) const
20284 + return !(aFlags & ~nsIFrame::eSVG);
20287 //----------------------------------------------------------------------
20288 // nsISVGValueObserver methods:
20290 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGDefsFrame.h mozilla.new/layout/svg/base/src/nsSVGDefsFrame.h
20291 --- mozilla/layout/svg/base/src/nsSVGDefsFrame.h 2005-04-19 05:48:09.000000000 +0200
20292 +++ mozilla.new/layout/svg/base/src/nsSVGDefsFrame.h 2006-03-03 07:14:58.000000000 +0100
20293 @@ -90,6 +90,7 @@ public:
20294 * @see nsLayoutAtoms::svgDefsFrame
20296 virtual nsIAtom* GetType() const;
20297 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20299 #ifdef DEBUG
20300 NS_IMETHOD GetFrameName(nsAString& aResult) const
20301 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGForeignObjectFrame.cpp mozilla.new/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
20302 --- mozilla/layout/svg/base/src/nsSVGForeignObjectFrame.cpp 2005-04-19 05:48:09.000000000 +0200
20303 +++ mozilla.new/layout/svg/base/src/nsSVGForeignObjectFrame.cpp 2006-03-03 07:14:58.000000000 +0100
20304 @@ -120,6 +120,7 @@ public:
20305 // frametypes, particularly code looking at block and area
20306 // also handles foreignObject before we return our own frametype
20307 // virtual nsIAtom* GetType() const;
20308 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20310 #ifdef DEBUG
20311 NS_IMETHOD GetFrameName(nsAString& aResult) const
20312 @@ -442,6 +443,12 @@ nsSVGForeignObjectFrame::ReplaceFrame(ns
20313 // return nsLayoutAtoms::svgForeignObjectFrame;
20314 // }
20316 +PRBool
20317 +nsSVGForeignObjectFrame::IsFrameOfType(PRUint32 aFlags) const
20319 + return !(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject));
20322 //----------------------------------------------------------------------
20323 // nsISVGValueObserver methods:
20325 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGGenericContainerFrame.cpp mozilla.new/layout/svg/base/src/nsSVGGenericContainerFrame.cpp
20326 --- mozilla/layout/svg/base/src/nsSVGGenericContainerFrame.cpp 2005-08-09 15:53:02.000000000 +0200
20327 +++ mozilla.new/layout/svg/base/src/nsSVGGenericContainerFrame.cpp 2006-03-03 07:14:58.000000000 +0100
20328 @@ -192,6 +192,11 @@ nsSVGGenericContainerFrame::GetType() co
20329 return nsLayoutAtoms::svgGenericContainerFrame;
20332 +PRBool
20333 +nsSVGGenericContainerFrame::IsFrameOfType(PRUint32 aFlags) const
20335 + return !(aFlags & ~nsIFrame::eSVG);
20338 //----------------------------------------------------------------------
20339 // nsISVGChildFrame methods
20340 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGGenericContainerFrame.h mozilla.new/layout/svg/base/src/nsSVGGenericContainerFrame.h
20341 --- mozilla/layout/svg/base/src/nsSVGGenericContainerFrame.h 2005-04-19 05:48:09.000000000 +0200
20342 +++ mozilla.new/layout/svg/base/src/nsSVGGenericContainerFrame.h 2006-03-03 07:14:58.000000000 +0100
20343 @@ -95,6 +95,7 @@ public:
20344 * @see nsLayoutAtoms::svgGenericContainerFrame
20346 virtual nsIAtom* GetType() const;
20347 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20349 #ifdef DEBUG
20350 NS_IMETHOD GetFrameName(nsAString& aResult) const
20351 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGGlyphFrame.cpp mozilla.new/layout/svg/base/src/nsSVGGlyphFrame.cpp
20352 --- mozilla/layout/svg/base/src/nsSVGGlyphFrame.cpp 2005-10-03 22:38:01.000000000 +0200
20353 +++ mozilla.new/layout/svg/base/src/nsSVGGlyphFrame.cpp 2006-03-03 07:14:59.000000000 +0100
20354 @@ -115,6 +115,7 @@ public:
20355 * @see nsLayoutAtoms::svgGlyphFrame
20357 virtual nsIAtom* GetType() const;
20358 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20360 #ifdef DEBUG
20361 NS_IMETHOD GetFrameName(nsAString& aResult) const
20362 @@ -401,6 +402,12 @@ nsSVGGlyphFrame::GetType() const
20363 return nsLayoutAtoms::svgGlyphFrame;
20366 +PRBool
20367 +nsSVGGlyphFrame::IsFrameOfType(PRUint32 aFlags) const
20369 + return !(aFlags & ~nsIFrame::eSVG);
20372 //----------------------------------------------------------------------
20373 // nsISVGValueObserver methods:
20375 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGGradientFrame.cpp mozilla.new/layout/svg/base/src/nsSVGGradientFrame.cpp
20376 --- mozilla/layout/svg/base/src/nsSVGGradientFrame.cpp 2005-10-04 00:38:28.000000000 +0200
20377 +++ mozilla.new/layout/svg/base/src/nsSVGGradientFrame.cpp 2006-02-24 11:16:42.000000000 +0100
20378 @@ -621,6 +621,10 @@ nsSVGGradientFrame::PrivateGetSpreadMeth
20379 NS_IMETHODIMP
20380 nsSVGGradientFrame::GetNextGradient(nsISVGGradient * *aNextGrad, PRUint32 aType) {
20381 PRUint32 nextType;
20382 + if (!mNextGrad) {
20383 + *aNextGrad = nsnull;
20384 + return NS_ERROR_FAILURE;
20386 mNextGrad->GetGradientType(&nextType);
20387 if (nextType == aType) {
20388 *aNextGrad = mNextGrad;
20389 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGInnerSVGFrame.cpp mozilla.new/layout/svg/base/src/nsSVGInnerSVGFrame.cpp
20390 --- mozilla/layout/svg/base/src/nsSVGInnerSVGFrame.cpp 2005-08-09 15:53:02.000000000 +0200
20391 +++ mozilla.new/layout/svg/base/src/nsSVGInnerSVGFrame.cpp 2006-03-03 07:14:59.000000000 +0100
20392 @@ -105,6 +105,7 @@ public:
20393 * @see nsLayoutAtoms::svgInnerSVGFrame
20395 virtual nsIAtom* GetType() const;
20396 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20398 #ifdef DEBUG
20399 NS_IMETHOD GetFrameName(nsAString& aResult) const
20400 @@ -347,6 +348,12 @@ nsSVGInnerSVGFrame::GetType() const
20401 return nsLayoutAtoms::svgInnerSVGFrame;
20404 +PRBool
20405 +nsSVGInnerSVGFrame::IsFrameOfType(PRUint32 aFlags) const
20407 + return !(aFlags & ~nsIFrame::eSVG);
20410 //----------------------------------------------------------------------
20411 // nsISVGChildFrame methods
20413 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp mozilla.new/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
20414 --- mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp 2005-09-05 22:41:47.000000000 +0200
20415 +++ mozilla.new/layout/svg/base/src/nsSVGOuterSVGFrame.cpp 2006-03-03 07:14:59.000000000 +0100
20416 @@ -223,6 +223,7 @@ public:
20417 * @see nsLayoutAtoms::svgOuterSVGFrame
20419 virtual nsIAtom* GetType() const;
20420 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20422 #ifdef DEBUG
20423 NS_IMETHOD GetFrameName(nsAString& aResult) const
20424 @@ -870,6 +871,12 @@ nsSVGOuterSVGFrame::GetType() const
20425 return nsLayoutAtoms::svgOuterSVGFrame;
20428 +PRBool
20429 +nsSVGOuterSVGFrame::IsFrameOfType(PRUint32 aFlags) const
20431 + return !(aFlags & ~nsIFrame::eSVG);
20434 //----------------------------------------------------------------------
20435 // nsISVGValueObserver methods:
20437 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.cpp mozilla.new/layout/svg/base/src/nsSVGPathGeometryFrame.cpp
20438 --- mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.cpp 2005-10-03 22:38:01.000000000 +0200
20439 +++ mozilla.new/layout/svg/base/src/nsSVGPathGeometryFrame.cpp 2006-03-03 07:14:59.000000000 +0100
20440 @@ -181,6 +181,12 @@ nsSVGPathGeometryFrame::GetType() const
20441 return nsLayoutAtoms::svgPathGeometryFrame;
20444 +PRBool
20445 +nsSVGPathGeometryFrame::IsFrameOfType(PRUint32 aFlags) const
20447 + return !(aFlags & ~nsIFrame::eSVG);
20450 //----------------------------------------------------------------------
20451 // nsISVGChildFrame methods
20453 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h mozilla.new/layout/svg/base/src/nsSVGPathGeometryFrame.h
20454 --- mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h 2005-09-27 21:58:56.000000000 +0200
20455 +++ mozilla.new/layout/svg/base/src/nsSVGPathGeometryFrame.h 2006-03-03 07:14:59.000000000 +0100
20456 @@ -94,6 +94,7 @@ public:
20457 * @see nsLayoutAtoms::svgPathGeometryFrame
20459 virtual nsIAtom* GetType() const;
20460 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20462 #ifdef DEBUG
20463 NS_IMETHOD GetFrameName(nsAString& aResult) const
20464 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGStopFrame.cpp mozilla.new/layout/svg/base/src/nsSVGStopFrame.cpp
20465 --- mozilla/layout/svg/base/src/nsSVGStopFrame.cpp 2005-08-09 17:45:34.000000000 +0200
20466 +++ mozilla.new/layout/svg/base/src/nsSVGStopFrame.cpp 2006-03-03 07:14:59.000000000 +0100
20467 @@ -68,6 +68,7 @@ class nsSVGStopFrame : public nsSVGStopF
20468 * @see nsLayoutAtoms::svgStopFrame
20470 virtual nsIAtom* GetType() const;
20471 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20473 #ifdef DEBUG
20474 NS_IMETHOD GetFrameName(nsAString& aResult) const
20475 @@ -134,6 +135,12 @@ nsSVGStopFrame::GetType() const
20476 return nsLayoutAtoms::svgStopFrame;
20479 +PRBool
20480 +nsSVGStopFrame::IsFrameOfType(PRUint32 aFlags) const
20482 + return !(aFlags & ~nsIFrame::eSVG);
20485 NS_IMETHODIMP
20486 nsSVGStopFrame::Init(nsPresContext* aPresContext,
20487 nsIContent* aContent,
20488 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGTextFrame.cpp mozilla.new/layout/svg/base/src/nsSVGTextFrame.cpp
20489 --- mozilla/layout/svg/base/src/nsSVGTextFrame.cpp 2005-10-23 23:10:50.000000000 +0200
20490 +++ mozilla.new/layout/svg/base/src/nsSVGTextFrame.cpp 2006-03-03 07:14:59.000000000 +0100
20491 @@ -121,6 +121,7 @@ public:
20492 * @see nsLayoutAtoms::svgTextFrame
20494 virtual nsIAtom* GetType() const;
20495 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20497 #ifdef DEBUG
20498 NS_IMETHOD GetFrameName(nsAString& aResult) const
20499 @@ -360,6 +361,12 @@ nsSVGTextFrame::GetType() const
20500 return nsLayoutAtoms::svgTextFrame;
20503 +PRBool
20504 +nsSVGTextFrame::IsFrameOfType(PRUint32 aFlags) const
20506 + return !(aFlags & ~nsIFrame::eSVG);
20509 NS_IMETHODIMP
20510 nsSVGTextFrame::AppendFrames(nsIAtom* aListName,
20511 nsIFrame* aFrameList)
20512 diff -uprN --exclude=CVS mozilla/layout/svg/base/src/nsSVGTSpanFrame.cpp mozilla.new/layout/svg/base/src/nsSVGTSpanFrame.cpp
20513 --- mozilla/layout/svg/base/src/nsSVGTSpanFrame.cpp 2005-10-03 23:10:32.000000000 +0200
20514 +++ mozilla.new/layout/svg/base/src/nsSVGTSpanFrame.cpp 2006-03-03 07:14:59.000000000 +0100
20515 @@ -110,6 +110,7 @@ public:
20516 * @see nsLayoutAtoms::svgTSpanFrame
20518 virtual nsIAtom* GetType() const;
20519 + virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
20521 #ifdef DEBUG
20522 NS_IMETHOD GetFrameName(nsAString& aResult) const
20523 @@ -268,6 +269,12 @@ nsSVGTSpanFrame::GetType() const
20524 return nsLayoutAtoms::svgTSpanFrame;
20527 +PRBool
20528 +nsSVGTSpanFrame::IsFrameOfType(PRUint32 aFlags) const
20530 + return !(aFlags & ~nsIFrame::eSVG);
20533 //----------------------------------------------------------------------
20534 // nsISupports methods
20536 diff -uprN --exclude=CVS mozilla/layout/tables/nsCellMap.cpp mozilla.new/layout/tables/nsCellMap.cpp
20537 --- mozilla/layout/tables/nsCellMap.cpp 2005-09-28 19:46:52.000000000 +0200
20538 +++ mozilla.new/layout/tables/nsCellMap.cpp 2006-03-03 07:14:59.000000000 +0100
20539 @@ -2110,8 +2110,24 @@ void nsCellMap::RemoveCell(nsTableCellMa
20540 void nsCellMap::Dump(PRBool aIsBorderCollapse) const
20542 printf("\n ***** START GROUP CELL MAP DUMP ***** %p\n", this);
20543 + nsTableRowGroupFrame* rg = GetRowGroup();
20544 + const nsStyleDisplay* display = rg->GetStyleDisplay();
20545 + switch (display->mDisplay) {
20546 + case NS_STYLE_DISPLAY_TABLE_HEADER_GROUP:
20547 + printf(" thead ");
20548 + break;
20549 + case NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP:
20550 + printf(" tfoot ");
20551 + break;
20552 + case NS_STYLE_DISPLAY_TABLE_ROW_GROUP:
20553 + printf(" tbody ");
20554 + break;
20555 + default:
20556 + printf("HUH? wrong display type on rowgroup");
20558 PRInt32 mapRowCount = mRows.Count();
20559 - printf(" mapRowCount=%d tableRowCount=%d \n", mapRowCount, mRowCount);
20560 + printf("mapRowCount=%d tableRowCount=%d\n", mapRowCount, mRowCount);
20563 PRInt32 rowIndex, colIndex;
20564 for (rowIndex = 0; rowIndex < mapRowCount; rowIndex++) {
20565 diff -uprN --exclude=CVS mozilla/layout/tables/nsCellMap.h mozilla.new/layout/tables/nsCellMap.h
20566 --- mozilla/layout/tables/nsCellMap.h 2004-12-08 20:39:53.000000000 +0100
20567 +++ mozilla.new/layout/tables/nsCellMap.h 2006-03-03 07:14:59.000000000 +0100
20568 @@ -203,6 +203,10 @@ protected:
20569 friend class nsCellMap;
20570 friend class BCMapCellIterator;
20571 friend class BCMapBorderIterator;
20572 +/** Insert a row group cellmap after aPrevMap, if aPrefMap is null insert it
20573 + * at the beginning, the ordering of the cellmap corresponds to the ordering of
20574 + * rowgroups once OrderRowGroups has been called
20575 + */
20576 void InsertGroupCellMap(nsCellMap* aPrevMap,
20577 nsCellMap& aNewMap);
20578 void DeleteRightBottomBorders();
20579 diff -uprN --exclude=CVS mozilla/layout/tables/nsTableFrame.cpp mozilla.new/layout/tables/nsTableFrame.cpp
20580 --- mozilla/layout/tables/nsTableFrame.cpp 2006-01-09 06:48:55.000000000 +0100
20581 +++ mozilla.new/layout/tables/nsTableFrame.cpp 2006-03-03 07:14:59.000000000 +0100
20582 @@ -1271,46 +1271,54 @@ void
20583 nsTableFrame::InsertRowGroups(nsIFrame* aFirstRowGroupFrame,
20584 nsIFrame* aLastRowGroupFrame)
20586 +#ifdef DEBUG_TABLE_CELLMAP
20587 + printf("insertRowGroupsBefore");
20588 + Dump(PR_TRUE, PR_FALSE, PR_TRUE);
20589 +#endif
20590 nsTableCellMap* cellMap = GetCellMap();
20591 if (cellMap) {
20592 nsAutoVoidArray orderedRowGroups;
20593 PRUint32 numRowGroups;
20594 OrderRowGroups(orderedRowGroups, numRowGroups);
20596 nsAutoVoidArray rows;
20597 - for (nsIFrame* kidFrame = aFirstRowGroupFrame; kidFrame;
20598 - kidFrame = kidFrame->GetNextSibling()) {
20599 - nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(kidFrame);
20600 - if (rgFrame) {
20601 - // get the prior row group in display order
20602 - PRUint32 rgIndex;
20603 - for (rgIndex = 0; rgIndex < numRowGroups; rgIndex++) {
20604 - if (GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgIndex)) == rgFrame) {
20605 - break;
20606 + // Loop over the rowgroups and check if some of them are new, if they are
20607 + // insert cellmaps in the order that is predefined by OrderRowGroups,
20608 + for (PRUint32 rgIndex = 0; rgIndex < numRowGroups; rgIndex++) {
20609 + nsIFrame* kidFrame = aFirstRowGroupFrame;
20610 + while (kidFrame) {
20611 + nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(kidFrame);
20613 + if (GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgIndex)) == rgFrame) {
20614 + nsTableRowGroupFrame* priorRG = (0 == rgIndex)
20615 + ? nsnull : GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgIndex - 1));
20616 + // create and add the cell map for the row group
20617 + cellMap->InsertGroupCellMap(*rgFrame, priorRG);
20618 + // collect the new row frames in an array and add them to the table
20619 + PRInt32 numRows = CollectRows(kidFrame, rows);
20620 + if (numRows > 0) {
20621 + PRInt32 rowIndex = 0;
20622 + if (priorRG) {
20623 + PRInt32 priorNumRows = priorRG->GetRowCount();
20624 + rowIndex = priorRG->GetStartRowIndex() + priorNumRows;
20626 + InsertRows(*rgFrame, rows, rowIndex, PR_TRUE);
20627 + rows.Clear();
20629 + break;
20631 - nsTableRowGroupFrame* priorRG = (0 == rgIndex)
20632 - ? nsnull : GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgIndex - 1));
20634 - // create and add the cell map for the row group
20635 - cellMap->InsertGroupCellMap(*rgFrame, priorRG);
20636 - // collect the new row frames in an array and add them to the table
20637 - PRInt32 numRows = CollectRows(kidFrame, rows);
20638 - if (numRows > 0) {
20639 - PRInt32 rowIndex = 0;
20640 - if (priorRG) {
20641 - PRInt32 priorNumRows = priorRG->GetRowCount();
20642 - rowIndex = priorRG->GetStartRowIndex() + priorNumRows;
20643 + else {
20644 + if (kidFrame == aLastRowGroupFrame) {
20645 + break;
20647 - InsertRows(*rgFrame, rows, rowIndex, PR_TRUE);
20648 - rows.Clear();
20649 + kidFrame = kidFrame->GetNextSibling();
20652 - if (kidFrame == aLastRowGroupFrame) {
20653 - break;
20657 +#ifdef DEBUG_TABLE_CELLMAP
20658 + printf("insertRowGroupsAfter");
20659 + Dump(PR_TRUE, PR_FALSE, PR_TRUE);
20660 +#endif
20664 diff -uprN --exclude=CVS mozilla/layout/xul/base/public/nsIListBoxObject.idl mozilla.new/layout/xul/base/public/nsIListBoxObject.idl
20665 --- mozilla/layout/xul/base/public/nsIListBoxObject.idl 2004-04-18 16:30:36.000000000 +0200
20666 +++ mozilla.new/layout/xul/base/public/nsIListBoxObject.idl 2006-02-14 10:01:28.000000000 +0100
20667 @@ -44,6 +44,8 @@ interface nsIDOMElement;
20668 [scriptable, uuid(FDE7C970-0B4E-49f4-B1EB-974AE6C96336)]
20669 interface nsIListBoxObject : nsISupports
20671 + // listboxBody is always null. It's only here to avoid changing the
20672 + // interface.
20673 readonly attribute nsIListBoxObject listboxBody;
20675 long getRowCount();
20676 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/nsBoxFrame.cpp mozilla.new/layout/xul/base/src/nsBoxFrame.cpp
20677 --- mozilla/layout/xul/base/src/nsBoxFrame.cpp 2005-08-23 00:06:56.000000000 +0200
20678 +++ mozilla.new/layout/xul/base/src/nsBoxFrame.cpp 2006-02-24 11:16:43.000000000 +0100
20679 @@ -1351,8 +1351,12 @@ nsBoxFrame::AttributeChanged(nsIContent*
20681 nsIBox* parent;
20682 GetParentBox(&parent);
20683 - parent->RelayoutChildAtOrdinal(state, this);
20684 - parent->MarkDirty(state);
20685 + // If our parent is not a box, there's not much we can do... but in that
20686 + // case our ordinal doesn't matter anyway, so that's ok.
20687 + if (parent) {
20688 + parent->RelayoutChildAtOrdinal(state, this);
20689 + parent->MarkDirty(state);
20692 // If the accesskey changed, register for the new value
20693 // The old value has been unregistered in nsXULElement::SetAttr
20694 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/nsBoxObject.cpp mozilla.new/layout/xul/base/src/nsBoxObject.cpp
20695 --- mozilla/layout/xul/base/src/nsBoxObject.cpp 2005-08-24 23:08:53.000000000 +0200
20696 +++ mozilla.new/layout/xul/base/src/nsBoxObject.cpp 2006-03-12 20:04:20.000000000 +0100
20697 @@ -135,7 +135,7 @@ NS_IMETHODIMP
20698 nsBoxObject::Init(nsIContent* aContent, nsIPresShell* aShell)
20700 mContent = aContent;
20701 - mPresShell = aShell;
20702 + mPresShell = do_GetWeakReference(aShell);
20703 return NS_OK;
20706 @@ -144,7 +144,7 @@ nsBoxObject::SetDocument(nsIDocument* aD
20708 mPresState = nsnull;
20709 if (aDocument) {
20710 - mPresShell = aDocument->GetShellAt(0);
20711 + mPresShell = do_GetWeakReference(aDocument->GetShellAt(0));
20713 else {
20714 mPresShell = nsnull;
20715 @@ -164,13 +164,26 @@ nsIFrame*
20716 nsBoxObject::GetFrame()
20718 nsIFrame* frame = nsnull;
20719 - if (mPresShell) {
20720 - mPresShell->FlushPendingNotifications(Flush_Frames);
20721 - mPresShell->GetPrimaryFrameFor(mContent, &frame);
20722 + nsCOMPtr<nsIPresShell> shell = GetPresShell();
20723 + if (shell) {
20724 + shell->FlushPendingNotifications(Flush_Frames);
20725 + shell->GetPrimaryFrameFor(mContent, &frame);
20727 return frame;
20730 +already_AddRefed<nsIPresShell>
20731 +nsBoxObject::GetPresShell()
20733 + if (!mPresShell) {
20734 + return nsnull;
20737 + nsIPresShell* shell = nsnull;
20738 + CallQueryReferent(mPresShell.get(), &shell);
20739 + return shell;
20742 nsresult
20743 nsBoxObject::GetOffsetRect(nsRect& aRect)
20745 @@ -405,8 +418,23 @@ nsBoxObject::GetPropertyAsSupports(const
20746 NS_IMETHODIMP
20747 nsBoxObject::SetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports* aValue)
20749 - if (!mPresState)
20750 +#ifdef DEBUG
20751 + if (aValue) {
20752 + nsIFrame* frame;
20753 + CallQueryInterface(aValue, &frame);
20754 + NS_ASSERTION(!frame,
20755 + "Calling SetPropertyAsSupports on a frame. Prepare to crash "
20756 + "and be exploited any time some random website decides to "
20757 + "exploit you");
20759 +#endif
20761 + NS_ENSURE_ARG(aPropertyName && *aPropertyName);
20763 + if (!mPresState) {
20764 NS_NewPresState(getter_Transfers(mPresState));
20765 + NS_ENSURE_TRUE(mPresState, NS_ERROR_OUT_OF_MEMORY);
20768 nsDependentString propertyName(aPropertyName);
20769 return mPresState->SetStatePropertyAsSupports(propertyName, aValue);
20770 @@ -415,6 +443,8 @@ nsBoxObject::SetPropertyAsSupports(const
20771 NS_IMETHODIMP
20772 nsBoxObject::GetProperty(const PRUnichar* aPropertyName, PRUnichar** aResult)
20774 + NS_ENSURE_ARG(aPropertyName && *aPropertyName);
20776 if (!mPresState) {
20777 *aResult = nsnull;
20778 return NS_OK;
20779 @@ -537,10 +567,6 @@ nsBoxObject::GetDocShell(nsIDocShell** a
20781 *aResult = nsnull;
20783 - if (!mPresShell) {
20784 - return NS_OK;
20787 nsIFrame *frame = GetFrame();
20789 if (frame) {
20790 @@ -558,8 +584,14 @@ nsBoxObject::GetDocShell(nsIDocShell** a
20791 // No nsIFrameFrame available for mContent, try if there's a mapping
20792 // between mContent's document to mContent's subdocument.
20794 - nsIDocument *sub_doc =
20795 - mPresShell->GetDocument()->GetSubDocumentFor(mContent);
20796 + // XXXbz sXBL/XBL2 issue -- ownerDocument or currentDocument?
20797 + nsIDocument *doc = mContent->GetDocument();
20799 + if (!doc) {
20800 + return NS_OK;
20803 + nsIDocument *sub_doc = doc->GetSubDocumentFor(mContent);
20805 if (!sub_doc) {
20806 return NS_OK;
20807 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/nsBoxObject.h mozilla.new/layout/xul/base/src/nsBoxObject.h
20808 --- mozilla/layout/xul/base/src/nsBoxObject.h 2005-02-18 10:22:33.000000000 +0100
20809 +++ mozilla.new/layout/xul/base/src/nsBoxObject.h 2006-03-12 20:04:20.000000000 +0100
20810 @@ -41,6 +41,8 @@
20811 #include "nsPresState.h"
20812 #include "nsPoint.h"
20813 #include "nsAutoPtr.h"
20814 +#include "nsIWeakReference.h"
20815 +#include "nsIWeakReferenceUtils.h"
20817 class nsIBoxLayoutManager;
20818 class nsIBoxPaintManager;
20819 @@ -63,6 +65,7 @@ public:
20820 NS_IMETHOD InvalidatePresentationStuff();
20822 virtual nsIFrame* GetFrame();
20823 + already_AddRefed<nsIPresShell> GetPresShell();
20824 nsresult GetOffsetRect(nsRect& aRect);
20825 nsresult GetScreenPosition(nsIntPoint& aPoint);
20827 @@ -81,5 +84,5 @@ protected:
20828 nsAutoPtr<nsPresState> mPresState; // [OWNER]
20830 nsIContent* mContent; // [WEAK]
20831 - nsIPresShell* mPresShell; // [WEAK]
20832 + nsWeakPtr mPresShell;
20834 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp mozilla.new/layout/xul/base/src/nsListBoxBodyFrame.cpp
20835 --- mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp 2005-04-03 23:19:37.000000000 +0200
20836 +++ mozilla.new/layout/xul/base/src/nsListBoxBodyFrame.cpp 2006-02-24 11:16:43.000000000 +0100
20837 @@ -71,6 +71,7 @@
20838 #include "nsPIBoxObject.h"
20839 #include "nsINodeInfo.h"
20840 #include "nsLayoutUtils.h"
20841 +#include "nsPIListBoxObject.h"
20843 /////////////// nsListScrollSmoother //////////////////
20845 @@ -284,10 +285,9 @@ nsListBoxBodyFrame::Destroy(nsPresContex
20846 nsCOMPtr<nsIBoxObject> box;
20847 nsdoc->GetBoxObjectFor(e, getter_AddRefs(box));
20849 - nsCOMPtr<nsPIBoxObject> pibox(do_QueryInterface(box));
20851 - if (pibox) {
20852 - pibox->InvalidatePresentationStuff();
20853 + nsCOMPtr<nsPIListBoxObject> piBox = do_QueryInterface(box);
20854 + if (piBox) {
20855 + piBox->ClearCachedListBoxBody();
20858 break;
20859 @@ -1316,6 +1316,9 @@ nsListBoxBodyFrame::OnContentInserted(ns
20860 void
20861 nsListBoxBodyFrame::OnContentRemoved(nsPresContext* aPresContext, nsIFrame* aChildFrame, PRInt32 aIndex)
20863 + NS_ASSERTION(!aChildFrame || aChildFrame->GetParent() == this,
20864 + "Removing frame that's not our child... Not good");
20866 if (mRowCount >= 0)
20867 --mRowCount;
20869 @@ -1433,7 +1436,12 @@ nsListBoxBodyFrame::RemoveChildFrame(nsB
20871 mFrameConstructor->RemoveMappingsForFrameSubtree(aFrame, nsnull);
20873 - mFrames.RemoveFrame(aFrame);
20874 +#ifdef DEBUG
20875 + PRBool removed =
20876 +#endif
20877 + mFrames.RemoveFrame(aFrame);
20878 + NS_ASSERTION(removed,
20879 + "Going to destroy a frame we didn't remove. Prepare to crash");
20880 if (mLayoutManager)
20881 mLayoutManager->ChildrenRemoved(this, aState, aFrame);
20882 aFrame->Destroy(mPresContext);
20883 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/nsListBoxObject.cpp mozilla.new/layout/xul/base/src/nsListBoxObject.cpp
20884 --- mozilla/layout/xul/base/src/nsListBoxObject.cpp 2005-04-03 23:02:46.000000000 +0200
20885 +++ mozilla.new/layout/xul/base/src/nsListBoxObject.cpp 2006-03-12 20:04:20.000000000 +0100
20886 @@ -38,7 +38,7 @@
20887 * ***** END LICENSE BLOCK ***** */
20889 #include "nsCOMPtr.h"
20890 -#include "nsIListBoxObject.h"
20891 +#include "nsPIListBoxObject.h"
20892 #include "nsBoxObject.h"
20893 #include "nsIFrame.h"
20894 #include "nsIDocument.h"
20895 @@ -48,41 +48,30 @@
20896 #include "nsXULAtoms.h"
20897 #include "nsIScrollableFrame.h"
20899 -class nsListBoxObject : public nsIListBoxObject, public nsBoxObject
20900 +class nsListBoxObject : public nsPIListBoxObject, public nsBoxObject
20902 public:
20903 - NS_DECL_ISUPPORTS
20904 + NS_DECL_ISUPPORTS_INHERITED
20905 NS_DECL_NSILISTBOXOBJECT
20907 + // nsPIListBoxObject
20908 + virtual void ClearCachedListBoxBody();
20909 + virtual nsIListBoxObject* GetListBoxBody();
20911 nsListBoxObject();
20912 virtual ~nsListBoxObject();
20914 - nsIListBoxObject* GetListBoxBody();
20916 NS_IMETHOD InvalidatePresentationStuff();
20918 protected:
20919 + nsIListBoxObject* mListBoxBody;
20922 -NS_IMPL_ADDREF(nsListBoxObject)
20923 -NS_IMPL_RELEASE(nsListBoxObject)
20925 -NS_IMETHODIMP
20926 -nsListBoxObject::QueryInterface(REFNSIID iid, void** aResult)
20928 - if (!aResult)
20929 - return NS_ERROR_NULL_POINTER;
20931 - if (iid.Equals(NS_GET_IID(nsIListBoxObject))) {
20932 - *aResult = (nsIListBoxObject*)this;
20933 - NS_ADDREF(this);
20934 - return NS_OK;
20936 +NS_IMPL_ISUPPORTS_INHERITED2(nsListBoxObject, nsBoxObject, nsIListBoxObject,
20937 + nsPIListBoxObject)
20939 - return nsBoxObject::QueryInterface(iid, aResult);
20942 nsListBoxObject::nsListBoxObject()
20943 + : mListBoxBody(nsnull)
20947 @@ -97,8 +86,7 @@ nsListBoxObject::~nsListBoxObject()
20948 NS_IMETHODIMP
20949 nsListBoxObject::GetListboxBody(nsIListBoxObject * *aListboxBody)
20951 - *aListboxBody = GetListBoxBody();
20952 - NS_IF_ADDREF(*aListboxBody);
20953 + *aListboxBody = nsnull;
20954 return NS_OK;
20957 @@ -175,6 +163,12 @@ nsListBoxObject::GetIndexOfItem(nsIDOMEl
20958 return NS_OK;
20961 +void
20962 +nsListBoxObject::ClearCachedListBoxBody()
20964 + mListBoxBody = nsnull;
20967 //////////////////////
20969 static void
20970 @@ -206,26 +200,25 @@ FindBodyContent(nsIContent* aParent, nsI
20971 nsIListBoxObject*
20972 nsListBoxObject::GetListBoxBody()
20974 - NS_NAMED_LITERAL_STRING(listboxbody, "listboxbody");
20976 - nsCOMPtr<nsISupports> supp;
20977 - GetPropertyAsSupports(listboxbody.get(), getter_AddRefs(supp));
20979 - if (supp) {
20980 - nsCOMPtr<nsIListBoxObject> body(do_QueryInterface(supp));
20981 - return body;
20982 + if (mListBoxBody) {
20983 + return mListBoxBody;
20986 nsIFrame* frame = GetFrame();
20987 if (!frame)
20988 return nsnull;
20990 + nsCOMPtr<nsIPresShell> shell = GetPresShell();
20991 + if (!shell) {
20992 + return nsnull;
20995 // Iterate over our content model children looking for the body.
20996 nsCOMPtr<nsIContent> content;
20997 FindBodyContent(frame->GetContent(), getter_AddRefs(content));
20999 // this frame will be a nsGFXScrollFrame
21000 - mPresShell->GetPrimaryFrameFor(content, &frame);
21001 + shell->GetPrimaryFrameFor(content, &frame);
21002 if (!frame)
21003 return nsnull;
21004 nsIScrollableFrame* scrollFrame;
21005 @@ -239,16 +232,14 @@ nsListBoxObject::GetListBoxBody()
21006 return nsnull;
21008 // It's a frame. Refcounts are irrelevant.
21009 - nsCOMPtr<nsIListBoxObject> body;
21010 - yeahBaby->QueryInterface(NS_GET_IID(nsIListBoxObject), getter_AddRefs(body));
21011 - SetPropertyAsSupports(listboxbody.get(), body);
21012 - return body;
21013 + CallQueryInterface(yeahBaby, &mListBoxBody);
21014 + return mListBoxBody;
21017 NS_IMETHODIMP
21018 nsListBoxObject::InvalidatePresentationStuff()
21020 - SetPropertyAsSupports(NS_LITERAL_STRING("listboxbody").get(), nsnull);
21021 + ClearCachedListBoxBody();
21023 return nsBoxObject::InvalidatePresentationStuff();
21025 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp mozilla.new/layout/xul/base/src/nsMenuPopupFrame.cpp
21026 --- mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp 2005-09-28 20:49:14.000000000 +0200
21027 +++ mozilla.new/layout/xul/base/src/nsMenuPopupFrame.cpp 2006-02-24 11:16:43.000000000 +0100
21028 @@ -1,4 +1,5 @@
21029 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
21030 +/* vim: set ts=2 sw=2 et tw=78: */
21031 /* ***** BEGIN LICENSE BLOCK *****
21032 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
21034 @@ -480,10 +481,11 @@ nsMenuPopupFrame::AdjustClientXYForNeste
21035 // nsXULPopupListener).
21037 nsCOMPtr<nsIDOMNode> targetNode;
21038 + nsCOMPtr<nsIDOMXULDocument2> doc = do_QueryInterface(inPopupDoc);
21039 if (mContent->Tag() == nsXULAtoms::tooltip)
21040 - inPopupDoc->GetTooltipNode(getter_AddRefs(targetNode));
21041 + doc->TrustedGetTooltipNode(getter_AddRefs(targetNode));
21042 else
21043 - inPopupDoc->GetPopupNode(getter_AddRefs(targetNode));
21044 + doc->TrustedGetPopupNode(getter_AddRefs(targetNode));
21046 //NS_WARN_IF_FALSE(targetNode, "no popup/tooltip node on document!");
21047 nsCOMPtr<nsIContent> targetAsContent ( do_QueryInterface(targetNode) );
21048 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/nsPIListBoxObject.h mozilla.new/layout/xul/base/src/nsPIListBoxObject.h
21049 --- mozilla/layout/xul/base/src/nsPIListBoxObject.h 1970-01-01 01:00:00.000000000 +0100
21050 +++ mozilla.new/layout/xul/base/src/nsPIListBoxObject.h 2006-02-03 02:46:01.000000000 +0100
21051 @@ -0,0 +1,63 @@
21052 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
21053 +/* ***** BEGIN LICENSE BLOCK *****
21054 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
21056 + * The contents of this file are subject to the Mozilla Public License Version
21057 + * 1.1 (the "License"); you may not use this file except in compliance with
21058 + * the License. You may obtain a copy of the License at
21059 + * http://www.mozilla.org/MPL/
21061 + * Software distributed under the License is distributed on an "AS IS" basis,
21062 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
21063 + * for the specific language governing rights and limitations under the
21064 + * License.
21066 + * The Original Code is Mozilla.org code.
21068 + * The Initial Developer of the Original Code is Mozilla.org.
21069 + * Portions created by the Initial Developer are Copyright (C) 2006
21070 + * the Initial Developer. All Rights Reserved.
21072 + * Contributor(s):
21073 + * Boris Zbarsky <bzbarsky@mit.edu> (Original Author)
21075 + * Alternatively, the contents of this file may be used under the terms of
21076 + * either the GNU General Public License Version 2 or later (the "GPL"), or
21077 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
21078 + * in which case the provisions of the GPL or the LGPL are applicable instead
21079 + * of those above. If you wish to allow use of your version of this file only
21080 + * under the terms of either the GPL or the LGPL, and not to allow others to
21081 + * use your version of this file under the terms of the MPL, indicate your
21082 + * decision by deleting the provisions above and replace them with the notice
21083 + * and other provisions required by the GPL or the LGPL. If you do not delete
21084 + * the provisions above, a recipient may use your version of this file under
21085 + * the terms of any one of the MPL, the GPL or the LGPL.
21087 + * ***** END LICENSE BLOCK ***** */
21089 +#ifndef nsPIListBoxObject_h__
21090 +#define nsPIListBoxObject_h__
21092 +#define NS_PILISTBOXOBJECT_IID \
21093 +{ 0x294e0820, 0x5c40, 0x42a8, \
21094 + { 0xb3, 0x2f, 0x6d, 0xcf, 0x05, 0xfb, 0xe1, 0xf3 } }
21096 +#include "nsIListBoxObject.h"
21098 +class nsPIListBoxObject : public nsIListBoxObject {
21099 + public:
21100 + NS_DEFINE_STATIC_IID_ACCESSOR(NS_PILISTBOXOBJECT_IID)
21102 + /**
21103 + * Clear the cached list box body frame from this box object. This should be
21104 + * called when the frame in question is destroyed.
21105 + */
21106 + virtual void ClearCachedListBoxBody() = 0;
21108 + /*
21109 + * Get the list box body. This will search for it as needed.
21110 + */
21111 + virtual nsIListBoxObject* GetListBoxBody() = 0;
21114 +#endif // nsPIListBoxObject_h__
21115 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/nsPopupBoxObject.cpp mozilla.new/layout/xul/base/src/nsPopupBoxObject.cpp
21116 --- mozilla/layout/xul/base/src/nsPopupBoxObject.cpp 2004-09-02 05:08:51.000000000 +0200
21117 +++ mozilla.new/layout/xul/base/src/nsPopupBoxObject.cpp 2006-03-12 20:04:20.000000000 +0100
21118 @@ -103,8 +103,13 @@ nsPopupBoxObject::HidePopup()
21119 nsIFrame* ourFrame = GetFrame();
21120 if (!ourFrame)
21121 return NS_OK;
21123 + nsCOMPtr<nsIPresShell> shell = GetPresShell();
21124 + if (!shell) {
21125 + return NS_OK;
21128 - nsIFrame* rootFrame = mPresShell->FrameManager()->GetRootFrame();
21129 + nsIFrame* rootFrame = shell->FrameManager()->GetRootFrame();
21130 if (!rootFrame)
21131 return NS_OK;
21133 @@ -138,7 +143,12 @@ nsPopupBoxObject::ShowPopup(nsIDOMElemen
21134 const PRUnichar *aPopupType, const PRUnichar *anAnchorAlignment,
21135 const PRUnichar *aPopupAlignment)
21137 - nsIFrame* rootFrame = mPresShell->FrameManager()->GetRootFrame();
21138 + nsCOMPtr<nsIPresShell> shell = GetPresShell();
21139 + if (!shell) {
21140 + return NS_OK;
21143 + nsIFrame* rootFrame = shell->FrameManager()->GetRootFrame();
21144 if (!rootFrame)
21145 return NS_OK;
21147 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/nsScrollBoxObject.cpp mozilla.new/layout/xul/base/src/nsScrollBoxObject.cpp
21148 --- mozilla/layout/xul/base/src/nsScrollBoxObject.cpp 2005-04-26 13:26:31.000000000 +0200
21149 +++ mozilla.new/layout/xul/base/src/nsScrollBoxObject.cpp 2006-03-12 20:04:20.000000000 +0100
21150 @@ -89,8 +89,13 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollT
21151 nsIScrollableView* scrollableView = GetScrollableView();
21152 if (!scrollableView)
21153 return NS_ERROR_FAILURE;
21155 + nsCOMPtr<nsIPresShell> shell = GetPresShell();
21156 + if (!shell) {
21157 + return NS_ERROR_UNEXPECTED;
21160 - float pixelsToTwips = mPresShell->GetPresContext()->PixelsToTwips();
21161 + float pixelsToTwips = shell->GetPresContext()->PixelsToTwips();
21163 return scrollableView->ScrollTo(NSToIntRound(x * pixelsToTwips),
21164 NSToIntRound(y * pixelsToTwips),
21165 @@ -239,8 +244,13 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollT
21166 if (!scrollableView)
21167 return NS_ERROR_FAILURE;
21169 + nsCOMPtr<nsIPresShell> shell = GetPresShell();
21170 + if (!shell) {
21171 + return NS_ERROR_UNEXPECTED;
21174 // prepare for twips
21175 - float pixelsToTwips = mPresShell->GetPresContext()->PixelsToTwips();
21176 + float pixelsToTwips = shell->GetPresContext()->PixelsToTwips();
21178 nsIFrame* scrolledBox = GetScrolledBox(this);
21179 if (!scrolledBox)
21180 @@ -307,7 +317,12 @@ NS_IMETHODIMP nsScrollBoxObject::GetPosi
21181 if (NS_FAILED(rv))
21182 return rv;
21184 - float twipsToPixels = mPresShell->GetPresContext()->TwipsToPixels();
21185 + nsCOMPtr<nsIPresShell> shell = GetPresShell();
21186 + if (!shell) {
21187 + return NS_ERROR_UNEXPECTED;
21190 + float twipsToPixels = shell->GetPresContext()->TwipsToPixels();
21192 *x = NSToIntRound(xc * twipsToPixels);
21193 *y = NSToIntRound(yc * twipsToPixels);
21194 @@ -329,9 +344,14 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureE
21195 if (!scrollableView)
21196 return NS_ERROR_FAILURE;
21198 + nsCOMPtr<nsIPresShell> shell = GetPresShell();
21199 + if (!shell) {
21200 + return NS_ERROR_UNEXPECTED;
21203 // prepare for twips
21204 float pixelsToTwips = 0.0;
21205 - pixelsToTwips = mPresShell->GetPresContext()->PixelsToTwips();
21206 + pixelsToTwips = shell->GetPresContext()->PixelsToTwips();
21208 nsIFrame* scrolledBox = GetScrolledBox(this);
21209 if (!scrolledBox)
21210 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/nsXULTooltipListener.cpp mozilla.new/layout/xul/base/src/nsXULTooltipListener.cpp
21211 --- mozilla/layout/xul/base/src/nsXULTooltipListener.cpp 2005-07-20 09:15:38.000000000 +0200
21212 +++ mozilla.new/layout/xul/base/src/nsXULTooltipListener.cpp 2006-02-24 11:16:43.000000000 +0100
21213 @@ -143,11 +143,11 @@ nsXULTooltipListener::MouseOut(nsIDOMEve
21214 nsCOMPtr<nsIDOMNode> targetNode(do_QueryInterface(eventTarget));
21216 // which node is our tooltip on?
21217 - nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(mCurrentTooltip->GetDocument()));
21218 + nsCOMPtr<nsIDOMXULDocument2> xulDoc(do_QueryInterface(mCurrentTooltip->GetDocument()));
21219 if (!xulDoc) // remotely possible someone could have
21220 return NS_OK; // removed tooltip from dom while it was open
21221 nsCOMPtr<nsIDOMNode> tooltipNode;
21222 - xulDoc->GetTooltipNode (getter_AddRefs(tooltipNode));
21223 + xulDoc->TrustedGetTooltipNode (getter_AddRefs(tooltipNode));
21225 // if they're the same, the mouse left the node the tooltip appeared on,
21226 // close the tooltip.
21227 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/tree/src/nsPITreeBoxObject.h mozilla.new/layout/xul/base/src/tree/src/nsPITreeBoxObject.h
21228 --- mozilla/layout/xul/base/src/tree/src/nsPITreeBoxObject.h 1970-01-01 01:00:00.000000000 +0100
21229 +++ mozilla.new/layout/xul/base/src/tree/src/nsPITreeBoxObject.h 2006-02-03 02:46:01.000000000 +0100
21230 @@ -0,0 +1,58 @@
21231 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
21232 +/* ***** BEGIN LICENSE BLOCK *****
21233 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
21235 + * The contents of this file are subject to the Mozilla Public License Version
21236 + * 1.1 (the "License"); you may not use this file except in compliance with
21237 + * the License. You may obtain a copy of the License at
21238 + * http://www.mozilla.org/MPL/
21240 + * Software distributed under the License is distributed on an "AS IS" basis,
21241 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
21242 + * for the specific language governing rights and limitations under the
21243 + * License.
21245 + * The Original Code is Mozilla.org code.
21247 + * The Initial Developer of the Original Code is Mozilla.org.
21248 + * Portions created by the Initial Developer are Copyright (C) 2006
21249 + * the Initial Developer. All Rights Reserved.
21251 + * Contributor(s):
21252 + * Boris Zbarsky <bzbarsky@mit.edu> (Original Author)
21254 + * Alternatively, the contents of this file may be used under the terms of
21255 + * either the GNU General Public License Version 2 or later (the "GPL"), or
21256 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
21257 + * in which case the provisions of the GPL or the LGPL are applicable instead
21258 + * of those above. If you wish to allow use of your version of this file only
21259 + * under the terms of either the GPL or the LGPL, and not to allow others to
21260 + * use your version of this file under the terms of the MPL, indicate your
21261 + * decision by deleting the provisions above and replace them with the notice
21262 + * and other provisions required by the GPL or the LGPL. If you do not delete
21263 + * the provisions above, a recipient may use your version of this file under
21264 + * the terms of any one of the MPL, the GPL or the LGPL.
21266 + * ***** END LICENSE BLOCK ***** */
21268 +#ifndef nsPITreeBoxObject_h__
21269 +#define nsPITreeBoxObject_h__
21271 +#define NS_PITREEBOXOBJECT_IID \
21272 +{ 0xafcd2a82, 0xc484, 0x4f86, \
21273 + { 0x83, 0x77, 0xd9, 0xb8, 0x59, 0x31, 0xef, 0xf0 } }
21275 +#include "nsITreeBoxObject.h"
21277 +class nsPITreeBoxObject : public nsITreeBoxObject {
21278 + public:
21279 + NS_DEFINE_STATIC_IID_ACCESSOR(NS_PITREEBOXOBJECT_IID)
21281 + /**
21282 + * Clear the cached tree body frame from this box object. This should be
21283 + * called when the frame in question is destroyed.
21284 + */
21285 + virtual void ClearCachedTreeBody() = 0;
21288 +#endif // nsPITreeBoxObject_h__
21289 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp mozilla.new/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
21290 --- mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp 2005-09-14 00:50:22.000000000 +0200
21291 +++ mozilla.new/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp 2006-02-14 10:01:28.000000000 +0100
21292 @@ -156,7 +156,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsLeafBo
21294 // Constructor
21295 nsTreeBodyFrame::nsTreeBodyFrame(nsIPresShell* aPresShell)
21296 -:nsLeafBoxFrame(aPresShell), mPresContext(nsnull), mTreeBoxObject(nsnull), mImageCache(nsnull),
21297 +:nsLeafBoxFrame(aPresShell), mPresContext(nsnull), mImageCache(nsnull),
21298 mScrollbar(nsnull), mTopRowIndex(0), mRowHeight(0), mIndentation(0), mStringWidth(-1),
21299 mFocused(PR_FALSE), mHasFixedRowCount(PR_FALSE),
21300 mVerticalOverflow(PR_FALSE), mReflowCallbackPosted(PR_FALSE),
21301 @@ -348,8 +348,7 @@ nsTreeBodyFrame::Destroy(nsPresContext*
21304 // Always null out the cached tree body frame.
21305 - nsAutoString treeBody(NS_LITERAL_STRING("treebody"));
21306 - box->RemoveProperty(treeBody.get());
21307 + mTreeBoxObject->ClearCachedTreeBody();
21309 mTreeBoxObject = nsnull; // Drop our ref here.
21311 @@ -395,12 +394,14 @@ nsTreeBodyFrame::EnsureView()
21312 nsCOMPtr<nsIBoxObject> box = do_QueryInterface(mTreeBoxObject);
21313 if (box) {
21314 nsCOMPtr<nsISupports> suppView;
21315 - box->GetPropertyAsSupports(NS_LITERAL_STRING("view").get(), getter_AddRefs(suppView));
21316 + box->GetPropertyAsSupports(NS_LITERAL_STRING("view").get(),
21317 + getter_AddRefs(suppView));
21318 nsCOMPtr<nsITreeView> treeView(do_QueryInterface(suppView));
21320 if (treeView) {
21321 nsXPIDLString rowStr;
21322 - box->GetProperty(NS_LITERAL_STRING("topRow").get(), getter_Copies(rowStr));
21323 + box->GetProperty(NS_LITERAL_STRING("topRow").get(),
21324 + getter_Copies(rowStr));
21325 nsAutoString rowStr2(rowStr);
21326 PRInt32 error;
21327 PRInt32 rowIndex = rowStr2.ToInteger(&error);
21328 @@ -514,7 +515,7 @@ NS_IMETHODIMP nsTreeBodyFrame::SetView(n
21329 EnsureBoxObject();
21330 nsCOMPtr<nsIBoxObject> box = do_QueryInterface(mTreeBoxObject);
21332 - nsAutoString view(NS_LITERAL_STRING("view"));
21333 + NS_NAMED_LITERAL_STRING(view, "view");
21335 if (mView) {
21336 nsCOMPtr<nsITreeSelection> sel;
21337 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.h mozilla.new/layout/xul/base/src/tree/src/nsTreeBodyFrame.h
21338 --- mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.h 2005-04-18 07:22:35.000000000 +0200
21339 +++ mozilla.new/layout/xul/base/src/tree/src/nsTreeBodyFrame.h 2006-02-14 10:01:28.000000000 +0100
21340 @@ -40,7 +40,7 @@
21341 * ***** END LICENSE BLOCK ***** */
21343 #include "nsLeafBoxFrame.h"
21344 -#include "nsITreeBoxObject.h"
21345 +#include "nsPITreeBoxObject.h"
21346 #include "nsITreeView.h"
21347 #include "nsICSSPseudoComparator.h"
21348 #include "nsIScrollbarMediator.h"
21349 @@ -313,7 +313,7 @@ protected: // Data Members
21350 nsPresContext* mPresContext;
21352 // The cached box object parent.
21353 - nsCOMPtr<nsITreeBoxObject> mTreeBoxObject;
21354 + nsCOMPtr<nsPITreeBoxObject> mTreeBoxObject;
21356 // Cached column information.
21357 nsRefPtr<nsTreeColumns> mColumns;
21358 diff -uprN --exclude=CVS mozilla/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp mozilla.new/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp
21359 --- mozilla/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp 2004-08-01 01:15:17.000000000 +0200
21360 +++ mozilla.new/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp 2006-03-12 20:04:20.000000000 +0100
21361 @@ -39,7 +39,7 @@
21362 #include "nsCOMPtr.h"
21363 #include "nsPresContext.h"
21364 #include "nsIPresShell.h"
21365 -#include "nsITreeBoxObject.h"
21366 +#include "nsPITreeBoxObject.h"
21367 #include "nsITreeView.h"
21368 #include "nsITreeSelection.h"
21369 #include "nsBoxObject.h"
21370 @@ -49,7 +49,7 @@
21371 #include "nsXULAtoms.h"
21372 #include "nsChildIterator.h"
21374 -class nsTreeBoxObject : public nsITreeBoxObject, public nsBoxObject
21375 +class nsTreeBoxObject : public nsPITreeBoxObject, public nsBoxObject
21377 public:
21378 NS_DECL_ISUPPORTS_INHERITED
21379 @@ -64,10 +64,17 @@ public:
21380 NS_IMETHOD Init(nsIContent* aContent, nsIPresShell* aPresShell);
21381 NS_IMETHOD SetDocument(nsIDocument* aDocument);
21382 NS_IMETHOD InvalidatePresentationStuff();
21384 + // nsPITreeBoxObject
21385 + virtual void ClearCachedTreeBody();
21387 +protected:
21388 + nsITreeBoxObject* mTreeBody;
21391 /* Implementation file */
21392 -NS_IMPL_ISUPPORTS_INHERITED1(nsTreeBoxObject, nsBoxObject, nsITreeBoxObject)
21393 +NS_IMPL_ISUPPORTS_INHERITED2(nsTreeBoxObject, nsBoxObject, nsITreeBoxObject,
21394 + nsPITreeBoxObject)
21397 NS_IMETHODIMP
21398 @@ -96,13 +103,14 @@ nsTreeBoxObject::SetDocument(nsIDocument
21399 NS_IMETHODIMP
21400 nsTreeBoxObject::InvalidatePresentationStuff()
21402 - SetPropertyAsSupports(NS_LITERAL_STRING("treebody").get(), nsnull);
21403 + ClearCachedTreeBody();
21404 SetPropertyAsSupports(NS_LITERAL_STRING("view").get(), nsnull);
21406 return nsBoxObject::InvalidatePresentationStuff();
21409 nsTreeBoxObject::nsTreeBoxObject()
21410 + : mTreeBody(nsnull)
21414 @@ -140,15 +148,11 @@ static void FindBodyElement(nsIContent*
21418 -inline nsITreeBoxObject*
21419 +nsITreeBoxObject*
21420 nsTreeBoxObject::GetTreeBody()
21422 - nsCOMPtr<nsISupports> supp;
21423 - GetPropertyAsSupports(NS_LITERAL_STRING("treebody").get(), getter_AddRefs(supp));
21425 - if (supp) {
21426 - nsCOMPtr<nsITreeBoxObject> body(do_QueryInterface(supp));
21427 - return body;
21428 + if (mTreeBody) {
21429 + return mTreeBody;
21432 nsIFrame* frame = GetFrame();
21433 @@ -159,15 +163,18 @@ nsTreeBoxObject::GetTreeBody()
21434 nsCOMPtr<nsIContent> content;
21435 FindBodyElement(frame->GetContent(), getter_AddRefs(content));
21437 - mPresShell->GetPrimaryFrameFor(content, &frame);
21438 + nsCOMPtr<nsIPresShell> shell = GetPresShell();
21439 + if (!shell) {
21440 + return nsnull;
21443 + shell->GetPrimaryFrameFor(content, &frame);
21444 if (!frame)
21445 return nsnull;
21447 // It's a frame. Refcounts are irrelevant.
21448 - nsCOMPtr<nsITreeBoxObject> body;
21449 - frame->QueryInterface(NS_GET_IID(nsITreeBoxObject), getter_AddRefs(body));
21450 - SetPropertyAsSupports(NS_LITERAL_STRING("treebody").get(), body);
21451 - return body;
21452 + CallQueryInterface(frame, &mTreeBody);
21453 + return mTreeBody;
21456 NS_IMETHODIMP nsTreeBoxObject::GetView(nsITreeView * *aView)
21457 @@ -410,6 +417,12 @@ NS_IMETHODIMP nsTreeBoxObject::ClearStyl
21458 return NS_OK;
21461 +void
21462 +nsTreeBoxObject::ClearCachedTreeBody()
21464 + mTreeBody = nsnull;
21467 // Creation Routine ///////////////////////////////////////////////////////////////////////
21469 nsresult
21470 diff -uprN --exclude=CVS mozilla/mailnews/addrbook/src/nsDirPrefs.cpp mozilla.new/mailnews/addrbook/src/nsDirPrefs.cpp
21471 --- mozilla/mailnews/addrbook/src/nsDirPrefs.cpp 2005-03-23 19:05:49.000000000 +0100
21472 +++ mozilla.new/mailnews/addrbook/src/nsDirPrefs.cpp 2006-02-24 11:16:49.000000000 +0100
21473 @@ -2693,6 +2693,14 @@ char *DIR_CreateServerPrefName (DIR_Serv
21474 leafName = nsCRT::strdup(name);
21475 else
21476 leafName = dir_ConvertDescriptionToPrefName (server);
21478 + if (!leafName || !*leafName)
21480 + // we need to handle this in case the description has no alphanumeric chars
21481 + // it's very common for cjk users
21482 + leafName = nsCRT::strdup("_nonascii");
21485 if (leafName)
21487 PRInt32 uniqueIDCnt = 0;
21488 @@ -2723,6 +2731,13 @@ char *DIR_CreateServerPrefName (DIR_Serv
21489 NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(prefCount, children);
21490 } /* while we don't have a unique name */
21492 + // fallback to "user_directory_N" form if we failed to verify
21493 + if (!isUnique && prefName)
21495 + PR_smprintf_free(prefName);
21496 + prefName = nsnull;
21499 PR_Free(leafName);
21501 } /* if leafName */
21502 diff -uprN --exclude=CVS mozilla/mailnews/base/prefs/resources/content/am-addressing.js mozilla.new/mailnews/base/prefs/resources/content/am-addressing.js
21503 --- mozilla/mailnews/base/prefs/resources/content/am-addressing.js 2004-11-10 22:40:59.000000000 +0100
21504 +++ mozilla.new/mailnews/base/prefs/resources/content/am-addressing.js 2006-02-14 10:01:38.000000000 +0100
21505 @@ -55,16 +55,16 @@ function enabling()
21507 // If the default per-identity directory preferences are locked
21508 // disable the corresponding elements.
21509 - if (gPrefInt.prefIsLocked("mail.identity." + gIdentity.key + ".overrideGlobal_Pref")) {
21510 + if (gIdentity && gPrefInt.prefIsLocked("mail.identity." + gIdentity.key + ".overrideGlobal_Pref")) {
21511 document.getElementById("useGlobalPref").setAttribute("disabled", "true");
21512 document.getElementById("directories").setAttribute("disabled", "true");
21514 else
21516 - document.getElementById("useGlobalPref").removeAttribute("disabled");
21517 + document.getElementById("useGlobalPref").removeAttribute("disabled");
21518 document.getElementById("directories").removeAttribute("disabled");
21520 - if (gPrefInt.prefIsLocked("mail.identity." + gIdentity.key + ".directoryServer")) {
21521 + if (gIdentity && gPrefInt.prefIsLocked("mail.identity." + gIdentity.key + ".directoryServer")) {
21522 document.getElementById("directoriesList").setAttribute("disabled", "true");
21523 document.getElementById("directoriesListPopup").setAttribute("disabled", "true");
21525 diff -uprN --exclude=CVS mozilla/mailnews/base/resources/content/mailWindowOverlay.js mozilla.new/mailnews/base/resources/content/mailWindowOverlay.js
21526 --- mozilla/mailnews/base/resources/content/mailWindowOverlay.js 2006-01-09 06:49:05.000000000 +0100
21527 +++ mozilla.new/mailnews/base/resources/content/mailWindowOverlay.js 2006-02-14 10:01:38.000000000 +0100
21528 @@ -2253,7 +2253,7 @@ function OnMsgLoaded(aUrl)
21529 var markReadOnADelay = gPrefBranch.getBoolPref("mailnews.mark_message_read.delay");
21530 if (msgHdr && !msgHdr.isRead)
21532 - var wintype = document.firstChild.getAttribute('windowtype');
21533 + var wintype = document.documentElement.getAttribute('windowtype');
21534 if (markReadOnADelay && wintype == "mail:3pane") // only use the timer if viewing using the 3-pane preview pane and the user has set the pref
21535 gMarkViewedMessageAsReadTimer = setTimeout(MarkCurrentMessageAsRead, gPrefBranch.getIntPref("mailnews.mark_message_read.delay.interval") * 1000);
21536 else
21537 diff -uprN --exclude=CVS mozilla/mailnews/base/resources/content/msgMail3PaneWindow.js mozilla.new/mailnews/base/resources/content/msgMail3PaneWindow.js
21538 --- mozilla/mailnews/base/resources/content/msgMail3PaneWindow.js 2006-01-23 08:55:19.000000000 +0100
21539 +++ mozilla.new/mailnews/base/resources/content/msgMail3PaneWindow.js 2006-02-14 10:01:38.000000000 +0100
21540 @@ -823,11 +823,11 @@ function loadStartFolder(initialUri)
21542 var startFolder = startFolderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
21544 - // Perform biff on the server to check for new mail, except for imap
21545 - // or a pop3 account that is deferred or deferred to,
21546 + // Perform biff on the server to check for new mail, except for
21547 + // a pop3 account that is deferred or deferred to,
21548 // or the case where initialUri is non-null (non-startup)
21549 if (!initialUri && isLoginAtStartUpEnabled && gLoadStartFolder
21550 - && defaultServer.type != "imap" && !defaultServer.isDeferredTo &&
21551 + && !defaultServer.isDeferredTo &&
21552 defaultServer.rootFolder == defaultServer.rootMsgFolder)
21553 defaultServer.PerformBiff(msgWindow);
21555 diff -uprN --exclude=CVS mozilla/mailnews/base/resources/content/phishingDetector.js mozilla.new/mailnews/base/resources/content/phishingDetector.js
21556 --- mozilla/mailnews/base/resources/content/phishingDetector.js 2006-01-09 06:49:06.000000000 +0100
21557 +++ mozilla.new/mailnews/base/resources/content/phishingDetector.js 2006-02-24 11:16:49.000000000 +0100
21558 @@ -76,7 +76,7 @@ function isMsgEmailScam(aUrl)
21560 var forms = msgDocument.getElementsByTagName("form");
21561 for (index = 0; index < forms.length && !isEmailScam; index++)
21562 - isEmailScam = !/^addbook:/.test(forms[index].action);
21563 + isEmailScam = forms[index].action != "" && !/^addbook:/.test(forms[index].action);
21566 // we'll add more checks here as our detector matures....
21567 @@ -135,6 +135,11 @@ function isPhishingURL(aLinkNode, aSilen
21568 function misMatchedHostWithLinkText(aLinkNode, aHrefURL, aLinkTextURL)
21570 var linkNodeText = gatherTextUnder(aLinkNode);
21572 + // gatherTextUnder puts a space between each piece of text it gathers,
21573 + // so strip the spaces out (see bug 326082 for details).
21574 + linkNodeText = linkNodeText.replace(/ /g, "");
21576 // only worry about http and https urls
21577 if (linkNodeText)
21579 diff -uprN --exclude=CVS mozilla/mailnews/base/search/src/nsMsgFilterService.cpp mozilla.new/mailnews/base/search/src/nsMsgFilterService.cpp
21580 --- mozilla/mailnews/base/search/src/nsMsgFilterService.cpp 2005-08-10 20:59:17.000000000 +0200
21581 +++ mozilla.new/mailnews/base/search/src/nsMsgFilterService.cpp 2006-02-14 10:01:38.000000000 +0100
21582 @@ -139,11 +139,15 @@ NS_IMETHODIMP nsMsgFilterService::CloseF
21583 /* save without deleting */
21584 NS_IMETHODIMP nsMsgFilterService::SaveFilterList(nsIMsgFilterList *filterList, nsIFileSpec *filterFile)
21586 - nsresult ret = NS_OK;
21587 + NS_ENSURE_ARG_POINTER(filterFile);
21588 + NS_ENSURE_ARG_POINTER(filterList);
21590 + nsresult ret = NS_OK;
21591 nsCOMPtr <nsIFileSpec> tmpFiltersFile;
21592 nsCOMPtr <nsIFileSpec> realFiltersFile;
21593 nsCOMPtr <nsIFileSpec> parentDir;
21596 nsSpecialSystemDirectory tmpFile(nsSpecialSystemDirectory::OS_TemporaryDirectory);
21597 tmpFile += "tmprules.dat";
21599 diff -uprN --exclude=CVS mozilla/mailnews/base/src/nsMessenger.cpp mozilla.new/mailnews/base/src/nsMessenger.cpp
21600 --- mozilla/mailnews/base/src/nsMessenger.cpp 2005-10-04 05:10:45.000000000 +0200
21601 +++ mozilla.new/mailnews/base/src/nsMessenger.cpp 2006-02-14 10:01:38.000000000 +0100
21602 @@ -902,6 +902,8 @@ nsMessenger::SaveAllAttachments(PRUint32
21603 const char **displayNameArray,
21604 const char **messageUriArray)
21606 + if (!count)
21607 + return NS_ERROR_INVALID_ARG;
21608 return SaveAllAttachments(count, contentTypeArray, urlArray, displayNameArray, messageUriArray, PR_FALSE);
21611 diff -uprN --exclude=CVS mozilla/mailnews/base/src/nsMsgContentPolicy.cpp mozilla.new/mailnews/base/src/nsMsgContentPolicy.cpp
21612 --- mozilla/mailnews/base/src/nsMsgContentPolicy.cpp 2005-10-24 07:41:40.000000000 +0200
21613 +++ mozilla.new/mailnews/base/src/nsMsgContentPolicy.cpp 2006-03-03 07:15:39.000000000 +0100
21614 @@ -350,7 +350,7 @@ nsMsgContentPolicy::ShouldLoad(PRUint32
21615 // now we need to call out the msg sink informing it that this message has remote content
21616 nsCOMPtr<nsIMsgWindow> msgWindow;
21617 rv = mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow)); // it's not an error for the msg window to be null
21618 - NS_ENSURE_TRUE(msgWindow, NS_ERROR_FAILURE);
21619 + NS_ENSURE_TRUE(msgWindow, NS_OK);
21621 nsCOMPtr<nsIMsgHeaderSink> msgHdrSink;
21622 rv = msgWindow->GetMsgHeaderSink(getter_AddRefs(msgHdrSink));
21623 diff -uprN --exclude=CVS mozilla/mailnews/base/src/nsMsgDBView.cpp mozilla.new/mailnews/base/src/nsMsgDBView.cpp
21624 --- mozilla/mailnews/base/src/nsMsgDBView.cpp 2005-10-14 02:42:20.000000000 +0200
21625 +++ mozilla.new/mailnews/base/src/nsMsgDBView.cpp 2006-02-14 10:01:38.000000000 +0100
21626 @@ -4062,6 +4062,7 @@ nsresult nsMsgDBView::ExpandByIndex(nsMs
21627 return NS_MSG_MESSAGE_NOT_FOUND;
21629 rv = GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(pThread));
21630 + NS_ENSURE_SUCCESS(rv, rv);
21631 m_flags[index] = flags;
21632 NoteChange(index, 1, nsMsgViewNotificationCode::changed);
21633 if (m_viewFlags & nsMsgViewFlagsType::kUnreadOnly)
21634 @@ -4348,12 +4349,6 @@ nsresult nsMsgDBView::AddHdr(nsIMsgDBHdr
21636 // if unreadonly, level is 0 because we must be the only msg in the thread.
21637 PRInt32 levelToAdd = 0;
21638 -#if 0
21639 - if (!(m_viewFlags & nsMsgViewFlagsType::kUnreadOnly))
21641 - levelToAdd = FindLevelInThread(msgHdr, insertIndex);
21643 -#endif
21645 if (m_sortOrder == nsMsgViewSortOrder::ascending)
21647 @@ -4382,12 +4377,6 @@ nsresult nsMsgDBView::AddHdr(nsIMsgDBHdr
21648 m_keys.InsertAt(insertIndex, msgKey);
21649 m_flags.InsertAt(insertIndex, flags);
21650 PRInt32 level = 0;
21651 -#if 0
21652 - if (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay)
21654 - level = FindLevelInThread(msgHdr, insertIndex);
21656 -#endif
21657 m_levels.InsertAt(insertIndex, level);
21659 // the call to NoteChange() has to happen after we add the key
21660 @@ -4501,11 +4490,9 @@ nsresult nsMsgDBView::ListIdsInThread(ns
21661 msgHdr->GetFlags(&msgFlags);
21662 AdjustReadFlag(msgHdr, &msgFlags);
21663 m_keys.InsertAt(viewIndex, msgKey);
21664 - // ### TODO - how about hasChildren flag?
21665 m_flags.InsertAt(viewIndex, msgFlags & ~MSG_VIEW_FLAGS);
21666 - // ### TODO this is going to be tricky - might use enumerators
21667 - PRInt32 level = FindLevelInThread(msgHdr, startOfThreadViewIndex, viewIndex);
21668 - m_levels.InsertAt(viewIndex, level);
21669 + // here, we're either flat, or we're grouped - in either case, level is 1
21670 + m_levels.InsertAt(viewIndex, 1);
21671 // turn off thread or elided bit if they got turned on (maybe from new only view?)
21672 if (i > 0)
21673 msgHdr->AndFlags(~(MSG_VIEW_FLAG_ISTHREAD | MSG_FLAG_ELIDED), &newFlags);
21674 diff -uprN --exclude=CVS mozilla/mailnews/base/util/nsMsgIdentity.cpp mozilla.new/mailnews/base/util/nsMsgIdentity.cpp
21675 --- mozilla/mailnews/base/util/nsMsgIdentity.cpp 2005-05-08 00:36:17.000000000 +0200
21676 +++ mozilla.new/mailnews/base/util/nsMsgIdentity.cpp 2006-02-24 11:16:50.000000000 +0100
21677 @@ -618,6 +618,13 @@ nsMsgIdentity::getFolderPref(const char
21678 if (NS_SUCCEEDED(rv))
21679 return msgFolder->GetURI(retval);
21681 + else // if the server doesn't exist, fall back to the default pref.
21683 + PR_FREEIF(*retval); // free the empty string
21684 + rv = getDefaultCharPref(prefname, retval);
21685 + if (NS_SUCCEEDED(rv) && *retval)
21686 + rv = setFolderPref(prefname, (const char *)*retval);
21689 return rv;
21691 diff -uprN --exclude=CVS mozilla/mailnews/base/util/nsMsgUtils.cpp mozilla.new/mailnews/base/util/nsMsgUtils.cpp
21692 --- mozilla/mailnews/base/util/nsMsgUtils.cpp 2005-10-04 05:10:45.000000000 +0200
21693 +++ mozilla.new/mailnews/base/util/nsMsgUtils.cpp 2006-02-14 10:01:38.000000000 +0100
21694 @@ -668,10 +668,10 @@ nsresult EscapeFromSpaceLine(nsIFileSpec
21695 // Found a line so check if it's a qualified "From " line.
21696 if (IsAFromSpaceLine(start, pChar))
21697 rv = pDst->Write(">", 1, &written);
21699 - rv = pDst->Write(start, pChar-start+2, &written);
21700 + PRInt32 lineTerminatorCount = (*(pChar + 1) == nsCRT::LF) ? 2 : 1;
21701 + rv = pDst->Write(start, pChar - start + lineTerminatorCount, &written);
21702 NS_ENSURE_SUCCESS(rv,rv);
21703 - pChar += 2;
21704 + pChar += lineTerminatorCount;
21705 start = pChar;
21707 else if (start < end)
21708 diff -uprN --exclude=CVS mozilla/mailnews/compose/src/nsMsgCompose.cpp mozilla.new/mailnews/compose/src/nsMsgCompose.cpp
21709 --- mozilla/mailnews/compose/src/nsMsgCompose.cpp 2005-12-01 00:44:46.000000000 +0100
21710 +++ mozilla.new/mailnews/compose/src/nsMsgCompose.cpp 2006-02-14 10:01:38.000000000 +0100
21711 @@ -403,10 +403,10 @@ nsresult nsMsgCompose::TagEmbeddedObject
21713 // first, convert the rdf original msg uri into a url that represents the message...
21714 nsCOMPtr <nsIMsgMessageService> msgService;
21715 - rv = GetMessageServiceFromURI(mQuoteURI.get(), getter_AddRefs(msgService));
21716 + rv = GetMessageServiceFromURI(mOriginalMsgURI.get(), getter_AddRefs(msgService));
21717 if (NS_SUCCEEDED(rv))
21719 - rv = msgService->GetUrlForUri(mQuoteURI.get(), getter_AddRefs(originalUrl), nsnull);
21720 + rv = msgService->GetUrlForUri(mOriginalMsgURI.get(), getter_AddRefs(originalUrl), nsnull);
21721 if (NS_SUCCEEDED(rv) && originalUrl)
21723 originalUrl->GetScheme(originalScheme);
21724 @@ -1742,8 +1742,6 @@ nsresult nsMsgCompose::CreateMessage(con
21726 // Setup quoting callbacks for later...
21727 mWhatHolder = 1;
21728 - mQuoteURI = originalMsgURI;
21730 break;
21732 case nsIMsgCompType::ForwardAsAttachment:
21733 @@ -3420,7 +3418,7 @@ nsMsgCompose::BuildQuotedMessageAndSigna
21735 // We will fire off the quote operation and wait for it to
21736 // finish before we actually do anything with Ender...
21737 - return QuoteOriginalMessage(mQuoteURI.get(), mWhatHolder);
21738 + return QuoteOriginalMessage(mOriginalMsgURI.get(), mWhatHolder);
21742 diff -uprN --exclude=CVS mozilla/mailnews/compose/src/nsMsgCompose.h mozilla.new/mailnews/compose/src/nsMsgCompose.h
21743 --- mozilla/mailnews/compose/src/nsMsgCompose.h 2005-10-18 18:34:41.000000000 +0200
21744 +++ mozilla.new/mailnews/compose/src/nsMsgCompose.h 2006-02-14 10:01:38.000000000 +0100
21745 @@ -91,7 +91,6 @@ private:
21746 nsIDOMNode * object);
21747 nsresult TagEmbeddedObjects(nsIEditorMailSupport *aMailEditor);
21749 - nsCString mQuoteURI;
21750 nsCString mQuoteCharset;
21751 nsCString mOriginalMsgURI; // used so we can mark message disposition flags after we send the message
21753 diff -uprN --exclude=CVS mozilla/mailnews/compose/src/nsMsgComposeService.cpp mozilla.new/mailnews/compose/src/nsMsgComposeService.cpp
21754 --- mozilla/mailnews/compose/src/nsMsgComposeService.cpp 2005-10-04 05:10:46.000000000 +0200
21755 +++ mozilla.new/mailnews/compose/src/nsMsgComposeService.cpp 2006-02-14 10:01:38.000000000 +0100
21756 @@ -1380,9 +1380,14 @@ nsMsgComposeService::Handle(nsICommandLi
21757 rv = aCmdLine->GetLength(&count);
21758 NS_ENSURE_SUCCESS(rv, rv);
21760 - if (count >= found) {
21761 + if (count > found + 1) {
21762 aCmdLine->GetArgument(found + 1, uristr);
21763 - if (StringBeginsWith(uristr, NS_LITERAL_STRING("mailto:"))) {
21764 + if (StringBeginsWith(uristr, NS_LITERAL_STRING("mailto:")) ||
21765 + StringBeginsWith(uristr, NS_LITERAL_STRING("to=")) ||
21766 + StringBeginsWith(uristr, NS_LITERAL_STRING("cc=")) ||
21767 + StringBeginsWith(uristr, NS_LITERAL_STRING("subject=")) ||
21768 + StringBeginsWith(uristr, NS_LITERAL_STRING("body=")) ||
21769 + StringBeginsWith(uristr, NS_LITERAL_STRING("attachment="))) {
21770 end++;
21771 // mailto: URIs are frequently passed with spaces in them. They should be
21772 // escaped with %20, but we hack around broken clients. See bug 231032.
21773 diff -uprN --exclude=CVS mozilla/mailnews/compose/src/nsMsgCompUtils.cpp mozilla.new/mailnews/compose/src/nsMsgCompUtils.cpp
21774 --- mozilla/mailnews/compose/src/nsMsgCompUtils.cpp 2005-07-20 13:49:42.000000000 +0200
21775 +++ mozilla.new/mailnews/compose/src/nsMsgCompUtils.cpp 2006-02-14 10:01:38.000000000 +0100
21776 @@ -1307,10 +1307,7 @@ RFC2231ParmFolding(const char *parmName,
21777 foldedParm = PL_strdup(parmName);
21779 else {
21780 - if (needEscape)
21781 - NS_MsgSACat(&foldedParm, "\r\n ");
21782 - else
21783 - NS_MsgSACat(&foldedParm, ";\r\n ");
21784 + NS_MsgSACat(&foldedParm, ";\r\n ");
21785 NS_MsgSACat(&foldedParm, parmName);
21787 PR_snprintf(digits, sizeof(digits), "*%d", counter);
21788 diff -uprN --exclude=CVS mozilla/mailnews/compose/src/nsSmtpService.cpp mozilla.new/mailnews/compose/src/nsSmtpService.cpp
21789 --- mozilla/mailnews/compose/src/nsSmtpService.cpp 2005-07-26 23:23:43.000000000 +0200
21790 +++ mozilla.new/mailnews/compose/src/nsSmtpService.cpp 2006-02-24 11:16:50.000000000 +0100
21791 @@ -345,6 +345,7 @@ NS_IMETHODIMP nsSmtpService::NewURI(cons
21793 NS_IMETHODIMP nsSmtpService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
21795 + NS_ENSURE_ARG_POINTER(aURI);
21796 // create an empty pipe for use with the input stream channel.
21797 nsCOMPtr<nsIInputStream> pipeIn;
21798 nsCOMPtr<nsIOutputStream> pipeOut;
21799 diff -uprN --exclude=CVS mozilla/mailnews/extensions/smime/resources/content/msgReadSMIMEOverlay.js mozilla.new/mailnews/extensions/smime/resources/content/msgReadSMIMEOverlay.js
21800 --- mozilla/mailnews/extensions/smime/resources/content/msgReadSMIMEOverlay.js 2002-05-29 06:44:47.000000000 +0200
21801 +++ mozilla.new/mailnews/extensions/smime/resources/content/msgReadSMIMEOverlay.js 2006-02-14 10:01:38.000000000 +0100
21802 @@ -119,7 +119,7 @@ var SecurityController =
21804 case "cmd_viewSecurityStatus":
21806 - if (document.firstChild.getAttribute('windowtype') == "mail:messageWindow")
21807 + if (document.documentElement.getAttribute('windowtype') == "mail:messageWindow")
21809 return ( gCurrentMessageUri != null);
21811 diff -uprN --exclude=CVS mozilla/mailnews/local/src/nsMailboxService.cpp mozilla.new/mailnews/local/src/nsMailboxService.cpp
21812 --- mozilla/mailnews/local/src/nsMailboxService.cpp 2005-11-01 17:49:22.000000000 +0100
21813 +++ mozilla.new/mailnews/local/src/nsMailboxService.cpp 2006-02-24 11:16:51.000000000 +0100
21814 @@ -558,6 +558,7 @@ NS_IMETHODIMP nsMailboxService::NewURI(c
21816 NS_IMETHODIMP nsMailboxService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
21818 + NS_ENSURE_ARG_POINTER(aURI);
21819 nsresult rv = NS_OK;
21820 nsMailboxProtocol * protocol = new nsMailboxProtocol(aURI);
21821 if (protocol)
21822 diff -uprN --exclude=CVS mozilla/mailnews/local/src/nsMailboxUrl.cpp mozilla.new/mailnews/local/src/nsMailboxUrl.cpp
21823 --- mozilla/mailnews/local/src/nsMailboxUrl.cpp 2005-06-01 21:04:20.000000000 +0200
21824 +++ mozilla.new/mailnews/local/src/nsMailboxUrl.cpp 2006-03-03 07:15:42.000000000 +0100
21825 @@ -277,7 +277,7 @@ NS_IMETHODIMP nsMailboxUrl::GetUri(char
21826 nsresult nsMailboxUrl::GetMsgHdrForKey(nsMsgKey msgKey, nsIMsgDBHdr ** aMsgHdr)
21828 nsresult rv = NS_OK;
21829 - if (aMsgHdr)
21830 + if (aMsgHdr && m_filePath)
21832 nsCOMPtr<nsIMsgDatabase> mailDBFactory;
21833 nsCOMPtr<nsIMsgDatabase> mailDB;
21834 diff -uprN --exclude=CVS mozilla/mailnews/local/src/nsPop3Service.cpp mozilla.new/mailnews/local/src/nsPop3Service.cpp
21835 --- mozilla/mailnews/local/src/nsPop3Service.cpp 2005-08-03 00:32:21.000000000 +0200
21836 +++ mozilla.new/mailnews/local/src/nsPop3Service.cpp 2006-02-24 11:16:51.000000000 +0100
21837 @@ -415,6 +415,7 @@ NS_IMETHODIMP nsPop3Service::NewURI(cons
21839 NS_IMETHODIMP nsPop3Service::NewChannel(nsIURI *aURI, nsIChannel **_retval)
21841 + NS_ENSURE_ARG_POINTER(aURI);
21842 nsresult rv = NS_OK;
21843 nsPop3Protocol * protocol = new nsPop3Protocol(aURI);
21844 if (protocol)
21845 diff -uprN --exclude=CVS mozilla/mailnews/mailnews.js mozilla.new/mailnews/mailnews.js
21846 --- mozilla/mailnews/mailnews.js 2006-01-09 06:49:05.000000000 +0100
21847 +++ mozilla.new/mailnews/mailnews.js 2006-02-24 11:16:49.000000000 +0100
21848 @@ -277,7 +277,7 @@ pref("ldap_2.servers.history.isOffline",
21849 // default mapping of addressbook properties to ldap attributes
21850 pref("ldap_2.servers.default.attrmap.FirstName", "givenName");
21851 pref("ldap_2.servers.default.attrmap.LastName", "sn,surname");
21852 -pref("ldap_2.servers.default.attrmap.DisplayName", "displayName,cn,commonname");
21853 +pref("ldap_2.servers.default.attrmap.DisplayName", "cn,commonname");
21854 pref("ldap_2.servers.default.attrmap.NickName", "mozillaNickname,xmozillanickname");
21855 pref("ldap_2.servers.default.attrmap.PrimaryEmail", "mail");
21856 pref("ldap_2.servers.default.attrmap.SecondEmail", "mozillaSecondEmail,xmozillasecondemail");
21857 diff -uprN --exclude=CVS mozilla/mailnews/mime/src/mimecryp.cpp mozilla.new/mailnews/mime/src/mimecryp.cpp
21858 --- mozilla/mailnews/mime/src/mimecryp.cpp 2004-01-04 08:57:16.000000000 +0100
21859 +++ mozilla.new/mailnews/mime/src/mimecryp.cpp 2006-02-14 10:01:39.000000000 +0100
21860 @@ -118,7 +118,17 @@ MimeEncrypted_parse_begin (MimeObject *o
21861 else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_BASE64))
21862 fn = &MimeB64DecoderInit;
21863 else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_QUOTED_PRINTABLE))
21864 - fn = &MimeQPDecoderInit;
21866 + enc->decoder_data =
21867 + MimeQPDecoderInit (/* The (int (*) ...) cast is to turn the `void' argument
21868 + into `MimeObject'. */
21869 + ((nsresult (*) (const char *, PRInt32, void *))
21870 + ((MimeEncryptedClass *)obj->clazz)->parse_decoded_buffer),
21871 + obj);
21873 + if (!enc->decoder_data)
21874 + return MIME_OUT_OF_MEMORY;
21876 else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE) ||
21877 !nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE2) ||
21878 !nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE3) ||
21879 diff -uprN --exclude=CVS mozilla/mailnews/mime/src/mimedrft.cpp mozilla.new/mailnews/mime/src/mimedrft.cpp
21880 --- mozilla/mailnews/mime/src/mimedrft.cpp 2005-07-20 13:49:43.000000000 +0200
21881 +++ mozilla.new/mailnews/mime/src/mimedrft.cpp 2006-02-14 10:01:39.000000000 +0100
21882 @@ -1964,7 +1964,13 @@ mime_decompose_file_init_fn ( void *stre
21883 else if (!nsCRT::strcasecmp(newAttachment->encoding, ENCODING_BASE64))
21884 fn = &MimeB64DecoderInit;
21885 else if (!nsCRT::strcasecmp(newAttachment->encoding, ENCODING_QUOTED_PRINTABLE))
21886 - fn = &MimeQPDecoderInit;
21888 + mdd->decoder_data = MimeQPDecoderInit (/* The (nsresult (*) ...) cast is to turn the `void' argument into `MimeObject'. */
21889 + ((nsresult (*) (const char *, PRInt32, void *))
21890 + dummy_file_write), mdd->tmpFileStream);
21891 + if (!mdd->decoder_data)
21892 + return MIME_OUT_OF_MEMORY;
21894 else if (!nsCRT::strcasecmp(newAttachment->encoding, ENCODING_UUENCODE) ||
21895 !nsCRT::strcasecmp(newAttachment->encoding, ENCODING_UUENCODE2) ||
21896 !nsCRT::strcasecmp(newAttachment->encoding, ENCODING_UUENCODE3) ||
21897 diff -uprN --exclude=CVS mozilla/mailnews/mime/src/mimeenc.cpp mozilla.new/mailnews/mime/src/mimeenc.cpp
21898 --- mozilla/mailnews/mime/src/mimeenc.cpp 2004-05-14 10:14:44.000000000 +0200
21899 +++ mozilla.new/mailnews/mime/src/mimeenc.cpp 2006-02-14 10:01:39.000000000 +0100
21900 @@ -42,6 +42,7 @@
21901 #include "plstr.h"
21902 #include "prlog.h"
21903 #include "prprf.h"
21904 +#include "mimeobj.h"
21906 typedef enum mime_encoding {
21907 mime_Base64, mime_QuotedPrintable, mime_uuencode, mime_yencode
21908 @@ -63,6 +64,7 @@ struct MimeDecoderData {
21909 char *line_buffer;
21910 int line_buffer_size;
21912 + MimeObject *objectToDecode; // might be null, only used for QP currently
21913 /* Where to write the decoded data */
21914 nsresult (*write_buffer) (const char *buf, PRInt32 size, void *closure);
21915 void *closure;
21916 @@ -176,7 +178,9 @@ mime_decode_qp_buffer (MimeDecoderData *
21917 continue;
21919 /* treat null bytes as spaces per bug 243199 comment 7 */
21920 - *out++ = c ? (char) c : ' ';
21921 + *out++ = c || (data->objectToDecode &&
21922 + data->objectToDecode->options->format_out != nsMimeOutput::nsMimeMessageBodyDisplay)
21923 + ? (char) c : ' ';
21925 else
21927 @@ -797,9 +801,12 @@ MimeB64DecoderInit (nsresult (*output_fn
21929 MimeDecoderData *
21930 MimeQPDecoderInit (nsresult (*output_fn) (const char *, PRInt32, void *),
21931 - void *closure)
21932 + void *closure, MimeObject *object)
21934 - return mime_decoder_init (mime_QuotedPrintable, output_fn, closure);
21935 + MimeDecoderData *retData = mime_decoder_init (mime_QuotedPrintable, output_fn, closure);
21936 + if (retData)
21937 + retData->objectToDecode = object;
21938 + return retData;
21941 MimeDecoderData *
21942 diff -uprN --exclude=CVS mozilla/mailnews/mime/src/mimeleaf.cpp mozilla.new/mailnews/mime/src/mimeleaf.cpp
21943 --- mozilla/mailnews/mime/src/mimeleaf.cpp 2005-06-03 12:26:24.000000000 +0200
21944 +++ mozilla.new/mailnews/mime/src/mimeleaf.cpp 2006-02-14 10:01:39.000000000 +0100
21945 @@ -124,7 +124,10 @@ MimeLeaf_parse_begin (MimeObject *obj)
21946 else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_BASE64))
21947 fn = &MimeB64DecoderInit;
21948 else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_QUOTED_PRINTABLE))
21949 - fn = &MimeQPDecoderInit;
21950 + leaf->decoder_data =
21951 + MimeQPDecoderInit(((nsresult (*) (const char *, PRInt32, void *))
21952 + ((MimeLeafClass *)obj->clazz)->parse_decoded_buffer),
21953 + obj, obj);
21954 else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE) ||
21955 !nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE2) ||
21956 !nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE3) ||
21957 diff -uprN --exclude=CVS mozilla/mailnews/mime/src/mimemsig.cpp mozilla.new/mailnews/mime/src/mimemsig.cpp
21958 --- mozilla/mailnews/mime/src/mimemsig.cpp 2004-04-17 20:33:13.000000000 +0200
21959 +++ mozilla.new/mailnews/mime/src/mimemsig.cpp 2006-02-14 10:01:39.000000000 +0100
21960 @@ -395,7 +395,15 @@ MimeMultipartSigned_parse_line (char *li
21961 else if (!nsCRT::strcasecmp(encoding.get(), ENCODING_BASE64))
21962 fn = &MimeB64DecoderInit;
21963 else if (!nsCRT::strcasecmp(encoding.get(), ENCODING_QUOTED_PRINTABLE))
21964 - fn = &MimeQPDecoderInit;
21966 + sig->sig_decoder_data =
21967 + MimeQPDecoderInit (((nsresult (*) (const char *, PRInt32, void *))
21968 + (((MimeMultipartSignedClass *) obj->clazz)
21969 + ->crypto_signature_hash)),
21970 + sig->crypto_closure);
21971 + if (!sig->sig_decoder_data)
21972 + return MIME_OUT_OF_MEMORY;
21974 else if (!nsCRT::strcasecmp(encoding.get(), ENCODING_UUENCODE) ||
21975 !nsCRT::strcasecmp(encoding.get(), ENCODING_UUENCODE2) ||
21976 !nsCRT::strcasecmp(encoding.get(), ENCODING_UUENCODE3) ||
21977 diff -uprN --exclude=CVS mozilla/mailnews/mime/src/modmimee.h mozilla.new/mailnews/mime/src/modmimee.h
21978 --- mozilla/mailnews/mime/src/modmimee.h 2004-04-17 20:33:13.000000000 +0200
21979 +++ mozilla.new/mailnews/mime/src/modmimee.h 2006-02-14 10:01:39.000000000 +0100
21980 @@ -56,17 +56,17 @@
21981 typedef struct MimeDecoderData MimeDecoderData;
21982 typedef struct MimeEncoderData MimeEncoderData;
21984 +struct MimeObject;
21987 /* functions for creating that opaque data.
21989 -MimeDecoderData *MimeB64DecoderInit(nsresult (*output_fn) (const char *buf,
21990 - PRInt32 size,
21991 - void *closure),
21992 - void *closure);
21993 -MimeDecoderData *MimeQPDecoderInit (nsresult (*output_fn) (const char *buf,
21994 - PRInt32 size,
21995 - void *closure),
21996 +MimeDecoderData *MimeB64DecoderInit(nsresult (*output_fn) (const char *buf,PRInt32 size, void *closure),
21997 void *closure);
21999 +MimeDecoderData *MimeQPDecoderInit (nsresult (*output_fn) (const char *buf, PRInt32 size, void *closure),
22000 + void *closure, MimeObject *object = nsnull);
22002 MimeDecoderData *MimeUUDecoderInit (nsresult (*output_fn) (const char *buf,
22003 PRInt32 size,
22004 void *closure),
22005 diff -uprN --exclude=CVS mozilla/mailnews/news/src/nsNntpService.cpp mozilla.new/mailnews/news/src/nsNntpService.cpp
22006 --- mozilla/mailnews/news/src/nsNntpService.cpp 2005-07-20 13:49:44.000000000 +0200
22007 +++ mozilla.new/mailnews/news/src/nsNntpService.cpp 2006-02-24 11:16:51.000000000 +0100
22008 @@ -24,7 +24,7 @@
22009 * Scott MacGregor <mscott@netscape.com>
22010 * Pierre Phaneuf <pp@ludusdesign.com>
22011 * Håkan Waara <hwaara@chello.se>
22012 - * David Bienvenu < bienvenu@nventure.com>
22013 + * David Bienvenu <bienvenu@nventure.com>
22015 * Alternatively, the contents of this file may be used under the terms of
22016 * either of the GNU General Public License Version 2 or later (the "GPL"),
22017 @@ -1416,11 +1416,12 @@ NS_IMETHODIMP nsNntpService::NewURI(cons
22019 NS_IMETHODIMP nsNntpService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
22021 + NS_ENSURE_ARG_POINTER(aURI);
22022 nsresult rv = NS_OK;
22023 nsCOMPtr <nsINNTPProtocol> nntpProtocol;
22024 rv = GetProtocolForUri(aURI, nsnull, getter_AddRefs(nntpProtocol));
22025 if (NS_SUCCEEDED(rv))
22026 - rv = nntpProtocol->Initialize(aURI, nsnull);
22027 + rv = nntpProtocol->Initialize(aURI, nsnull);
22028 if (NS_FAILED(rv)) return rv;
22030 return CallQueryInterface(nntpProtocol, _retval);
22031 diff -uprN --exclude=CVS mozilla/Makefile.in mozilla.new/Makefile.in
22032 --- mozilla/Makefile.in 2006-01-09 06:48:35.000000000 +0100
22033 +++ mozilla.new/Makefile.in 2006-02-24 11:16:26.000000000 +0100
22034 @@ -430,6 +430,11 @@ tier_99_dirs += \
22035 $(NULL)
22036 endif
22038 +# This should be built last, after all IDL files in the tree have been processed
22039 +ifdef MOZ_JAVAXPCOM
22040 +tier_99_dirs += extensions/java/xpcom/interfaces
22041 +endif
22043 else
22045 # Standalone build
22046 diff -uprN --exclude=CVS mozilla/modules/libpr0n/decoders/gif/GIF2.cpp mozilla.new/modules/libpr0n/decoders/gif/GIF2.cpp
22047 --- mozilla/modules/libpr0n/decoders/gif/GIF2.cpp 2005-03-10 14:31:26.000000000 +0100
22048 +++ mozilla.new/modules/libpr0n/decoders/gif/GIF2.cpp 2006-03-04 21:31:06.000000000 +0100
22049 @@ -408,7 +408,7 @@ PRBool GIFInit(gif_struct* gs, void* aCl
22050 return PR_FALSE;
22052 // Clear out the structure, excluding the arrays
22053 - memset(gs, 0, offsetof(gif_struct, prefix));
22054 + memset(gs, 0, sizeof(gif_struct));
22055 gs->clientptr = aClientData;
22057 gs->state = gif_init;
22058 diff -uprN --exclude=CVS mozilla/modules/libpr0n/decoders/icon/nsIconProtocolHandler.cpp mozilla.new/modules/libpr0n/decoders/icon/nsIconProtocolHandler.cpp
22059 --- mozilla/modules/libpr0n/decoders/icon/nsIconProtocolHandler.cpp 2005-03-24 19:17:15.000000000 +0100
22060 +++ mozilla.new/modules/libpr0n/decoders/icon/nsIconProtocolHandler.cpp 2006-02-24 11:15:49.000000000 +0100
22061 @@ -106,6 +106,7 @@ NS_IMETHODIMP nsIconProtocolHandler::New
22063 NS_IMETHODIMP nsIconProtocolHandler::NewChannel(nsIURI* url, nsIChannel* *result)
22065 + NS_ENSURE_ARG_POINTER(url);
22066 nsIconChannel* channel = new nsIconChannel;
22067 if (!channel)
22068 return NS_ERROR_OUT_OF_MEMORY;
22069 diff -uprN --exclude=CVS mozilla/modules/libpr0n/decoders/icon/nsIconURI.cpp mozilla.new/modules/libpr0n/decoders/icon/nsIconURI.cpp
22070 --- mozilla/modules/libpr0n/decoders/icon/nsIconURI.cpp 2005-02-05 00:22:57.000000000 +0100
22071 +++ mozilla.new/modules/libpr0n/decoders/icon/nsIconURI.cpp 2006-03-03 07:11:15.000000000 +0100
22072 @@ -434,13 +434,13 @@ nsMozIconURI::SchemeIs(const char *i_Sch
22073 NS_IMETHODIMP
22074 nsMozIconURI::Clone(nsIURI **result)
22076 - return NS_OK;
22077 + return NS_ERROR_NOT_IMPLEMENTED;
22080 NS_IMETHODIMP
22081 nsMozIconURI::Resolve(const nsACString &relativePath, nsACString &result)
22083 - return NS_OK;
22084 + return NS_ERROR_NOT_IMPLEMENTED;
22087 NS_IMETHODIMP
22088 diff -uprN --exclude=CVS mozilla/modules/libpref/src/init/all.js mozilla.new/modules/libpref/src/init/all.js
22089 --- mozilla/modules/libpref/src/init/all.js 2006-01-11 23:04:49.000000000 +0100
22090 +++ mozilla.new/modules/libpref/src/init/all.js 2006-02-14 10:01:22.000000000 +0100
22091 @@ -270,19 +270,30 @@ pref("capability.policy.default.Navigato
22093 pref("capability.policy.default.Window.blur.get", "allAccess");
22094 pref("capability.policy.default.Window.close.get", "allAccess");
22095 -pref("capability.policy.default.Window.closed", "allAccess");
22096 +pref("capability.policy.default.Window.closed.get", "allAccess");
22097 pref("capability.policy.default.Window.Components", "allAccess");
22098 -pref("capability.policy.default.Window.document", "allAccess");
22099 +pref("capability.policy.default.Window.document.get", "allAccess");
22100 pref("capability.policy.default.Window.focus.get", "allAccess");
22101 -pref("capability.policy.default.Window.frames", "allAccess");
22102 -pref("capability.policy.default.Window.history", "allAccess");
22103 -pref("capability.policy.default.Window.length", "allAccess");
22104 +pref("capability.policy.default.Window.frames.get", "allAccess");
22105 +pref("capability.policy.default.Window.history.get", "allAccess");
22106 +pref("capability.policy.default.Window.length.get", "allAccess");
22107 pref("capability.policy.default.Window.location", "allAccess");
22108 -pref("capability.policy.default.Window.opener", "allAccess");
22109 -pref("capability.policy.default.Window.parent", "allAccess");
22110 -pref("capability.policy.default.Window.self", "allAccess");
22111 -pref("capability.policy.default.Window.top", "allAccess");
22112 -pref("capability.policy.default.Window.window", "allAccess");
22113 +pref("capability.policy.default.Window.opener.get", "allAccess");
22114 +pref("capability.policy.default.Window.parent.get", "allAccess");
22115 +pref("capability.policy.default.Window.self.get", "allAccess");
22116 +pref("capability.policy.default.Window.top.get", "allAccess");
22117 +pref("capability.policy.default.Window.window.get", "allAccess");
22119 +pref("capability.policy.default.XULControllers.commandDispatcher", "noAccess");
22120 +pref("capability.policy.default.XULControllers.getControllerForCommand", "noAccess");
22121 +pref("capability.policy.default.XULControllers.insertControllerAt", "noAccess");
22122 +pref("capability.policy.default.XULControllers.removeControllerAt", "noAccess");
22123 +pref("capability.policy.default.XULControllers.getControllerAt", "noAccess");
22124 +pref("capability.policy.default.XULControllers.appendController", "noAccess");
22125 +pref("capability.policy.default.XULControllers.removeController", "noAccess");
22126 +pref("capability.policy.default.XULControllers.getControllerId", "noAccess");
22127 +pref("capability.policy.default.XULControllers.getControllerById", "noAccess");
22128 +pref("capability.policy.default.XULControllers.getControllerCount", "noAccess");
22130 // Restrictions on the DOM for mail/news - see bugs 66938 and 84545
22131 pref("capability.policy.mailnews.sites", "mailbox: imap: news:");
22132 diff -uprN --exclude=CVS mozilla/modules/plugin/base/src/ns4xPlugin.cpp mozilla.new/modules/plugin/base/src/ns4xPlugin.cpp
22133 --- mozilla/modules/plugin/base/src/ns4xPlugin.cpp 2006-01-09 06:48:47.000000000 +0100
22134 +++ mozilla.new/modules/plugin/base/src/ns4xPlugin.cpp 2006-02-24 11:16:36.000000000 +0100
22135 @@ -195,7 +195,28 @@ PR_BEGIN_EXTERN_C
22137 PR_END_EXTERN_C
22139 -#if defined(XP_MACOSX) && defined(__POWERPC__)
22140 +#if defined(XP_MACOSX) && defined(__i386__)
22142 +// BROKEN_PLUGIN_HACK works around bugs in the version of the Macromedia
22143 +// Flash Player plugin that is supplied with the initial consumer shipment
22144 +// of Mac OS X for x86-based Macs. The plugin is broken in at least
22145 +// 10.4.4/x86 and 10.4.5/x86.
22146 +#define BROKEN_PLUGIN_HACK
22148 +// brokenPlugin is defined in the scope in which TV2FP is used. It is
22149 +// true when this ns4xPlugin object has loaded a plugin that contains the
22150 +// bugs being worked around.
22152 +// The broken plugin returns entry points that are pointers to function
22153 +// pointers, instead of just returning the function pointers. These must
22154 +// be dereferenced, or Mozilla will crash upon attempting to call an address
22155 +// that doesn't contain code. TV2FP is a convenient place to handle this,
22156 +// since the macro is already present everywhere it's needed, and is otherwise
22157 +// unused on x86.
22158 +#define TV2FP(f) (brokenPlugin && f ? *(void**)f : (void*)f)
22159 +#define FP2TV(f) (f)
22161 +#elif defined(XP_MACOSX) && defined(__POWERPC__)
22163 #define TV2FP(tvp) _TV2FP((void *)tvp)
22165 @@ -424,6 +445,56 @@ ns4xPlugin::ns4xPlugin(NPPluginFuncs* ca
22167 fShutdownEntry = (NP_PLUGINSHUTDOWN)PR_FindSymbol(aLibrary, "NP_Shutdown");
22168 #elif defined(XP_MACOSX)
22169 +#ifdef BROKEN_PLUGIN_HACK
22170 +#warning BROKEN_PLUGIN_HACK is in use, enjoy your Flash movies!
22171 + // This is a private NSPR struct. Define it here because it's necessary
22172 + // to restrict the hack to plugins that need it, and the only way to do
22173 + // that is to examine the bundle that was loaded. I feel comfortable doing
22174 + // this because BROKEN_PLUGIN_HACK is a hack anyway, and it's not intended
22175 + // to be long-lived.
22176 + struct myPRLibrary {
22177 + char* name;
22178 + PRLibrary* next;
22179 + int refCount;
22180 + const PRStaticLinkTable* staticTable;
22181 + CFragConnectionID connection;
22182 + CFBundleRef bundle;
22183 + Ptr main;
22184 + CFMutableDictionaryRef wrappers;
22185 + const struct mach_header* image;
22186 + };
22188 + // brokenPlugin indicates whether the plugin needs to be worked around
22189 + // because it doesn't adhere to the API used on x86.
22190 + PRBool brokenPlugin = PR_FALSE;
22192 + // Identify the broken plugin by a variety of attributes.
22193 + // Further inspection will be done before applying any workarounds.
22194 + struct myPRLibrary *prLibrary = (struct myPRLibrary*) aLibrary;
22196 + if (prLibrary->name && prLibrary->bundle) {
22197 + CFStringRef bundleIdentifier = ::CFBundleGetIdentifier(prLibrary->bundle);
22198 + CFStringRef bundleShortVersion =
22199 + (CFStringRef) ::CFBundleGetValueForInfoDictionaryKey(prLibrary->bundle,
22200 + CFSTR("CFBundleShortVersionString"));
22202 + if (!strcmp(prLibrary->name,
22203 + "/Library/Internet Plug-Ins/Flash Player.plugin") &&
22204 + ::CFBundleGetVersionNumber(prLibrary->bundle) == 0x1018011 &&
22205 + bundleIdentifier &&
22206 + ::CFStringCompare(bundleIdentifier,
22207 + CFSTR("com.macromedia.Flash Player.plugin"),
22208 + 0) == kCFCompareEqualTo &&
22209 + bundleShortVersion &&
22210 + ::CFStringCompare(bundleShortVersion,
22211 + CFSTR("8.0.17"),
22212 + 0) == kCFCompareEqualTo) {
22213 + // Macromedia Flash Player plugin, version 8.0.17, bundle version 1.0.1f17
22214 + brokenPlugin = PR_TRUE;
22217 +#endif /* BROKEN_PLUGIN_HACK */
22219 // call into the entry point
22220 NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "main");
22222 @@ -443,6 +514,92 @@ ns4xPlugin::ns4xPlugin(NPPluginFuncs* ca
22223 &pfnShutdown),
22224 aLibrary, nsnull);
22226 +#ifdef BROKEN_PLUGIN_HACK
22227 + // The broken plugin has wrapped NPN callback function pointers in PPC
22228 + // TVector glue as though they were pointers to CFM TVectors. When the
22229 + // x86 attempts to execute the PPC glue, it will of course fail.
22230 + //
22231 + // What's done here is a bit unorthodox. I'm going to locate the
22232 + // TVector glue that the plugin created from ns4xPlugin::CALLBACKS by
22233 + // peeking into its symbol table, then I'm going to dissect the PPC
22234 + // machine code to get the target addresses and produce x86 machine code.
22235 + // The x86 code overwrites the PPC code in the plugin's jump table.
22236 + // The replacement code is of course executable. I know I can do this,
22237 + // because the broken plugin builds its table of TVector glue based on
22238 + // what the sample NPAPI plugin does.
22239 + //
22240 + // Watch this.
22241 + if (brokenPlugin) {
22242 + PRUint32 glueFixed = 0;
22244 + // Locate the table that the plugin filled with TVector glue.
22245 + PRUint8* pluginsGlueTable = (PRUint8*)
22246 + ::CFBundleGetDataPointerForName(prLibrary->bundle,
22247 + CFSTR("gNetscapeFuncsGlueTable"));
22249 + if (pluginsGlueTable) {
22250 + // The table contains 40 entries. Each entry is TVector glue of 6
22251 + // 4-byte words (24 bytes total). See gPluginFuncsGlueTable in
22252 + // mozilla/modules/plugin/samples/default/mac/npmac.cpp . That table
22253 + // accomodates 23 entries, inspection in the debugger teaches that the
22254 + // broken plugin's table is 40 entries long.
22255 + for (PRUint32 i = 0 ; i < 40 ; i++) {
22256 + PRUint32* gluePPC = (PRUint32*) (pluginsGlueTable + 24 * i);
22258 + // Only translate entries that are actually stored as TVector glue.
22259 + // There are other ways to write the glue for PPC, but this is the
22260 + // de facto standard, and it's what the broken plugin uses. The
22261 + // PPC code means:
22262 + // lis r12, hi16(address) ; pointer to tvector embedded
22263 + // ori r12, r12, lo16(address) ; as immediate params in glue
22264 + // lwz r0, 0(r12) ; get pc from tvector
22265 + // lwz r2, 4(r12) ; get rtoc from tvector
22266 + // mtctr r0
22267 + // bctr ; jump to new pc
22268 + if ( (*gluePPC & 0xffff0000) == 0x3d800000 &&
22269 + (*(gluePPC+1) & 0xffff0000) == 0x618c0000 &&
22270 + *(gluePPC+2) == 0x800c0000 &&
22271 + *(gluePPC+3) == 0x804c0004 &&
22272 + *(gluePPC+4) == 0x7c0903a6 &&
22273 + *(gluePPC+5) == 0x4e800420) {
22274 + // Determine the actual address of the function by stripping the
22275 + // TVector glue. |address| is a usable function pointer. Making
22276 + // it a pointer to an 8-bit quantity keeps the math below simple.
22277 + PRUint8* address = (PRUint8*) ((*gluePPC) << 16 |
22278 + *(gluePPC+1) & 0xffff);
22280 + // Build an x86 JMP instruction to jump to the desired function,
22281 + // and replace the TVector glue with it. Opcode 0xe9 is a
22282 + // jump relative to the next instruction. Total instruction length
22283 + // is 5 bytes (in 32-bit operand-size mode). If base is address
22284 + // 0xfece5 and the target function is at address 0xc0ffee, then
22285 + // the instruction placed at base, byte for byte, should be:
22286 + // 0xfece5: 0xe9 0x04 0x13 0xb1 0x00: jmp 0xc0ffee
22287 + PRUint8* glueX86 = (PRUint8*) gluePPC;
22288 + *glueX86 = 0xe9;
22290 + PRInt32* offset = (PRInt32*) (glueX86+1);
22291 + *offset = (address - (glueX86 + 5));
22293 + // PPC TVector glue is big compared to the x86 JMP. Clean up the
22294 + // rest of the space in the table entry. Opcode 0x90 is NOP,
22295 + // instruction length 1 byte. This permits clean disassembly of
22296 + // the entire memory region corresponding to the table.
22297 + memset(glueX86+5, 0x90, 19);
22299 + glueFixed++;
22304 + if (!glueFixed) {
22305 + // This plugin wasn't broken after all. Avoid applying the callback
22306 + // dereferencing workarounds (TV2FP).
22307 + brokenPlugin = PR_FALSE;
22310 +#endif /* BROKEN_PLUGIN_HACK */
22312 NPP_PLUGIN_LOG(PLUGIN_LOG_BASIC,
22313 ("NPP MainEntryProc called: return=%d\n",error));
22315 diff -uprN --exclude=CVS mozilla/modules/plugin/samples/default/mac/DefaultPlugin.pbproj/project.pbxproj mozilla.new/modules/plugin/samples/default/mac/DefaultPlugin.pbproj/project.pbxproj
22316 --- mozilla/modules/plugin/samples/default/mac/DefaultPlugin.pbproj/project.pbxproj 2003-04-05 00:47:00.000000000 +0200
22317 +++ mozilla.new/modules/plugin/samples/default/mac/DefaultPlugin.pbproj/project.pbxproj 2006-02-24 11:16:36.000000000 +0100
22318 @@ -349,7 +349,7 @@
22320 F5E0C34D036A12DF01A96660 = {
22321 isa = PBXFileReference;
22322 - path = _NullPlugin.rsrc;
22323 + path = NullPlugin.rsrc;
22324 refType = 2;
22326 F5E0C34E036A12DF01A96660 = {
22327 diff -uprN --exclude=CVS mozilla/modules/plugin/samples/default/mac/DefaultPlugin.xcode/project.pbxproj mozilla.new/modules/plugin/samples/default/mac/DefaultPlugin.xcode/project.pbxproj
22328 --- mozilla/modules/plugin/samples/default/mac/DefaultPlugin.xcode/project.pbxproj 2005-06-01 20:53:30.000000000 +0200
22329 +++ mozilla.new/modules/plugin/samples/default/mac/DefaultPlugin.xcode/project.pbxproj 2006-02-24 11:16:36.000000000 +0100
22330 @@ -343,7 +343,7 @@
22331 F5E0C34D036A12DF01A96660 = {
22332 isa = PBXFileReference;
22333 lastKnownFileType = file;
22334 - path = _NullPlugin.rsrc;
22335 + path = NullPlugin.rsrc;
22336 refType = 2;
22337 sourceTree = SOURCE_ROOT;
22339 diff -uprN --exclude=CVS mozilla/modules/plugin/samples/default/mac/Makefile.in mozilla.new/modules/plugin/samples/default/mac/Makefile.in
22340 --- mozilla/modules/plugin/samples/default/mac/Makefile.in 2005-06-20 21:24:51.000000000 +0200
22341 +++ mozilla.new/modules/plugin/samples/default/mac/Makefile.in 2006-02-24 11:16:36.000000000 +0100
22342 @@ -76,10 +76,6 @@ PACKAGE_FILE = npnul.pkg
22344 unexport CC CXX
22346 -# decodes resource files from AppleSingle to Resource Manager format.
22347 -ASDECODE = $(DIST)/bin/asdecode
22348 -RESOURCE_FILES = _NullPlugin.rsrc
22350 # for objdir builds, copy the project, and symlink the sources
22351 ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
22352 ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
22353 @@ -90,6 +86,7 @@ export::
22354 ln -fs $(srcdir)/NullPlugin.cpp
22355 ln -fs $(srcdir)/npmac.cpp
22356 ln -fs $(srcdir)/Info-*.plist .
22357 + ln -fs $(srcdir)/NullPlugin.rsrc
22358 endif
22360 libs install:: install-plugin
22361 @@ -97,15 +94,9 @@ libs install:: install-plugin
22362 install-plugin: build-plugin
22363 $(INSTALL) "$(XCODE_PRODUCT_DIR)/Default Plugin.plugin" $(DIST)/bin/plugins
22365 -resources: $(RESOURCE_FILES)
22367 -build-plugin: resources
22368 +build-plugin:
22369 $(PBBUILD) $(PROJECT_ARG) -target $(TARGET) -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
22370 echo -n NSPLMOSS > "$(XCODE_PRODUCT_DIR)/Default Plugin.plugin/Contents/PkgInfo"
22372 -_%.rsrc: %.rsrc
22373 - $(ASDECODE) $< $@
22375 clean clobber distclean::
22376 - rm -f $(RESOURCE_FILES)
22377 rm -rf build
22378 Dateien mozilla/modules/plugin/samples/default/mac/NullPlugin.rsrc und mozilla.new/modules/plugin/samples/default/mac/NullPlugin.rsrc sind verschieden.
22379 diff -uprN --exclude=CVS mozilla/netwerk/base/src/nsStandardURL.cpp mozilla.new/netwerk/base/src/nsStandardURL.cpp
22380 --- mozilla/netwerk/base/src/nsStandardURL.cpp 2005-10-17 22:12:58.000000000 +0200
22381 +++ mozilla.new/netwerk/base/src/nsStandardURL.cpp 2006-02-24 11:16:36.000000000 +0100
22382 @@ -864,10 +864,24 @@ nsStandardURL::ACEtoDisplayIDN(const nsC
22383 /* static */ nsresult
22384 nsStandardURL::UTF8toDisplayIDN(const nsCSubstring &host, nsCString &result)
22386 - if (gShowPunycode || !IsInWhitelist(host))
22387 + // We have to normalize the hostname before testing against the domain
22388 + // whitelist. See bug 315411.
22390 + nsCAutoString temp;
22391 + if (gShowPunycode || NS_FAILED(gIDN->Normalize(host, temp)))
22392 return gIDN->ConvertUTF8toACE(host, result);
22394 - return gIDN->Normalize(host, result);
22395 + PRBool isACE = PR_FALSE;
22396 + gIDN->IsACE(temp, &isACE);
22398 + // If host is converted to ACE by the normalizer, then the host may contain
22399 + // unsafe characters. See bug 283016, bug 301694, and bug 309311.
22401 + if (!isACE && !IsInWhitelist(temp))
22402 + return gIDN->ConvertUTF8toACE(temp, result);
22404 + result = temp;
22405 + return NS_OK;
22408 /* static */ PRBool
22409 @@ -876,6 +890,8 @@ nsStandardURL::IsInWhitelist(const nsCSu
22410 PRInt32 pos;
22411 PRBool safe;
22413 + // XXX This code uses strings inefficiently.
22415 if (gIDNWhitelistPrefBranch &&
22416 (pos = nsCAutoString(host).RFind(".")) != kNotFound &&
22417 NS_SUCCEEDED(gIDNWhitelistPrefBranch->
22418 @@ -2423,7 +2439,6 @@ nsStandardURL::GetFile(nsIFile **result)
22419 if (NS_FAILED(rv))
22420 return rv;
22423 #if defined(PR_LOGGING)
22424 if (LOG_ENABLED()) {
22425 nsCAutoString path;
22426 diff -uprN --exclude=CVS mozilla/netwerk/cache/src/nsDiskCacheMap.h mozilla.new/netwerk/cache/src/nsDiskCacheMap.h
22427 --- mozilla/netwerk/cache/src/nsDiskCacheMap.h 2005-06-29 22:47:45.000000000 +0200
22428 +++ mozilla.new/netwerk/cache/src/nsDiskCacheMap.h 2006-02-24 11:16:36.000000000 +0100
22429 @@ -358,6 +358,14 @@ struct nsDiskCacheHeader {
22430 mEntryCount = ::PR_htonl(mEntryCount);
22431 mIsDirty = ::PR_htonl(mIsDirty);
22432 mRecordCount = ::PR_htonl(mRecordCount);
22434 +#ifdef XP_MACOSX
22435 + // Mac-only on the 1.8.0 branch, see bug 325765
22436 + for (PRUint32 i = 0; i < kBuckets ; i++) {
22437 + mEvictionRank[i] = ::PR_htonl(mEvictionRank[i]);
22438 + mBucketUsage[i] = ::PR_htonl(mBucketUsage[i]);
22440 +#endif
22441 #endif
22444 @@ -369,6 +377,14 @@ struct nsDiskCacheHeader {
22445 mEntryCount = ::PR_ntohl(mEntryCount);
22446 mIsDirty = ::PR_ntohl(mIsDirty);
22447 mRecordCount = ::PR_ntohl(mRecordCount);
22449 +#ifdef XP_MACOSX
22450 + // Mac-only on the 1.8.0 branch, see bug 325765
22451 + for (PRUint32 i = 0; i < kBuckets ; i++) {
22452 + mEvictionRank[i] = ::PR_ntohl(mEvictionRank[i]);
22453 + mBucketUsage[i] = ::PR_ntohl(mBucketUsage[i]);
22455 +#endif
22456 #endif
22459 diff -uprN --exclude=CVS mozilla/netwerk/cookie/public/nsICookieManager2.idl mozilla.new/netwerk/cookie/public/nsICookieManager2.idl
22460 --- mozilla/netwerk/cookie/public/nsICookieManager2.idl 2003-10-30 03:50:11.000000000 +0100
22461 +++ mozilla.new/netwerk/cookie/public/nsICookieManager2.idl 2006-02-24 11:16:36.000000000 +0100
22462 @@ -68,7 +68,6 @@ interface nsICookieManager2 : nsICookieM
22463 * expiration date, in seconds since the epoch. only relevant if
22464 * aIsSession is false.
22466 - [noscript]
22467 void add(in AUTF8String aDomain,
22468 in AUTF8String aPath,
22469 in ACString aName,
22470 diff -uprN --exclude=CVS mozilla/netwerk/protocol/about/src/nsAboutBlank.cpp mozilla.new/netwerk/protocol/about/src/nsAboutBlank.cpp
22471 --- mozilla/netwerk/protocol/about/src/nsAboutBlank.cpp 2005-09-01 21:34:24.000000000 +0200
22472 +++ mozilla.new/netwerk/protocol/about/src/nsAboutBlank.cpp 2006-02-24 11:16:36.000000000 +0100
22473 @@ -49,6 +49,7 @@ static const char kBlankPage[] = "<!DOCT
22474 NS_IMETHODIMP
22475 nsAboutBlank::NewChannel(nsIURI *aURI, nsIChannel **result)
22477 + NS_ENSURE_ARG_POINTER(aURI);
22478 nsresult rv;
22479 nsIChannel* channel;
22481 diff -uprN --exclude=CVS mozilla/netwerk/protocol/about/src/nsAboutBloat.cpp mozilla.new/netwerk/protocol/about/src/nsAboutBloat.cpp
22482 --- mozilla/netwerk/protocol/about/src/nsAboutBloat.cpp 2005-09-01 21:34:24.000000000 +0200
22483 +++ mozilla.new/netwerk/protocol/about/src/nsAboutBloat.cpp 2006-02-24 11:16:36.000000000 +0100
22484 @@ -60,6 +60,7 @@ NS_IMPL_ISUPPORTS1(nsAboutBloat, nsIAbou
22485 NS_IMETHODIMP
22486 nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result)
22488 + NS_ENSURE_ARG_POINTER(aURI);
22489 nsresult rv;
22490 nsCAutoString path;
22491 rv = aURI->GetPath(path);
22492 diff -uprN --exclude=CVS mozilla/netwerk/protocol/about/src/nsAboutCache.cpp mozilla.new/netwerk/protocol/about/src/nsAboutCache.cpp
22493 --- mozilla/netwerk/protocol/about/src/nsAboutCache.cpp 2005-09-01 21:34:25.000000000 +0200
22494 +++ mozilla.new/netwerk/protocol/about/src/nsAboutCache.cpp 2006-02-24 11:16:36.000000000 +0100
22495 @@ -75,6 +75,7 @@ NS_IMPL_ISUPPORTS2(nsAboutCache, nsIAbou
22496 NS_IMETHODIMP
22497 nsAboutCache::NewChannel(nsIURI *aURI, nsIChannel **result)
22499 + NS_ENSURE_ARG_POINTER(aURI);
22500 nsresult rv;
22501 PRUint32 bytesWritten;
22503 diff -uprN --exclude=CVS mozilla/netwerk/protocol/about/src/nsAboutCacheEntry.cpp mozilla.new/netwerk/protocol/about/src/nsAboutCacheEntry.cpp
22504 --- mozilla/netwerk/protocol/about/src/nsAboutCacheEntry.cpp 2005-09-01 21:34:25.000000000 +0200
22505 +++ mozilla.new/netwerk/protocol/about/src/nsAboutCacheEntry.cpp 2006-02-24 11:16:36.000000000 +0100
22506 @@ -64,6 +64,7 @@ NS_IMPL_ISUPPORTS4(nsAboutCacheEntry,
22507 NS_IMETHODIMP
22508 nsAboutCacheEntry::NewChannel(nsIURI *aURI, nsIChannel **result)
22510 + NS_ENSURE_ARG_POINTER(aURI);
22511 nsresult rv;
22513 nsCOMPtr<nsIChannel> chan;
22514 diff -uprN --exclude=CVS mozilla/netwerk/protocol/about/src/nsAboutProtocolHandler.cpp mozilla.new/netwerk/protocol/about/src/nsAboutProtocolHandler.cpp
22515 --- mozilla/netwerk/protocol/about/src/nsAboutProtocolHandler.cpp 2005-09-14 06:18:36.000000000 +0200
22516 +++ mozilla.new/netwerk/protocol/about/src/nsAboutProtocolHandler.cpp 2006-02-24 11:16:36.000000000 +0100
22517 @@ -135,6 +135,7 @@ nsAboutProtocolHandler::NewURI(const nsA
22518 NS_IMETHODIMP
22519 nsAboutProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
22521 + NS_ENSURE_ARG_POINTER(uri);
22522 // about:what you ask?
22523 nsresult rv;
22524 nsCAutoString contractID;
22525 diff -uprN --exclude=CVS mozilla/netwerk/protocol/about/src/nsAboutRedirector.cpp mozilla.new/netwerk/protocol/about/src/nsAboutRedirector.cpp
22526 --- mozilla/netwerk/protocol/about/src/nsAboutRedirector.cpp 2005-09-14 06:18:36.000000000 +0200
22527 +++ mozilla.new/netwerk/protocol/about/src/nsAboutRedirector.cpp 2006-02-24 11:16:36.000000000 +0100
22528 @@ -76,7 +76,7 @@ static const int kRedirTotal = NS_ARRAY_
22529 NS_IMETHODIMP
22530 nsAboutRedirector::NewChannel(nsIURI *aURI, nsIChannel **result)
22532 - NS_ASSERTION(aURI, "must not be null");
22533 + NS_ENSURE_ARG_POINTER(aURI);
22534 NS_ASSERTION(result, "must not be null");
22536 nsresult rv;
22537 diff -uprN --exclude=CVS mozilla/netwerk/protocol/data/src/nsDataChannel.cpp mozilla.new/netwerk/protocol/data/src/nsDataChannel.cpp
22538 --- mozilla/netwerk/protocol/data/src/nsDataChannel.cpp 2005-08-13 21:34:01.000000000 +0200
22539 +++ mozilla.new/netwerk/protocol/data/src/nsDataChannel.cpp 2006-02-24 11:16:36.000000000 +0100
22540 @@ -180,8 +180,8 @@ nsDataChannel::ParseData() {
22541 if (lBase64) {
22542 *base64 = ';';
22543 PRInt32 resultLen = 0;
22544 - if (dataBuffer[dataLen-1] == '=') {
22545 - if (dataBuffer[dataLen-2] == '=')
22546 + if (dataLen >= 1 && dataBuffer[dataLen-1] == '=') {
22547 + if (dataLen >= 2 && dataBuffer[dataLen-2] == '=')
22548 resultLen = dataLen-2;
22549 else
22550 resultLen = dataLen-1;
22551 diff -uprN --exclude=CVS mozilla/netwerk/protocol/data/src/nsDataHandler.cpp mozilla.new/netwerk/protocol/data/src/nsDataHandler.cpp
22552 --- mozilla/netwerk/protocol/data/src/nsDataHandler.cpp 2004-12-04 11:19:27.000000000 +0100
22553 +++ mozilla.new/netwerk/protocol/data/src/nsDataHandler.cpp 2006-02-24 11:16:36.000000000 +0100
22554 @@ -117,6 +117,7 @@ nsDataHandler::NewURI(const nsACString &
22555 NS_IMETHODIMP
22556 nsDataHandler::NewChannel(nsIURI* url, nsIChannel* *result)
22558 + NS_ENSURE_ARG_POINTER(url);
22559 nsresult rv;
22561 nsDataChannel* channel;
22562 diff -uprN --exclude=CVS mozilla/netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp mozilla.new/netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp
22563 --- mozilla/netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp 2005-02-25 21:46:29.000000000 +0100
22564 +++ mozilla.new/netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp 2006-02-24 11:16:36.000000000 +0100
22565 @@ -213,6 +213,7 @@ nsFtpProtocolHandler::NewChannel(nsIURI*
22566 NS_IMETHODIMP
22567 nsFtpProtocolHandler::NewProxiedChannel(nsIURI* url, nsIProxyInfo* proxyInfo, nsIChannel* *result)
22569 + NS_ENSURE_ARG_POINTER(url);
22570 nsFTPChannel *channel = new nsFTPChannel();
22571 if (!channel)
22572 return NS_ERROR_OUT_OF_MEMORY;
22573 diff -uprN --exclude=CVS mozilla/netwerk/protocol/gopher/src/nsGopherHandler.cpp mozilla.new/netwerk/protocol/gopher/src/nsGopherHandler.cpp
22574 --- mozilla/netwerk/protocol/gopher/src/nsGopherHandler.cpp 2004-12-04 11:19:27.000000000 +0100
22575 +++ mozilla.new/netwerk/protocol/gopher/src/nsGopherHandler.cpp 2006-02-24 11:16:36.000000000 +0100
22576 @@ -131,6 +131,7 @@ NS_IMETHODIMP
22577 nsGopherHandler::NewProxiedChannel(nsIURI* url, nsIProxyInfo* proxyInfo,
22578 nsIChannel* *result)
22580 + NS_ENSURE_ARG_POINTER(url);
22581 nsGopherChannel *chan = new nsGopherChannel();
22582 if (!chan)
22583 return NS_ERROR_OUT_OF_MEMORY;
22584 diff -uprN --exclude=CVS mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp mozilla.new/netwerk/protocol/http/src/nsHttpChannel.cpp
22585 --- mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp 2005-10-22 20:23:59.000000000 +0200
22586 +++ mozilla.new/netwerk/protocol/http/src/nsHttpChannel.cpp 2006-02-24 11:16:36.000000000 +0100
22587 @@ -2765,8 +2765,20 @@ nsHttpChannel::PromptForIdentity(const c
22589 NS_NAMED_LITERAL_STRING(proxyText, "EnterUserPasswordForProxy");
22590 NS_NAMED_LITERAL_STRING(originText, "EnterUserPasswordForRealm");
22591 - const PRUnichar *text = proxyAuth ? proxyText.get() : originText.get();
22594 + const PRUnichar *text;
22595 + if (proxyAuth) {
22596 + text = proxyText.get();
22597 + } else {
22598 + text = originText.get();
22600 + // prepend "scheme://"
22601 + nsAutoString schemeU;
22602 + CopyASCIItoUTF16(scheme, schemeU);
22603 + schemeU.AppendLiteral("://");
22604 + displayHost.Insert(schemeU, 0);
22607 const PRUnichar *strings[] = { realmU.get(), displayHost.get() };
22609 rv = bundle->FormatStringFromName(text, strings, 2,
22610 diff -uprN --exclude=CVS mozilla/netwerk/protocol/http/src/nsHttpTransaction.cpp mozilla.new/netwerk/protocol/http/src/nsHttpTransaction.cpp
22611 --- mozilla/netwerk/protocol/http/src/nsHttpTransaction.cpp 2005-10-22 03:03:14.000000000 +0200
22612 +++ mozilla.new/netwerk/protocol/http/src/nsHttpTransaction.cpp 2006-02-24 11:16:36.000000000 +0100
22613 @@ -44,8 +44,10 @@
22614 #include "nsHttpRequestHead.h"
22615 #include "nsHttpResponseHead.h"
22616 #include "nsHttpChunkedDecoder.h"
22617 +#include "nsNetSegmentUtils.h"
22618 #include "nsTransportUtils.h"
22619 #include "nsIOService.h"
22620 +#include "nsNetUtil.h"
22621 #include "nsAutoLock.h"
22622 #include "pratom.h"
22623 #include "plevent.h"
22624 @@ -236,7 +238,12 @@ nsHttpTransaction::Init(PRUint8 caps,
22625 rv = multi->AppendStream(requestBody);
22626 if (NS_FAILED(rv)) return rv;
22628 - mRequestStream = multi;
22629 + // wrap the multiplexed input stream with a buffered input stream, so
22630 + // that we write data in the largest chunks possible. this is actually
22631 + // necessary to workaround some common server bugs (see bug 137155).
22632 + rv = NS_NewBufferedInputStream(getter_AddRefs(mRequestStream), multi,
22633 + NET_DEFAULT_SEGMENT_SIZE);
22634 + if (NS_FAILED(rv)) return rv;
22636 else
22637 mRequestStream = headers;
22638 diff -uprN --exclude=CVS mozilla/netwerk/protocol/keyword/src/nsKeywordProtocolHandler.cpp mozilla.new/netwerk/protocol/keyword/src/nsKeywordProtocolHandler.cpp
22639 --- mozilla/netwerk/protocol/keyword/src/nsKeywordProtocolHandler.cpp 2004-12-04 11:19:28.000000000 +0100
22640 +++ mozilla.new/netwerk/protocol/keyword/src/nsKeywordProtocolHandler.cpp 2006-02-24 11:16:36.000000000 +0100
22641 @@ -164,6 +164,7 @@ nsKeywordProtocolHandler::NewURI(const n
22642 NS_IMETHODIMP
22643 nsKeywordProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
22645 + NS_ENSURE_ARG_POINTER(uri);
22646 nsresult rv;
22647 nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
22648 if (NS_FAILED(rv)) return rv;
22649 diff -uprN --exclude=CVS mozilla/netwerk/protocol/res/src/nsResProtocolHandler.cpp mozilla.new/netwerk/protocol/res/src/nsResProtocolHandler.cpp
22650 --- mozilla/netwerk/protocol/res/src/nsResProtocolHandler.cpp 2004-12-04 11:19:28.000000000 +0100
22651 +++ mozilla.new/netwerk/protocol/res/src/nsResProtocolHandler.cpp 2006-02-24 11:16:36.000000000 +0100
22652 @@ -236,6 +236,7 @@ nsResProtocolHandler::NewURI(const nsACS
22653 NS_IMETHODIMP
22654 nsResProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
22656 + NS_ENSURE_ARG_POINTER(uri);
22657 nsresult rv;
22658 nsCAutoString spec;
22660 diff -uprN --exclude=CVS mozilla/netwerk/protocol/viewsource/src/nsViewSourceHandler.cpp mozilla.new/netwerk/protocol/viewsource/src/nsViewSourceHandler.cpp
22661 --- mozilla/netwerk/protocol/viewsource/src/nsViewSourceHandler.cpp 2004-07-02 01:45:34.000000000 +0200
22662 +++ mozilla.new/netwerk/protocol/viewsource/src/nsViewSourceHandler.cpp 2006-02-24 11:16:36.000000000 +0100
22663 @@ -115,6 +115,7 @@ nsViewSourceHandler::NewURI(const nsACSt
22664 NS_IMETHODIMP
22665 nsViewSourceHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
22667 + NS_ENSURE_ARG_POINTER(uri);
22668 nsViewSourceChannel *channel = new nsViewSourceChannel();
22669 if (!channel)
22670 return NS_ERROR_OUT_OF_MEMORY;
22671 diff -uprN --exclude=CVS mozilla/nsprpub/config/autoconf.mk.in mozilla.new/nsprpub/config/autoconf.mk.in
22672 --- mozilla/nsprpub/config/autoconf.mk.in 2006-01-09 06:47:18.000000000 +0100
22673 +++ mozilla.new/nsprpub/config/autoconf.mk.in 2006-02-24 11:15:17.000000000 +0100
22674 @@ -88,6 +88,7 @@ RESOLVE_LINK_SYMBOLS = @RESOLVE_LINK_SYM
22676 HOST_CC = @HOST_CC@
22677 HOST_CFLAGS = @HOST_CFLAGS@
22678 +HOST_LDFLAGS = @HOST_LDFLAGS@
22680 DEFINES = @DEFINES@ @DEFS@
22682 diff -uprN --exclude=CVS mozilla/nsprpub/config/rules.mk mozilla.new/nsprpub/config/rules.mk
22683 --- mozilla/nsprpub/config/rules.mk 2005-04-14 00:57:55.000000000 +0200
22684 +++ mozilla.new/nsprpub/config/rules.mk 2006-02-24 11:15:17.000000000 +0100
22685 @@ -87,6 +87,7 @@ CC=$(HOST_CC)
22686 CCC=$(HOST_CXX)
22687 CFLAGS=$(HOST_CFLAGS)
22688 CXXFLAGS=$(HOST_CXXFLAGS)
22689 +LDFLAGS=$(HOST_LDFLAGS)
22690 endif
22691 endif
22692 endif
22693 diff -uprN --exclude=CVS mozilla/nsprpub/configure mozilla.new/nsprpub/configure
22694 --- mozilla/nsprpub/configure 2006-01-11 23:01:55.000000000 +0100
22695 +++ mozilla.new/nsprpub/configure 2006-02-24 11:15:17.000000000 +0100
22696 @@ -1185,12 +1185,21 @@ rm -f conftest*
22697 CFLAGS=$_SAVE_CFLAGS
22698 LDFLAGS=$_SAVE_LDFLAGS
22700 + case "$build:$target" in
22701 + powerpc-apple-darwin8*:i?86-apple-darwin*)
22702 + _SAVE_CFLAGS=$CFLAGS
22703 + _SAVE_CXXFLAGS=$CXXLAGS
22704 + CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
22705 + CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
22706 + ;;
22707 + esac
22709 for ac_prog in $CC "${target_alias}-gcc" "${target}-gcc"
22711 # Extract the first word of "$ac_prog", so it can be a program name with args.
22712 set dummy $ac_prog; ac_word=$2
22713 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22714 -echo "configure:1194: checking for $ac_word" >&5
22715 +echo "configure:1203: checking for $ac_word" >&5
22716 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
22717 echo $ac_n "(cached) $ac_c" 1>&6
22718 else
22719 @@ -1224,7 +1233,7 @@ test -n "$CC" || CC="echo"
22720 # Extract the first word of "gcc", so it can be a program name with args.
22721 set dummy gcc; ac_word=$2
22722 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22723 -echo "configure:1228: checking for $ac_word" >&5
22724 +echo "configure:1237: checking for $ac_word" >&5
22725 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
22726 echo $ac_n "(cached) $ac_c" 1>&6
22727 else
22728 @@ -1254,7 +1263,7 @@ if test -z "$CC"; then
22729 # Extract the first word of "cc", so it can be a program name with args.
22730 set dummy cc; ac_word=$2
22731 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22732 -echo "configure:1258: checking for $ac_word" >&5
22733 +echo "configure:1267: checking for $ac_word" >&5
22734 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
22735 echo $ac_n "(cached) $ac_c" 1>&6
22736 else
22737 @@ -1305,7 +1314,7 @@ fi
22738 # Extract the first word of "cl", so it can be a program name with args.
22739 set dummy cl; ac_word=$2
22740 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22741 -echo "configure:1309: checking for $ac_word" >&5
22742 +echo "configure:1318: checking for $ac_word" >&5
22743 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
22744 echo $ac_n "(cached) $ac_c" 1>&6
22745 else
22746 @@ -1337,7 +1346,7 @@ fi
22749 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
22750 -echo "configure:1341: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
22751 +echo "configure:1350: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
22753 ac_ext=c
22754 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
22755 @@ -1348,12 +1357,12 @@ cross_compiling=$ac_cv_prog_cc_cross
22757 cat > conftest.$ac_ext << EOF
22759 -#line 1352 "configure"
22760 +#line 1361 "configure"
22761 #include "confdefs.h"
22763 main(){return(0);}
22765 -if { (eval echo configure:1357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
22766 +if { (eval echo configure:1366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
22767 ac_cv_prog_cc_works=yes
22768 # If we can't run a trivial program, we are probably using a cross compiler.
22769 if (./conftest; exit) 2>/dev/null; then
22770 @@ -1379,12 +1388,12 @@ if test $ac_cv_prog_cc_works = no; then
22771 { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
22773 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
22774 -echo "configure:1383: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
22775 +echo "configure:1392: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
22776 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
22777 cross_compiling=$ac_cv_prog_cc_cross
22779 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
22780 -echo "configure:1388: checking whether we are using GNU C" >&5
22781 +echo "configure:1397: checking whether we are using GNU C" >&5
22782 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
22783 echo $ac_n "(cached) $ac_c" 1>&6
22784 else
22785 @@ -1393,7 +1402,7 @@ else
22786 yes;
22787 #endif
22789 -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1397: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
22790 +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1406: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
22791 ac_cv_prog_gcc=yes
22792 else
22793 ac_cv_prog_gcc=no
22794 @@ -1412,7 +1421,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
22795 ac_save_CFLAGS="$CFLAGS"
22796 CFLAGS=
22797 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
22798 -echo "configure:1416: checking whether ${CC-cc} accepts -g" >&5
22799 +echo "configure:1425: checking whether ${CC-cc} accepts -g" >&5
22800 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
22801 echo $ac_n "(cached) $ac_c" 1>&6
22802 else
22803 @@ -1448,7 +1457,7 @@ do
22804 # Extract the first word of "$ac_prog", so it can be a program name with args.
22805 set dummy $ac_prog; ac_word=$2
22806 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22807 -echo "configure:1452: checking for $ac_word" >&5
22808 +echo "configure:1461: checking for $ac_word" >&5
22809 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
22810 echo $ac_n "(cached) $ac_c" 1>&6
22811 else
22812 @@ -1484,7 +1493,7 @@ do
22813 # Extract the first word of "$ac_prog", so it can be a program name with args.
22814 set dummy $ac_prog; ac_word=$2
22815 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22816 -echo "configure:1488: checking for $ac_word" >&5
22817 +echo "configure:1497: checking for $ac_word" >&5
22818 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
22819 echo $ac_n "(cached) $ac_c" 1>&6
22820 else
22821 @@ -1516,7 +1525,7 @@ test -n "$CXX" || CXX="gcc"
22824 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
22825 -echo "configure:1520: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
22826 +echo "configure:1529: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
22828 ac_ext=C
22829 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
22830 @@ -1527,12 +1536,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
22832 cat > conftest.$ac_ext << EOF
22834 -#line 1531 "configure"
22835 +#line 1540 "configure"
22836 #include "confdefs.h"
22838 int main(){return(0);}
22840 -if { (eval echo configure:1536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
22841 +if { (eval echo configure:1545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
22842 ac_cv_prog_cxx_works=yes
22843 # If we can't run a trivial program, we are probably using a cross compiler.
22844 if (./conftest; exit) 2>/dev/null; then
22845 @@ -1558,12 +1567,12 @@ if test $ac_cv_prog_cxx_works = no; then
22846 { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
22848 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
22849 -echo "configure:1562: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
22850 +echo "configure:1571: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
22851 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
22852 cross_compiling=$ac_cv_prog_cxx_cross
22854 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
22855 -echo "configure:1567: checking whether we are using GNU C++" >&5
22856 +echo "configure:1576: checking whether we are using GNU C++" >&5
22857 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
22858 echo $ac_n "(cached) $ac_c" 1>&6
22859 else
22860 @@ -1572,7 +1581,7 @@ else
22861 yes;
22862 #endif
22864 -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1576: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
22865 +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1585: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
22866 ac_cv_prog_gxx=yes
22867 else
22868 ac_cv_prog_gxx=no
22869 @@ -1591,7 +1600,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
22870 ac_save_CXXFLAGS="$CXXFLAGS"
22871 CXXFLAGS=
22872 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
22873 -echo "configure:1595: checking whether ${CXX-g++} accepts -g" >&5
22874 +echo "configure:1604: checking whether ${CXX-g++} accepts -g" >&5
22875 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
22876 echo $ac_n "(cached) $ac_c" 1>&6
22877 else
22878 @@ -1622,12 +1631,20 @@ else
22883 + case "$build:$target" in
22884 + powerpc-apple-darwin8*:i?86-apple-darwin*)
22885 + CFLAGS=$_SAVE_CFLAGS
22886 + CXXFLAGS=$_SAVE_CXXFLAGS
22887 + ;;
22888 + esac
22890 for ac_prog in $RANLIB "${target_alias}-ranlib" "${target}-ranlib"
22892 # Extract the first word of "$ac_prog", so it can be a program name with args.
22893 set dummy $ac_prog; ac_word=$2
22894 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22895 -echo "configure:1631: checking for $ac_word" >&5
22896 +echo "configure:1648: checking for $ac_word" >&5
22897 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
22898 echo $ac_n "(cached) $ac_c" 1>&6
22899 else
22900 @@ -1662,7 +1679,7 @@ do
22901 # Extract the first word of "$ac_prog", so it can be a program name with args.
22902 set dummy $ac_prog; ac_word=$2
22903 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22904 -echo "configure:1666: checking for $ac_word" >&5
22905 +echo "configure:1683: checking for $ac_word" >&5
22906 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
22907 echo $ac_n "(cached) $ac_c" 1>&6
22908 else
22909 @@ -1697,7 +1714,7 @@ do
22910 # Extract the first word of "$ac_prog", so it can be a program name with args.
22911 set dummy $ac_prog; ac_word=$2
22912 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22913 -echo "configure:1701: checking for $ac_word" >&5
22914 +echo "configure:1718: checking for $ac_word" >&5
22915 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
22916 echo $ac_n "(cached) $ac_c" 1>&6
22917 else
22918 @@ -1732,7 +1749,7 @@ do
22919 # Extract the first word of "$ac_prog", so it can be a program name with args.
22920 set dummy $ac_prog; ac_word=$2
22921 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22922 -echo "configure:1736: checking for $ac_word" >&5
22923 +echo "configure:1753: checking for $ac_word" >&5
22924 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
22925 echo $ac_n "(cached) $ac_c" 1>&6
22926 else
22927 @@ -1767,7 +1784,7 @@ do
22928 # Extract the first word of "$ac_prog", so it can be a program name with args.
22929 set dummy $ac_prog; ac_word=$2
22930 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22931 -echo "configure:1771: checking for $ac_word" >&5
22932 +echo "configure:1788: checking for $ac_word" >&5
22933 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
22934 echo $ac_n "(cached) $ac_c" 1>&6
22935 else
22936 @@ -1802,7 +1819,7 @@ do
22937 # Extract the first word of "$ac_prog", so it can be a program name with args.
22938 set dummy $ac_prog; ac_word=$2
22939 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22940 -echo "configure:1806: checking for $ac_word" >&5
22941 +echo "configure:1823: checking for $ac_word" >&5
22942 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
22943 echo $ac_n "(cached) $ac_c" 1>&6
22944 else
22945 @@ -1839,7 +1856,7 @@ do
22946 # Extract the first word of "$ac_prog", so it can be a program name with args.
22947 set dummy $ac_prog; ac_word=$2
22948 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
22949 -echo "configure:1843: checking for $ac_word" >&5
22950 +echo "configure:1860: checking for $ac_word" >&5
22951 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
22952 echo $ac_n "(cached) $ac_c" 1>&6
22953 else
22954 @@ -1871,7 +1888,7 @@ test -n "$CXX" || CXX="gcc"
22957 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
22958 -echo "configure:1875: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
22959 +echo "configure:1892: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
22961 ac_ext=C
22962 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
22963 @@ -1882,12 +1899,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
22965 cat > conftest.$ac_ext << EOF
22967 -#line 1886 "configure"
22968 +#line 1903 "configure"
22969 #include "confdefs.h"
22971 int main(){return(0);}
22973 -if { (eval echo configure:1891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
22974 +if { (eval echo configure:1908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
22975 ac_cv_prog_cxx_works=yes
22976 # If we can't run a trivial program, we are probably using a cross compiler.
22977 if (./conftest; exit) 2>/dev/null; then
22978 @@ -1913,12 +1930,12 @@ if test $ac_cv_prog_cxx_works = no; then
22979 { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
22981 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
22982 -echo "configure:1917: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
22983 +echo "configure:1934: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
22984 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
22985 cross_compiling=$ac_cv_prog_cxx_cross
22987 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
22988 -echo "configure:1922: checking whether we are using GNU C++" >&5
22989 +echo "configure:1939: checking whether we are using GNU C++" >&5
22990 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
22991 echo $ac_n "(cached) $ac_c" 1>&6
22992 else
22993 @@ -1927,7 +1944,7 @@ else
22994 yes;
22995 #endif
22997 -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1931: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
22998 +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1948: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
22999 ac_cv_prog_gxx=yes
23000 else
23001 ac_cv_prog_gxx=no
23002 @@ -1946,7 +1963,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
23003 ac_save_CXXFLAGS="$CXXFLAGS"
23004 CXXFLAGS=
23005 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
23006 -echo "configure:1950: checking whether ${CXX-g++} accepts -g" >&5
23007 +echo "configure:1967: checking whether ${CXX-g++} accepts -g" >&5
23008 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
23009 echo $ac_n "(cached) $ac_c" 1>&6
23010 else
23011 @@ -1983,7 +2000,7 @@ fi
23012 # Extract the first word of "gcc", so it can be a program name with args.
23013 set dummy gcc; ac_word=$2
23014 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
23015 -echo "configure:1987: checking for $ac_word" >&5
23016 +echo "configure:2004: checking for $ac_word" >&5
23017 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
23018 echo $ac_n "(cached) $ac_c" 1>&6
23019 else
23020 @@ -2013,7 +2030,7 @@ if test -z "$CC"; then
23021 # Extract the first word of "cc", so it can be a program name with args.
23022 set dummy cc; ac_word=$2
23023 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
23024 -echo "configure:2017: checking for $ac_word" >&5
23025 +echo "configure:2034: checking for $ac_word" >&5
23026 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
23027 echo $ac_n "(cached) $ac_c" 1>&6
23028 else
23029 @@ -2064,7 +2081,7 @@ fi
23030 # Extract the first word of "cl", so it can be a program name with args.
23031 set dummy cl; ac_word=$2
23032 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
23033 -echo "configure:2068: checking for $ac_word" >&5
23034 +echo "configure:2085: checking for $ac_word" >&5
23035 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
23036 echo $ac_n "(cached) $ac_c" 1>&6
23037 else
23038 @@ -2096,7 +2113,7 @@ fi
23041 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
23042 -echo "configure:2100: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
23043 +echo "configure:2117: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
23045 ac_ext=c
23046 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
23047 @@ -2107,12 +2124,12 @@ cross_compiling=$ac_cv_prog_cc_cross
23049 cat > conftest.$ac_ext << EOF
23051 -#line 2111 "configure"
23052 +#line 2128 "configure"
23053 #include "confdefs.h"
23055 main(){return(0);}
23057 -if { (eval echo configure:2116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
23058 +if { (eval echo configure:2133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
23059 ac_cv_prog_cc_works=yes
23060 # If we can't run a trivial program, we are probably using a cross compiler.
23061 if (./conftest; exit) 2>/dev/null; then
23062 @@ -2138,12 +2155,12 @@ if test $ac_cv_prog_cc_works = no; then
23063 { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
23065 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
23066 -echo "configure:2142: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
23067 +echo "configure:2159: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
23068 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
23069 cross_compiling=$ac_cv_prog_cc_cross
23071 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
23072 -echo "configure:2147: checking whether we are using GNU C" >&5
23073 +echo "configure:2164: checking whether we are using GNU C" >&5
23074 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
23075 echo $ac_n "(cached) $ac_c" 1>&6
23076 else
23077 @@ -2152,7 +2169,7 @@ else
23078 yes;
23079 #endif
23081 -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2156: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
23082 +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2173: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
23083 ac_cv_prog_gcc=yes
23084 else
23085 ac_cv_prog_gcc=no
23086 @@ -2171,7 +2188,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
23087 ac_save_CFLAGS="$CFLAGS"
23088 CFLAGS=
23089 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
23090 -echo "configure:2175: checking whether ${CC-cc} accepts -g" >&5
23091 +echo "configure:2192: checking whether ${CC-cc} accepts -g" >&5
23092 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
23093 echo $ac_n "(cached) $ac_c" 1>&6
23094 else
23095 @@ -2204,7 +2221,7 @@ fi
23098 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
23099 -echo "configure:2208: checking how to run the C preprocessor" >&5
23100 +echo "configure:2225: checking how to run the C preprocessor" >&5
23101 # On Suns, sometimes $CPP names a directory.
23102 if test -n "$CPP" && test -d "$CPP"; then
23103 CPP=
23104 @@ -2219,13 +2236,13 @@ else
23105 # On the NeXT, cc -E runs the code through the compiler's parser,
23106 # not just through cpp.
23107 cat > conftest.$ac_ext <<EOF
23108 -#line 2223 "configure"
23109 +#line 2240 "configure"
23110 #include "confdefs.h"
23111 #include <assert.h>
23112 Syntax Error
23114 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
23115 -{ (eval echo configure:2229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23116 +{ (eval echo configure:2246: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23117 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
23118 if test -z "$ac_err"; then
23120 @@ -2236,13 +2253,13 @@ else
23121 rm -rf conftest*
23122 CPP="${CC-cc} -E -traditional-cpp"
23123 cat > conftest.$ac_ext <<EOF
23124 -#line 2240 "configure"
23125 +#line 2257 "configure"
23126 #include "confdefs.h"
23127 #include <assert.h>
23128 Syntax Error
23130 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
23131 -{ (eval echo configure:2246: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23132 +{ (eval echo configure:2263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23133 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
23134 if test -z "$ac_err"; then
23136 @@ -2253,13 +2270,13 @@ else
23137 rm -rf conftest*
23138 CPP="${CC-cc} -nologo -E"
23139 cat > conftest.$ac_ext <<EOF
23140 -#line 2257 "configure"
23141 +#line 2274 "configure"
23142 #include "confdefs.h"
23143 #include <assert.h>
23144 Syntax Error
23146 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
23147 -{ (eval echo configure:2263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23148 +{ (eval echo configure:2280: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23149 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
23150 if test -z "$ac_err"; then
23152 @@ -2286,7 +2303,7 @@ echo "$ac_t""$CPP" 1>&6
23153 # Extract the first word of "ranlib", so it can be a program name with args.
23154 set dummy ranlib; ac_word=$2
23155 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
23156 -echo "configure:2290: checking for $ac_word" >&5
23157 +echo "configure:2307: checking for $ac_word" >&5
23158 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
23159 echo $ac_n "(cached) $ac_c" 1>&6
23160 else
23161 @@ -2318,7 +2335,7 @@ do
23162 # Extract the first word of "$ac_prog", so it can be a program name with args.
23163 set dummy $ac_prog; ac_word=$2
23164 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
23165 -echo "configure:2322: checking for $ac_word" >&5
23166 +echo "configure:2339: checking for $ac_word" >&5
23167 if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then
23168 echo $ac_n "(cached) $ac_c" 1>&6
23169 else
23170 @@ -2359,7 +2376,7 @@ do
23171 # Extract the first word of "$ac_prog", so it can be a program name with args.
23172 set dummy $ac_prog; ac_word=$2
23173 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
23174 -echo "configure:2363: checking for $ac_word" >&5
23175 +echo "configure:2380: checking for $ac_word" >&5
23176 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
23177 echo $ac_n "(cached) $ac_c" 1>&6
23178 else
23179 @@ -2400,7 +2417,7 @@ do
23180 # Extract the first word of "$ac_prog", so it can be a program name with args.
23181 set dummy $ac_prog; ac_word=$2
23182 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
23183 -echo "configure:2404: checking for $ac_word" >&5
23184 +echo "configure:2421: checking for $ac_word" >&5
23185 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
23186 echo $ac_n "(cached) $ac_c" 1>&6
23187 else
23188 @@ -2441,7 +2458,7 @@ do
23189 # Extract the first word of "$ac_prog", so it can be a program name with args.
23190 set dummy $ac_prog; ac_word=$2
23191 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
23192 -echo "configure:2445: checking for $ac_word" >&5
23193 +echo "configure:2462: checking for $ac_word" >&5
23194 if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then
23195 echo $ac_n "(cached) $ac_c" 1>&6
23196 else
23197 @@ -2482,7 +2499,7 @@ do
23198 # Extract the first word of "$ac_prog", so it can be a program name with args.
23199 set dummy $ac_prog; ac_word=$2
23200 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
23201 -echo "configure:2486: checking for $ac_word" >&5
23202 +echo "configure:2503: checking for $ac_word" >&5
23203 if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then
23204 echo $ac_n "(cached) $ac_c" 1>&6
23205 else
23206 @@ -2537,6 +2554,12 @@ if test "`echo | $AS -v 2>&1 | grep -c G
23208 rm -f a.out
23210 +case "$build:$target" in
23211 + i?86-apple-darwin*:powerpc-apple-darwin*)
23212 + cross_compiling=yes
23213 + ;;
23214 +esac
23216 if test "$cross_compiling" = "yes"; then
23217 CROSS_COMPILE=1
23218 else
23219 @@ -2544,7 +2567,7 @@ else
23222 echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6
23223 -echo "configure:2548: checking for gcc -pipe support" >&5
23224 +echo "configure:2571: checking for gcc -pipe support" >&5
23225 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
23226 echo '#include <stdio.h>' > dummy-hello.c
23227 echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c
23228 @@ -2559,14 +2582,14 @@ if test -n "$GNU_CC" && test -n "$GNU_CX
23229 _SAVE_CFLAGS=$CFLAGS
23230 CFLAGS="$CFLAGS -pipe"
23231 cat > conftest.$ac_ext <<EOF
23232 -#line 2563 "configure"
23233 +#line 2586 "configure"
23234 #include "confdefs.h"
23235 #include <stdio.h>
23236 int main() {
23237 printf("Hello World\n");
23238 ; return 0; }
23240 -if { (eval echo configure:2570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
23241 +if { (eval echo configure:2593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
23242 rm -rf conftest*
23243 _res_gcc_pipe="yes"
23244 else
23245 @@ -2593,7 +2616,7 @@ fi
23247 if test "$GNU_CC"; then
23248 echo $ac_n "checking for visibility(hidden) attribute""... $ac_c" 1>&6
23249 -echo "configure:2597: checking for visibility(hidden) attribute" >&5
23250 +echo "configure:2620: checking for visibility(hidden) attribute" >&5
23251 if eval "test \"`echo '$''{'ac_cv_visibility_hidden'+set}'`\" = set"; then
23252 echo $ac_n "(cached) $ac_c" 1>&6
23253 else
23254 @@ -2617,7 +2640,7 @@ echo "$ac_t""$ac_cv_visibility_hidden" 1
23257 echo $ac_n "checking for visibility pragma support""... $ac_c" 1>&6
23258 -echo "configure:2621: checking for visibility pragma support" >&5
23259 +echo "configure:2644: checking for visibility pragma support" >&5
23260 if eval "test \"`echo '$''{'ac_cv_visibility_pragma'+set}'`\" = set"; then
23261 echo $ac_n "(cached) $ac_c" 1>&6
23262 else
23263 @@ -2670,7 +2693,7 @@ do
23264 # Extract the first word of "$ac_prog", so it can be a program name with args.
23265 set dummy $ac_prog; ac_word=$2
23266 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
23267 -echo "configure:2674: checking for $ac_word" >&5
23268 +echo "configure:2697: checking for $ac_word" >&5
23269 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
23270 echo $ac_n "(cached) $ac_c" 1>&6
23271 else
23272 @@ -2730,6 +2753,7 @@ if test -n "$CROSS_COMPILE"; then
23273 linux*) OS_ARCH=Linux ;;
23274 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
23275 mingw*) OS_ARCH=WINNT ;;
23276 + darwin*) OS_ARCH=Darwin ;;
23277 esac
23278 else
23279 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
23280 @@ -2916,17 +2940,17 @@ EOF
23281 DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib'
23282 ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'`
23283 echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6
23284 -echo "configure:2920: checking for sys/atomic_op.h" >&5
23285 +echo "configure:2944: checking for sys/atomic_op.h" >&5
23286 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
23287 echo $ac_n "(cached) $ac_c" 1>&6
23288 else
23289 cat > conftest.$ac_ext <<EOF
23290 -#line 2925 "configure"
23291 +#line 2949 "configure"
23292 #include "confdefs.h"
23293 #include <sys/atomic_op.h>
23295 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
23296 -{ (eval echo configure:2930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23297 +{ (eval echo configure:2954: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23298 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
23299 if test -z "$ac_err"; then
23300 rm -rf conftest*
23301 @@ -3083,7 +3107,7 @@ EOF
23302 _DEBUG_FLAGS='-gdwarf-2 -O0'
23303 MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
23304 echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6
23305 -echo "configure:3087: checking for gethostbyaddr in -lbind" >&5
23306 +echo "configure:3111: checking for gethostbyaddr in -lbind" >&5
23307 ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'`
23308 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
23309 echo $ac_n "(cached) $ac_c" 1>&6
23310 @@ -3091,7 +3115,7 @@ else
23311 ac_save_LIBS="$LIBS"
23312 LIBS="-lbind $LIBS"
23313 cat > conftest.$ac_ext <<EOF
23314 -#line 3095 "configure"
23315 +#line 3119 "configure"
23316 #include "confdefs.h"
23317 /* Override any gcc2 internal prototype to avoid an error. */
23318 /* We use char because int might match the return type of a gcc2
23319 @@ -3102,7 +3126,7 @@ int main() {
23320 gethostbyaddr()
23321 ; return 0; }
23323 -if { (eval echo configure:3106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
23324 +if { (eval echo configure:3130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
23325 rm -rf conftest*
23326 eval "ac_cv_lib_$ac_lib_var=yes"
23327 else
23328 @@ -3305,7 +3329,7 @@ EOF
23329 DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
23330 # Use the standard preprocessor (cpp)
23331 CFLAGS="$CFLAGS -no-cpp-precomp"
23332 - MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@'
23333 + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
23334 STRIP="$STRIP -x -S"
23335 DLL_SUFFIX=dylib
23336 USE_PTHREADS=1
23337 @@ -3364,6 +3388,11 @@ tools are selected during the Xcode/Deve
23338 LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
23339 DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS"
23340 export NEXT_ROOT=$MACOS_SDK_DIR
23342 + if test -n "$CROSS_COMPILE" ; then
23343 + HOST_CC="NEXT_ROOT= $HOST_CC"
23344 + HOST_CXX="NEXT_ROOT= $HOST_CXX"
23345 + fi
23346 else
23347 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
23349 @@ -4363,17 +4392,17 @@ EOF
23350 _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
23351 ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
23352 echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
23353 -echo "configure:4367: checking for machine/builtins.h" >&5
23354 +echo "configure:4396: checking for machine/builtins.h" >&5
23355 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
23356 echo $ac_n "(cached) $ac_c" 1>&6
23357 else
23358 cat > conftest.$ac_ext <<EOF
23359 -#line 4372 "configure"
23360 +#line 4401 "configure"
23361 #include "confdefs.h"
23362 #include <machine/builtins.h>
23364 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
23365 -{ (eval echo configure:4377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23366 +{ (eval echo configure:4406: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23367 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
23368 if test -z "$ac_err"; then
23369 rm -rf conftest*
23370 @@ -4935,7 +4964,7 @@ case $target in
23373 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
23374 -echo "configure:4939: checking for dlopen in -ldl" >&5
23375 +echo "configure:4968: checking for dlopen in -ldl" >&5
23376 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
23377 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
23378 echo $ac_n "(cached) $ac_c" 1>&6
23379 @@ -4943,7 +4972,7 @@ else
23380 ac_save_LIBS="$LIBS"
23381 LIBS="-ldl $LIBS"
23382 cat > conftest.$ac_ext <<EOF
23383 -#line 4947 "configure"
23384 +#line 4976 "configure"
23385 #include "confdefs.h"
23386 /* Override any gcc2 internal prototype to avoid an error. */
23387 /* We use char because int might match the return type of a gcc2
23388 @@ -4954,7 +4983,7 @@ int main() {
23389 dlopen()
23390 ; return 0; }
23392 -if { (eval echo configure:4958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
23393 +if { (eval echo configure:4987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
23394 rm -rf conftest*
23395 eval "ac_cv_lib_$ac_lib_var=yes"
23396 else
23397 @@ -4971,17 +5000,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_l
23398 echo "$ac_t""yes" 1>&6
23399 ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
23400 echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
23401 -echo "configure:4975: checking for dlfcn.h" >&5
23402 +echo "configure:5004: checking for dlfcn.h" >&5
23403 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
23404 echo $ac_n "(cached) $ac_c" 1>&6
23405 else
23406 cat > conftest.$ac_ext <<EOF
23407 -#line 4980 "configure"
23408 +#line 5009 "configure"
23409 #include "confdefs.h"
23410 #include <dlfcn.h>
23412 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
23413 -{ (eval echo configure:4985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23414 +{ (eval echo configure:5014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
23415 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
23416 if test -z "$ac_err"; then
23417 rm -rf conftest*
23418 @@ -5014,13 +5043,13 @@ esac
23420 if test $ac_cv_prog_gcc = yes; then
23421 echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
23422 -echo "configure:5018: checking whether ${CC-cc} needs -traditional" >&5
23423 +echo "configure:5047: checking whether ${CC-cc} needs -traditional" >&5
23424 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
23425 echo $ac_n "(cached) $ac_c" 1>&6
23426 else
23427 ac_pattern="Autoconf.*'x'"
23428 cat > conftest.$ac_ext <<EOF
23429 -#line 5024 "configure"
23430 +#line 5053 "configure"
23431 #include "confdefs.h"
23432 #include <sgtty.h>
23433 Autoconf TIOCGETP
23434 @@ -5038,7 +5067,7 @@ rm -f conftest*
23436 if test $ac_cv_prog_gcc_traditional = no; then
23437 cat > conftest.$ac_ext <<EOF
23438 -#line 5042 "configure"
23439 +#line 5071 "configure"
23440 #include "confdefs.h"
23441 #include <termio.h>
23442 Autoconf TCGETA
23443 @@ -5062,12 +5091,12 @@ fi
23444 for ac_func in lchown strerror
23446 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
23447 -echo "configure:5066: checking for $ac_func" >&5
23448 +echo "configure:5095: checking for $ac_func" >&5
23449 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
23450 echo $ac_n "(cached) $ac_c" 1>&6
23451 else
23452 cat > conftest.$ac_ext <<EOF
23453 -#line 5071 "configure"
23454 +#line 5100 "configure"
23455 #include "confdefs.h"
23456 /* System header to define __stub macros and hopefully few prototypes,
23457 which can conflict with char $ac_func(); below. */
23458 @@ -5090,7 +5119,7 @@ $ac_func();
23460 ; return 0; }
23462 -if { (eval echo configure:5094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
23463 +if { (eval echo configure:5123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
23464 rm -rf conftest*
23465 eval "ac_cv_func_$ac_func=yes"
23466 else
23467 @@ -5131,7 +5160,7 @@ hpux*)
23468 if test -z "$GNU_CC"; then
23470 echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
23471 -echo "configure:5135: checking for +Olit support" >&5
23472 +echo "configure:5164: checking for +Olit support" >&5
23473 if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
23474 echo $ac_n "(cached) $ac_c" 1>&6
23475 else
23476 @@ -5170,7 +5199,7 @@ darwin*)
23479 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
23480 -echo "configure:5174: checking for pthread_create in -lpthreads" >&5
23481 +echo "configure:5203: checking for pthread_create in -lpthreads" >&5
23482 echo "
23483 #include <pthread.h>
23484 void *foo(void *v) { return v; }
23485 @@ -5192,7 +5221,7 @@ echo "
23486 echo "$ac_t""no" 1>&6
23488 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
23489 -echo "configure:5196: checking for pthread_create in -lpthread" >&5
23490 +echo "configure:5225: checking for pthread_create in -lpthread" >&5
23491 echo "
23492 #include <pthread.h>
23493 void *foo(void *v) { return v; }
23494 @@ -5214,7 +5243,7 @@ echo "
23495 echo "$ac_t""no" 1>&6
23497 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
23498 -echo "configure:5218: checking for pthread_create in -lc_r" >&5
23499 +echo "configure:5247: checking for pthread_create in -lc_r" >&5
23500 echo "
23501 #include <pthread.h>
23502 void *foo(void *v) { return v; }
23503 @@ -5236,7 +5265,7 @@ echo "
23504 echo "$ac_t""no" 1>&6
23506 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
23507 -echo "configure:5240: checking for pthread_create in -lc" >&5
23508 +echo "configure:5269: checking for pthread_create in -lc" >&5
23509 echo "
23510 #include <pthread.h>
23511 void *foo(void *v) { return v; }
23512 @@ -5390,7 +5419,7 @@ if test -n "$USE_PTHREADS"; then
23513 rm -f conftest*
23514 ac_cv_have_dash_pthread=no
23515 echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
23516 -echo "configure:5394: checking whether ${CC-cc} accepts -pthread" >&5
23517 +echo "configure:5423: checking whether ${CC-cc} accepts -pthread" >&5
23518 echo 'int main() { return 0; }' | cat > conftest.c
23519 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
23520 if test $? -eq 0; then
23521 @@ -5413,7 +5442,7 @@ echo "configure:5394: checking whether $
23522 ac_cv_have_dash_pthreads=no
23523 if test "$ac_cv_have_dash_pthread" = "no"; then
23524 echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
23525 -echo "configure:5417: checking whether ${CC-cc} accepts -pthreads" >&5
23526 +echo "configure:5446: checking whether ${CC-cc} accepts -pthreads" >&5
23527 echo 'int main() { return 0; }' | cat > conftest.c
23528 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
23529 if test $? -eq 0; then
23530 @@ -5831,6 +5860,7 @@ esac
23535 MAKEFILES="
23536 Makefile
23537 config/Makefile
23538 @@ -6058,6 +6088,7 @@ s%@PERL@%$PERL%g
23539 s%@SHELL_OVERRIDE@%$SHELL_OVERRIDE%g
23540 s%@MOZILLA_CLIENT@%$MOZILLA_CLIENT%g
23541 s%@HOST_CFLAGS@%$HOST_CFLAGS%g
23542 +s%@HOST_LDFLAGS@%$HOST_LDFLAGS%g
23543 s%@GNU_CC@%$GNU_CC%g
23544 s%@GCC_USE_GNU_LD@%$GCC_USE_GNU_LD%g
23545 s%@MSC_VER@%$MSC_VER%g
23546 diff -uprN --exclude=CVS mozilla/nsprpub/configure.in mozilla.new/nsprpub/configure.in
23547 --- mozilla/nsprpub/configure.in 2006-01-11 23:01:56.000000000 +0100
23548 +++ mozilla.new/nsprpub/configure.in 2006-02-24 11:15:17.000000000 +0100
23549 @@ -412,12 +412,37 @@ if test "$target" != "$host"; then
23550 CFLAGS=$_SAVE_CFLAGS
23551 LDFLAGS=$_SAVE_LDFLAGS
23553 + case "$build:$target" in
23554 + powerpc-apple-darwin8*:i?86-apple-darwin*)
23555 + dnl The Darwin cross compiler doesn't necessarily point itself at a
23556 + dnl root that has libraries for the proper architecture, it defaults
23557 + dnl to the system root. The libraries in the system root on current
23558 + dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
23559 + dnl checks will fail. Fake a working SDK in that case.
23560 + _SAVE_CFLAGS=$CFLAGS
23561 + _SAVE_CXXFLAGS=$CXXLAGS
23562 + CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
23563 + CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
23564 + ;;
23565 + esac
23567 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", echo)
23568 unset ac_cv_prog_CC
23569 AC_PROG_CC
23570 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", echo)
23571 unset ac_cv_prog_CXX
23572 AC_PROG_CXX
23574 + case "$build:$target" in
23575 + powerpc-apple-darwin8*:i?86-apple-darwin*)
23576 + dnl Revert the changes made above. From this point on, the target
23577 + dnl compiler will never be used without applying the SDK to CFLAGS
23578 + dnl (see --with-macos-sdk below).
23579 + CFLAGS=$_SAVE_CFLAGS
23580 + CXXFLAGS=$_SAVE_CXXFLAGS
23581 + ;;
23582 + esac
23584 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", echo)
23585 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", echo)
23586 AC_CHECK_PROGS(AS, $AS "${target_alias}-as" "${target}-as", echo)
23587 @@ -458,6 +483,15 @@ if test "`echo | $AS -v 2>&1 | grep -c G
23589 rm -f a.out
23591 +case "$build:$target" in
23592 + i?86-apple-darwin*:powerpc-apple-darwin*)
23593 + dnl cross_compiling will have erroneously been set to "no" in this
23594 + dnl case, because the x86 build host is able to run ppc code in a
23595 + dnl translated environment, making a cross compiler appear native.
23596 + cross_compiling=yes
23597 + ;;
23598 +esac
23600 if test "$cross_compiling" = "yes"; then
23601 CROSS_COMPILE=1
23602 else
23603 @@ -591,6 +625,7 @@ if test -n "$CROSS_COMPILE"; then
23604 linux*) OS_ARCH=Linux ;;
23605 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
23606 mingw*) OS_ARCH=WINNT ;;
23607 + darwin*) OS_ARCH=Darwin ;;
23608 esac
23609 else
23610 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
23611 @@ -943,7 +978,7 @@ case "$target" in
23612 DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
23613 # Use the standard preprocessor (cpp)
23614 CFLAGS="$CFLAGS -no-cpp-precomp"
23615 - MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@'
23616 + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
23617 STRIP="$STRIP -x -S"
23618 DLL_SUFFIX=dylib
23619 USE_PTHREADS=1
23620 @@ -1020,6 +1055,14 @@ tools are selected during the Xcode/Deve
23621 LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
23622 DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS"
23623 export NEXT_ROOT=$MACOS_SDK_DIR
23625 + if test -n "$CROSS_COMPILE" ; then
23626 + dnl NEXT_ROOT will be in the environment, but it
23627 + dnl shouldn't be set for the build host. HOST_CXX is
23628 + dnl presently unused.
23629 + HOST_CC="NEXT_ROOT= $HOST_CC"
23630 + HOST_CXX="NEXT_ROOT= $HOST_CXX"
23631 + fi
23632 else
23633 dnl gcc >= 4.0 uses different paths than above, but knows
23634 dnl how to find them itself.
23635 @@ -2619,6 +2662,7 @@ AC_SUBST(CPPFLAGS)
23636 AC_SUBST(HOST_CC)
23637 AC_SUBST(HOST_CFLAGS)
23638 AC_SUBST(LDFLAGS)
23639 +AC_SUBST(HOST_LDFLAGS)
23640 AC_SUBST(GNU_CC)
23641 AC_SUBST(GCC_USE_GNU_LD)
23642 AC_SUBST(MSC_VER)
23643 diff -uprN --exclude=CVS mozilla/nsprpub/pr/include/md/_darwin.cfg mozilla.new/nsprpub/pr/include/md/_darwin.cfg
23644 --- mozilla/nsprpub/pr/include/md/_darwin.cfg 2004-04-28 02:33:44.000000000 +0200
23645 +++ mozilla.new/nsprpub/pr/include/md/_darwin.cfg 2006-02-24 11:15:17.000000000 +0100
23646 @@ -94,6 +94,7 @@
23647 #define PR_ALIGN_OF_FLOAT 4
23648 #define PR_ALIGN_OF_DOUBLE 4
23649 #define PR_ALIGN_OF_POINTER 4
23650 +#define PR_ALIGN_OF_WORD 4
23652 #ifndef NO_NSPR_10_SUPPORT
23654 diff -uprN --exclude=CVS mozilla/nsprpub/pr/src/Makefile.in mozilla.new/nsprpub/pr/src/Makefile.in
23655 --- mozilla/nsprpub/pr/src/Makefile.in 2005-06-01 16:26:29.000000000 +0200
23656 +++ mozilla.new/nsprpub/pr/src/Makefile.in 2006-02-14 09:59:41.000000000 +0100
23657 @@ -198,9 +198,9 @@ endif
23659 ifeq ($(OS_ARCH),WINNT)
23660 ifdef NS_USE_GCC
23661 -OS_LIBS = -ladvapi32 -lwsock32
23662 +OS_LIBS = -ladvapi32 -lwsock32 -lwinmm
23663 else
23664 -OS_LIBS = advapi32.lib wsock32.lib
23665 +OS_LIBS = advapi32.lib wsock32.lib winmm.lib
23666 endif
23667 endif
23669 diff -uprN --exclude=CVS mozilla/nsprpub/pr/src/md/windows/ntinrval.c mozilla.new/nsprpub/pr/src/md/windows/ntinrval.c
23670 --- mozilla/nsprpub/pr/src/md/windows/ntinrval.c 2004-04-28 02:34:06.000000000 +0200
23671 +++ mozilla.new/nsprpub/pr/src/md/windows/ntinrval.c 2006-02-14 09:59:42.000000000 +0100
23672 @@ -42,83 +42,19 @@
23674 #include "primpl.h"
23676 -#if defined(WIN16)
23677 -#include <win/compobj.h>
23678 -#define QueryPerformanceFrequency(x) FALSE
23679 -#define QueryPerformanceCounter(x) FALSE
23680 -#endif
23682 -static PRIntn _nt_bitShift = 0;
23683 -static PRInt32 _nt_ticksPerSec = -1;
23685 void
23686 _PR_MD_INTERVAL_INIT()
23688 - LARGE_INTEGER count;
23690 - if (QueryPerformanceFrequency(&count)) {
23691 - /*
23692 - * HighPart is signed (LONG). Assert that its sign bit is 0
23693 - * because we will be right shifting it. LowPart is unsigned
23694 - * (DWORD).
23695 - */
23696 - PR_ASSERT(count.HighPart >= 0);
23697 - while(count.HighPart) {
23698 - count.LowPart = (count.HighPart << 31) + (count.LowPart >> 1);
23699 - count.HighPart >>= 1;
23700 - _nt_bitShift++;
23702 - while(count.LowPart > PR_INTERVAL_MAX) {
23703 - count.LowPart >>= 1;
23704 - _nt_bitShift++;
23707 - /*
23708 - * We can't use the performance counter if after
23709 - * normalization we are left with fewer than 32 bits.
23710 - */
23711 - if (_nt_bitShift <= 32) {
23712 - _nt_ticksPerSec = count.LowPart;
23713 - PR_ASSERT(_nt_ticksPerSec > PR_INTERVAL_MIN);
23714 - return;
23717 - _nt_ticksPerSec = -1;
23720 PRIntervalTime
23721 _PR_MD_GET_INTERVAL()
23723 - LARGE_INTEGER count;
23725 - /* Sadly; nspr requires the interval to range from 1000 ticks per second
23726 - * to only 100000 ticks per second; QueryPerformanceCounter is too high
23727 - * resolution...
23728 - */
23729 - if (_nt_ticksPerSec != -1) {
23730 - (void)QueryPerformanceCounter(&count);
23731 - PR_ASSERT(_nt_bitShift <= 32);
23732 - if (_nt_bitShift == 32) {
23733 - return (PRUint32)count.HighPart;
23734 - } else {
23735 - return (PRUint32)((count.HighPart << (32 - _nt_bitShift))
23736 - + (count.LowPart >> _nt_bitShift));
23738 - } else
23739 -#if defined(__MINGW32__)
23740 - return time();
23741 -#elif defined(WIN16)
23742 - return clock(); /* milliseconds since application start */
23743 -#else
23744 - return GetTickCount(); /* milliseconds since system start */
23745 -#endif
23746 + return timeGetTime(); /* milliseconds since system start */
23749 PRIntervalTime
23750 _PR_MD_INTERVAL_PER_SEC()
23752 - if (_nt_ticksPerSec != -1)
23753 - return _nt_ticksPerSec;
23754 - else
23755 - return 1000;
23756 + return 1000;
23758 diff -uprN --exclude=CVS mozilla/nsprpub/pr/src/md/windows/ntio.c mozilla.new/nsprpub/pr/src/md/windows/ntio.c
23759 --- mozilla/nsprpub/pr/src/md/windows/ntio.c 2004-04-28 02:34:06.000000000 +0200
23760 +++ mozilla.new/nsprpub/pr/src/md/windows/ntio.c 2006-02-24 11:15:18.000000000 +0100
23761 @@ -20,6 +20,7 @@
23762 * the Initial Developer. All Rights Reserved.
23764 * Contributor(s):
23765 + * Masayuki Nakano <masayuki@d-toybox.com>
23767 * Alternatively, the contents of this file may be used under the terms of
23768 * either the GNU General Public License Version 2 or later (the "GPL"), or
23769 @@ -108,6 +109,8 @@ static const PRTime _pr_filetime_offset
23770 static const PRTime _pr_filetime_offset = 116444736000000000i64;
23771 #endif
23773 +static PRBool IsPrevCharSlash(const char *str, const char *current);
23775 #define _NEED_351_FILE_LOCKING_HACK
23776 #ifdef _NEED_351_FILE_LOCKING_HACK
23777 #define _PR_LOCAL_FILE 1
23778 @@ -2769,7 +2772,7 @@ _PR_MD_OPEN_DIR(_MDDir *d, const char *n
23779 * If 'name' ends in a slash or backslash, do not append
23780 * another backslash.
23782 - if (filename[len - 1] == '/' || filename[len - 1] == '\\') {
23783 + if (IsPrevCharSlash(filename, filename + len)) {
23784 len--;
23786 strcpy(&filename[len], "\\*.*");
23787 @@ -2907,7 +2910,7 @@ _PR_MD_STAT(const char *fn, struct stat
23789 int len = strlen(fn);
23790 if (len > 0 && len <= _MAX_PATH
23791 - && (fn[len - 1] == '\\' || fn[len - 1] == '/')) {
23792 + && IsPrevCharSlash(fn, fn + len)) {
23793 char newfn[_MAX_PATH + 1];
23795 strcpy(newfn, fn);
23796 @@ -2924,6 +2927,17 @@ _PR_MD_STAT(const char *fn, struct stat
23798 #define _PR_IS_SLASH(ch) ((ch) == '/' || (ch) == '\\')
23800 +static PRBool
23801 +IsPrevCharSlash(const char *str, const char *current)
23803 + const char *prev;
23805 + if (str >= current)
23806 + return PR_FALSE;
23807 + prev = _mbsdec(str, current);
23808 + return (prev == current - 1) && _PR_IS_SLASH(*prev);
23812 * IsRootDirectory --
23814 @@ -2970,7 +2984,7 @@ IsRootDirectory(char *fn, size_t buflen)
23816 /* look for the next slash */
23817 do {
23818 - p++;
23819 + p = _mbsinc(p);
23820 } while (*p != '\0' && !_PR_IS_SLASH(*p));
23821 if (*p == '\0') {
23822 return PR_FALSE;
23823 @@ -2984,7 +2998,7 @@ IsRootDirectory(char *fn, size_t buflen)
23825 /* look for the final slash */
23826 do {
23827 - p++;
23828 + p = _mbsinc(p);
23829 } while (*p != '\0' && !_PR_IS_SLASH(*p));
23830 if (_PR_IS_SLASH(*p) && p[1] != '\0') {
23831 return PR_FALSE;
23832 @@ -3074,7 +3088,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRF
23833 info->creationTime = 0;
23834 return 0;
23836 - if (!_PR_IS_SLASH(pathbuf[len - 1])) {
23837 + if (!IsPrevCharSlash(pathbuf, pathbuf + len)) {
23838 _PR_MD_MAP_OPENDIR_ERROR(GetLastError());
23839 return -1;
23840 } else {
23841 diff -uprN --exclude=CVS mozilla/nsprpub/pr/src/md/windows/w95io.c mozilla.new/nsprpub/pr/src/md/windows/w95io.c
23842 --- mozilla/nsprpub/pr/src/md/windows/w95io.c 2004-04-28 02:34:06.000000000 +0200
23843 +++ mozilla.new/nsprpub/pr/src/md/windows/w95io.c 2006-02-24 11:15:18.000000000 +0100
23844 @@ -20,6 +20,7 @@
23845 * the Initial Developer. All Rights Reserved.
23847 * Contributor(s):
23848 + * Masayuki Nakano <masayuki@d-toybox.com>
23850 * Alternatively, the contents of this file may be used under the terms of
23851 * either the GNU General Public License Version 2 or later (the "GPL"), or
23852 @@ -84,6 +85,8 @@ static const PRTime _pr_filetime_offset
23853 static void InitUnicodeSupport(void);
23854 #endif
23856 +static PRBool IsPrevCharSlash(const char *str, const char *current);
23858 void
23859 _PR_MD_INIT_IO()
23861 @@ -516,7 +519,7 @@ _PR_MD_OPEN_DIR(_MDDir *d, const char *n
23862 * If 'name' ends in a slash or backslash, do not append
23863 * another backslash.
23865 - if (filename[len - 1] == '/' || filename[len - 1] == '\\') {
23866 + if (IsPrevCharSlash(filename, filename + len)) {
23867 len--;
23869 strcpy(&filename[len], "\\*.*");
23870 @@ -654,7 +657,7 @@ _PR_MD_STAT(const char *fn, struct stat
23872 int len = strlen(fn);
23873 if (len > 0 && len <= _MAX_PATH
23874 - && (fn[len - 1] == '\\' || fn[len - 1] == '/')) {
23875 + && IsPrevCharSlash(fn, fn + len)) {
23876 char newfn[_MAX_PATH + 1];
23878 strcpy(newfn, fn);
23879 @@ -671,6 +674,17 @@ _PR_MD_STAT(const char *fn, struct stat
23881 #define _PR_IS_SLASH(ch) ((ch) == '/' || (ch) == '\\')
23883 +static PRBool
23884 +IsPrevCharSlash(const char *str, const char *current)
23886 + const char *prev;
23888 + if (str >= current)
23889 + return PR_FALSE;
23890 + prev = _mbsdec(str, current);
23891 + return (prev == current - 1) && _PR_IS_SLASH(*prev);
23895 * IsRootDirectory --
23897 @@ -717,7 +731,7 @@ IsRootDirectory(char *fn, size_t buflen)
23899 /* look for the next slash */
23900 do {
23901 - p++;
23902 + p = _mbsinc(p);
23903 } while (*p != '\0' && !_PR_IS_SLASH(*p));
23904 if (*p == '\0') {
23905 return PR_FALSE;
23906 @@ -731,7 +745,7 @@ IsRootDirectory(char *fn, size_t buflen)
23908 /* look for the final slash */
23909 do {
23910 - p++;
23911 + p = _mbsinc(p);
23912 } while (*p != '\0' && !_PR_IS_SLASH(*p));
23913 if (_PR_IS_SLASH(*p) && p[1] != '\0') {
23914 return PR_FALSE;
23915 @@ -821,7 +835,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRF
23916 info->creationTime = 0;
23917 return 0;
23919 - if (!_PR_IS_SLASH(pathbuf[len - 1])) {
23920 + if (!IsPrevCharSlash(pathbuf, pathbuf + len)) {
23921 _PR_MD_MAP_OPENDIR_ERROR(GetLastError());
23922 return -1;
23923 } else {
23924 diff -uprN --exclude=CVS mozilla/parser/expat/lib/internal.h mozilla.new/parser/expat/lib/internal.h
23925 --- mozilla/parser/expat/lib/internal.h 2005-07-22 00:14:59.000000000 +0200
23926 +++ mozilla.new/parser/expat/lib/internal.h 2006-02-24 11:16:41.000000000 +0100
23927 @@ -20,7 +20,7 @@
23928 and therefore subject to change.
23931 -#if defined(__GNUC__) && defined(__i386__) && !defined(XP_MACOSX)
23932 +#if defined(__GNUC__) && defined(__i386__)
23933 /* We'll use this version by default only where we know it helps.
23935 regparm() generates warnings on Solaris boxes. See SF bug #692878.
23936 diff -uprN --exclude=CVS mozilla/parser/htmlparser/src/CNavDTD.cpp mozilla.new/parser/htmlparser/src/CNavDTD.cpp
23937 --- mozilla/parser/htmlparser/src/CNavDTD.cpp 2005-09-13 19:15:18.000000000 +0200
23938 +++ mozilla.new/parser/htmlparser/src/CNavDTD.cpp 2006-03-12 20:04:18.000000000 +0100
23939 @@ -2028,7 +2028,11 @@ nsresult CNavDTD::HandleSavedTokens(PRIn
23940 // EndContext(). Ex: <center><table><a></center>.
23941 // In the Ex. above </center> should not close <center> above table.
23942 // Doing so will cause the current context to get closed prematurely.
23943 - PRInt32 theIndex=mBodyContext->LastOf(theTag);
23944 + eHTMLTags closed = FindAutoCloseTargetForEndTag(theTag, *mBodyContext,
23945 + mDTDMode);
23946 + PRInt32 theIndex = closed != eHTMLTag_unknown
23947 + ? mBodyContext->LastOf(closed)
23948 + : kNotFound;
23950 if(theIndex!=kNotFound && theIndex<=mBodyContext->mContextTopIndex) {
23951 IF_FREE(theToken, mTokenAllocator);
23952 diff -uprN --exclude=CVS mozilla/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/Info.plist mozilla.new/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/Info.plist
23953 --- mozilla/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/Info.plist 2006-01-09 06:48:48.000000000 +0100
23954 +++ mozilla.new/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/Info.plist 2006-02-24 11:16:36.000000000 +0100
23955 @@ -7,7 +7,7 @@
23956 <key>CFBundleExecutable</key>
23957 <string>JavaEmbeddingPlugin</string>
23958 <key>CFBundleGetInfoString</key>
23959 - <string>Java Embedding Plugin 0.9.5+b, Copyright (c) 2005 Steven Michaud</string>
23960 + <string>Java Embedding Plugin 0.9.5+c, Copyright (c) 2006 Steven Michaud</string>
23961 <key>CFBundleInfoDictionaryVersion</key>
23962 <string>6.0</string>
23963 <key>CFBundleName</key>
23964 @@ -15,11 +15,11 @@
23965 <key>CFBundlePackageType</key>
23966 <string>BNDL</string>
23967 <key>CFBundleShortVersionString</key>
23968 - <string>0.9.5+b</string>
23969 + <string>0.9.5+c</string>
23970 <key>CFBundleSignature</key>
23971 <string>????</string>
23972 <key>CFBundleVersion</key>
23973 - <string>0.9.5+b</string>
23974 + <string>0.9.5+c</string>
23975 <key>NSJavaNeeded</key>
23976 <string>YES</string>
23977 <key>NSJavaPath</key>
23978 Dateien mozilla/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/MacOS/JavaEmbeddingPlugin und mozilla.new/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/MacOS/JavaEmbeddingPlugin sind verschieden.
23979 diff -uprN --exclude=CVS mozilla/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/pbdevelopment.plist mozilla.new/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/pbdevelopment.plist
23980 --- mozilla/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/pbdevelopment.plist 2006-01-09 06:48:48.000000000 +0100
23981 +++ mozilla.new/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/pbdevelopment.plist 2006-02-24 11:16:36.000000000 +0100
23982 @@ -3,6 +3,6 @@
23983 <plist version="1.0">
23984 <dict>
23985 <key>PBXProjectSourcePath</key>
23986 - <string>/Volumes/Storage2/Developer/JavaEmbeddingPlugin/Project/JavaEmbeddingPlugin0.9.5+b/JavaEmbeddingPlugin.pbproj</string>
23987 + <string>/Volumes/Storage2/Developer/JavaEmbeddingPlugin/Project/JavaEmbeddingPlugin0.9.5+c/JavaEmbeddingPlugin.pbproj</string>
23988 </dict>
23989 </plist>
23990 Dateien mozilla/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/Resources/English.lproj/InfoPlist.strings und mozilla.new/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/Resources/English.lproj/InfoPlist.strings sind verschieden.
23991 Dateien mozilla/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/Resources/Java/JavaEmbeddingPlugin.jar und mozilla.new/plugin/oji/JEP/JavaEmbeddingPlugin.bundle/Contents/Resources/Java/JavaEmbeddingPlugin.jar sind verschieden.
23992 diff -uprN --exclude=CVS mozilla/plugin/oji/JEP/MRJPlugin.plugin/Contents/Info.plist mozilla.new/plugin/oji/JEP/MRJPlugin.plugin/Contents/Info.plist
23993 --- mozilla/plugin/oji/JEP/MRJPlugin.plugin/Contents/Info.plist 2006-01-09 06:48:49.000000000 +0100
23994 +++ mozilla.new/plugin/oji/JEP/MRJPlugin.plugin/Contents/Info.plist 2006-02-24 11:16:37.000000000 +0100
23995 @@ -7,7 +7,7 @@
23996 <key>CFBundleExecutable</key>
23997 <string>MRJPlugin</string>
23998 <key>CFBundleGetInfoString</key>
23999 - <string>MRJ Plugin 1.0-JEP-0.9.5+b, Copyright (c) 2002 The Mozilla Organization</string>
24000 + <string>MRJ Plugin 1.0-JEP-0.9.5+c, Copyright (c) 2002 The Mozilla Organization</string>
24001 <key>CFBundleIdentifier</key>
24002 <string>com.netscape.MRJPlugin</string>
24003 <key>CFBundleInfoDictionaryVersion</key>
24004 @@ -17,11 +17,11 @@
24005 <key>CFBundlePackageType</key>
24006 <string>NSPL</string>
24007 <key>CFBundleShortVersionString</key>
24008 - <string>1.0-JEP-0.9.5+b</string>
24009 + <string>1.0-JEP-0.9.5+c</string>
24010 <key>CFBundleSignature</key>
24011 <string>MOSS</string>
24012 <key>CFBundleVersion</key>
24013 - <string>1.0-JEP-0.9.5+b</string>
24014 + <string>1.0-JEP-0.9.5+c</string>
24015 <key>CSResourcesFileMapped</key>
24016 <true/>
24017 </dict>
24018 Dateien mozilla/plugin/oji/JEP/MRJPlugin.plugin/Contents/MacOS/MRJPlugin und mozilla.new/plugin/oji/JEP/MRJPlugin.plugin/Contents/MacOS/MRJPlugin sind verschieden.
24019 Dateien mozilla/plugin/oji/JEP/MRJPlugin.plugin/Contents/MacOS/MRJPlugin.jar und mozilla.new/plugin/oji/JEP/MRJPlugin.plugin/Contents/MacOS/MRJPlugin.jar sind verschieden.
24020 Dateien mozilla/plugin/oji/JEP/MRJPlugin.plugin/Contents/Resources/English.lproj/InfoPlist.strings und mozilla.new/plugin/oji/JEP/MRJPlugin.plugin/Contents/Resources/English.lproj/InfoPlist.strings sind verschieden.
24021 Dateien mozilla/plugin/oji/JEP/MRJPlugin.plugin/Contents/Resources/MRJPlugin.rsrc und mozilla.new/plugin/oji/JEP/MRJPlugin.plugin/Contents/Resources/MRJPlugin.rsrc sind verschieden.
24022 diff -uprN --exclude=CVS mozilla/plugin/oji/MRJCarbon/plugin/MRJPlugin.pbproj/project.pbxproj mozilla.new/plugin/oji/MRJCarbon/plugin/MRJPlugin.pbproj/project.pbxproj
24023 --- mozilla/plugin/oji/MRJCarbon/plugin/MRJPlugin.pbproj/project.pbxproj 2003-06-11 07:11:30.000000000 +0200
24024 +++ mozilla.new/plugin/oji/MRJCarbon/plugin/MRJPlugin.pbproj/project.pbxproj 2006-02-24 11:16:39.000000000 +0100
24025 @@ -406,14 +406,14 @@
24027 F59D146D02AC308301000104 = {
24028 isa = PBXFileReference;
24029 - name = _Dialogs.rsrc;
24030 - path = Resources/_Dialogs.rsrc;
24031 + name = Dialogs.rsrc;
24032 + path = Resources/Dialogs.rsrc;
24033 refType = 2;
24035 F59D146E02AC308301000104 = {
24036 isa = PBXFileReference;
24037 - name = _Strings.rsrc;
24038 - path = Resources/_Strings.rsrc;
24039 + name = Strings.rsrc;
24040 + path = Resources/Strings.rsrc;
24041 refType = 2;
24043 F59D146F02AC308301000104 = {
24044 Dateien mozilla/plugin/oji/MRJCarbon/plugin/Resources/Dialogs.rsrc und mozilla.new/plugin/oji/MRJCarbon/plugin/Resources/Dialogs.rsrc sind verschieden.
24045 diff -uprN --exclude=CVS mozilla/plugin/oji/MRJCarbon/plugin/Resources/Makefile mozilla.new/plugin/oji/MRJCarbon/plugin/Resources/Makefile
24046 --- mozilla/plugin/oji/MRJCarbon/plugin/Resources/Makefile 2003-06-11 07:11:33.000000000 +0200
24047 +++ mozilla.new/plugin/oji/MRJCarbon/plugin/Resources/Makefile 2006-02-24 11:16:39.000000000 +0100
24048 @@ -1,15 +1,3 @@
24049 -# decodes resource files from AppleSingle to Resource Manager format.
24051 -ASDECODE = ../../../../../dist/bin/asdecode
24052 -RESOURCE_FILES = _Dialogs.rsrc _Strings.rsrc
24054 -all: $(RESOURCE_FILES)
24056 -_Dialogs.rsrc: Dialogs.rsrc
24057 - $(ASDECODE) Dialogs.rsrc _Dialogs.rsrc
24059 -_Strings.rsrc: Strings.rsrc
24060 - $(ASDECODE) Strings.rsrc _Strings.rsrc
24062 -clean:
24063 - rm -f $(RESOURCE_FILES)
24064 +all:
24065 + @echo These .rsrc files are now distributed as resources in data forks.
24066 + @echo No further processing is necessary.
24067 Dateien mozilla/plugin/oji/MRJCarbon/plugin/Resources/Strings.rsrc und mozilla.new/plugin/oji/MRJCarbon/plugin/Resources/Strings.rsrc sind verschieden.
24068 Dateien mozilla/plugin/oji/MRJCarbon/plugin/Resources/Version.rsrc und mozilla.new/plugin/oji/MRJCarbon/plugin/Resources/Version.rsrc sind verschieden.
24069 diff -uprN --exclude=CVS mozilla/rdf/base/src/nsRDFXMLSerializer.cpp mozilla.new/rdf/base/src/nsRDFXMLSerializer.cpp
24070 --- mozilla/rdf/base/src/nsRDFXMLSerializer.cpp 2005-07-01 10:22:17.000000000 +0200
24071 +++ mozilla.new/rdf/base/src/nsRDFXMLSerializer.cpp 2006-02-24 11:16:39.000000000 +0100
24072 @@ -180,10 +180,7 @@ nsRDFXMLSerializer::AddNameSpace(nsIAtom
24073 if (!prefix) {
24074 // Make up a prefix, we don't want default namespaces, so
24075 // that we can use QNames for elements and attributes alike.
24076 - nsCAutoString pref;
24077 - pref.AssignLiteral("NS");
24078 - pref.AppendInt(++mPrefixID, 10);
24079 - prefix = do_GetAtom(pref);
24080 + prefix = EnsureNewPrefix();
24082 mNameSpaces.Put(aURI, prefix);
24083 return NS_OK;
24084 @@ -220,6 +217,28 @@ rdf_BlockingWrite(nsIOutputStream* strea
24085 return rdf_BlockingWrite(stream, utf8.get(), utf8.Length());
24088 +already_AddRefed<nsIAtom>
24089 +nsRDFXMLSerializer::EnsureNewPrefix()
24091 + nsCAutoString qname;
24092 + nsCOMPtr<nsIAtom> prefix;
24093 + PRBool isNewPrefix;
24094 + do {
24095 + isNewPrefix = PR_TRUE;
24096 + qname.AssignLiteral("NS");
24097 + qname.AppendInt(++mPrefixID, 10);
24098 + prefix = do_GetAtom(qname);
24099 + nsNameSpaceMap::const_iterator iter = mNameSpaces.first();
24100 + while (iter != mNameSpaces.last() && isNewPrefix) {
24101 + isNewPrefix = (iter->mPrefix != prefix);
24102 + ++iter;
24103 + }
24104 + } while (!isNewPrefix);
24105 + nsIAtom* outPrefix = nsnull;
24106 + prefix.swap(outPrefix);
24107 + return outPrefix;
24110 // This converts a property resource (like
24111 // "http://www.w3.org/TR/WD-rdf-syntax#Description") into a QName
24112 // ("RDF:Description"), and registers the namespace, if it's made up.
24113 @@ -253,12 +272,9 @@ nsRDFXMLSerializer::RegisterQName(nsIRDF
24115 // Take whatever is to the right of the '#' or '/' and call it the
24116 // local name, make up a prefix.
24117 - qname.AssignLiteral("NS");
24118 - qname.AppendInt(++mPrefixID, 10);
24120 - nsCOMPtr<nsIAtom> prefix = do_GetAtom(qname);
24121 - mNameSpaces.Put(StringHead(uri, i+1), prefix);
24123 + nsCOMPtr<nsIAtom> prefix = EnsureNewPrefix();
24124 + mNameSpaces.Put(StringHead(uri, i+1), prefix);
24125 + prefix->ToUTF8String(qname);
24126 qname.Append(':');
24127 qname += StringTail(uri, uri.Length() - (i + 1));
24129 diff -uprN --exclude=CVS mozilla/rdf/base/src/nsRDFXMLSerializer.h mozilla.new/rdf/base/src/nsRDFXMLSerializer.h
24130 --- mozilla/rdf/base/src/nsRDFXMLSerializer.h 2005-06-24 09:49:43.000000000 +0200
24131 +++ mozilla.new/rdf/base/src/nsRDFXMLSerializer.h 2006-02-24 11:16:39.000000000 +0100
24132 @@ -79,6 +79,8 @@ protected:
24133 RegisterQName(nsIRDFResource* aResource);
24134 nsresult
24135 GetQName(nsIRDFResource* aResource, nsCString& aQName);
24136 + already_AddRefed<nsIAtom>
24137 + EnsureNewPrefix();
24139 nsresult
24140 SerializeInlineAssertion(nsIOutputStream* aStream,
24141 diff -uprN --exclude=CVS mozilla/security/coreconf/Darwin.mk mozilla.new/security/coreconf/Darwin.mk
24142 --- mozilla/security/coreconf/Darwin.mk 2006-01-09 06:47:32.000000000 +0100
24143 +++ mozilla.new/security/coreconf/Darwin.mk 2006-03-03 07:10:28.000000000 +0100
24144 @@ -43,12 +43,16 @@ CC = cc
24145 CCC = c++
24146 RANLIB = ranlib
24148 -ifeq (86,$(findstring 86,$(OS_TEST)))
24149 +ifndef CPU_ARCH
24150 +# When cross-compiling, CPU_ARCH should already be defined as the target
24151 +# architecture, set to powerpc or i386.
24152 +CPU_ARCH := $(shell uname -p)
24153 +endif
24155 +ifeq (,$(filter-out i%86,$(CPU_ARCH)))
24156 OS_REL_CFLAGS = -Di386
24157 -CPU_ARCH = i386
24158 else
24159 OS_REL_CFLAGS = -Dppc
24160 -CPU_ARCH = ppc
24161 endif
24163 ifneq (,$(MACOS_SDK_DIR))
24164 @@ -59,13 +63,13 @@ ifneq (,$(MACOS_SDK_DIR))
24166 ifeq (,$(filter-out 2 3,$(GCC_VERSION_MAJOR)))
24167 # GCC <= 3
24168 - DARWIN_SDK_FRAMEWORKS = -F$(MACOS_SDK_DIR)/System/Library/Frameworks
24169 + DARWIN_SDK_FRAMEWORKS = -F$(MACOS_SDK_DIR)/System/Library/Frameworks
24170 ifneq (,$(shell find $(MACOS_SDK_DIR)/Library/Frameworks -maxdepth 0))
24171 DARWIN_SDK_FRAMEWORKS += -F$(MACOS_SDK_DIR)/Library/Frameworks
24172 endif
24173 DARWIN_SDK_CFLAGS = -nostdinc -isystem $(MACOS_SDK_DIR)/usr/include/gcc/darwin/$(GCC_VERSION) -isystem $(MACOS_SDK_DIR)/usr/include $(DARWIN_SDK_FRAMEWORKS)
24174 DARWIN_SDK_LDFLAGS = -L$(MACOS_SDK_DIR)/usr/lib/gcc/darwin -L$(MACOS_SDK_DIR)/usr/lib/gcc/darwin/$(GCC_VERSION_FULL) -L$(MACOS_SDK_DIR)/usr/lib
24175 - DARWIN_SDK_DSOFLAGS = $(DARWIN_SDK_LDFLAGS) $(DARWIN_SDK_FRAMEWORKS)
24176 + DARWIN_SDK_SHLIBFLAGS = $(DARWIN_SDK_LDFLAGS) $(DARWIN_SDK_FRAMEWORKS)
24177 NEXT_ROOT = $(MACOS_SDK_DIR)
24178 export NEXT_ROOT
24179 else
24180 @@ -75,12 +79,12 @@ ifneq (,$(MACOS_SDK_DIR))
24181 # gcc > 4.0.0 passes -syslibroot to ld based on -isysroot.
24182 # Don't add -isysroot to DARWIN_SDK_LDFLAGS, because the programs
24183 # that are linked with those flags also get DARWIN_SDK_CFLAGS.
24184 - DARWIN_SDK_DSOFLAGS = -isysroot $(MACOS_SDK_DIR)
24185 + DARWIN_SDK_SHLIBFLAGS = -isysroot $(MACOS_SDK_DIR)
24186 else
24187 # gcc 4.0.0 doesn't pass -syslibroot to ld, it needs to be
24188 # explicit.
24189 DARWIN_SDK_LDFLAGS = -Wl,-syslibroot,$(MACOS_SDK_DIR)
24190 - DARWIN_SDK_DSOFLAGS = $(DARWIN_SDK_LDFLAGS)
24191 + DARWIN_SDK_SHLIBFLAGS = $(DARWIN_SDK_LDFLAGS)
24192 endif
24193 endif
24195 @@ -105,10 +109,11 @@ endif
24197 ARCH = darwin
24199 +DSO_CFLAGS = -fPIC
24200 # May override this with -bundle to create a loadable module.
24201 -DSO_LDOPTS = -dynamiclib -compatibility_version 1 -current_version 1 -install_name @executable_path/$(notdir $@) -headerpad_max_install_names $(DARWIN_SDK_DSOFLAGS)
24202 +DSO_LDOPTS = -dynamiclib -compatibility_version 1 -current_version 1 -install_name @executable_path/$(notdir $@) -headerpad_max_install_names
24204 -MKSHLIB = $(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS)
24205 +MKSHLIB = $(CC) $(DSO_LDOPTS) $(DARWIN_SDK_SHLIBFLAGS)
24206 DLL_SUFFIX = dylib
24207 PROCESS_MAP_FILE = grep -v ';+' $(LIBRARY_NAME).def | grep -v ';-' | \
24208 sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,^,_,' > $@
24209 diff -uprN --exclude=CVS mozilla/security/manager/ssl/src/nsCrypto.cpp mozilla.new/security/manager/ssl/src/nsCrypto.cpp
24210 --- mozilla/security/manager/ssl/src/nsCrypto.cpp 2005-07-28 20:15:20.000000000 +0200
24211 +++ mozilla.new/security/manager/ssl/src/nsCrypto.cpp 2006-03-04 21:31:09.000000000 +0100
24212 @@ -69,6 +69,7 @@
24213 #include "nsIDOMCryptoDialogs.h"
24214 #include "nsIFormSigningDialog.h"
24215 #include "nsIProxyObjectManager.h"
24216 +#include "nsIJSContextStack.h"
24217 #include "jsapi.h"
24218 #include "jsdbgapi.h"
24219 #include <ctype.h>
24220 @@ -243,7 +244,7 @@ nsCrypto::~nsCrypto()
24221 NS_IMETHODIMP
24222 nsCrypto::SetEnableSmartCardEvents(PRBool aEnable)
24224 - nsresult rv;
24225 + nsresult rv = NS_OK;
24227 // this has the side effect of starting the nssComponent (and initializing
24228 // NSS) even if it isn't already going. Starting the nssComponent is a
24229 @@ -1773,15 +1774,23 @@ nsCryptoRunnable::Run()
24230 if (NS_FAILED(rv))
24231 return NS_ERROR_FAILURE;
24233 + // make sure the right context is on the stack. must not return w/out popping
24234 + nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1"));
24235 + if (!stack || NS_FAILED(stack->Push(cx))) {
24236 + return NS_ERROR_FAILURE;
24239 jsval retval;
24240 if (JS_EvaluateScriptForPrincipals(cx, m_args->m_scope, principals,
24241 m_args->m_jsCallback,
24242 strlen(m_args->m_jsCallback),
24243 nsnull, 0,
24244 &retval) != JS_TRUE) {
24245 - return NS_ERROR_FAILURE;
24246 + rv = NS_ERROR_FAILURE;
24248 - return NS_OK;
24250 + stack->Pop(nsnull);
24251 + return rv;
24254 //Quick helper function to check if a newly issued cert
24255 @@ -2522,7 +2531,8 @@ nsPkcs11::~nsPkcs11()
24256 PRBool
24257 confirm_user(const PRUnichar *message)
24259 - PRBool confirmation = PR_FALSE;
24260 + PRInt32 buttonPressed = 1; // If the user exits by clicking the close box, assume No (button 1)
24262 nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
24263 nsCOMPtr<nsIPrompt> prompter;
24264 if (wwatch)
24265 @@ -2531,11 +2541,16 @@ confirm_user(const PRUnichar *message)
24266 if (prompter) {
24267 nsPSMUITracker tracker;
24268 if (!tracker.isUIForbidden()) {
24269 - prompter->Confirm(0, message, &confirmation);
24270 + prompter->ConfirmEx(0, message,
24271 + (nsIPrompt::BUTTON_DELAY_ENABLE) +
24272 + (nsIPrompt::BUTTON_POS_1_DEFAULT) +
24273 + (nsIPrompt::BUTTON_TITLE_OK * nsIPrompt::BUTTON_POS_0) +
24274 + (nsIPrompt::BUTTON_TITLE_CANCEL * nsIPrompt::BUTTON_POS_1),
24275 + nsnull, nsnull, nsnull, nsnull, nsnull, &buttonPressed);
24279 - return confirmation;
24280 + return (buttonPressed == 0);
24283 //Delete a PKCS11 module from the user's profile.
24284 diff -uprN --exclude=CVS mozilla/toolkit/components/autocomplete/public/nsIAutoCompleteResultTypes.idl mozilla.new/toolkit/components/autocomplete/public/nsIAutoCompleteResultTypes.idl
24285 --- mozilla/toolkit/components/autocomplete/public/nsIAutoCompleteResultTypes.idl 2005-02-01 18:06:59.000000000 +0100
24286 +++ mozilla.new/toolkit/components/autocomplete/public/nsIAutoCompleteResultTypes.idl 2006-03-12 20:03:26.000000000 +0100
24287 @@ -81,3 +81,10 @@ interface nsIAutoCompleteMdbResult : nsI
24289 long getIntRowValue(in nsIMdbRow row, in mdb_column col);
24292 +/* noscript */
24293 +[uuid(148C9DC5-0FBB-408B-80FE-544F6A85B433)]
24294 +interface nsIAutoCompleteMdbResult2 : nsIAutoCompleteMdbResult
24296 + attribute boolean reverseByteOrder;
24298 diff -uprN --exclude=CVS mozilla/toolkit/components/autocomplete/src/nsAutoCompleteMdbResult.cpp mozilla.new/toolkit/components/autocomplete/src/nsAutoCompleteMdbResult.cpp
24299 --- mozilla/toolkit/components/autocomplete/src/nsAutoCompleteMdbResult.cpp 2005-02-01 18:07:00.000000000 +0100
24300 +++ mozilla.new/toolkit/components/autocomplete/src/nsAutoCompleteMdbResult.cpp 2006-03-12 20:03:26.000000000 +0100
24301 @@ -39,10 +39,20 @@
24302 #include "nsCOMPtr.h"
24303 #include "nsCRT.h"
24305 +static void SwapBytes(PRUnichar* aDest, const PRUnichar* aSrc, PRUint32 aLen)
24307 + for(PRUint32 i = 0; i < aLen; i++)
24309 + PRUnichar aChar = *aSrc++;
24310 + *aDest++ = (0xff & (aChar >> 8)) | (aChar << 8);
24314 NS_INTERFACE_MAP_BEGIN(nsAutoCompleteMdbResult)
24315 NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteResult)
24316 NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteBaseResult)
24317 NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteMdbResult)
24318 + NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteMdbResult2)
24319 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAutoCompleteResult)
24320 NS_INTERFACE_MAP_END
24322 @@ -51,7 +61,8 @@ NS_IMPL_RELEASE(nsAutoCompleteMdbResult)
24324 nsAutoCompleteMdbResult::nsAutoCompleteMdbResult() :
24325 mDefaultIndex(-1),
24326 - mSearchResult(nsIAutoCompleteResult::RESULT_IGNORED)
24327 + mSearchResult(nsIAutoCompleteResult::RESULT_IGNORED),
24328 + mReverseByteOrder(PR_FALSE)
24332 @@ -245,9 +256,21 @@ nsAutoCompleteMdbResult::GetRowValue(nsI
24333 return NS_OK;
24335 switch (yarn.mYarn_Form) {
24336 - case 0: // unicode
24337 - aValue.Assign((const PRUnichar *)yarn.mYarn_Buf, yarn.mYarn_Fill/sizeof(PRUnichar));
24338 + case 0: { // unicode
24339 + PRUint32 len = yarn.mYarn_Fill / sizeof(PRUnichar);
24340 + if (mReverseByteOrder) {
24341 + // The mdb file is other-endian, byte-swap the result
24342 + PRUnichar *swapval = new PRUnichar[len];
24343 + if (!swapval)
24344 + return NS_ERROR_OUT_OF_MEMORY;
24345 + SwapBytes(swapval, (const PRUnichar *)yarn.mYarn_Buf, len);
24346 + aValue.Assign(swapval, len);
24347 + delete swapval;
24349 + else
24350 + aValue.Assign((const PRUnichar *)yarn.mYarn_Buf, len);
24351 break;
24353 case 1: // utf 8
24354 aValue.Assign(NS_ConvertUTF8toUCS2((const char*)yarn.mYarn_Buf, yarn.mYarn_Fill));
24355 break;
24356 @@ -295,3 +318,20 @@ nsAutoCompleteMdbResult::GetIntRowValue(
24358 return NS_OK;
24361 +////////////////////////////////////////////////////////////////////////
24362 +//// nsIAutoCompleteMdbResult2
24364 +NS_IMETHODIMP
24365 +nsAutoCompleteMdbResult::GetReverseByteOrder(PRBool *aReverseByteOrder)
24367 + *aReverseByteOrder = mReverseByteOrder;
24368 + return NS_OK;
24371 +NS_IMETHODIMP
24372 +nsAutoCompleteMdbResult::SetReverseByteOrder(PRBool aReverseByteOrder)
24374 + mReverseByteOrder = aReverseByteOrder;
24375 + return NS_OK;
24377 diff -uprN --exclude=CVS mozilla/toolkit/components/autocomplete/src/nsAutoCompleteMdbResult.h mozilla.new/toolkit/components/autocomplete/src/nsAutoCompleteMdbResult.h
24378 --- mozilla/toolkit/components/autocomplete/src/nsAutoCompleteMdbResult.h 2005-02-01 18:07:00.000000000 +0100
24379 +++ mozilla.new/toolkit/components/autocomplete/src/nsAutoCompleteMdbResult.h 2006-03-12 20:03:26.000000000 +0100
24380 @@ -44,7 +44,7 @@
24381 #include "nsArray.h"
24382 #include "mdb.h"
24384 -class nsAutoCompleteMdbResult : public nsIAutoCompleteMdbResult
24385 +class nsAutoCompleteMdbResult : public nsIAutoCompleteMdbResult2
24387 public:
24388 NS_DECL_ISUPPORTS
24389 @@ -55,6 +55,7 @@ public:
24391 NS_DECL_NSIAUTOCOMPLETEBASERESULT
24392 NS_DECL_NSIAUTOCOMPLETEMDBRESULT
24393 + NS_DECL_NSIAUTOCOMPLETEMDBRESULT2
24395 protected:
24396 nsCOMArray<nsIMdbRow> mResults;
24397 @@ -71,6 +72,8 @@ protected:
24398 PRInt16 mValueType;
24399 mdb_scope mCommentToken;
24400 PRInt16 mCommentType;
24402 + PRPackedBool mReverseByteOrder;
24405 #endif // __nsAutoCompleteResultBase__
24406 diff -uprN --exclude=CVS mozilla/toolkit/components/history/src/nsGlobalHistory.cpp mozilla.new/toolkit/components/history/src/nsGlobalHistory.cpp
24407 --- mozilla/toolkit/components/history/src/nsGlobalHistory.cpp 2006-01-09 06:48:17.000000000 +0100
24408 +++ mozilla.new/toolkit/components/history/src/nsGlobalHistory.cpp 2006-03-12 20:03:28.000000000 +0100
24409 @@ -4203,7 +4203,7 @@ nsGlobalHistory::StartSearch(const nsASt
24411 NS_ENSURE_SUCCESS(OpenDB(), NS_ERROR_FAILURE);
24413 - nsCOMPtr<nsIAutoCompleteMdbResult> result;
24414 + nsCOMPtr<nsIAutoCompleteMdbResult2> result;
24415 if (aSearchString.IsEmpty()) {
24416 AutoCompleteTypedSearch(getter_AddRefs(result));
24417 } else {
24418 @@ -4222,7 +4222,7 @@ nsGlobalHistory::StartSearch(const nsASt
24420 // perform the actual search here
24421 nsresult rv = AutoCompleteSearch(filtered, &exclude,
24422 - NS_STATIC_CAST(nsIAutoCompleteMdbResult *,
24423 + NS_STATIC_CAST(nsIAutoCompleteMdbResult2 *,
24424 aPreviousResult),
24425 getter_AddRefs(result));
24426 NS_ENSURE_SUCCESS(rv, rv);
24427 @@ -4246,7 +4246,7 @@ nsGlobalHistory::StopSearch()
24430 nsresult
24431 -nsGlobalHistory::AutoCompleteTypedSearch(nsIAutoCompleteMdbResult **aResult)
24432 +nsGlobalHistory::AutoCompleteTypedSearch(nsIAutoCompleteMdbResult2 **aResult)
24434 mdb_count count;
24435 mdb_err err = mTable->GetCount(mEnv, &count);
24436 @@ -4257,15 +4257,16 @@ nsGlobalHistory::AutoCompleteTypedSearch
24437 NS_ENSURE_TRUE(!err, NS_ERROR_FAILURE);
24439 nsresult rv;
24440 - nsCOMPtr<nsIAutoCompleteMdbResult> result = do_CreateInstance("@mozilla.org/autocomplete/mdb-result;1", &rv);
24441 + nsCOMPtr<nsIAutoCompleteMdbResult2> result = do_CreateInstance("@mozilla.org/autocomplete/mdb-result;1", &rv);
24442 NS_ENSURE_SUCCESS(rv, rv);
24443 result->Init(mEnv, mTable);
24444 - result->SetTokens(kToken_URLColumn, nsIAutoCompleteMdbResult::kCharType, kToken_NameColumn, nsIAutoCompleteMdbResult::kUnicharType);
24445 + result->SetTokens(kToken_URLColumn, nsIAutoCompleteMdbResult2::kCharType, kToken_NameColumn, nsIAutoCompleteMdbResult2::kUnicharType);
24446 + result->SetReverseByteOrder(mReverseByteOrder);
24448 - nsIMdbRow *row = nsnull;
24449 + nsCOMPtr<nsIMdbRow> row;
24450 mdb_pos pos;
24451 do {
24452 - rowCursor->PrevRow(mEnv, &row, &pos);
24453 + rowCursor->PrevRow(mEnv, getter_AddRefs(row), &pos);
24454 if (!row) break;
24456 if (HasCell(mEnv, row, kToken_TypedColumn)) {
24457 @@ -4293,8 +4294,8 @@ nsGlobalHistory::AutoCompleteTypedSearch
24458 nsresult
24459 nsGlobalHistory::AutoCompleteSearch(const nsAString &aSearchString,
24460 AutocompleteExclude *aExclude,
24461 - nsIAutoCompleteMdbResult *aPrevResult,
24462 - nsIAutoCompleteMdbResult **aResult)
24463 + nsIAutoCompleteMdbResult2 *aPrevResult,
24464 + nsIAutoCompleteMdbResult2 **aResult)
24466 // determine if we can skip searching the whole history and only search
24467 // through the previous search results
24468 @@ -4325,10 +4326,11 @@ nsGlobalHistory::AutoCompleteSearch(cons
24470 // Create and initialize a new result object
24471 nsresult rv = NS_OK;
24472 - nsCOMPtr<nsIAutoCompleteMdbResult> result = do_CreateInstance("@mozilla.org/autocomplete/mdb-result;1", &rv);
24473 + nsCOMPtr<nsIAutoCompleteMdbResult2> result = do_CreateInstance("@mozilla.org/autocomplete/mdb-result;1", &rv);
24474 NS_ENSURE_SUCCESS(rv, rv);
24475 result->Init(mEnv, mTable);
24476 - result->SetTokens(kToken_URLColumn, nsIAutoCompleteMdbResult::kCharType, kToken_NameColumn, nsIAutoCompleteMdbResult::kUnicharType);
24477 + result->SetTokens(kToken_URLColumn, nsIAutoCompleteMdbResult2::kCharType, kToken_NameColumn, nsIAutoCompleteMdbResult2::kUnicharType);
24478 + result->SetReverseByteOrder(mReverseByteOrder);
24479 result->SetSearchString(aSearchString);
24481 // Get a cursor to iterate through all rows in the database
24482 diff -uprN --exclude=CVS mozilla/toolkit/components/history/src/nsGlobalHistory.h mozilla.new/toolkit/components/history/src/nsGlobalHistory.h
24483 --- mozilla/toolkit/components/history/src/nsGlobalHistory.h 2005-08-10 22:21:44.000000000 +0200
24484 +++ mozilla.new/toolkit/components/history/src/nsGlobalHistory.h 2006-03-12 20:03:28.000000000 +0100
24485 @@ -213,11 +213,11 @@ protected:
24486 nsStringArray mIgnoreSchemes;
24487 nsStringArray mIgnoreHostnames;
24489 - nsresult AutoCompleteTypedSearch(nsIAutoCompleteMdbResult **aResult);
24490 + nsresult AutoCompleteTypedSearch(nsIAutoCompleteMdbResult2 **aResult);
24491 nsresult AutoCompleteSearch(const nsAString& aSearchString,
24492 AutocompleteExclude* aExclude,
24493 - nsIAutoCompleteMdbResult* aPrevResult,
24494 - nsIAutoCompleteMdbResult** aResult);
24495 + nsIAutoCompleteMdbResult2* aPrevResult,
24496 + nsIAutoCompleteMdbResult2** aResult);
24497 void AutoCompleteCutPrefix(nsAString& aURL, AutocompleteExclude* aExclude);
24498 void AutoCompleteGetExcludeInfo(const nsAString& aURL, AutocompleteExclude* aExclude);
24499 nsString AutoCompletePrefilter(const nsAString& aSearchString);
24500 diff -uprN --exclude=CVS mozilla/toolkit/components/satchel/src/nsFormFillController.cpp mozilla.new/toolkit/components/satchel/src/nsFormFillController.cpp
24501 --- mozilla/toolkit/components/satchel/src/nsFormFillController.cpp 2005-06-16 01:52:43.000000000 +0200
24502 +++ mozilla.new/toolkit/components/satchel/src/nsFormFillController.cpp 2006-03-12 20:03:28.000000000 +0100
24503 @@ -486,14 +486,14 @@ nsFormFillController::StartSearch(const
24504 nsIAutoCompleteResult *aPreviousResult, nsIAutoCompleteObserver *aListener)
24506 nsCOMPtr<nsIAutoCompleteResult> result;
24507 - nsCOMPtr<nsIAutoCompleteMdbResult> mdbResult = do_QueryInterface(aPreviousResult);
24508 + nsCOMPtr<nsIAutoCompleteMdbResult2> mdbResult = do_QueryInterface(aPreviousResult);
24510 nsPasswordManager* passMgr = nsPasswordManager::GetInstance();
24511 if (!passMgr)
24512 return NS_ERROR_OUT_OF_MEMORY;
24514 // Only hand off a previous result to the password manager if it's
24515 - // a password manager result (i.e. not an nsIAutoCompleteMdbResult).
24516 + // a password manager result (i.e. not an nsIAutoCompleteMdbResult2).
24518 if (!passMgr->AutoCompleteSearch(aSearchString,
24519 mdbResult ? nsnull : aPreviousResult,
24520 diff -uprN --exclude=CVS mozilla/toolkit/components/satchel/src/nsFormHistory.cpp mozilla.new/toolkit/components/satchel/src/nsFormHistory.cpp
24521 --- mozilla/toolkit/components/satchel/src/nsFormHistory.cpp 2005-06-19 20:09:51.000000000 +0200
24522 +++ mozilla.new/toolkit/components/satchel/src/nsFormHistory.cpp 2006-03-12 20:03:28.000000000 +0100
24523 @@ -61,6 +61,15 @@
24524 #include "nsVoidArray.h"
24525 #include "nsCOMArray.h"
24527 +static void SwapBytes(PRUnichar* aDest, const PRUnichar* aSrc, PRUint32 aLen)
24529 + for(PRUint32 i = 0; i < aLen; i++)
24531 + PRUnichar aChar = *aSrc++;
24532 + *aDest++ = (0xff & (aChar >> 8)) | (aChar << 8);
24536 #define PREF_FORMFILL_BRANCH "browser.formfill."
24537 #define PREF_FORMFILL_ENABLE "enable"
24539 @@ -86,7 +95,8 @@ PRBool nsFormHistory::gPrefsInitialized
24540 nsFormHistory::nsFormHistory() :
24541 mEnv(nsnull),
24542 mStore(nsnull),
24543 - mTable(nsnull)
24544 + mTable(nsnull),
24545 + mReverseByteOrder(PR_FALSE)
24549 @@ -263,6 +273,9 @@ NS_IMETHODIMP
24550 nsFormHistory::RemoveAllEntries()
24552 nsresult rv = RemoveEntriesInternal(nsnull);
24554 + if (NS_SUCCEEDED(rv))
24555 + rv = InitByteOrder(PR_TRUE);
24557 rv |= Flush();
24559 @@ -424,18 +437,23 @@ nsFormHistory::OpenDatabase()
24560 historyFile->GetNativePath(filePath);
24561 PRBool exists = PR_TRUE;
24562 historyFile->Exists(&exists);
24564 + PRBool createdNew = PR_FALSE;
24566 if (!exists || NS_FAILED(rv = OpenExistingFile(filePath.get()))) {
24567 // If the file doesn't exist, or we fail trying to open it,
24568 // then make sure it is deleted and then create an empty database file
24569 historyFile->Remove(PR_FALSE);
24570 rv = CreateNewFile(filePath.get());
24571 + createdNew = PR_TRUE;
24573 NS_ENSURE_SUCCESS(rv, rv);
24575 // Get the initial size of the file, needed later for Commit
24576 historyFile->GetFileSize(&mFileSizeOnDisk);
24578 + rv = InitByteOrder(createdNew);
24580 /* // TESTING: Add a row to the database
24581 nsAutoString foopy;
24582 foopy.AssignWithConversion("foopy");
24583 @@ -460,7 +478,7 @@ nsFormHistory::OpenDatabase()
24584 printf("ROW: %s - %s\n", ToNewCString(name), ToNewCString(value));
24585 } */
24587 - return NS_OK;
24588 + return rv;
24591 nsresult
24592 @@ -499,6 +517,10 @@ nsFormHistory::OpenExistingFile(const ch
24593 return NS_ERROR_FAILURE;
24596 + err = mTable->GetMetaRow(mEnv, &oid, nsnull, getter_AddRefs(mMetaRow));
24597 + if (err)
24598 + NS_WARNING("Could not get meta row");
24600 if (NS_FAILED(thumbErr))
24601 err = thumbErr;
24603 @@ -526,6 +548,13 @@ nsFormHistory::CreateNewFile(const char
24604 err = mStore->NewTable(mEnv, kToken_RowScope, kToken_Kind, PR_TRUE, nsnull, &mTable);
24605 NS_ENSURE_TRUE(!err && mTable, NS_ERROR_FAILURE);
24607 + mdbOid oid = {kToken_RowScope, 1};
24608 + err = mTable->GetMetaRow(mEnv, &oid, nsnull, getter_AddRefs(mMetaRow));
24609 + if (err) {
24610 + NS_WARNING("Could not get meta row");
24611 + return NS_ERROR_FAILURE;
24614 // oldTable will only be set if we detected a corrupt db, and are
24615 // trying to restore data from it.
24616 if (oldTable)
24617 @@ -547,6 +576,8 @@ nsFormHistory::CloseDatabase()
24619 Flush();
24621 + mMetaRow = nsnull;
24623 if (mTable)
24624 mTable->Release();
24626 @@ -583,6 +614,9 @@ nsFormHistory::CreateTokens()
24627 err = mStore->StringToToken(mEnv, "Name", &kToken_NameColumn);
24628 if (err != 0) return NS_ERROR_FAILURE;
24630 + err = mStore->StringToToken(mEnv, "ByteOrder", &kToken_ByteOrder);
24631 + if (err != 0) return NS_ERROR_FAILURE;
24633 return NS_OK;
24636 @@ -641,7 +675,7 @@ nsFormHistory::CopyRowsFromTable(nsIMdbT
24637 rowId.mOid_Id = mdb_id(-1);
24639 nsCOMPtr<nsIMdbRow> newRow;
24640 - mdb_err err = mTable->NewRow(mEnv, &rowId, getter_AddRefs(newRow));
24641 + mTable->NewRow(mEnv, &rowId, getter_AddRefs(newRow));
24642 newRow->SetRow(mEnv, row);
24643 mTable->AddRow(mEnv, newRow);
24644 } while (row);
24645 @@ -683,9 +717,23 @@ nsresult
24646 nsFormHistory::SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const nsAString &aValue)
24648 PRInt32 len = aValue.Length() * sizeof(PRUnichar);
24649 + PRUnichar *swapval = nsnull;
24650 + mdbYarn yarn = {nsnull, len, len, 0, 0, nsnull};
24651 + const nsPromiseFlatString& buffer = PromiseFlatString(aValue);
24653 + if (mReverseByteOrder) {
24654 + swapval = new PRUnichar[aValue.Length()];
24655 + if (!swapval)
24656 + return NS_ERROR_OUT_OF_MEMORY;
24657 + SwapBytes(swapval, buffer.get(), aValue.Length());
24658 + yarn.mYarn_Buf = swapval;
24660 + else
24661 + yarn.mYarn_Buf = (void*)buffer.get();
24663 - mdbYarn yarn = {(void *)ToNewUnicode(aValue), len, len, 0, 0, nsnull};
24664 mdb_err err = aRow->AddColumn(mEnv, aCol, &yarn);
24666 + delete swapval;
24668 return err ? NS_ERROR_FAILURE : NS_OK;
24670 @@ -703,9 +751,20 @@ nsFormHistory::GetRowValue(nsIMdbRow *aR
24671 return NS_OK;
24673 switch (yarn.mYarn_Form) {
24674 - case 0: // unicode
24675 - aValue.Assign((const PRUnichar *)yarn.mYarn_Buf, yarn.mYarn_Fill/sizeof(PRUnichar));
24676 + case 0: { // unicode
24677 + PRUint32 len = yarn.mYarn_Fill / sizeof(PRUnichar);
24678 + if (mReverseByteOrder) {
24679 + PRUnichar *swapval = new PRUnichar[len];
24680 + if (!swapval)
24681 + return NS_ERROR_OUT_OF_MEMORY;
24682 + SwapBytes(swapval, (const PRUnichar*)yarn.mYarn_Buf, len);
24683 + aValue.Assign(swapval, len);
24684 + delete swapval;
24686 + else
24687 + aValue.Assign((const PRUnichar *)yarn.mYarn_Buf, len);
24688 break;
24690 default:
24691 return NS_ERROR_UNEXPECTED;
24693 @@ -716,7 +775,7 @@ nsFormHistory::GetRowValue(nsIMdbRow *aR
24694 nsresult
24695 nsFormHistory::AutoCompleteSearch(const nsAString &aInputName,
24696 const nsAString &aInputValue,
24697 - nsIAutoCompleteMdbResult *aPrevResult,
24698 + nsIAutoCompleteMdbResult2 *aPrevResult,
24699 nsIAutoCompleteResult **aResult)
24701 if (!FormHistoryEnabled())
24702 @@ -725,7 +784,7 @@ nsFormHistory::AutoCompleteSearch(const
24703 nsresult rv = OpenDatabase(); // lazily ensure that the database is open
24704 NS_ENSURE_SUCCESS(rv, rv);
24706 - nsCOMPtr<nsIAutoCompleteMdbResult> result;
24707 + nsCOMPtr<nsIAutoCompleteMdbResult2> result;
24709 if (aPrevResult) {
24710 result = aPrevResult;
24711 @@ -744,7 +803,8 @@ nsFormHistory::AutoCompleteSearch(const
24713 result->SetSearchString(aInputValue);
24714 result->Init(mEnv, mTable);
24715 - result->SetTokens(kToken_ValueColumn, nsIAutoCompleteMdbResult::kUnicharType, nsnull, nsIAutoCompleteMdbResult::kUnicharType);
24716 + result->SetTokens(kToken_ValueColumn, nsIAutoCompleteMdbResult2::kUnicharType, nsnull, nsIAutoCompleteMdbResult2::kUnicharType);
24717 + result->SetReverseByteOrder(mReverseByteOrder);
24719 // Get a cursor to iterate through all rows in the database
24720 nsCOMPtr<nsIMdbTableRowCursor> rowCursor;
24721 @@ -941,3 +1001,74 @@ nsFormHistory::RemoveEntriesInternal(con
24722 return (err == 0) ? NS_OK : NS_ERROR_FAILURE;
24726 +nsresult
24727 +nsFormHistory::InitByteOrder(PRBool aForce)
24729 + // bigEndian and littleEndian are endianness markers that are stored in
24730 + // the formhistory db as UTF-16. Define them to be strings easily
24731 + // recognized in either endianness.
24732 + nsAutoString bigEndianByteOrder((PRUnichar*)"BBBB");
24733 + nsAutoString littleEndianByteOrder((PRUnichar*)"llll");
24734 +#ifdef IS_BIG_ENDIAN
24735 + nsAutoString nativeByteOrder(bigEndianByteOrder);
24736 +#else
24737 + nsAutoString nativeByteOrder(littleEndianByteOrder);
24738 +#endif
24740 + nsAutoString fileByteOrder;
24741 + nsresult rv = NS_OK;
24743 + if (!aForce)
24744 + rv = GetByteOrder(fileByteOrder);
24746 + if (aForce || NS_FAILED(rv) ||
24747 + !(fileByteOrder.Equals(bigEndianByteOrder) ||
24748 + fileByteOrder.Equals(littleEndianByteOrder))) {
24749 +#if defined(XP_MACOSX) && defined(IS_LITTLE_ENDIAN)
24750 + // The formhistory db did not carry endiannes information until the
24751 + // initial x86 Mac release. There are a lot of users out there who
24752 + // will be switching from ppc versions to x86, and their unmarked
24753 + // formhistory files are big-endian. On x86 Macs, unless aForce is set
24754 + // (indicating formhistory reset or a brand-new db), use big-endian byte
24755 + // ordering and turn swapping on.
24756 + if (aForce) {
24757 + mReverseByteOrder = PR_FALSE;
24758 + rv = SaveByteOrder(nativeByteOrder);
24760 + else {
24761 + mReverseByteOrder = PR_TRUE;
24762 + rv = SaveByteOrder(bigEndianByteOrder);
24764 +#else
24765 + mReverseByteOrder = PR_FALSE;
24766 + rv = SaveByteOrder(nativeByteOrder);
24767 +#endif
24769 + else
24770 + mReverseByteOrder = !fileByteOrder.Equals(nativeByteOrder);
24772 + return rv;
24775 +nsresult
24776 +nsFormHistory::GetByteOrder(nsAString& aByteOrder)
24778 + NS_ENSURE_SUCCESS(OpenDatabase(), NS_ERROR_FAILURE);
24780 + mdb_err err = GetRowValue(mMetaRow, kToken_ByteOrder, aByteOrder);
24781 + NS_ENSURE_FALSE(err, NS_ERROR_FAILURE);
24783 + return NS_OK;
24786 +nsresult
24787 +nsFormHistory::SaveByteOrder(const nsAString& aByteOrder)
24789 + NS_ENSURE_SUCCESS(OpenDatabase(), NS_ERROR_FAILURE);
24791 + mdb_err err = SetRowValue(mMetaRow, kToken_ByteOrder, aByteOrder);
24792 + NS_ENSURE_FALSE(err, NS_ERROR_FAILURE);
24794 + return NS_OK;
24796 diff -uprN --exclude=CVS mozilla/toolkit/components/satchel/src/nsFormHistory.h mozilla.new/toolkit/components/satchel/src/nsFormHistory.h
24797 --- mozilla/toolkit/components/satchel/src/nsFormHistory.h 2005-02-01 18:07:04.000000000 +0100
24798 +++ mozilla.new/toolkit/components/satchel/src/nsFormHistory.h 2006-03-12 20:03:28.000000000 +0100
24799 @@ -69,7 +69,7 @@ public:
24800 static void ReleaseInstance(void);
24802 nsresult AutoCompleteSearch(const nsAString &aInputName, const nsAString &aInputValue,
24803 - nsIAutoCompleteMdbResult *aPrevResult, nsIAutoCompleteResult **aNewResult);
24804 + nsIAutoCompleteMdbResult2 *aPrevResult, nsIAutoCompleteResult **aNewResult);
24806 static mdb_column kToken_ValueColumn;
24807 static mdb_column kToken_NameColumn;
24808 @@ -98,6 +98,10 @@ protected:
24810 nsresult RemoveEntriesInternal(const nsAString *aName);
24812 + nsresult InitByteOrder(PRBool aForce);
24813 + nsresult GetByteOrder(nsAString& aByteOrder);
24814 + nsresult SaveByteOrder(const nsAString& aByteOrder);
24816 static PRBool FormHistoryEnabled();
24818 static nsFormHistory *gFormHistory;
24819 @@ -111,10 +115,13 @@ protected:
24820 nsIMdbStore* mStore;
24821 nsIMdbTable* mTable;
24822 PRInt64 mFileSizeOnDisk;
24823 + nsCOMPtr<nsIMdbRow> mMetaRow;
24824 + PRPackedBool mReverseByteOrder;
24826 // database tokens
24827 mdb_scope kToken_RowScope;
24828 mdb_kind kToken_Kind;
24829 + mdb_column kToken_ByteOrder;
24832 #endif // __nsFormHistory__
24833 diff -uprN --exclude=CVS mozilla/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp mozilla.new/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp
24834 --- mozilla/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp 2005-09-28 16:41:36.000000000 +0200
24835 +++ mozilla.new/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp 2006-02-24 11:15:58.000000000 +0100
24836 @@ -299,7 +299,7 @@ nsTypeAheadFind::FindItNow(nsIPresShell
24837 return NS_ERROR_FAILURE;
24840 - nsPresContext* presContext = presShell->GetPresContext();
24841 + nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
24843 if (!presContext)
24844 return NS_ERROR_FAILURE;
24845 @@ -351,7 +351,7 @@ nsTypeAheadFind::FindItNow(nsIPresShell
24846 aIsFirstVisiblePreferred,
24847 !aIsFirstVisiblePreferred || mStartFindRange,
24848 getter_AddRefs(presShell),
24849 - &presContext))) {
24850 + getter_AddRefs(presContext)))) {
24851 return NS_ERROR_FAILURE;
24854 @@ -497,7 +497,7 @@ nsTypeAheadFind::FindItNow(nsIPresShell
24855 aIsRepeatingSameChar,
24856 aIsFirstVisiblePreferred, PR_FALSE,
24857 getter_AddRefs(presShell),
24858 - &presContext))) {
24859 + getter_AddRefs(presContext)))) {
24860 continue;
24863 @@ -582,8 +582,8 @@ nsTypeAheadFind::GetSearchContainers(nsI
24864 nsCOMPtr<nsIPresShell> presShell;
24865 docShell->GetPresShell(getter_AddRefs(presShell));
24867 - nsPresContext* presContext;
24868 - docShell->GetPresContext(&presContext);
24869 + nsRefPtr<nsPresContext> presContext;
24870 + docShell->GetPresContext(getter_AddRefs(presContext));
24872 if (!presShell || !presContext)
24873 return NS_ERROR_FAILURE;
24874 diff -uprN --exclude=CVS mozilla/toolkit/content/widgets/tabbrowser.xml mozilla.new/toolkit/content/widgets/tabbrowser.xml
24875 --- mozilla/toolkit/content/widgets/tabbrowser.xml 2005-10-23 20:45:50.000000000 +0200
24876 +++ mozilla.new/toolkit/content/widgets/tabbrowser.xml 2006-02-24 11:15:58.000000000 +0100
24877 @@ -650,10 +650,15 @@
24878 this.mCurrentBrowser.focusedElement = document.commandDispatcher.focusedElement;
24881 - if (this.mCurrentBrowser.focusedElement) {
24882 + if (this.mCurrentBrowser.focusedElement instanceof NSHTMLElement ||
24883 + this.mCurrentBrowser.focusedElement instanceof XULElement) {
24884 // Clear focus outline before we draw on top of it
24885 this.mCurrentBrowser.focusedElement.blur();
24887 + else {
24888 + // non-HTML/XUL elements have no blur method, see bug 323805
24889 + this.mCurrentBrowser.focusedElement = null;
24891 this.mCurrentBrowser.setAttribute("type", "content");
24894 @@ -745,7 +750,12 @@
24896 function setFocus(element) {
24897 document.commandDispatcher.suppressFocusScroll = true;
24898 - element.focus();
24900 + if (element instanceof Window ||
24901 + element instanceof NSHTMLElement ||
24902 + element instanceof XULElement) {
24903 + element.focus();
24905 document.commandDispatcher.suppressFocusScroll = false;
24908 @@ -2032,7 +2042,6 @@
24909 <![CDATA[
24910 this.mCurrentBrowser = this.mPanelContainer.childNodes[0].firstChild.nextSibling;
24911 this.mCurrentTab = this.mTabContainer.firstChild;
24912 - this.mTabBox.handleCtrlTab = !/Mac/.test(navigator.platform);
24913 document.addEventListener("keypress", this._keyEventHandler, false);
24915 var uniqueId = "panel" + Date.now();
24916 diff -uprN --exclude=CVS mozilla/toolkit/library/Makefile.in mozilla.new/toolkit/library/Makefile.in
24917 --- mozilla/toolkit/library/Makefile.in 2006-01-09 06:48:18.000000000 +0100
24918 +++ mozilla.new/toolkit/library/Makefile.in 2006-02-24 11:15:58.000000000 +0100
24919 @@ -85,7 +85,12 @@ CPPSRCS += dlldeps-zlib.cpp
24920 DEFINES += -DZLIB_INTERNAL
24921 endif
24923 -LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/windows
24924 +LOCAL_INCLUDES += \
24925 + -I$(topsrcdir)/widget/src/windows \
24926 + -I$(topsrcdir)/widget/src/build \
24927 + $(NULL)
24929 +RESFILE = xulrunner.res
24930 endif
24932 ifeq ($(OS_ARCH),WINNT)
24933 diff -uprN --exclude=CVS mozilla/toolkit/library/xulrunner.rc mozilla.new/toolkit/library/xulrunner.rc
24934 --- mozilla/toolkit/library/xulrunner.rc 1970-01-01 01:00:00.000000000 +0100
24935 +++ mozilla.new/toolkit/library/xulrunner.rc 2006-02-17 20:50:53.000000000 +0100
24936 @@ -0,0 +1 @@
24937 +#include "widget.rc"
24938 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/downloads/content/downloads.js mozilla.new/toolkit/mozapps/downloads/content/downloads.js
24939 --- mozilla/toolkit/mozapps/downloads/content/downloads.js 2005-09-06 18:10:35.000000000 +0200
24940 +++ mozilla.new/toolkit/mozapps/downloads/content/downloads.js 2006-02-24 11:15:58.000000000 +0100
24941 @@ -24,6 +24,7 @@
24942 # Ben Goodger <ben@bengoodger.com> (v2.0)
24943 # Dan Mosedale <dmose@mozilla.org>
24944 # Fredrik Holmqvist <thesuckiestemail@yahoo.se>
24945 +# Josh Aas <josh@mozilla.com>
24947 # Alternatively, the contents of this file may be used under the terms of
24948 # either the GNU General Public License Version 2 or later (the "GPL"), or
24949 @@ -59,7 +60,11 @@ var gActiveDownloads = [];
24950 // opened by the xpinstall manager prevents the window from being closed after
24951 // each download completes (because xpinstall downloads are done sequentially,
24952 // not concurrently)
24953 -var gCanAutoClose = true;
24954 +var gCanAutoClose = true;
24956 +// If the user has interacted with the window in a significant way, we should
24957 +// not auto-close the window. Tough UI decisions about what is "significant."
24958 +var gUserInteracted = false;
24960 ///////////////////////////////////////////////////////////////////////////////
24961 // Utility Functions
24962 @@ -182,14 +187,12 @@ function autoClose(aDownload)
24963 // For the moment, just use the simple heuristic that if this window was
24964 // opened by the download process, rather than by the user, it should auto-close
24965 // if the pref is set that way. If the user opened it themselves, it should
24966 - // not close until they explicitly close it.
24967 - // We may like to revisit this in a bit more detail later, perhaps we want
24968 - // to keep it up if the user messes with it in a significant way.
24969 + // not close until they explicitly close it.
24970 var pref = Components.classes["@mozilla.org/preferences-service;1"]
24971 .getService(Components.interfaces.nsIPrefBranch);
24972 var autoClose = pref.getBoolPref(PREF_BDM_CLOSEWHENDONE)
24973 if (autoClose && (!window.opener || window.opener.location.href == window.location.href) &&
24974 - gCanAutoClose)
24975 + gCanAutoClose && !gUserInteracted)
24976 gCloseDownloadManager();
24979 @@ -422,6 +425,7 @@ function onDownloadOpenWith(aEvent)
24981 function onDownloadProperties(aEvent)
24983 + gUserInteracted = true;
24984 window.openDialog("chrome://mozapps/content/downloads/downloadProperties.xul",
24985 "_blank", "modal,centerscreen,chrome,resizable=no", aEvent.target.id);
24987 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/extensions/src/Makefile.in mozilla.new/toolkit/mozapps/extensions/src/Makefile.in
24988 --- mozilla/toolkit/mozapps/extensions/src/Makefile.in 2005-06-08 00:20:34.000000000 +0200
24989 +++ mozilla.new/toolkit/mozapps/extensions/src/Makefile.in 2006-02-24 11:15:58.000000000 +0100
24990 @@ -48,11 +48,6 @@ EXTRA_COMPONENTS = nsExtensionManager.js
24992 include $(topsrcdir)/config/rules.mk
24994 -DEFINES += -DOS_TARGET=\"$(OS_TARGET)\"
24995 -ifdef TARGET_XPCOM_ABI
24996 -DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
24997 -endif
24999 nsExtensionManager.js: nsExtensionManager.js.in
25000 $(PERL) $(MOZILLA_DIR)/config/preprocessor.pl $(DEFINES) $(ACDEFINES) $^ > $@
25002 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in mozilla.new/toolkit/mozapps/extensions/src/nsExtensionManager.js.in
25003 --- mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in 2005-10-21 03:27:44.000000000 +0200
25004 +++ mozilla.new/toolkit/mozapps/extensions/src/nsExtensionManager.js.in 2006-02-24 11:15:58.000000000 +0100
25005 @@ -84,16 +84,7 @@ const FILE_INSTALL_MANIFEST =
25006 const FILE_CONTENTS_MANIFEST = "contents.rdf";
25007 const FILE_CHROME_MANIFEST = "chrome.manifest";
25009 -#expand const OS_TARGET = __OS_TARGET__;
25011 -#ifdef TARGET_XPCOM_ABI
25012 -#expand const TARGET_XPCOM_ABI = __TARGET_XPCOM_ABI__;
25013 -#else
25014 -// Provide a default for TARGET_XPCOM_ABI. It won't be compared to an item's metadata
25015 -// (i.e. install.rdf can't specify e.g. WINNT_unknownABI as targetPlatform),
25016 -// but it will be displayed in error messages and transmitted to update URLs.
25017 -const TARGET_XPCOM_ABI = "unknownABI";
25018 -#endif
25019 +const UNKNOWN_XPCOM_ABI = "unknownABI";
25021 const FILE_LOGFILE = "extensionmanager.log";
25023 @@ -162,6 +153,8 @@ var gApp = null;
25024 var gPref = null;
25025 var gRDF = null;
25026 var gOS = null;
25027 +var gXPCOMABI = null;
25028 +var gOSTarget = null;
25029 var gConsole = null;
25030 var gInstallManifestRoot = null;
25031 var gVersionChecker = null;
25032 @@ -915,7 +908,13 @@ function DirectoryInstallLocation(name,
25033 throw new Error("location must be a directoy!");
25035 else {
25036 - location.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0775);
25037 + try {
25038 + location.create(nsILocalFile.DIRECTORY_TYPE, 0775);
25040 + catch (e) {
25041 + LOG("DirectoryInstallLocation: failed to create location " +
25042 + " directory = " + location.path + ", exception = " + e + "\n");
25046 this._location = location;
25047 @@ -1266,8 +1265,10 @@ WinRegInstallLocation.prototype = {
25048 .createInstance(nsILocalFile);
25049 dir.initWithPath(key.readStringValue(id));
25051 - this._IDToDirMap[id] = dir;
25052 - this._DirToIDMap[dir.path] = id;
25053 + if (dir.exists() && dir.isDirectory()) {
25054 + this._IDToDirMap[id] = dir;
25055 + this._DirToIDMap[dir.path] = id;
25060 @@ -2186,6 +2187,16 @@ function ExtensionManager() {
25061 gApp = Components.classes["@mozilla.org/xre/app-info;1"]
25062 .getService(Components.interfaces.nsIXULAppInfo)
25063 .QueryInterface(Components.interfaces.nsIXULRuntime);
25064 + gOSTarget = gApp.OS;
25065 + try {
25066 + gXPCOMABI = gApp.XPCOMABI;
25067 + } catch (ex) {
25068 + // Provide a default for gXPCOMABI. It won't be compared to an
25069 + // item's metadata (i.e. install.rdf can't specify e.g. WINNT_unknownABI
25070 + // as targetPlatform), but it will be displayed in error messages and
25071 + // transmitted to update URLs.
25072 + gXPCOMABI = UNKNOWN_XPCOM_ABI;
25074 gPref = Components.classes["@mozilla.org/preferences-service;1"]
25075 .getService(Components.interfaces.nsIPrefBranch2);
25076 gLoggingEnabled = getPref("getBoolPref", PREF_EM_LOGGING_ENABLED, false);
25077 @@ -3578,18 +3589,16 @@ ExtensionManager.prototype = {
25078 var tokens = targetPlatform.split("_");
25079 var os = tokens[0];
25080 var abi = (tokens.length > 1) ? tokens[1] : null;
25081 - if (os == OS_TARGET) {
25082 + if (os == gOSTarget) {
25083 foundMatchingOS = true;
25084 // The presence of any ABI part after our OS means ABI is important.
25085 if (abi != null) {
25086 requireABICompatibility = true;
25087 -// If we don't know our ABI, we can't be compatible - skip the equality check.
25088 -#ifdef TARGET_XPCOM_ABI
25089 - if (abi == TARGET_XPCOM_ABI) {
25090 + // If we don't know our ABI, we can't be compatible
25091 + if (abi == gXPCOMABI && abi != UNKNOWN_XPCOM_ABI) {
25092 foundMatchingOSAndABI = true;
25093 break;
25095 -#endif
25099 @@ -4063,7 +4072,7 @@ ExtensionManager.prototype = {
25100 "invalidVersionMessage", [installData.name, installData.version]);
25101 break;
25102 case INSTALLERROR_INCOMPATIBLE_PLATFORM:
25103 - const osABI = OS_TARGET + "_" + TARGET_XPCOM_ABI;
25104 + const osABI = gOSTarget + "_" + gXPCOMABI;
25105 LOG("Incompatible Platform: Item: \"" + installData.id + "\" is not " +
25106 "compatible with '" + osABI + "'.");
25107 var bundle = BundleManager.getBundle(URI_EXTENSIONS_PROPERTIES);
25108 @@ -5249,8 +5258,8 @@ RDFItemUpdater.prototype = {
25109 dsURI = dsURI.replace(/%APP_ID%/g, this._updater._appID);
25110 dsURI = dsURI.replace(/%APP_VERSION%/g, this._updater._appVersion);
25111 dsURI = dsURI.replace(/%REQ_VERSION%/g, 1);
25112 - dsURI = dsURI.replace(/%APP_OS%/g, OS_TARGET);
25113 - dsURI = dsURI.replace(/%APP_ABI%/g, TARGET_XPCOM_ABI);
25114 + dsURI = dsURI.replace(/%APP_OS%/g, gOSTarget);
25115 + dsURI = dsURI.replace(/%APP_ABI%/g, gXPCOMABI);
25117 // escape() does not properly encode + symbols in any embedded FVF strings.
25118 dsURI = dsURI.replace(/\+/g, "%2B");
25119 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/CFGParser.pm mozilla.new/toolkit/mozapps/installer/CFGParser.pm
25120 --- mozilla/toolkit/mozapps/installer/CFGParser.pm 2005-08-30 22:15:36.000000000 +0200
25121 +++ mozilla.new/toolkit/mozapps/installer/CFGParser.pm 2006-02-24 11:15:58.000000000 +0100
25122 @@ -81,12 +81,6 @@ sub ParseInstallerCfg
25123 elsif ($prop eq "FileInstallerEXE") {
25124 $ENV{WIZ_fileInstallerExe} = $value;
25126 - elsif ($prop eq "FileUninstall") {
25127 - $ENV{WIZ_fileUninstall} = $value;
25129 - elsif ($prop eq "FileUninstallZIP") {
25130 - $ENV{WIZ_fileUninstallZip} = $value;
25132 elsif ($prop eq "FileMainEXE") {
25133 $ENV{WIZ_fileMainExe} = $value;
25135 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/makeall.pl mozilla.new/toolkit/mozapps/installer/makeall.pl
25136 --- mozilla/toolkit/mozapps/installer/makeall.pl 2005-08-30 22:15:38.000000000 +0200
25137 +++ mozilla.new/toolkit/mozapps/installer/makeall.pl 2006-02-24 11:15:58.000000000 +0100
25138 @@ -90,8 +90,6 @@ $seiFileNameGeneric = "nsinstall".
25139 $seiFileNameSpecific = $ENV{WIZ_fileInstallerExe};
25140 $seiStubRootName = $ENV{WIZ_fileNetStubRootName};
25141 $seiFileNameSpecificStub = "$seiStubRootName".$exe_suffix;
25142 -$seuFileNameSpecific = $ENV{WIZ_fileUninstall};
25143 -$seuzFileNameSpecific = $ENV{WIZ_fileUninstallZip};
25145 if(defined($ENV{DEBUG_INSTALLER_BUILD}))
25147 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/makecfgini.pl mozilla.new/toolkit/mozapps/installer/makecfgini.pl
25148 --- mozilla/toolkit/mozapps/installer/makecfgini.pl 2005-06-01 16:20:35.000000000 +0200
25149 +++ mozilla.new/toolkit/mozapps/installer/makecfgini.pl 2006-02-24 11:15:58.000000000 +0100
25150 @@ -109,8 +109,6 @@ $nameProduct = $ENV{WIZ_nameProduct
25151 $shortNameProduct = $ENV{WIZ_shortNameProduct};
25152 $nameProductInternal = $ENV{WIZ_nameProductInternal};
25153 $fileMainExe = $ENV{WIZ_fileMainExe};
25154 -$fileUninstall = $ENV{WIZ_fileUninstall};
25155 -$fileUninstallZip = $ENV{WIZ_fileUninstallZip};
25156 $greBuildID = $ENV{WIZ_greBuildID};
25157 $greFileVersion = $ENV{WIZ_greFileVersion};
25158 $greUniqueID = $ENV{WIZ_greUniqueID};
25159 @@ -157,26 +155,19 @@ while($line = <fpInIt>)
25160 chop($componentName);
25163 - if($componentName =~ /\$UninstallFileZip\$/i)
25164 + $installSize = OutputInstallSize("$inStagePath/$componentName");
25166 + # special oji consideration here. Since it's an installer that
25167 + # seamonkey installer will be calling, the disk space allocation
25168 + # needs to be adjusted by an expansion factor of 3.62.
25169 + if($componentName =~ /oji/i)
25171 - $installSize = OutputInstallSizeArchive("$inXpiPath/$fileUninstallZip") * 2;
25172 + $installSize = int($installSize * 3.62);
25174 - else
25176 - $installSize = OutputInstallSize("$inStagePath/$componentName");
25178 - # special oji consideration here. Since it's an installer that
25179 - # seamonkey installer will be calling, the disk space allocation
25180 - # needs to be adjusted by an expansion factor of 3.62.
25181 - if($componentName =~ /oji/i)
25183 - $installSize = int($installSize * 3.62);
25186 - if($componentName =~ /gre/i)
25188 - $installSize = int($installSize * 4.48);
25190 + if($componentName =~ /gre/i)
25192 + $installSize = int($installSize * 4.48);
25196 @@ -208,7 +199,6 @@ while($line = <fpInIt>)
25197 else {
25198 chop($componentName);
25200 - $componentName =~ s/\$UninstallFileZip\$/$fileUninstallZip/gi;
25201 $installSizeArchive = OutputInstallSizeArchive("$inXpiPath/$componentName");
25204 @@ -252,8 +242,6 @@ while($line = <fpInIt>)
25205 $line =~ s/\$ProductNameInternal\$/$nameProductInternal/gi;
25206 $line =~ s/\$ProductShortName\$/$shortNameProduct/gi;
25207 $line =~ s/\$MainExeFile\$/$fileMainExe/gi;
25208 - $line =~ s/\$UninstallFile\$/$fileUninstall/gi;
25209 - $line =~ s/\$UninstallFileZip\$/$fileUninstallZip/gi;
25210 $line =~ s/\$GreBuildID\$/$greBuildID/gi;
25211 $line =~ s/\$GreFileVersion\$/$greFileVersion/gi;
25212 $line =~ s/\$GreUniqueID\$/$greUniqueID/gi;
25213 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/makejs.pl mozilla.new/toolkit/mozapps/installer/makejs.pl
25214 --- mozilla/toolkit/mozapps/installer/makejs.pl 2005-02-01 18:07:16.000000000 +0100
25215 +++ mozilla.new/toolkit/mozapps/installer/makejs.pl 2006-02-24 11:15:58.000000000 +0100
25216 @@ -85,7 +85,6 @@ $nameProduct = $ENV{WIZ_nameProduct
25217 $nameProductInternal = $ENV{WIZ_nameProductInternal};
25218 $shortNameProduct = $ENV{WIZ_shortNameProduct};
25219 $fileMainExe = $ENV{WIZ_fileMainExe};
25220 -$fileUninstall = $ENV{WIZ_fileUninstall};
25221 $greBuildID = $ENV{WIZ_greBuildID};
25222 $greFileVersion = $ENV{WIZ_greFileVersion};
25223 $greUniqueID = $ENV{WIZ_greUniqueID};
25224 @@ -141,7 +140,6 @@ while($line = <fpInTemplate>)
25225 $line =~ s/\$ProductShortName\$/$shortNameProduct/i;
25226 $line =~ s/\$ProductNameInternal\$/$nameProductInternal/gi;
25227 $line =~ s/\$MainExeFile\$/$fileMainExe/i;
25228 - $line =~ s/\$UninstallFile\$/$fileUninstall/i;
25229 $line =~ s/\$GreBuildID\$/$greBuildID/gi;
25230 $line =~ s/\$GreFileVersion\$/$greFileVersion/gi;
25231 $line =~ s/\$GreUniqueID\$/$greUniqueID/gi;
25232 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/packager.mk mozilla.new/toolkit/mozapps/installer/packager.mk
25233 --- mozilla/toolkit/mozapps/installer/packager.mk 2005-10-12 15:41:43.000000000 +0200
25234 +++ mozilla.new/toolkit/mozapps/installer/packager.mk 2006-02-24 11:15:58.000000000 +0100
25235 @@ -101,6 +101,7 @@ else
25236 _APPNAME = $(MOZ_APP_DISPLAYNAME).app
25237 endif
25238 endif
25239 +_BINPATH = /$(_APPNAME)/Contents/MacOS
25240 PKG_SUFFIX = .dmg
25241 PKG_DMG_FLAGS =
25242 ifneq (,$(MOZ_PKG_MAC_DSSTORE))
25243 @@ -119,8 +120,11 @@ ifneq (,$(MOZ_PKG_MAC_EXTRA))
25244 PKG_DMG_FLAGS += $(MOZ_PKG_MAC_EXTRA)
25245 endif
25246 _ABS_TOPSRCDIR = $(shell cd $(topsrcdir) && pwd)
25247 +ifdef UNIVERSAL_BINARY
25248 +STAGEPATH = universal/
25249 +endif
25250 MAKE_PACKAGE = $(_ABS_TOPSRCDIR)/build/package/mac_osx/pkg-dmg \
25251 - --source "$(MOZ_PKG_APPNAME)" --target "$(PACKAGE)" \
25252 + --source "$(STAGEPATH)$(MOZ_PKG_APPNAME)" --target "$(PACKAGE)" \
25253 --volname "$(MOZ_APP_DISPLAYNAME)" $(PKG_DMG_FLAGS)
25254 UNMAKE_PACKAGE = \
25255 set -ex; \
25256 @@ -155,15 +159,21 @@ endif
25258 # dummy macro if we don't have PSM built
25259 SIGN_NSS =
25260 -ifndef CROSS_COMPILE
25261 +ifneq (1_,$(if $(CROSS_COMPILE),1,0)_$(UNIVERSAL_BINARY))
25262 ifdef MOZ_PSM
25263 SIGN_NSS = @echo signing nss libraries;
25265 +ifdef UNIVERSAL_BINARY
25266 +NATIVE_ARCH = $(shell uname -p | sed -e s/powerpc/ppc/)
25267 +NATIVE_DIST = $(DIST)/../../$(NATIVE_ARCH)/dist
25268 +SIGN_CMD = $(NATIVE_DIST)/bin/run-mozilla.sh $(NATIVE_DIST)/bin/shlibsign -v -i
25269 +else
25270 SIGN_CMD = $(DIST)/bin/run-mozilla.sh $(DIST)/bin/shlibsign -v -i
25271 +endif
25273 -SOFTOKN = $(DIST)/$(MOZ_PKG_APPNAME)/$(DLL_PREFIX)softokn3$(DLL_SUFFIX)
25274 -FREEBL_HYBRID = $(DIST)/$(MOZ_PKG_APPNAME)/$(DLL_PREFIX)freebl_hybrid_3$(DLL_SUFFIX)
25275 -FREEBL_PURE = $(DIST)/$(MOZ_PKG_APPNAME)/$(DLL_PREFIX)freebl_pure32_3$(DLL_SUFFIX)
25276 +SOFTOKN = $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)softokn3$(DLL_SUFFIX)
25277 +FREEBL_HYBRID = $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_hybrid_3$(DLL_SUFFIX)
25278 +FREEBL_PURE = $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_pure32_3$(DLL_SUFFIX)
25280 SIGN_NSS += $(SIGN_CMD) $(SOFTOKN); \
25281 if test -f $(FREEBL_HYBRID); then $(SIGN_CMD) $(FREEBL_HYBRID); fi; \
25282 @@ -260,14 +270,18 @@ ifdef MOZ_PKG_MANIFEST
25283 $(PERL) $(topsrcdir)/xpinstall/packager/xptlink.pl -s $(DIST) -d $(DIST)/xpt -f $(DIST)/$(MOZ_PKG_APPNAME)/components -v
25284 else # !MOZ_PKG_MANIFEST
25285 ifeq ($(MOZ_PKG_FORMAT),DMG)
25286 +# If UNIVERSAL_BINARY, the package will be made from an already-prepared
25287 +# STAGEPATH
25288 +ifndef UNIVERSAL_BINARY
25289 @cd $(DIST) && rsync -auv --copy-unsafe-links $(_APPNAME) $(MOZ_PKG_APPNAME)
25290 +endif
25291 else
25292 @cd $(DIST)/bin && tar $(TAR_CREATE_FLAGS) - * | (cd ../$(MOZ_PKG_APPNAME); tar -xf -)
25293 endif # DMG
25294 endif # MOZ_PKG_MANIFEST
25295 ifndef PKG_SKIP_STRIP
25296 @echo "Stripping package directory..."
25297 - @cd $(DIST)/$(MOZ_PKG_APPNAME); find . ! -type d \
25298 + @cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME); find . ! -type d \
25299 ! -name "*.js" \
25300 ! -name "*.xpt" \
25301 ! -name "*.gif" \
25302 @@ -293,16 +307,11 @@ ifndef PKG_SKIP_STRIP
25303 $(SIGN_NSS)
25304 endif
25305 @echo "Removing unpackaged files..."
25306 -ifeq ($(MOZ_PKG_FORMAT),DMG)
25307 - cd $(DIST)/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/MacOS; rm -rf $(NO_PKG_FILES)
25308 -ifdef MOZ_PKG_REMOVALS
25309 - $(SYSINSTALL) $(MOZ_PKG_REMOVALS_GEN) $(DIST)/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/MacOS
25310 -endif # MOZ_PKG_REMOVALS
25311 -else
25312 - cd $(DIST)/$(MOZ_PKG_APPNAME); rm -rf $(NO_PKG_FILES)
25313 +ifdef NO_PKG_FILES
25314 + cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH); rm -rf $(NO_PKG_FILES)
25315 +endif
25316 ifdef MOZ_PKG_REMOVALS
25317 - $(SYSINSTALL) $(MOZ_PKG_REMOVALS_GEN) $(DIST)/$(MOZ_PKG_APPNAME)
25318 + $(SYSINSTALL) $(MOZ_PKG_REMOVALS_GEN) $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)
25319 endif # MOZ_PKG_REMOVALS
25320 -endif
25321 @echo "Compressing..."
25322 cd $(DIST); $(MAKE_PACKAGE)
25323 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/install_sub.pl mozilla.new/toolkit/mozapps/installer/windows/install_sub.pl
25324 --- mozilla/toolkit/mozapps/installer/windows/install_sub.pl 2004-11-30 23:54:02.000000000 +0100
25325 +++ mozilla.new/toolkit/mozapps/installer/windows/install_sub.pl 2006-02-24 11:15:58.000000000 +0100
25326 @@ -11,9 +11,6 @@ $exe_suffix = '.exe';
25328 sub BuildPlatformInstaller
25330 - print "Making uninstaller...\n";
25331 - MakeUninstall() && die;
25333 # copy the lean installer to stub\ dir
25334 print "\n****************************\n";
25335 print "* *\n";
25336 @@ -211,55 +208,6 @@ sub BuildPlatformInstaller
25337 return 0;
25340 -sub MakeUninstall
25342 - chdir($inConfigFiles);
25343 - if(MakeUninstallIniFile())
25345 - return(1);
25348 - # Copy the uninstall files to the dist uninstall directory.
25349 - copy("uninstall.ini", "$gDirDistInstall") ||
25350 - die "copy uninstall.ini $gDirDistInstall: $!\n";
25351 - copy("uninstall.ini", "$gDirDistInstall/uninstall") ||
25352 - die "copy uninstall.ini $gDirDistInstall/uninstall: $!\n";
25353 - copy("$gDirDistInstall/uninstall.exe", "$gDirDistInstall/uninstall") ||
25354 - die "copy $gDirDistInstall/uninstall.exe $gDirDistInstall/uninstall: $!\n";
25356 - # build the self-extracting .exe (uninstaller) file.
25357 - print "\nbuilding self-extracting uninstaller ($seuFileNameSpecific)...\n";
25358 - copy("$gDirDistInstall/$seiFileNameGeneric", "$gDirDistInstall/$seuFileNameSpecific") ||
25359 - die "copy $gDirDistInstall/$seiFileNameGeneric $gDirDistInstall/$seuFileNameSpecific: $!\n";
25361 - $origCwd = cwd();
25362 - chdir($gDirDistInstall);
25364 - if(system("./nsztool.exe $seuFileNameSpecific uninstall/*.*"))
25366 - print "\n Error: ./nsztool.exe $seuFileNameSpecific uninstall/*.*\n";
25367 - return(1);
25370 - chdir($origCwd);
25372 - MakeExeZip($gDirDistInstall, $seuFileNameSpecific, $seuzFileNameSpecific);
25373 - unlink <$gDirDistInstall/$seuFileNameSpecific>;
25374 - return(0);
25377 -sub MakeUninstallIniFile
25379 - # Make config.ini file
25380 - chdir($inConfigFiles);
25381 - if(system("perl $gDirPackager/windows/makeuninstallini.pl uninstall.it $gDefaultProductVersion"))
25383 - print "\n Error: perl $gDirPackager/windows/makeuninstallini.pl uninstall.it $gDefaultProductVersion\n";
25384 - return(1);
25386 - return(0);
25389 sub MakeExeZip
25391 my($aSrcDir, $aExeFile, $aZipFile) = @_;
25392 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/Makefile.in mozilla.new/toolkit/mozapps/installer/windows/wizard/Makefile.in
25393 --- mozilla/toolkit/mozapps/installer/windows/wizard/Makefile.in 2005-02-01 18:07:27.000000000 +0100
25394 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/Makefile.in 2006-02-24 11:15:58.000000000 +0100
25395 @@ -42,7 +42,7 @@ VPATH = @srcdir@
25397 include $(DEPTH)/config/autoconf.mk
25399 -DIRS = uninstall setuprsc setup
25400 +DIRS = setuprsc setup
25402 include $(topsrcdir)/config/rules.mk
25404 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/setup/dialogs.c mozilla.new/toolkit/mozapps/installer/windows/wizard/setup/dialogs.c
25405 --- mozilla/toolkit/mozapps/installer/windows/wizard/setup/dialogs.c 2005-10-19 02:10:44.000000000 +0200
25406 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/setup/dialogs.c 2006-02-24 11:15:58.000000000 +0100
25407 @@ -268,7 +268,6 @@ void InitSequence(HINSTANCE hInstance)
25408 RefreshIcons();
25410 UnsetSetupState(); // clear setup state
25411 - ClearWinRegUninstallFileDeletion();
25412 if (!gbIgnoreProgramFolderX)
25413 ProcessProgramFolderShowCmd();
25415 @@ -2189,7 +2188,6 @@ LRESULT CALLBACK DlgProcInstallSuccessfu
25416 RefreshIcons();
25418 UnsetSetupState(); // clear setup state
25419 - ClearWinRegUninstallFileDeletion();
25420 if (!gbIgnoreProgramFolderX)
25421 ProcessProgramFolderShowCmd();
25423 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/setup/extra.c mozilla.new/toolkit/mozapps/installer/windows/wizard/setup/extra.c
25424 --- mozilla/toolkit/mozapps/installer/windows/wizard/setup/extra.c 2005-05-21 00:42:47.000000000 +0200
25425 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/setup/extra.c 2006-02-24 11:15:59.000000000 +0100
25426 @@ -640,51 +640,6 @@ void RemoveDelayedDeleteFileEntries(cons
25427 free(pathToMatch);
25431 -/* Looks for and removes the uninstaller from the Windows Registry
25432 - * that is set to delete the uninstaller at the next restart of
25433 - * Windows. This key is set/created when the user does the following:
25435 - * 1) Runs the uninstaller from the previous version of the product.
25436 - * 2) User does not reboot the OS and starts the installation of
25437 - * the next version of the product.
25439 - * This functions prevents the uninstaller from being deleted on a
25440 - * system reboot after the user performs 2).
25441 - */
25442 -void ClearWinRegUninstallFileDeletion(void)
25444 - char szLCUninstallFilenameLongBuf[MAX_BUF];
25445 - char szLCUninstallFilenameShortBuf[MAX_BUF];
25446 - char szWinInitFile[MAX_BUF];
25447 - char szTempInitFile[MAX_BUF];
25448 - char szWinDir[MAX_BUF];
25450 - if(!GetWindowsDirectory(szWinDir, sizeof(szWinDir)))
25451 - return;
25453 - wsprintf(szLCUninstallFilenameLongBuf, "%s\\%s", szWinDir, sgProduct.szUninstallFilename);
25454 - GetShortPathName(szLCUninstallFilenameLongBuf, szLCUninstallFilenameShortBuf, sizeof(szLCUninstallFilenameShortBuf));
25456 - if(gSystemInfo.dwOSType & OS_NT)
25458 - RemoveDelayedDeleteFileEntries(szLCUninstallFilenameShortBuf);
25460 - else
25462 - /* OS type is win9x */
25463 - wsprintf(szWinInitFile, "%s\\wininit.ini", szWinDir);
25464 - wsprintf(szTempInitFile, "%s\\wininit.moz", szWinDir);
25465 - if(FileExists(szWinInitFile))
25467 - if(UpdateFile(szWinInitFile, szTempInitFile, szLCUninstallFilenameLongBuf))
25468 - CopyFile(szTempInitFile, szWinInitFile, FALSE);
25470 - DeleteFile(szTempInitFile);
25475 HRESULT Initialize(HINSTANCE hInstance)
25477 char szBuf[MAX_BUF];
25478 @@ -3941,8 +3896,6 @@ HRESULT InitSetupGeneral()
25479 return(1);
25480 if((sgProduct.szProductNamePrevious = NS_GlobalAlloc(MAX_BUF)) == NULL)
25481 return(1);
25482 - if((sgProduct.szUninstallFilename = NS_GlobalAlloc(MAX_BUF)) == NULL)
25483 - return(1);
25484 if((sgProduct.szUserAgent = NS_GlobalAlloc(MAX_BUF)) == NULL)
25485 return(1);
25486 if((sgProduct.szProgramFolderName = NS_GlobalAlloc(MAX_BUF)) == NULL)
25487 @@ -3981,7 +3934,6 @@ void DeInitSetupGeneral()
25488 FreeMemory(&(sgProduct.szProductName));
25489 FreeMemory(&(sgProduct.szProductNameInternal));
25490 FreeMemory(&(sgProduct.szProductNamePrevious));
25491 - FreeMemory(&(sgProduct.szUninstallFilename));
25492 FreeMemory(&(sgProduct.szUserAgent));
25493 FreeMemory(&(sgProduct.szProgramFolderName));
25494 FreeMemory(&(sgProduct.szProgramFolderPath));
25495 @@ -7276,7 +7228,6 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine
25496 lstrcpy(sgProduct.szProductNameInternal, sgProduct.szProductName);
25498 GetConfigIniProfileString("General", "Product Name Previous", "", sgProduct.szProductNamePrevious, MAX_BUF);
25499 - GetConfigIniProfileString("General", "Uninstall Filename", "", sgProduct.szUninstallFilename, MAX_BUF);
25500 GetConfigIniProfileString("General", "User Agent", "", sgProduct.szUserAgent, MAX_BUF);
25501 GetConfigIniProfileString("General", "Sub Path", "", sgProduct.szSubPath, MAX_BUF);
25502 GetConfigIniProfileString("General", "Program Name", "", sgProduct.szProgramName, MAX_BUF);
25503 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/setup/extra.h mozilla.new/toolkit/mozapps/installer/windows/wizard/setup/extra.h
25504 --- mozilla/toolkit/mozapps/installer/windows/wizard/setup/extra.h 2005-04-15 16:49:51.000000000 +0200
25505 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/setup/extra.h 2006-02-24 11:15:59.000000000 +0100
25506 @@ -202,7 +202,6 @@ void Delay(DWORD dwSeconds)
25507 void UnsetSetupState(void);
25508 void SetSetupState(char *szState);
25509 siCD *InitWinInitNodes(char *szInFile);
25510 -void UpdateWininit(LPSTR szUninstallFilename);
25511 char *GetSaveInstallerPath(char *szBuf, DWORD dwBufSize);
25512 void SaveInstallerFiles(void);
25513 void ResetComponentAttributes(char *szFileIni);
25514 @@ -227,7 +226,6 @@ void RestoreInvisibleFlag(s
25515 void RestoreAdditionalFlag(siC *siCNode);
25516 void RestoreEnabledFlag(siC *siCNode);
25517 void SwapFTPAndHTTP(char *szInUrl, DWORD dwInUrlSize);
25518 -void ClearWinRegUninstallFileDeletion(void);
25519 void RemoveDelayedDeleteFileEntries(const char *aPathToMatch);
25520 int AppendToGlobalMessageStream(char *szInfo);
25521 char *GetOSTypeString(char *szOSType, DWORD dwOSTypeBufSize);
25522 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/setup/logging.c mozilla.new/toolkit/mozapps/installer/windows/wizard/setup/logging.c
25523 --- mozilla/toolkit/mozapps/installer/windows/wizard/setup/logging.c 2005-02-01 18:07:27.000000000 +0100
25524 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/setup/logging.c 2006-02-24 11:15:59.000000000 +0100
25525 @@ -121,11 +121,10 @@ void LogISProductInfo(void)
25527 UpdateInstallStatusLog(szBuf);
25529 - wsprintf(szBuf, " Company name: %s\n Product name (external): %s\n Product name (internal): %s\n Uninstall Filename: %s\n UserAgent: %s\n Alternate search path: %s\n",
25530 + wsprintf(szBuf, " Company name: %s\n Product name (external): %s\n Product name (internal): %s\n UserAgent: %s\n Alternate search path: %s\n",
25531 sgProduct.szCompanyName,
25532 sgProduct.szProductName,
25533 sgProduct.szProductNameInternal,
25534 - sgProduct.szUninstallFilename,
25535 sgProduct.szUserAgent,
25536 sgProduct.szAlternateArchiveSearchPath);
25537 UpdateInstallStatusLog(szBuf);
25538 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/setup/setup.h mozilla.new/toolkit/mozapps/installer/windows/wizard/setup/setup.h
25539 --- mozilla/toolkit/mozapps/installer/windows/wizard/setup/setup.h 2005-08-30 22:15:41.000000000 +0200
25540 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/setup/setup.h 2006-02-24 11:15:59.000000000 +0100
25541 @@ -541,7 +541,6 @@ typedef struct setupStruct
25542 LPSTR szProductName;
25543 LPSTR szProductNameInternal;
25544 LPSTR szProductNamePrevious;
25545 - LPSTR szUninstallFilename;
25546 LPSTR szUserAgent;
25547 LPSTR szProgramFolderName;
25548 LPSTR szProgramFolderPath;
25549 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/dialogs.c mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/dialogs.c
25550 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/dialogs.c 2005-02-12 01:05:12.000000000 +0100
25551 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/dialogs.c 2006-02-24 11:15:59.000000000 +0100
25552 @@ -74,7 +74,7 @@ void ParseDefaultsInfo()
25553 int iIndex;
25554 DWORD dwIconsVisible;
25556 - // If szAppPath is a null sting, i.e. we cannot find where the app has been installed:
25557 + // If szAppPath is a null string, i.e. we cannot find where the app has been installed:
25558 // - HIDEICONS will still remove the shortcuts but
25559 // - SHOWICONS will do nothing because we won't be able to find the shortcuts to display.
25560 ParsePath(ugUninstall.szAppPath, szStorageDir, MAX_BUF, PP_PATH_ONLY);
25561 @@ -267,12 +267,12 @@ void ParseAllUninstallLogs()
25562 lstrcat(szKey, ugUninstall.szUninstallKeyDescription);
25563 RegDeleteKey(HKEY_LOCAL_MACHINE, szKey);
25565 - /* update Wininit.ini to remove itself at reboot */
25566 - RemoveUninstaller(ugUninstall.szUninstallFilename);
25568 // Calling SHChangeNotify() will update the file association icons
25569 // in case they had been reset.
25570 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
25572 + // Note completion of the uninstall process.
25573 + gbUninstallCompleted = TRUE;
25576 /* Broadcast message only if the windows registry keys exist
25577 @@ -489,6 +489,66 @@ LRESULT CALLBACK DlgProcMessage(HWND hDl
25578 return(0);
25581 +// This dialog proc must be used in conjunction with DLG_MESSAGE_CHK.
25582 +LRESULT CALLBACK DlgProcComplete(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam)
25584 + RECT rDlg;
25585 + char text[256];
25586 + LRESULT result = 0;
25588 + switch(msg)
25590 + case WM_INITDIALOG:
25591 + SetWindowText(hDlg, diUninstall.szTitle);
25593 + GetPrivateProfileString("Dialog Uninstall", "OK", "",
25594 + text, sizeof(text), szFileIniUninstall);
25595 + SetDlgItemText(hDlg, IDOK, text);
25597 + GetPrivateProfileString("Messages", "MSG_UNINSTALL_COMPLETE", "",
25598 + text, sizeof(text), szFileIniUninstall);
25599 + SetDlgItemText(hDlg, IDC_MESSAGE, text);
25601 + GetPrivateProfileString("Messages", "MSG_UNINSTALL_SURVEY", "",
25602 + text, sizeof(text), szFileIniUninstall);
25603 + if (text[0])
25605 + SetDlgItemText(hDlg, IDC_CHECKBOX, text);
25607 + else
25609 + // Hide the checkbox control if there is not survey text.
25610 + ShowWindow(GetDlgItem(hDlg, IDC_CHECKBOX), SW_HIDE);
25613 + if(GetClientRect(hDlg, &rDlg))
25614 + SetWindowPos(hDlg, HWND_TOP, (dwScreenX/2)-(rDlg.right/2), (dwScreenY/2)-(rDlg.bottom/2), 0, 0, SWP_NOSIZE);
25616 + break;
25618 + case WM_COMMAND:
25619 + switch(LOWORD(wParam))
25621 + case IDOK:
25622 + if (SendDlgItemMessage(hDlg, IDC_CHECKBOX, BM_GETCHECK, 0, 0) == BST_CHECKED)
25624 + EndDialog(hDlg, ID_YES_TO_ALL);
25626 + else
25628 + EndDialog(hDlg, IDOK);
25629 + }
25630 + break;
25632 + break;
25634 + case WM_CLOSE:
25635 + EndDialog(hDlg, IDOK);
25636 + break;
25638 + return(0);
25641 void ProcessWindowsMessages()
25643 MSG msg;
25644 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/dialogs.h mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/dialogs.h
25645 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/dialogs.h 2005-02-01 18:07:28.000000000 +0100
25646 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/dialogs.h 2006-02-24 11:15:59.000000000 +0100
25647 @@ -43,6 +43,7 @@
25648 LRESULT CALLBACK DlgProcUninstall(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam);
25649 LRESULT CALLBACK DlgProcWhatToDo(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam);
25650 LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam);
25651 +LRESULT CALLBACK DlgProcComplete(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam);
25653 void ParseAllUninstallLogs();
25654 void ParseDefaultsInfo();
25655 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/extern.h mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/extern.h
25656 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/extern.h 2005-02-01 18:07:28.000000000 +0100
25657 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/extern.h 2006-02-24 11:15:59.000000000 +0100
25658 @@ -75,4 +75,8 @@ extern BOOL gbAllowMultipleI
25659 extern uninstallGen ugUninstall;
25660 extern diU diUninstall;
25662 +extern DWORD dwParentPID;
25664 +extern BOOL gbUninstallCompleted;
25666 #endif
25667 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/extra.c mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/extra.c
25668 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/extra.c 2005-02-01 18:07:28.000000000 +0100
25669 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/extra.c 2006-02-24 11:15:59.000000000 +0100
25670 @@ -253,19 +253,10 @@ HRESULT Initialize(HINSTANCE hInstance)
25672 lstrcpy(szTempDir, szUninstallDir);
25674 - else
25675 + else if (!MakeUniquePath(szTempDir))
25677 - int i;
25678 - for(i = 1; i <= 100 && (FileExists(szTempDir) != FALSE); i++)
25680 - itoa(i, (szTempDir + dwLen), 10);
25683 - if (FileExists(szTempDir) != FALSE)
25685 - MessageBox(hWndMain, "Cannot create temp directory", NULL, MB_OK | MB_ICONEXCLAMATION);
25686 - exit(1);
25688 + MessageBox(hWndMain, "Cannot create temp directory", NULL, MB_OK | MB_ICONEXCLAMATION);
25689 + exit(1);
25692 else
25693 @@ -854,8 +845,6 @@ HRESULT InitUninstallGeneral()
25694 return(1);
25695 if((ugUninstall.szUninstallKeyDescription = NS_GlobalAlloc(MAX_BUF)) == NULL)
25696 return(1);
25697 - if((ugUninstall.szUninstallFilename = NS_GlobalAlloc(MAX_BUF)) == NULL)
25698 - return(1);
25699 if((ugUninstall.szClientAppID = NS_GlobalAlloc(MAX_BUF)) == NULL)
25700 return(1);
25701 if((ugUninstall.szClientAppPath = NS_GlobalAlloc(MAX_BUF)) == NULL)
25702 @@ -871,7 +860,6 @@ void DeInitUninstallGeneral()
25703 FreeMemory(&(ugUninstall.szLogFilename));
25704 FreeMemory(&(ugUninstall.szDescription));
25705 FreeMemory(&(ugUninstall.szUninstallKeyDescription));
25706 - FreeMemory(&(ugUninstall.szUninstallFilename));
25707 FreeMemory(&(ugUninstall.szUserAgent));
25708 FreeMemory(&(ugUninstall.szDefaultComponent));
25709 FreeMemory(&(ugUninstall.szWrKey));
25710 @@ -1023,6 +1011,17 @@ DWORD ParseCommandLine(LPSTR lpszCmdLine
25712 gbAllowMultipleInstalls = TRUE;
25714 + else if(!lstrcmpi(szArgVBuf, "-ppid") || !lstrcmpi(szArgVBuf, "/ppid"))
25716 + if((i + 1) < iArgC)
25718 + char buf[32];
25719 + if (GetArgV(lpszCmdLine, ++i, buf, sizeof(buf)))
25721 + dwParentPID = (DWORD) atoi(buf);
25726 ++i;
25728 @@ -2068,9 +2067,6 @@ HRESULT ParseUninstallIni()
25730 RemoveBackSlash(ugUninstall.szWrMainKey);
25732 - GetPrivateProfileString("General", "Uninstall Filename", "", ugUninstall.szUninstallFilename, MAX_BUF, szFileIniUninstall);
25735 /* Uninstall dialog */
25736 GetPrivateProfileString("Dialog Uninstall", "Show Dialog", "", szShowDialog, MAX_BUF, szFileIniUninstall);
25737 GetPrivateProfileString("Dialog Uninstall", "Title", "", diUninstall.szTitle, MAX_BUF, szFileIniUninstall);
25738 @@ -2581,6 +2577,18 @@ HRESULT FileExists(LPSTR szFile)
25742 +BOOL MakeUniquePath(LPSTR szPath)
25744 + int i, dwLen;
25746 + dwLen = lstrlen(szPath);
25747 + for(i = 1; i <= 999 && (FileExists(szPath) != FALSE); i++)
25749 + itoa(i, (szPath + dwLen), 10);
25751 + return !FileExists(szPath);
25754 BOOL WinRegNameExists(HKEY hkRootKey, LPSTR szKey, LPSTR szName)
25756 HKEY hkResult;
25757 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/extra.h mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/extra.h
25758 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/extra.h 2005-02-01 18:07:28.000000000 +0100
25759 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/extra.h 2006-02-24 11:15:59.000000000 +0100
25760 @@ -91,6 +91,7 @@ void AppendBackSlash(LPSTR
25761 void RemoveSlash(LPSTR szInput);
25762 void AppendSlash(LPSTR szInput, DWORD dwInputSize);
25763 HRESULT FileExists(LPSTR szFile);
25764 +BOOL MakeUniquePath(LPSTR szPath);
25765 BOOL IsWin95Debute(void);
25766 HRESULT CheckInstances();
25767 BOOL GetFileVersion(LPSTR szFile, verBlock *vbVersion);
25768 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/Makefile.in mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/Makefile.in
25769 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/Makefile.in 2005-02-01 18:07:28.000000000 +0100
25770 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/Makefile.in 2006-02-24 11:15:59.000000000 +0100
25771 @@ -68,7 +68,7 @@ LOCAL_INCLUDES = -I$(srcdir)
25772 ifdef GNU_CC
25773 OS_LIBS += -lshell32 -lversion -lgdi32
25774 else
25775 -OS_LIBS += shell32.lib version.lib
25776 +OS_LIBS += shell32.lib version.lib ole32.lib
25777 endif
25779 NO_DIST_INSTALL = 1
25780 @@ -76,11 +76,10 @@ NO_DIST_INSTALL = 1
25781 include $(topsrcdir)/config/rules.mk
25783 libs:: $(PROGRAM)
25784 - $(INSTALL) $(PROGRAM) $(DIST)/install
25785 + $(INSTALL) $(PROGRAM) $(DIST)/bin/uninstall
25787 install:: $(PROGRAM)
25788 - $(INSTALL) $(PROGRAM) $(DESTDIR)$(mozappdir)/install
25789 + $(INSTALL) $(PROGRAM) $(DESTDIR)$(mozappdir)/bin/uninstall
25791 clean clobber realclean clobber_all::
25792 - $(RM) $(DIST)/install/$(PROGRAM)
25794 + $(RM) $(DIST)/bin/uninstall/$(PROGRAM)
25795 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/parser.c mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/parser.c
25796 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/parser.c 2005-02-01 18:07:28.000000000 +0100
25797 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/parser.c 2006-02-24 11:15:59.000000000 +0100
25798 @@ -46,69 +46,48 @@
25800 #define KEY_SHARED_DLLS "Software\\Microsoft\\Windows\\CurrentVersion\\SharedDlls"
25802 -BOOL DeleteOrDelayUntilReboot(LPSTR szFile)
25803 +BOOL DeleteOnReboot(LPSTR szFile)
25805 - FILE *ofp;
25806 - char szWinDir[MAX_BUF];
25807 - char szWininitFile[MAX_BUF];
25808 - BOOL bDelayDelete = FALSE;
25809 - BOOL bWriteRenameSection;
25811 - FileDelete(szFile);
25812 - if(FileExists(szFile))
25813 + if(ulOSType & OS_NT)
25814 + MoveFileEx(szFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
25815 + else
25817 - bDelayDelete = TRUE;
25818 - if(ulOSType & OS_NT)
25819 - MoveFileEx(szFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
25820 - else
25822 - if(GetWindowsDirectory(szWinDir, sizeof(szWinDir)) == 0)
25823 - return(FALSE);
25825 - lstrcpy(szWininitFile, szWinDir);
25826 - AppendBackSlash(szWininitFile, sizeof(szWininitFile));
25827 - lstrcat(szWininitFile, "wininit.ini");
25828 + char szWinDir[MAX_BUF];
25829 + char szWininitFile[MAX_BUF];
25830 + BOOL bWriteRenameSection;
25831 + FILE *ofp;
25833 + if(GetWindowsDirectory(szWinDir, sizeof(szWinDir)) == 0)
25834 + return(FALSE);
25836 + lstrcpy(szWininitFile, szWinDir);
25837 + AppendBackSlash(szWininitFile, sizeof(szWininitFile));
25838 + lstrcat(szWininitFile, "wininit.ini");
25840 - if(FileExists(szWininitFile) == FALSE)
25841 - bWriteRenameSection = TRUE;
25842 - else
25843 - bWriteRenameSection = FALSE;
25844 + if(FileExists(szWininitFile) == FALSE)
25845 + bWriteRenameSection = TRUE;
25846 + else
25847 + bWriteRenameSection = FALSE;
25849 - if((ofp = fopen(szWininitFile, "a+")) == NULL)
25850 - return(FALSE);
25851 + if((ofp = fopen(szWininitFile, "a+")) == NULL)
25852 + return(FALSE);
25854 - if(bWriteRenameSection == TRUE)
25855 - fprintf(ofp, "[RENAME]\n");
25856 + if(bWriteRenameSection == TRUE)
25857 + fprintf(ofp, "[RENAME]\n");
25859 - fprintf(ofp, "NUL=%s\n", szFile);
25860 - fclose(ofp);
25862 + fprintf(ofp, "NUL=%s\n", szFile);
25863 + fclose(ofp);
25865 - else
25866 - bDelayDelete = FALSE;
25868 - return(bDelayDelete);
25869 + return(TRUE);
25872 -void RemoveUninstaller(LPSTR szUninstallFilename)
25873 +BOOL DeleteOrDelayUntilReboot(LPSTR szFile)
25875 - char szBuf[MAX_BUF];
25876 - char szWinDir[MAX_BUF];
25877 - char szUninstallFile[MAX_BUF];
25879 - if(SearchForUninstallKeys(szUninstallFilename))
25880 - /* Found the uninstall file name in the windows registry uninstall
25881 - * key sections. We should not try to delete ourselves. */
25882 - return;
25884 - if(GetWindowsDirectory(szWinDir, sizeof(szWinDir)) == 0)
25885 - return;
25886 + FileDelete(szFile);
25887 + if(FileExists(szFile))
25888 + return DeleteOnReboot(szFile);
25890 - lstrcpy(szBuf, szWinDir);
25891 - AppendBackSlash(szBuf, sizeof(szBuf));
25892 - lstrcat(szBuf, szUninstallFilename);
25893 - GetShortPathName(szBuf, szUninstallFile, sizeof(szUninstallFile));
25894 - DeleteOrDelayUntilReboot(szUninstallFile);
25895 + return(TRUE);
25898 sil *InitSilNodes(char *szInFile)
25899 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/parser.h mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/parser.h
25900 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/parser.h 2005-02-01 18:07:28.000000000 +0100
25901 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/parser.h 2006-02-24 11:15:59.000000000 +0100
25902 @@ -50,9 +50,9 @@ HRESULT ParseForWinRegInfo(LPSTR szS
25903 void ParseForUninstallCommand(LPSTR szString, LPSTR szKeyStr, LPSTR szFile, DWORD dwFileBufSize, LPSTR szParam, DWORD dwParamBufSize);
25904 void DeleteWinRegKey(HKEY hkRootKey, LPSTR szKey, BOOL bAbsoluteDelete);
25905 DWORD GetLogFile(LPSTR szTargetPath, LPSTR szInFilename, LPSTR szOutBuf, DWORD dwOutBufSize);
25906 -void RemoveUninstaller(LPSTR szUninstallFilename);
25907 DWORD DecrementSharedFileCounter(char *file);
25908 BOOL DeleteOrDelayUntilReboot(LPSTR szFile);
25909 +BOOL DeleteOnReboot(LPSTR szFile);
25910 BOOL UnregisterServer(char *file);
25911 int GetSharedFileCount(char *file);
25912 BOOL DetermineUnRegisterServer(sil *silInstallLogHead, LPSTR szFile);
25913 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/resource.h mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/resource.h
25914 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/resource.h 2003-10-09 04:02:08.000000000 +0200
25915 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/resource.h 2006-02-24 11:15:59.000000000 +0100
25916 @@ -15,6 +15,7 @@
25917 #define IDI_SETUP 105
25918 #define IDI_UNINSTALL 105
25919 #define DLG_MESSAGE 110
25920 +#define DLG_MESSAGE_CHK 111
25921 #define IDC_LIST_PRODUCTS 1000
25922 #define ID_NO 1001
25923 #define IDC_GAUGE_FILE 1002
25924 @@ -29,6 +30,7 @@
25925 #define IDC_MESSAGE0 1042
25926 #define IDC_MESSAGE1 1043
25927 #define IDC_MESSAGE 1049
25928 +#define IDC_CHECKBOX 1050
25929 #define DLG_UNINSTALL 2008
25930 #define DLG_EXTRACTING 2009
25931 #define DLG_PRODUCT_LIST 2009
25932 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.c mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.c
25933 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.c 2005-02-01 18:07:28.000000000 +0100
25934 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.c 2006-02-24 11:15:59.000000000 +0100
25935 @@ -22,6 +22,7 @@
25937 * Contributor(s):
25938 * Sean Su <ssu@netscape.com>
25939 + * Darin Fisher <darin@meer.net>
25941 * Alternatively, the contents of this file may be used under the terms of
25942 * either the GNU General Public License Version 2 or later (the "GPL"), or
25943 @@ -41,6 +42,7 @@
25944 #include "extra.h"
25945 #include "dialogs.h"
25946 #include "ifuncns.h"
25947 +#include "parser.h"
25949 /* global variables */
25950 HINSTANCE hInst;
25951 @@ -75,6 +77,155 @@ BOOL gbAllowMultipleInstalls
25952 uninstallGen ugUninstall;
25953 diU diUninstall;
25955 +DWORD dwParentPID = 0;
25957 +BOOL gbUninstallCompleted = FALSE;
25959 +/* Copy a file into a directory. Write the path to the new file
25960 + * into the result buffer (MAX_PATH in size). */
25961 +static BOOL CopyTo(LPCSTR file, LPCSTR destDir, LPSTR result)
25963 + char leaf[MAX_BUF_TINY];
25965 + ParsePath(file, leaf, sizeof(leaf), PP_FILENAME_ONLY);
25966 + lstrcpy(result, destDir);
25967 + lstrcat(result, "\\");
25968 + lstrcat(result, leaf);
25970 + return CopyFile(file, result, TRUE);
25973 +/* Spawn child process. */
25974 +static BOOL SpawnProcess(LPCSTR exePath, LPCSTR cmdLine)
25976 + STARTUPINFO si = {sizeof(si), 0};
25977 + PROCESS_INFORMATION pi = {0};
25979 + BOOL ok = CreateProcess(exePath,
25980 + cmdLine,
25981 + NULL, // no special security attributes
25982 + NULL, // no special thread attributes
25983 + FALSE, // don't inherit filehandles
25984 + 0, // No special process creation flags
25985 + NULL, // inherit my environment
25986 + NULL, // use my current directory
25987 + &si,
25988 + &pi);
25990 + if (ok) {
25991 + CloseHandle(pi.hProcess);
25992 + CloseHandle(pi.hThread);
25995 + return ok;
25998 +/* This function is called to ensure that the running executable is a copy of
25999 + * the actual uninstaller. If not, then this function copies the uninstaller
26000 + * into a temporary directory and invokes the copy of itself. This is done to
26001 + * enable the uninstaller to remove itself. */
26002 +static BOOL EnsureRunningAsCopy(LPCSTR cmdLine)
26004 + char uninstExe[MAX_PATH], uninstIni[MAX_PATH];
26005 + char tempBuf[MAX_PATH], tempDir[MAX_PATH] = "";
26006 + DWORD n;
26008 + if (dwParentPID != 0)
26010 + HANDLE hParent;
26012 + /* OpenProcess may return NULL if the parent process has already gone away.
26013 + * If not, then wait for the parent process to exit. NOTE: The process may
26014 + * be signaled before it releases the executable image, so we sit in a loop
26015 + * until OpenProcess returns NULL. */
26016 + while ((hParent = OpenProcess(SYNCHRONIZE, FALSE, dwParentPID)) != NULL)
26018 + DWORD rv = WaitForSingleObject(hParent, 5000);
26019 + CloseHandle(hParent);
26020 + if (rv != WAIT_OBJECT_0)
26021 + return FALSE;
26022 + Sleep(50); /* prevent burning CPU while waiting */
26025 + return TRUE;
26028 + /* otherwise, copy ourselves to a temp location and execute the copy. */
26030 + /* make unique folder under the Temp folder */
26031 + n = GetTempPath(sizeof(tempDir)-1, tempDir);
26032 + if (n == 0 || n > sizeof(tempDir)-1)
26033 + return FALSE;
26034 + lstrcat(tempDir, "nstmp");
26035 + if (!MakeUniquePath(tempDir) || !CreateDirectory(tempDir, NULL))
26036 + return FALSE;
26038 + if (!GetModuleFileName(hInst, tempBuf, sizeof(tempBuf)))
26039 + return FALSE;
26041 + /* copy exe file into temp folder */
26042 + if (!CopyTo(tempBuf, tempDir, uninstExe))
26044 + RemoveDirectory(tempDir);
26045 + return FALSE;
26048 + /* copy ini file into temp folder */
26049 + ParsePath(tempBuf, uninstIni, sizeof(uninstIni), PP_PATH_ONLY);
26050 + lstrcat(uninstIni, FILE_INI_UNINSTALL);
26052 + if (!CopyTo(uninstIni, tempDir, tempBuf))
26054 + DeleteFile(uninstExe);
26055 + RemoveDirectory(tempDir);
26056 + return FALSE;
26059 + /* schedule temp dir and contents to be deleted on reboot */
26060 + DeleteOnReboot(uninstExe);
26061 + DeleteOnReboot(tempBuf);
26062 + DeleteOnReboot(tempDir);
26064 + /* append -ppid command line flag */
26065 + _snprintf(tempBuf, sizeof(tempBuf), "\"%s\" %s /ppid %lu",
26066 + uninstExe, cmdLine, GetCurrentProcessId());
26068 + /* call CreateProcess */
26069 + SpawnProcess(uninstExe, tempBuf);
26071 + return FALSE; /* exit this process */
26074 +/* Uninstall completed; show some UI... */
26075 +static void OnUninstallComplete()
26077 + char exePath[MAX_PATH], buf[MAX_PATH];
26079 + if (!(ugUninstall.szProductName && ugUninstall.szProductName[0]) ||
26080 + !(ugUninstall.szUserAgent && ugUninstall.szUserAgent[0]))
26081 + return;
26083 + if (DialogBox(hInst, MAKEINTRESOURCE(DLG_MESSAGE_CHK), NULL,
26084 + DlgProcComplete) != ID_YES_TO_ALL)
26085 + return;
26087 + /* find iexplore.exe. we cannot use ShellExecute because the protocol
26088 + * association (in HKEY_CLASSES_ROOT) may reference the app we just
26089 + * uninstalled, which is a bug in and of itself. */
26090 + GetWinReg(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\IE Setup\\Setup", "Path",
26091 + exePath, sizeof(exePath));
26092 + if (!exePath[0])
26093 + return;
26094 + lstrcat(exePath, "\\iexplore.exe");
26096 + /* launch IE, and point it at the survey URL (whitespace in the product name
26097 + * or user agent is okay) */
26098 + _snprintf(buf, sizeof(buf),
26099 + "\"%s\" \"https://survey.mozilla.com/1/%s/%s/exit.html\"", exePath,
26100 + ugUninstall.szProductName, ugUninstall.szUserAgent);
26101 + SpawnProcess(exePath, buf);
26104 int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
26106 /***********************************************************************/
26107 @@ -92,10 +243,10 @@ int APIENTRY WinMain(HINSTANCE hInstance
26108 if(!hPrevInstance)
26110 hInst = GetModuleHandle(NULL);
26111 - if(InitUninstallGeneral())
26112 - PostQuitMessage(1);
26113 - else if(ParseCommandLine(lpszCmdLine))
26114 + if(InitUninstallGeneral() || ParseCommandLine(lpszCmdLine))
26116 PostQuitMessage(1);
26118 else if((hwndFW = FindWindow(CLASS_NAME_UNINSTALL_DLG, NULL)) != NULL && !gbAllowMultipleInstalls)
26120 /* Allow only one instance of setup to run.
26121 @@ -107,7 +258,7 @@ int APIENTRY WinMain(HINSTANCE hInstance
26122 iRv = WIZ_SETUP_ALREADY_RUNNING;
26123 PostQuitMessage(1);
26125 - else if(Initialize(hInst))
26126 + else if(!EnsureRunningAsCopy(lpszCmdLine) || Initialize(hInst))
26128 PostQuitMessage(1);
26130 @@ -152,6 +303,11 @@ int APIENTRY WinMain(HINSTANCE hInstance
26134 + if(diUninstall.bShowDialog == TRUE && gbUninstallCompleted)
26136 + OnUninstallComplete();
26139 /* garbage collection */
26140 DeInitUninstallGeneral();
26141 if(iRv != WIZ_SETUP_ALREADY_RUNNING)
26142 @@ -160,4 +316,3 @@ int APIENTRY WinMain(HINSTANCE hInstance
26144 return(msg.wParam);
26145 } /* End of WinMain */
26147 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.h mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.h
26148 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.h 2005-08-30 22:15:41.000000000 +0200
26149 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.h 2006-02-24 11:15:59.000000000 +0100
26150 @@ -172,7 +172,6 @@ typedef struct uninstallStruct
26151 LPSTR szProductName;
26152 LPSTR szDescription;
26153 LPSTR szUninstallKeyDescription;
26154 - LPSTR szUninstallFilename;
26155 HKEY hWrMainRoot;
26156 LPSTR szWrMainKey;
26157 HKEY hWrRoot;
26158 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.rc mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.rc
26159 --- mozilla/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.rc 2004-02-11 01:56:16.000000000 +0100
26160 +++ mozilla.new/toolkit/mozapps/installer/windows/wizard/uninstall/uninstall.rc 2006-02-24 11:15:59.000000000 +0100
26161 @@ -126,6 +126,15 @@ BEGIN
26162 CTEXT "",IDC_MESSAGE,0,0,236,34,SS_CENTERIMAGE
26165 +DLG_MESSAGE_CHK DIALOG DISCARDABLE 0, 0, 200, 66
26166 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
26167 +FONT 8, "MS Sans Serif"
26168 +BEGIN
26169 + DEFPUSHBUTTON "",IDOK,75,45,53,14
26170 + LTEXT "",IDC_MESSAGE,11,8,191,8
26171 + CONTROL "",IDC_CHECKBOX,"Button",BS_AUTOCHECKBOX|WS_TABSTOP,15,25,191,10
26172 +END
26174 DLG_WHAT_TO_DO DIALOG DISCARDABLE 51, 56, 333, 140
26175 STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
26176 WS_SYSMENU
26177 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/Makefile.in mozilla.new/toolkit/mozapps/Makefile.in
26178 --- mozilla/toolkit/mozapps/Makefile.in 2004-06-19 00:05:29.000000000 +0200
26179 +++ mozilla.new/toolkit/mozapps/Makefile.in 2006-02-24 11:15:58.000000000 +0100
26180 @@ -44,5 +44,12 @@ include $(DEPTH)/config/autoconf.mk
26182 DIRS = downloads extensions update xpinstall
26184 -include $(topsrcdir)/config/rules.mk
26185 +# The installer is built during the packaging phase, but the uninstaller needs
26186 +# to be built earlier.
26187 +ifdef MOZ_INSTALLER
26188 +ifeq ($(OS_ARCH),WINNT)
26189 +DIRS += installer/windows/wizard/uninstall
26190 +endif
26191 +endif
26193 +include $(topsrcdir)/config/rules.mk
26194 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/update/src/nsPostUpdateWin.js mozilla.new/toolkit/mozapps/update/src/nsPostUpdateWin.js
26195 --- mozilla/toolkit/mozapps/update/src/nsPostUpdateWin.js 2005-11-04 19:45:00.000000000 +0100
26196 +++ mozilla.new/toolkit/mozapps/update/src/nsPostUpdateWin.js 2006-02-24 11:15:59.000000000 +0100
26197 @@ -46,7 +46,6 @@ const URI_BRAND_PROPERTIES = "chrome
26198 const URI_UNINSTALL_PROPERTIES = "chrome://branding/content/uninstall.properties";
26200 const KEY_APPDIR = "XCurProcD";
26201 -const KEY_WINDIR = "WinD";
26202 const KEY_COMPONENTS_DIR = "ComsD";
26203 const KEY_PLUGINS_DIR = "APlugns";
26204 const KEY_EXECUTABLE_FILE = "XREExeF";
26205 @@ -576,6 +575,9 @@ function updateRegistry(rootKey) {
26207 var vendorShortName;
26208 try {
26209 + // The Thunderbird vendorShortName is "Mozilla Thunderbird", but we
26210 + // just want "Thunderbird", so allow it to be overridden in prefs.
26212 var prefs =
26213 Components.classes["@mozilla.org/preferences-service;1"].
26214 getService(Components.interfaces.nsIPrefBranch);
26215 @@ -710,9 +712,10 @@ function updateRegistry(rootKey) {
26216 var uninstallBundle = sbs.createBundle(URI_UNINSTALL_PROPERTIES);
26218 var nameWithVersion = brandFullName + " (" + app.version + ")";
26219 - var uninstaller = getFile(KEY_WINDIR);
26220 - uninstaller.append(uninstallBundle.GetStringFromName("fileUninstall"));
26221 - // XXX copy latest uninstaller to this location
26223 + var uninstaller = getFile(KEY_APPDIR);
26224 + uninstaller.append("uninstall");
26225 + uninstaller.append("uninstall.exe");
26227 var uninstallString =
26228 uninstaller.path + " /ua \"" + versionWithLocale + "\"";
26229 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/update/src/nsUpdateService.js.in mozilla.new/toolkit/mozapps/update/src/nsUpdateService.js.in
26230 --- mozilla/toolkit/mozapps/update/src/nsUpdateService.js.in 2005-11-05 03:01:15.000000000 +0100
26231 +++ mozilla.new/toolkit/mozapps/update/src/nsUpdateService.js.in 2006-02-24 11:15:59.000000000 +0100
26232 @@ -1,3 +1,4 @@
26233 +#if 0
26234 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
26235 /* ***** BEGIN LICENSE BLOCK *****
26236 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
26237 @@ -36,6 +37,7 @@
26238 * the terms of any one of the MPL, the GPL or the LGPL.
26240 * ***** END LICENSE BLOCK ***** */
26241 +#endif
26243 const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
26244 const PREF_APP_UPDATE_AUTO = "app.update.auto";
26245 @@ -116,6 +118,7 @@ const Node = Components.interfaces.nsIDO
26246 var gApp = null;
26247 var gPref = null;
26248 var gOS = null;
26249 +var gABI = null;
26250 var gConsole = null;
26251 var gLogEnabled = { };
26253 @@ -854,6 +857,24 @@ function UpdateService() {
26254 gConsole = Components.classes["@mozilla.org/consoleservice;1"]
26255 .getService(Components.interfaces.nsIConsoleService);
26257 + // Not all builds have a known ABI
26258 + try {
26259 + gABI = gApp.XPCOMABI;
26261 + catch (e) {
26262 + LOG("UpdateService", "XPCOM ABI unknown: updates are not possible.");
26265 +#ifdef XP_MACOSX
26266 + // Mac universal build should report a different ABI than either macppc
26267 + // or mactel.
26268 + var macutils = Components.classes["@mozilla.org/xpcom/mac-utils;1"]
26269 + .getService(Components.interfaces.nsIMacUtils);
26271 + if (macutils.isUniversalBinary)
26272 + gABI = "Universal-gcc3";
26273 +#endif
26275 // Start the update timer only after a profile has been selected so that the
26276 // appropriate values for the update check are read from the user's profile.
26277 gOS.addObserver(this, "profile-after-change", false);
26278 @@ -1302,6 +1323,11 @@ UpdateService.prototype = {
26279 var enabled = getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true);
26280 if (!enabled && gPref.prefIsLocked(PREF_APP_UPDATE_ENABLED))
26281 return false;
26283 + // If we don't know the binary platform we're updating, we can't update.
26284 + if (!gABI)
26285 + return false;
26287 return true;
26290 @@ -1686,7 +1712,7 @@ Checker.prototype = {
26291 url = url.replace(/%PRODUCT%/g, gApp.name);
26292 url = url.replace(/%VERSION%/g, gApp.version);
26293 url = url.replace(/%BUILD_ID%/g, gApp.appBuildID);
26294 - url = url.replace(/%BUILD_TARGET%/g, gApp.OS + "_" + gApp.XPCOMABI);
26295 + url = url.replace(/%BUILD_TARGET%/g, gApp.OS + "_" + gABI);
26296 url = url.replace(/%LOCALE%/g, getLocale());
26297 url = url.replace(/%CHANNEL%/g, getUpdateChannel());
26298 url = url.replace(/\+/g, "%2B");
26299 diff -uprN --exclude=CVS mozilla/toolkit/mozapps/update/src/updater/progressui_win.cpp mozilla.new/toolkit/mozapps/update/src/updater/progressui_win.cpp
26300 --- mozilla/toolkit/mozapps/update/src/updater/progressui_win.cpp 2005-10-25 20:26:56.000000000 +0200
26301 +++ mozilla.new/toolkit/mozapps/update/src/updater/progressui_win.cpp 2006-02-14 10:01:03.000000000 +0100
26302 @@ -21,6 +21,7 @@
26304 * Contributor(s):
26305 * Darin Fisher <darin@meer.net>
26306 + * Masayuki Nakano <masayuki@d-toybox.com>
26308 * Alternatively, the contents of this file may be used under the terms of
26309 * either the GNU General Public License Version 2 or later (the "GPL"), or
26310 @@ -48,6 +49,7 @@
26312 static float sProgress; // between 0 and 100
26313 static BOOL sQuit = FALSE;
26314 +static HFONT sSystemFont = 0;
26316 static BOOL
26317 GetStringsFile(char filename[MAX_PATH])
26318 @@ -67,7 +69,7 @@ static void
26319 UpdateDialog(HWND hDlg)
26321 int pos = int(sProgress + 0.5f);
26322 - SendMessage(GetDlgItem(hDlg, IDC_PROGRESS), PBM_SETPOS, pos, 0L);
26323 + SendDlgItemMessage(hDlg, IDC_PROGRESS, PBM_SETPOS, pos, 0L);
26326 // The code in this function is from MSDN:
26327 @@ -123,13 +125,27 @@ InitDialog(HWND hDlg)
26328 SetItemText(hDlg, "Title", filename);
26329 SetItemText(GetDlgItem(hDlg, IDC_INFO), "Info", filename);
26331 + // On Win9x, we need to send WM_SETFONT for l10n builds. Yes, we shouldn't
26332 + // use the system font. For example, if the text has Japanese characters on
26333 + // Win98-en, then the text may not be displayed correctly. We should perhaps
26334 + // support loading a font named in updater.ini; however, even then there are
26335 + // cases where it might not work properly.
26336 + if (!sSystemFont) {
26337 + NONCLIENTMETRICS ncm;
26338 + memset(&ncm, 0, sizeof(ncm));
26339 + ncm.cbSize = sizeof(ncm);
26340 + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
26341 + sSystemFont = CreateFontIndirect(&ncm.lfMessageFont);
26343 + if (sSystemFont)
26344 + SendDlgItemMessage(hDlg, IDC_INFO, WM_SETFONT, (WPARAM)sSystemFont, 0L);
26346 // Set dialog icon
26347 HICON hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_DIALOG));
26348 if (hIcon)
26349 SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
26351 - SendMessage(GetDlgItem(hDlg, IDC_PROGRESS), PBM_SETRANGE, 0,
26352 - MAKELPARAM(0, 100));
26353 + SendDlgItemMessage(hDlg, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
26355 CenterDialog(hDlg); // make dialog appear in the center of the screen
26357 @@ -147,10 +163,15 @@ DialogProc(HWND hDlg, UINT message, WPAR
26358 return TRUE;
26360 case WM_TIMER:
26361 - if (sQuit)
26362 + if (sQuit) {
26363 EndDialog(hDlg, 0);
26364 - else
26365 + if (sSystemFont) {
26366 + DeleteObject(sSystemFont);
26367 + sSystemFont = 0;
26369 + } else {
26370 UpdateDialog(hDlg);
26372 return TRUE;
26374 case WM_COMMAND:
26375 diff -uprN --exclude=CVS mozilla/toolkit/xre/MacLaunchHelper.m mozilla.new/toolkit/xre/MacLaunchHelper.m
26376 --- mozilla/toolkit/xre/MacLaunchHelper.m 2005-02-01 18:07:35.000000000 +0100
26377 +++ mozilla.new/toolkit/xre/MacLaunchHelper.m 2006-03-03 07:11:40.000000000 +0100
26378 @@ -42,6 +42,12 @@
26379 #include <mach-o/dyld.h>
26380 #include <sys/utsname.h>
26382 +#ifdef __ppc__
26383 +#include <sys/types.h>
26384 +#include <sys/sysctl.h>
26385 +#include <mach/machine.h>
26386 +#endif /* __ppc__ */
26388 @interface TaskMonitor : NSObject
26389 -(void)prebindFinished:(NSNotification *)aNotification;
26390 @end
26391 @@ -104,6 +110,31 @@ void LaunchChildMac(int aArgc, char** aA
26392 NSMutableArray* args = [[NSMutableArray alloc] init];
26393 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
26395 +#ifdef __ppc__
26396 + // It's possible that the app is a universal binary running under Rosetta
26397 + // translation because the user forced it to. Relaunching via NSTask would
26398 + // launch the app natively, which the user apparently doesn't want.
26399 + // In that case, try to preserve translation.
26401 + // If the sysctl doesn't exist, it's because Rosetta doesn't exist,
26402 + // so don't try to force translation. In case of other errors, just assume
26403 + // that the app is native.
26405 + int isNative = 0;
26406 + size_t sz = sizeof(isNative);
26408 + if (sysctlbyname("sysctl.proc_native", &isNative, &sz, NULL, 0) == 0 &&
26409 + !isNative) {
26410 + // Running translated on ppc.
26412 + cpu_type_t preferredCPU = CPU_TYPE_POWERPC;
26413 + sysctlbyname("sysctl.proc_exec_affinity", NULL, NULL,
26414 + &preferredCPU, sizeof(preferredCPU));
26416 + // Nothing can be done to handle failure, relaunch anyway.
26418 +#endif /* __ppc__ */
26420 for (i = 1; i < aArgc; ++i)
26421 [args addObject: [NSString stringWithCString: aArgv[i]]];
26423 diff -uprN --exclude=CVS mozilla/toolkit/xre/nsAppRunner.cpp mozilla.new/toolkit/xre/nsAppRunner.cpp
26424 --- mozilla/toolkit/xre/nsAppRunner.cpp 2005-10-17 21:16:51.000000000 +0200
26425 +++ mozilla.new/toolkit/xre/nsAppRunner.cpp 2006-02-24 11:15:59.000000000 +0100
26426 @@ -1627,7 +1627,8 @@ SelectProfile(nsIProfileLock* *aResult,
26428 static PRBool
26429 CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion,
26430 - nsIFile* aXULRunnerDir, nsIFile* aAppDir)
26431 + const nsCString& aOSABI, nsIFile* aXULRunnerDir,
26432 + nsIFile* aAppDir)
26434 nsCOMPtr<nsIFile> file;
26435 aProfileDir->Clone(getter_AddRefs(file));
26436 @@ -1649,6 +1650,13 @@ CheckCompatibility(nsIFile* aProfileDir,
26437 if (!aVersion.Equals(buf))
26438 return PR_FALSE;
26440 + rv = parser.GetString("Compatibility", "LastOSABI", buf);
26441 + if (NS_FAILED(rv))
26442 + return PR_FALSE;
26444 + if (!aOSABI.Equals(buf))
26445 + return PR_FALSE;
26447 rv = parser.GetString("Compatibility", "LastPlatformDir", buf);
26448 if (NS_FAILED(rv))
26449 return PR_FALSE;
26450 @@ -1693,7 +1701,8 @@ static void BuildVersion(nsCString &aBuf
26452 static void
26453 WriteVersion(nsIFile* aProfileDir, const nsCString& aVersion,
26454 - nsIFile* aXULRunnerDir, nsIFile* aAppDir)
26455 + const nsCString& aOSABI, nsIFile* aXULRunnerDir,
26456 + nsIFile* aAppDir)
26458 nsCOMPtr<nsIFile> file;
26459 aProfileDir->Clone(getter_AddRefs(file));
26460 @@ -1723,6 +1732,10 @@ WriteVersion(nsIFile* aProfileDir, const
26461 PR_Write(fd, kHeader, sizeof(kHeader) - 1);
26462 PR_Write(fd, aVersion.get(), aVersion.Length());
26464 + static const char kOSABIHeader[] = NS_LINEBREAK "LastOSABI=";
26465 + PR_Write(fd, kOSABIHeader, sizeof(kOSABIHeader) - 1);
26466 + PR_Write(fd, aOSABI.get(), aOSABI.Length());
26468 static const char kPlatformDirHeader[] = NS_LINEBREAK "LastPlatformDir=";
26470 PR_Write(fd, kPlatformDirHeader, sizeof(kPlatformDirHeader) - 1);
26471 @@ -2083,10 +2096,17 @@ XRE_main(int argc, char* argv[], const n
26472 nsCAutoString version;
26473 BuildVersion(version);
26475 +#ifdef TARGET_OS_ABI
26476 + NS_NAMED_LITERAL_CSTRING(osABI, TARGET_OS_ABI);
26477 +#else
26478 + // No TARGET_XPCOM_ABI, but at least the OS is known
26479 + NS_NAMED_LITERAL_CSTRING(osABI, OS_TARGET "_UNKNOWN");
26480 +#endif
26482 // Check for version compatibility with the last version of the app this
26483 // profile was started with. The format of the version stamp is defined
26484 // by the BuildVersion function.
26485 - PRBool versionOK = CheckCompatibility(profD, version,
26486 + PRBool versionOK = CheckCompatibility(profD, version, osABI,
26487 dirProvider.GetAppDir(),
26488 gAppData->directory);
26490 @@ -2099,7 +2119,7 @@ XRE_main(int argc, char* argv[], const n
26492 if (gSafeMode) {
26493 RemoveComponentRegistries(profD, profLD, PR_FALSE);
26494 - WriteVersion(profD, NS_LITERAL_CSTRING("Safe Mode"),
26495 + WriteVersion(profD, NS_LITERAL_CSTRING("Safe Mode"), osABI,
26496 dirProvider.GetAppDir(), gAppData->directory);
26498 else if (versionOK) {
26499 @@ -2124,7 +2144,7 @@ XRE_main(int argc, char* argv[], const n
26500 upgraded = PR_TRUE;
26502 // Write out version
26503 - WriteVersion(profD, version,
26504 + WriteVersion(profD, version, osABI,
26505 dirProvider.GetAppDir(), gAppData->directory);
26508 @@ -2168,6 +2188,24 @@ XRE_main(int argc, char* argv[], const n
26509 // So we can open and close windows during startup
26510 appStartup->EnterLastWindowClosingSurvivalArea();
26512 + if (gDoMigration) {
26513 + nsCOMPtr<nsIFile> file;
26514 + dirProvider.GetAppDir()->Clone(getter_AddRefs(file));
26515 + file->AppendNative(NS_LITERAL_CSTRING("override.ini"));
26516 + nsINIParser parser;
26517 + nsCOMPtr<nsILocalFile> localFile(do_QueryInterface(file));
26518 + nsresult rv = parser.Init(localFile);
26519 + if (NS_SUCCEEDED(rv)) {
26520 + nsCAutoString buf;
26521 + rv = parser.GetString("XRE", "EnableProfileMigrator", buf);
26522 + if (NS_SUCCEEDED(rv)) {
26523 + if (buf[0] == '0' || buf[0] == 'f' || buf[0] == 'F') {
26524 + gDoMigration = PR_FALSE;
26530 // Profile Migration
26531 if (gAppData->flags & NS_XRE_ENABLE_PROFILE_MIGRATOR && gDoMigration) {
26532 gDoMigration = PR_FALSE;
26533 diff -uprN --exclude=CVS mozilla/uriloader/prefetch/nsPrefetchService.cpp mozilla.new/uriloader/prefetch/nsPrefetchService.cpp
26534 --- mozilla/uriloader/prefetch/nsPrefetchService.cpp 2005-06-29 22:57:34.000000000 +0200
26535 +++ mozilla.new/uriloader/prefetch/nsPrefetchService.cpp 2006-02-24 11:16:39.000000000 +0100
26536 @@ -237,6 +237,14 @@ nsPrefetchListener::OnChannelRedirect(ns
26537 return NS_ERROR_ABORT;
26540 + // HTTP request headers are not automatically forwarded to the new channel.
26541 + nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aNewChannel);
26542 + NS_ENSURE_STATE(httpChannel);
26544 + httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("X-Moz"),
26545 + NS_LITERAL_CSTRING("prefetch"), PR_FALSE);
26547 + mService->UpdateCurrentChannel(aNewChannel);
26548 return NS_OK;
26551 diff -uprN --exclude=CVS mozilla/uriloader/prefetch/nsPrefetchService.h mozilla.new/uriloader/prefetch/nsPrefetchService.h
26552 --- mozilla/uriloader/prefetch/nsPrefetchService.h 2005-06-29 22:57:34.000000000 +0200
26553 +++ mozilla.new/uriloader/prefetch/nsPrefetchService.h 2006-02-24 11:16:39.000000000 +0100
26554 @@ -73,6 +73,7 @@ public:
26556 nsresult Init();
26557 void ProcessNextURI();
26558 + void UpdateCurrentChannel(nsIChannel *c) { mCurrentChannel = c; }
26560 private:
26561 ~nsPrefetchService();
26562 diff -uprN --exclude=CVS mozilla/view/src/nsViewManager.cpp mozilla.new/view/src/nsViewManager.cpp
26563 --- mozilla/view/src/nsViewManager.cpp 2005-10-15 09:54:38.000000000 +0200
26564 +++ mozilla.new/view/src/nsViewManager.cpp 2006-02-24 11:16:48.000000000 +0100
26565 @@ -4501,6 +4501,33 @@ nsViewManager::SynthesizeMouseMove(PRBoo
26566 return NS_OK;
26569 +/**
26570 + * Find the first floating view with a widget in a postorder traversal of the
26571 + * view tree that contains the point. Thus more deeply nested floating views
26572 + * are preferred over their ancestors, and floating views earlier in the
26573 + * view hierarchy (i.e., added later) are preferred over their siblings.
26574 + * This is adequate for finding the "topmost" floating view under a point,
26575 + * given that floating views don't supporting having a specific z-index.
26577 + * We cannot exit early when aPt is outside the view bounds, because floating
26578 + * views aren't necessarily included in their parent's bounds, so this could
26579 + * traverse the entire view hierarchy --- use carefully.
26580 + */
26581 +static nsView* FindFloatingViewContaining(nsView* aView, nsPoint aPt)
26583 + for (nsView* v = aView->GetFirstChild(); v; v = v->GetNextSibling()) {
26584 + nsView* r = FindFloatingViewContaining(v, aPt - v->GetOffsetTo(aView));
26585 + if (r)
26586 + return r;
26589 + if (aView->GetFloating() && aView->HasWidget() &&
26590 + aView->GetDimensions().Contains(aPt) && IsViewVisible(aView))
26591 + return aView;
26593 + return nsnull;
26596 void
26597 nsViewManager::ProcessSynthMouseMoveEvent(PRBool aFromScroll)
26599 @@ -4523,14 +4550,29 @@ nsViewManager::ProcessSynthMouseMoveEven
26600 this, mMouseLocation.x, mMouseLocation.y);
26601 #endif
26603 - nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, mRootView->GetWidget(),
26604 + nsPoint pt = mMouseLocation;
26605 + pt.x = NSToCoordRound(mMouseLocation.x*mPixelsToTwips);
26606 + pt.y = NSToCoordRound(mMouseLocation.y*mPixelsToTwips);
26607 + // This could be a bit slow (traverses entire view hierarchy)
26608 + // but it's OK to do it once per synthetic mouse event
26609 + nsView* view = FindFloatingViewContaining(mRootView, pt);
26610 + nsPoint offset(0, 0);
26611 + if (!view) {
26612 + view = mRootView;
26613 + } else {
26614 + offset = view->GetOffsetTo(mRootView);
26615 + offset.x = NSToIntRound(offset.x*mTwipsToPixels);
26616 + offset.y = NSToIntRound(offset.y*mTwipsToPixels);
26618 + nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, view->GetWidget(),
26619 nsMouseEvent::eSynthesized);
26620 - event.point = mMouseLocation;
26622 + event.point = mMouseLocation - offset;
26623 event.time = PR_IntervalNow();
26624 // XXX set event.isShift, event.isControl, event.isAlt, event.isMeta ?
26626 nsEventStatus status;
26627 - DispatchEvent(&event, &status);
26628 + view->GetViewManager()->DispatchEvent(&event, &status);
26630 if (!aFromScroll)
26631 mSynthMouseMoveEventQueue = nsnull;
26632 diff -uprN --exclude=CVS mozilla/widget/src/mac/nsMacEventHandler.cpp mozilla.new/widget/src/mac/nsMacEventHandler.cpp
26633 --- mozilla/widget/src/mac/nsMacEventHandler.cpp 2006-01-09 06:48:56.000000000 +0100
26634 +++ mozilla.new/widget/src/mac/nsMacEventHandler.cpp 2006-02-24 11:16:48.000000000 +0100
26635 @@ -2616,7 +2616,7 @@ nsresult nsMacEventHandler::HandleTextEv
26636 mIMEPos.x = textEvent.theReply.mCursorPosition.x;
26637 mIMEPos.y = textEvent.theReply.mCursorPosition.y +
26638 textEvent.theReply.mCursorPosition.height;
26639 - focusedWidget->LocalToWindowCoordinate(mIMEPos);
26640 + mTopLevelWidget->LocalToWindowCoordinate(mIMEPos);
26641 #ifdef DEBUG_TSM
26642 printf("HandleTextEvent reply (%d,%d)\n", mIMEPos.x , mIMEPos.y);
26643 #endif
26644 diff -uprN --exclude=CVS mozilla/widget/src/mac/nsMacWindow.cpp mozilla.new/widget/src/mac/nsMacWindow.cpp
26645 --- mozilla/widget/src/mac/nsMacWindow.cpp 2006-01-09 06:48:56.000000000 +0100
26646 +++ mozilla.new/widget/src/mac/nsMacWindow.cpp 2006-02-24 11:16:49.000000000 +0100
26647 @@ -213,6 +213,9 @@ nsMacWindow::nsMacWindow() : Inherited()
26648 , mResizeIsFromUs(PR_FALSE)
26649 , mShown(PR_FALSE)
26650 , mMacEventHandler(nsnull)
26651 +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
26652 + , mNeedsResize(PR_FALSE)
26653 +#endif
26655 mMacEventHandler.reset(new nsMacEventHandler(this));
26656 WIDGET_SET_CLASSNAME("nsMacWindow");
26657 @@ -572,7 +575,9 @@ nsresult nsMacWindow::StandardCreate(nsI
26658 // to enable live resizing
26659 { kEventClassWindow, kEventWindowBoundsChanged },
26660 // to roll up popups when we're minimized
26661 - { kEventClassWindow, kEventWindowCollapse },
26662 + { kEventClassWindow, kEventWindowCollapsing },
26663 + // to activate when restoring
26664 + { kEventClassWindow, kEventWindowExpanded },
26665 // to keep invisible windows off the screen
26666 { kEventClassWindow, kEventWindowConstrain },
26667 // to handle update events
26668 @@ -699,14 +704,30 @@ nsMacWindow::WindowEventHandler ( EventH
26669 break;
26671 // roll up popups when we're minimized
26672 - case kEventWindowCollapse:
26673 + case kEventWindowCollapsing:
26675 if ( gRollupListener && gRollupWidget )
26676 gRollupListener->Rollup();
26677 + nsMacWindow *self = NS_REINTERPRET_CAST(nsMacWindow *, userData);
26678 + if (self) {
26679 + gEventDispatchHandler.DispatchGuiEvent(self, NS_DEACTIVATE);
26681 retVal = ::CallNextEventHandler(inHandlerChain, inEvent);
26683 break;
26686 + // Activate when restoring from the minimized state. This ensures that
26687 + // the restored window will be able to take focus.
26688 + case kEventWindowExpanded:
26690 + nsMacWindow *self = NS_REINTERPRET_CAST(nsMacWindow *, userData);
26691 + if (self) {
26692 + gEventDispatchHandler.DispatchGuiEvent(self, NS_ACTIVATE);
26694 + retVal = ::CallNextEventHandler(inHandlerChain, inEvent);
26696 + break;
26698 default:
26699 // do nothing...
26700 break;
26701 @@ -1412,6 +1433,24 @@ NS_IMETHODIMP nsMacWindow::Resize(PRInt3
26702 nsresult nsMacWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint, PRBool aFromUI)
26704 if (mWindowMadeHere) {
26705 +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
26706 + if (mInUpdate && nsToolkit::OSXVersion() < MAC_OS_X_VERSION_10_3_HEX) {
26707 + // Calling SizeWindow in the middle of an update will hang on 10.2,
26708 + // even if care is taken to break out of the update with EndUpdate.
26709 + // On 10.2, defer the resize until the update is done. Update will
26710 + // call back into Resize with these values after the update is
26711 + // finished.
26712 + mResizeTo.width = aWidth;
26713 + mResizeTo.height = aHeight;
26714 + mResizeTo.repaint = aRepaint;
26715 + mResizeTo.fromUI = aFromUI;
26717 + mNeedsResize = PR_TRUE;
26719 + return NS_OK;
26721 +#endif
26723 Rect windowRect;
26724 if (::GetWindowBounds(mWindowPtr, kWindowContentRgn, &windowRect)
26725 != noErr) {
26726 @@ -2037,3 +2076,23 @@ nsresult nsMacWindow::GetDesktopRect(Rec
26727 // to be cleared.
26728 return NS_OK;
26731 +NS_IMETHODIMP nsMacWindow::Update()
26733 + nsresult rv = Inherited::Update();
26735 +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
26736 + if (NS_SUCCEEDED(rv) && mNeedsResize) {
26737 + // Something wanted to resize this window in the middle of the update
26738 + // above, and the host OS is 10.2. The resize would have caused a
26739 + // hang in SizeWindow, so it was deferred. Now that the update is
26740 + // done, it's safe to resize.
26741 + mNeedsResize = PR_FALSE;
26743 + Resize(mResizeTo.width, mResizeTo.height,
26744 + mResizeTo.repaint, mResizeTo.fromUI);
26746 +#endif
26748 + return rv;
26750 diff -uprN --exclude=CVS mozilla/widget/src/mac/nsMacWindow.h mozilla.new/widget/src/mac/nsMacWindow.h
26751 --- mozilla/widget/src/mac/nsMacWindow.h 2005-09-30 23:59:37.000000000 +0200
26752 +++ mozilla.new/widget/src/mac/nsMacWindow.h 2006-02-24 11:16:49.000000000 +0100
26753 @@ -132,6 +132,8 @@ public:
26754 WindowPtr GetWindowTop(WindowPtr baseWindowRef);
26755 void UpdateWindowMenubar(WindowPtr parentWindow, PRBool enableFlag);
26757 + NS_IMETHOD Update();
26759 protected:
26761 void InstallBorderlessDefProc ( WindowPtr inWindow ) ;
26762 @@ -164,6 +166,15 @@ protected:
26763 auto_ptr<nsMacEventHandler> mMacEventHandler;
26764 nsIWidget *mOffsetParent;
26766 +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
26767 + PRPackedBool mNeedsResize;
26768 + struct {
26769 + PRInt32 width;
26770 + PRInt32 height;
26771 + PRPackedBool repaint;
26772 + PRPackedBool fromUI;
26773 + } mResizeTo;
26774 +#endif
26777 #endif // MacWindow_h__
26778 diff -uprN --exclude=CVS mozilla/widget/src/os2/nsWindow.cpp mozilla.new/widget/src/os2/nsWindow.cpp
26779 --- mozilla/widget/src/os2/nsWindow.cpp 2005-10-21 00:04:32.000000000 +0200
26780 +++ mozilla.new/widget/src/os2/nsWindow.cpp 2006-02-14 10:01:30.000000000 +0100
26781 @@ -557,6 +557,27 @@ PRBool nsWindow::DispatchAppCommandEvent
26784 //-------------------------------------------------------------------------
26786 +// Dispatch DragDrop (target) event
26788 +//-------------------------------------------------------------------------
26789 +PRBool nsWindow::DispatchDragDropEvent(PRUint32 aMsg)
26791 + nsMouseEvent event(PR_TRUE, aMsg, this, nsMouseEvent::eReal);
26792 + InitEvent(event);
26794 + event.isShift = WinIsKeyDown(VK_SHIFT);
26795 + event.isControl = WinIsKeyDown(VK_CTRL);
26796 + event.isAlt = WinIsKeyDown(VK_ALT) || WinIsKeyDown(VK_ALTGRAF);
26797 + event.isMeta = PR_FALSE;
26799 + PRBool result = DispatchWindowEvent(&event);
26800 + NS_RELEASE(event.widget);
26802 + return result;
26805 +//-------------------------------------------------------------------------
26806 NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener,
26807 PRBool aDoCapture,
26808 PRBool aConsumeRollupEvent)
26809 @@ -3935,10 +3956,10 @@ PRBool nsWindow::OnDragDropMsg(ULONG msg
26810 mDragStatus = gDragStatus = (dragFlags & DND_DragStatus);
26812 if (dragFlags & DND_DispatchEnterEvent)
26813 - DispatchStandardEvent(NS_DRAGDROP_ENTER);
26814 + DispatchDragDropEvent(NS_DRAGDROP_ENTER);
26816 if (dragFlags & DND_DispatchEvent)
26817 - DispatchStandardEvent(eventType);
26818 + DispatchDragDropEvent(eventType);
26820 if (dragFlags & DND_GetDragoverResult)
26821 dragSession->GetDragoverResult(mr);
26822 diff -uprN --exclude=CVS mozilla/widget/src/os2/nsWindow.h mozilla.new/widget/src/os2/nsWindow.h
26823 --- mozilla/widget/src/os2/nsWindow.h 2005-10-04 20:08:05.000000000 +0200
26824 +++ mozilla.new/widget/src/os2/nsWindow.h 2006-02-14 10:01:30.000000000 +0100
26825 @@ -322,6 +322,7 @@ protected:
26826 virtual PRBool DispatchWindowEvent(nsGUIEvent*event, nsEventStatus &aStatus);
26827 PRBool DispatchStandardEvent( PRUint32 aMsg);
26828 PRBool DispatchAppCommandEvent(PRUint32 aEventCommand);
26829 + PRBool DispatchDragDropEvent(PRUint32 aMsg);
26830 virtual PRBool DispatchMouseEvent( PRUint32 aEventType, MPARAM mp1, MPARAM mp2);
26831 virtual PRBool DispatchResizeEvent( PRInt32 aClientX, PRInt32 aClientY);
26832 void GetNonClientBounds(nsRect &aRect);
26833 diff -uprN --exclude=CVS mozilla/xpcom/base/Makefile.in mozilla.new/xpcom/base/Makefile.in
26834 --- mozilla/xpcom/base/Makefile.in 2005-08-09 15:39:11.000000000 +0200
26835 +++ mozilla.new/xpcom/base/Makefile.in 2006-02-24 11:16:39.000000000 +0100
26836 @@ -70,6 +70,10 @@ CPPSRCS += nsLeakDetector.cpp
26837 REQUIRES += boehm
26838 endif
26840 +ifeq ($(OS_ARCH),Darwin)
26841 +CPPSRCS += nsMacUtilsImpl.cpp
26842 +endif
26844 EXPORTS = \
26845 nsAgg.h \
26846 nsAutoPtr.h \
26847 @@ -124,6 +128,10 @@ ifdef GC_LEAK_DETECTOR
26848 XPIDLSRCS += nsILeakDetector.idl
26849 endif
26851 +ifeq ($(OS_ARCH),Darwin)
26852 +XPIDLSRCS += nsIMacUtils.idl
26853 +endif
26855 # we don't want the shared lib, but we want to force the creation of a static lib.
26856 FORCE_STATIC_LIB = 1
26858 diff -uprN --exclude=CVS mozilla/xpcom/base/nscore.h mozilla.new/xpcom/base/nscore.h
26859 --- mozilla/xpcom/base/nscore.h 2005-07-22 00:15:00.000000000 +0200
26860 +++ mozilla.new/xpcom/base/nscore.h 2006-02-24 11:16:39.000000000 +0100
26861 @@ -140,7 +140,7 @@
26862 * NS_HIDDEN_(int) NS_FASTCALL func2(char *foo);
26865 -#if defined(__i386__) && defined(__GNUC__) && (__GNUC__ >= 3) && !defined(XP_OS2) && !defined(XP_MACOSX)
26866 +#if defined(__i386__) && defined(__GNUC__) && (__GNUC__ >= 3) && !defined(XP_OS2)
26867 #define NS_FASTCALL __attribute__ ((regparm (3), stdcall))
26868 #else
26869 #define NS_FASTCALL
26870 @@ -150,7 +150,7 @@
26871 * NS_DEFCALL undoes the effect of a global regparm/stdcall setting
26872 * so that xptcall works correctly.
26874 -#if defined(__i386__) && defined(__GNUC__) && (__GNUC__ >= 3) && !defined(XP_OS2) && !defined(XP_MACOSX)
26875 +#if defined(__i386__) && defined(__GNUC__) && (__GNUC__ >= 3) && !defined(XP_OS2)
26876 #define NS_DEFCALL __attribute__ ((regparm (0), cdecl))
26877 #else
26878 #define NS_DEFCALL
26879 diff -uprN --exclude=CVS mozilla/xpcom/base/nsIMacUtils.idl mozilla.new/xpcom/base/nsIMacUtils.idl
26880 --- mozilla/xpcom/base/nsIMacUtils.idl 1970-01-01 01:00:00.000000000 +0100
26881 +++ mozilla.new/xpcom/base/nsIMacUtils.idl 2006-02-22 04:55:29.000000000 +0100
26882 @@ -0,0 +1,52 @@
26883 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
26884 +/* ***** BEGIN LICENSE BLOCK *****
26885 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
26887 + * The contents of this file are subject to the Mozilla Public License Version
26888 + * 1.1 (the "License"); you may not use this file except in compliance with
26889 + * the License. You may obtain a copy of the License at
26890 + * http://www.mozilla.org/MPL/
26892 + * Software distributed under the License is distributed on an "AS IS" basis,
26893 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
26894 + * for the specific language governing rights and limitations under the
26895 + * License.
26897 + * The Original Code is XPCOM utility functions for Mac OS X
26899 + * The Initial Developer of the Original Code is Google Inc.
26900 + * Portions created by the Initial Developer are Copyright (C) 2006
26901 + * the Initial Developer. All Rights Reserved.
26903 + * Contributor(s):
26904 + * Mark Mentovai <mark@moxienet.com> (Original Author)
26906 + * Alternatively, the contents of this file may be used under the terms of
26907 + * either the GNU General Public License Version 2 or later (the "GPL"), or
26908 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26909 + * in which case the provisions of the GPL or the LGPL are applicable instead
26910 + * of those above. If you wish to allow use of your version of this file only
26911 + * under the terms of either the GPL or the LGPL, and not to allow others to
26912 + * use your version of this file under the terms of the MPL, indicate your
26913 + * decision by deleting the provisions above and replace them with the notice
26914 + * and other provisions required by the GPL or the LGPL. If you do not delete
26915 + * the provisions above, a recipient may use your version of this file under
26916 + * the terms of any one of the MPL, the GPL or the LGPL.
26918 + * ***** END LICENSE BLOCK ***** */
26920 +#include "nsISupports.idl"
26922 +/**
26923 + * nsIMacUtils: Generic globally-available Mac-specific utilities.
26924 + */
26926 +[scriptable, uuid(59BE3453-873B-450D-8DB8-2643E08A00BE)]
26927 +interface nsIMacUtils : nsISupports
26929 + /**
26930 + * True when the main executable is a fat file supporting at least
26931 + * ppc and x86 (universal binary).
26932 + */
26933 + readonly attribute boolean isUniversalBinary;
26935 diff -uprN --exclude=CVS mozilla/xpcom/base/nsMacUtilsImpl.cpp mozilla.new/xpcom/base/nsMacUtilsImpl.cpp
26936 --- mozilla/xpcom/base/nsMacUtilsImpl.cpp 1970-01-01 01:00:00.000000000 +0100
26937 +++ mozilla.new/xpcom/base/nsMacUtilsImpl.cpp 2006-02-22 04:55:29.000000000 +0100
26938 @@ -0,0 +1,125 @@
26939 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
26940 +/* ***** BEGIN LICENSE BLOCK *****
26941 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
26943 + * The contents of this file are subject to the Mozilla Public License Version
26944 + * 1.1 (the "License"); you may not use this file except in compliance with
26945 + * the License. You may obtain a copy of the License at
26946 + * http://www.mozilla.org/MPL/
26948 + * Software distributed under the License is distributed on an "AS IS" basis,
26949 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
26950 + * for the specific language governing rights and limitations under the
26951 + * License.
26953 + * The Original Code is XPCOM utility functions for Mac OS X
26955 + * The Initial Developer of the Original Code is Google Inc.
26956 + * Portions created by the Initial Developer are Copyright (C) 2006
26957 + * the Initial Developer. All Rights Reserved.
26959 + * Contributor(s):
26960 + * Mark Mentovai <mark@moxienet.com> (Original Author)
26962 + * Alternatively, the contents of this file may be used under the terms of
26963 + * either the GNU General Public License Version 2 or later (the "GPL"), or
26964 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26965 + * in which case the provisions of the GPL or the LGPL are applicable instead
26966 + * of those above. If you wish to allow use of your version of this file only
26967 + * under the terms of either the GPL or the LGPL, and not to allow others to
26968 + * use your version of this file under the terms of the MPL, indicate your
26969 + * decision by deleting the provisions above and replace them with the notice
26970 + * and other provisions required by the GPL or the LGPL. If you do not delete
26971 + * the provisions above, a recipient may use your version of this file under
26972 + * the terms of any one of the MPL, the GPL or the LGPL.
26974 + * ***** END LICENSE BLOCK ***** */
26976 +#include "nsMacUtilsImpl.h"
26978 +#include <CoreFoundation/CoreFoundation.h>
26979 +#include <fcntl.h>
26980 +#include <unistd.h>
26981 +#include <mach-o/fat.h>
26983 +NS_IMPL_ISUPPORTS1(nsMacUtilsImpl, nsIMacUtils)
26985 +/* readonly attribute boolean isUniversalBinary; */
26986 +// True when the main executable is a fat file supporting at least
26987 +// ppc and x86 (universal binary).
26988 +NS_IMETHODIMP nsMacUtilsImpl::GetIsUniversalBinary(PRBool *aIsUniversalBinary)
26990 + static PRBool sInitialized = PR_FALSE,
26991 + sIsUniversalBinary = PR_FALSE;
26993 + if (sInitialized) {
26994 + *aIsUniversalBinary = sIsUniversalBinary;
26995 + return NS_OK;
26998 + PRBool foundPPC = PR_FALSE,
26999 + foundX86 = PR_FALSE;
27000 + CFURLRef executableURL = nsnull;
27001 + int fd = -1;
27003 + CFBundleRef mainBundle;
27004 + if (!(mainBundle = ::CFBundleGetMainBundle()))
27005 + goto done;
27007 + if (!(executableURL = ::CFBundleCopyExecutableURL(mainBundle)))
27008 + goto done;
27010 + char executablePath[PATH_MAX];
27011 + if (!::CFURLGetFileSystemRepresentation(executableURL, PR_TRUE,
27012 + (UInt8*) executablePath,
27013 + sizeof(executablePath)))
27014 + goto done;
27016 + if ((fd = open(executablePath, O_RDONLY)) == -1)
27017 + goto done;
27019 + struct fat_header fatHeader;
27020 + if (read(fd, &fatHeader, sizeof(fatHeader)) != sizeof(fatHeader))
27021 + goto done;
27023 + // The fat header is always stored on disk as big-endian.
27024 + fatHeader.magic = CFSwapInt32BigToHost(fatHeader.magic);
27025 + fatHeader.nfat_arch = CFSwapInt32BigToHost(fatHeader.nfat_arch);
27027 + // Main executable is thin.
27028 + if (fatHeader.magic != FAT_MAGIC)
27029 + goto done;
27031 + // Loop over each architecture in the file. We're presently only
27032 + // interested in 32-bit PPC and x86.
27033 + for (PRUint32 i = 0 ; i < fatHeader.nfat_arch ; i++) {
27034 + struct fat_arch fatArch;
27035 + if (read(fd, &fatArch, sizeof(fatArch)) != sizeof(fatArch))
27036 + goto done;
27038 + // This is still part of the fat header, so byte-swap as needed.
27039 + fatArch.cputype = CFSwapInt32BigToHost(fatArch.cputype);
27041 + // Don't mask out the ABI bits. This allows identification of ppc64
27042 + // as distinct from ppc. CPU_TYPE_X86 is preferred to CPU_TYPE_I386
27043 + // but does not exist prior to the 10.4 headers.
27044 + if (fatArch.cputype == CPU_TYPE_POWERPC)
27045 + foundPPC = PR_TRUE;
27046 + else if (fatArch.cputype == CPU_TYPE_I386)
27047 + foundX86 = PR_TRUE;
27050 + if (foundPPC && foundX86)
27051 + sIsUniversalBinary = PR_TRUE;
27053 +done:
27054 + if (fd != -1)
27055 + close(fd);
27056 + if (executableURL)
27057 + ::CFRelease(executableURL);
27059 + *aIsUniversalBinary = sIsUniversalBinary;
27060 + sInitialized = PR_TRUE;
27062 + return NS_OK;
27064 diff -uprN --exclude=CVS mozilla/xpcom/base/nsMacUtilsImpl.h mozilla.new/xpcom/base/nsMacUtilsImpl.h
27065 --- mozilla/xpcom/base/nsMacUtilsImpl.h 1970-01-01 01:00:00.000000000 +0100
27066 +++ mozilla.new/xpcom/base/nsMacUtilsImpl.h 2006-02-22 04:55:29.000000000 +0100
27067 @@ -0,0 +1,62 @@
27068 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
27069 +/* ***** BEGIN LICENSE BLOCK *****
27070 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
27072 + * The contents of this file are subject to the Mozilla Public License Version
27073 + * 1.1 (the "License"); you may not use this file except in compliance with
27074 + * the License. You may obtain a copy of the License at
27075 + * http://www.mozilla.org/MPL/
27077 + * Software distributed under the License is distributed on an "AS IS" basis,
27078 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
27079 + * for the specific language governing rights and limitations under the
27080 + * License.
27082 + * The Original Code is XPCOM utility functions for Mac OS X
27084 + * The Initial Developer of the Original Code is Google Inc.
27085 + * Portions created by the Initial Developer are Copyright (C) 2006
27086 + * the Initial Developer. All Rights Reserved.
27088 + * Contributor(s):
27089 + * Mark Mentovai <mark@moxienet.com> (Original Author)
27091 + * Alternatively, the contents of this file may be used under the terms of
27092 + * either the GNU General Public License Version 2 or later (the "GPL"), or
27093 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27094 + * in which case the provisions of the GPL or the LGPL are applicable instead
27095 + * of those above. If you wish to allow use of your version of this file only
27096 + * under the terms of either the GPL or the LGPL, and not to allow others to
27097 + * use your version of this file under the terms of the MPL, indicate your
27098 + * decision by deleting the provisions above and replace them with the notice
27099 + * and other provisions required by the GPL or the LGPL. If you do not delete
27100 + * the provisions above, a recipient may use your version of this file under
27101 + * the terms of any one of the MPL, the GPL or the LGPL.
27103 + * ***** END LICENSE BLOCK ***** */
27105 +#ifndef nsMacUtilsImpl_h___
27106 +#define nsMacUtilsImpl_h___
27108 +#include "nsIMacUtils.h"
27110 +class nsMacUtilsImpl : public nsIMacUtils
27112 +public:
27113 + NS_DECL_ISUPPORTS
27114 + NS_DECL_NSIMACUTILS
27116 + nsMacUtilsImpl() {}
27118 +private:
27119 + ~nsMacUtilsImpl() {}
27122 +// Global singleton service
27123 +// 697BD3FD-43E5-41CE-AD5E-C339175C0818
27124 +#define NS_MACUTILSIMPL_CLASSNAME "Mac OS X Utilities"
27125 +#define NS_MACUTILSIMPL_CID \
27126 + {0x697BD3FD, 0x43E5, 0x41CE, {0xAD, 0x5E, 0xC3, 0x39, 0x17, 0x5C, 0x08, 0x18}}
27127 +#define NS_MACUTILSIMPL_CONTRACTID "@mozilla.org/xpcom/mac-utils;1"
27129 +#endif /* nsMacUtilsImpl_h___ */
27130 diff -uprN --exclude=CVS mozilla/xpcom/base/nsStackFrameUnix.cpp mozilla.new/xpcom/base/nsStackFrameUnix.cpp
27131 --- mozilla/xpcom/base/nsStackFrameUnix.cpp 2004-04-18 16:18:12.000000000 +0200
27132 +++ mozilla.new/xpcom/base/nsStackFrameUnix.cpp 2006-02-24 11:16:39.000000000 +0100
27133 @@ -83,25 +83,15 @@ void DemangleSymbol(const char * aSymbol
27137 -#if defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC)) // i386 or PPC Linux stackwalking code
27138 +#if defined(linux) && defined(__GNUC__) && (defined(__i386) || defined(PPC)) // i386 or PPC Linux stackwalking code
27140 -#include <setjmp.h>
27143 void DumpStackToFile(FILE* aStream)
27145 - jmp_buf jb;
27146 - setjmp(jb);
27148 // Stack walking code courtesy Kipp's "leaky".
27150 - // Get the frame pointer out of the jmp_buf
27151 - void **bp = (void**)
27152 -#if defined(__i386)
27153 - (jb[0].__jmpbuf[JB_BP]);
27154 -#elif defined(PPC)
27155 - (jb[0].__jmpbuf[JB_GPR1]);
27156 -#endif
27157 + // Get the frame pointer
27158 + void **bp = (void**) __builtin_frame_address(0);
27160 int skip = 2;
27161 for ( ; (void**)*bp > bp; bp = (void**)*bp) {
27162 diff -uprN --exclude=CVS mozilla/xpcom/base/nsTraceRefcntImpl.cpp mozilla.new/xpcom/base/nsTraceRefcntImpl.cpp
27163 --- mozilla/xpcom/base/nsTraceRefcntImpl.cpp 2005-06-24 02:24:41.000000000 +0200
27164 +++ mozilla.new/xpcom/base/nsTraceRefcntImpl.cpp 2006-02-24 11:16:39.000000000 +0100
27165 @@ -50,19 +50,6 @@
27167 #if defined(_WIN32)
27168 #include <windows.h>
27169 -#elif defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC))
27170 -#include <setjmp.h>
27173 -// On glibc 2.1, the Dl_info api defined in <dlfcn.h> is only exposed
27174 -// if __USE_GNU is defined. I suppose its some kind of standards
27175 -// adherence thing.
27177 -#if (__GLIBC_MINOR__ >= 1) && !defined(__USE_GNU)
27178 -#define __USE_GNU
27179 -#endif
27181 -#include <dlfcn.h>
27182 #endif
27184 #ifdef HAVE_LIBDL
27185 @@ -460,7 +447,7 @@ static PRIntn PR_CALLBACK DumpSerialNumb
27187 #endif /* NS_BUILD_REFCNT_LOGGING */
27189 -nsresult
27190 +NS_COM nsresult
27191 nsTraceRefcntImpl::DumpStatistics(StatisticsType type, FILE* out)
27193 nsresult rv = NS_OK;
27194 @@ -537,7 +524,7 @@ done:
27195 return rv;
27198 -void
27199 +NS_COM void
27200 nsTraceRefcntImpl::ResetStatistics()
27202 #ifdef NS_BUILD_REFCNT_LOGGING
27203 @@ -821,7 +808,7 @@ static void InitTraceLog(void)
27205 #if defined(_WIN32) && defined(_M_IX86) && !defined(WINCE) // WIN32 x86 stack walking code
27206 #include "nsStackFrameWin.h"
27207 -void
27208 +NS_COM void
27209 nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
27211 DumpStackToFile(aStream);
27212 @@ -829,9 +816,9 @@ nsTraceRefcntImpl::WalkTheStack(FILE* aS
27214 // WIN32 x86 stack walking code
27215 // i386 or PPC Linux stackwalking code or Solaris
27216 -#elif (defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386)))
27217 +#elif (defined(linux) && defined(__GNUC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386)))
27218 #include "nsStackFrameUnix.h"
27219 -void
27220 +NS_COM void
27221 nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
27223 DumpStackToFile(aStream);
27224 @@ -839,7 +826,7 @@ nsTraceRefcntImpl::WalkTheStack(FILE* aS
27226 #else // unsupported platform.
27228 -void
27229 +NS_COM void
27230 nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
27232 fprintf(aStream, "write me, dammit!\n");
27233 diff -uprN --exclude=CVS mozilla/xpcom/build/nsXPComInit.cpp mozilla.new/xpcom/build/nsXPComInit.cpp
27234 --- mozilla/xpcom/build/nsXPComInit.cpp 2005-09-28 18:45:07.000000000 +0200
27235 +++ mozilla.new/xpcom/build/nsXPComInit.cpp 2006-02-24 11:16:39.000000000 +0100
27236 @@ -122,6 +122,10 @@
27237 #include "nsWindowsRegKey.h"
27238 #endif
27240 +#ifdef XP_MACOSX
27241 +#include "nsMacUtilsImpl.h"
27242 +#endif
27244 #include <locale.h>
27246 // Registry Factory creation function defined in nsRegistry.cpp
27247 @@ -205,6 +209,10 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimelin
27249 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHashPropertyBag, Init)
27251 +#ifdef XP_MACOSX
27252 +NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacUtilsImpl)
27253 +#endif
27255 static NS_METHOD
27256 nsXPTIInterfaceInfoManagerGetSingleton(nsISupports* outer,
27257 const nsIID& aIID,
27258 @@ -391,6 +399,10 @@ static const nsModuleComponentInfo compo
27259 #if defined(XP_WIN) && !defined(WINCE)
27260 COMPONENT(WINDOWSREGKEY, nsWindowsRegKeyConstructor),
27261 #endif
27263 +#ifdef XP_MACOSX
27264 + COMPONENT(MACUTILSIMPL, nsMacUtilsImplConstructor),
27265 +#endif
27268 #undef COMPONENT
27269 diff -uprN --exclude=CVS mozilla/xpcom/glue/nsGREGlue.cpp mozilla.new/xpcom/glue/nsGREGlue.cpp
27270 --- mozilla/xpcom/glue/nsGREGlue.cpp 2006-01-09 06:48:51.000000000 +0100
27271 +++ mozilla.new/xpcom/glue/nsGREGlue.cpp 2006-03-03 07:13:51.000000000 +0100
27272 @@ -211,11 +211,10 @@ GRE_GetGREPathWithProperties(const GREVe
27273 if (CFURLGetFileSystemRepresentation(xpcomurl, PR_TRUE,
27274 (UInt8*) tbuffer,
27275 sizeof(tbuffer)) &&
27276 - access(tbuffer, R_OK | X_OK) == 0 &&
27277 - realpath(tbuffer, aBuffer)) {
27278 - char *lastslash = strrchr(aBuffer, '/');
27279 - if (lastslash)
27280 - *lastslash = '\0';
27281 + access(tbuffer, R_OK | X_OK) == 0) {
27282 + if (!realpath(tbuffer, aBuffer)) {
27283 + aBuffer[0] = '\0';
27287 CFRelease(xpcomurl);
27288 diff -uprN --exclude=CVS mozilla/xpcom/glue/pldhash.h mozilla.new/xpcom/glue/pldhash.h
27289 --- mozilla/xpcom/glue/pldhash.h 2005-08-19 21:36:58.000000000 +0200
27290 +++ mozilla.new/xpcom/glue/pldhash.h 2006-02-24 11:16:39.000000000 +0100
27291 @@ -46,7 +46,7 @@
27293 PR_BEGIN_EXTERN_C
27295 -#if defined(__GNUC__) && defined(__i386__) && (__GNUC__ >= 3) && !defined(XP_OS2) && !defined(XP_MACOSX)
27296 +#if defined(__GNUC__) && defined(__i386__) && (__GNUC__ >= 3) && !defined(XP_OS2)
27297 #define PL_DHASH_FASTCALL __attribute__ ((regparm (3),stdcall))
27298 #else
27299 #define PL_DHASH_FASTCALL
27300 diff -uprN --exclude=CVS mozilla/xpcom/glue/standalone/nsGlueLinkingDlopen.cpp mozilla.new/xpcom/glue/standalone/nsGlueLinkingDlopen.cpp
27301 --- mozilla/xpcom/glue/standalone/nsGlueLinkingDlopen.cpp 2006-01-09 06:48:51.000000000 +0100
27302 +++ mozilla.new/xpcom/glue/standalone/nsGlueLinkingDlopen.cpp 2006-02-24 11:16:39.000000000 +0100
27303 @@ -94,7 +94,7 @@ XPCOMGlueLoad(const char *xpcomFile)
27305 XPCOMGlueLoadDependentLibs(xpcomDir, ReadDependentCB);
27307 - sprintf(lastSlash, "/" XUL_DLL);
27308 + snprintf(lastSlash, MAXPATHLEN - strlen(xpcomDir), "/" XUL_DLL);
27310 sXULLibHandle = dlopen(xpcomDir, RTLD_GLOBAL | RTLD_LAZY);
27312 diff -uprN --exclude=CVS mozilla/xpcom/glue/standalone/nsGlueLinkingOSX.cpp mozilla.new/xpcom/glue/standalone/nsGlueLinkingOSX.cpp
27313 --- mozilla/xpcom/glue/standalone/nsGlueLinkingOSX.cpp 2006-01-09 06:48:51.000000000 +0100
27314 +++ mozilla.new/xpcom/glue/standalone/nsGlueLinkingOSX.cpp 2006-02-24 11:16:39.000000000 +0100
27315 @@ -45,6 +45,8 @@
27316 #include <string.h>
27317 #include <stdio.h>
27319 +static const mach_header* sXULLibImage;
27321 static void
27322 ReadDependentCB(const char *aDependentLib)
27324 @@ -53,9 +55,35 @@ ReadDependentCB(const char *aDependentLi
27325 NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
27328 +static void*
27329 +LookupSymbol(const mach_header* aLib, const char* aSymbolName)
27331 + // Try to use |NSLookupSymbolInImage| since it is faster than searching
27332 + // the global symbol table. If we couldn't get a mach_header pointer
27333 + // for the XPCOM dylib, then use |NSLookupAndBindSymbol| to search the
27334 + // global symbol table (this shouldn't normally happen, unless the user
27335 + // has called XPCOMGlueStartup(".") and relies on libxpcom.dylib
27336 + // already being loaded).
27337 + NSSymbol sym = nsnull;
27338 + if (aLib) {
27339 + sym = NSLookupSymbolInImage(aLib, aSymbolName,
27340 + NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
27341 + NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
27342 + } else {
27343 + if (NSIsSymbolNameDefined(aSymbolName))
27344 + sym = NSLookupAndBindSymbol(aSymbolName);
27346 + if (!sym)
27347 + return nsnull;
27349 + return NSAddressOfSymbol(sym);
27352 GetFrozenFunctionsFunc
27353 XPCOMGlueLoad(const char *xpcomFile)
27355 + const mach_header* lib = nsnull;
27357 if (xpcomFile[0] != '.' || xpcomFile[1] != '\0') {
27358 char xpcomDir[PATH_MAX];
27359 if (realpath(xpcomFile, xpcomDir)) {
27360 @@ -64,22 +92,23 @@ XPCOMGlueLoad(const char *xpcomFile)
27361 *lastSlash = '\0';
27363 XPCOMGlueLoadDependentLibs(xpcomDir, ReadDependentCB);
27365 + snprintf(lastSlash, PATH_MAX - strlen(xpcomDir), "/" XUL_DLL);
27367 + sXULLibImage = NSAddImage(xpcomDir,
27368 + NSADDIMAGE_OPTION_RETURN_ON_ERROR |
27369 + NSADDIMAGE_OPTION_WITH_SEARCHING |
27370 + NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
27374 - (void) NSAddImage(xpcomFile,
27375 - NSADDIMAGE_OPTION_RETURN_ON_ERROR |
27376 - NSADDIMAGE_OPTION_WITH_SEARCHING |
27377 - NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
27378 - // We don't really care if this fails, as long as we can get
27379 - // NS_GetFrozenFunctions below.
27380 + lib = NSAddImage(xpcomFile,
27381 + NSADDIMAGE_OPTION_RETURN_ON_ERROR |
27382 + NSADDIMAGE_OPTION_WITH_SEARCHING |
27383 + NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
27386 - if (!NSIsSymbolNameDefined("_NS_GetFrozenFunctions"))
27387 - return nsnull;
27389 - NSSymbol sym = NSLookupAndBindSymbol("_NS_GetFrozenFunctions");
27390 - return (GetFrozenFunctionsFunc) NSAddressOfSymbol(sym);
27391 + return (GetFrozenFunctionsFunc) LookupSymbol(lib, "_NS_GetFrozenFunctions");
27394 void
27395 @@ -96,13 +125,9 @@ XPCOMGlueLoadXULFunctions(const nsDynami
27396 char buffer[512];
27397 snprintf(buffer, sizeof(buffer), "_%s", symbols->functionName);
27399 - if (!NSIsSymbolNameDefined(buffer)) {
27400 + *symbols->function = (NSFuncPtr) LookupSymbol(sXULLibImage, buffer);
27401 + if (!*symbols->function)
27402 rv = NS_ERROR_LOSS_OF_SIGNIFICANT_DATA;
27404 - else {
27405 - NSSymbol sym = NSLookupAndBindSymbol(buffer);
27406 - *symbols->function = (NSFuncPtr) NSAddressOfSymbol(sym);
27409 ++symbols;
27411 diff -uprN --exclude=CVS mozilla/xpcom/glue/standalone/nsGlueLinkingWin.cpp mozilla.new/xpcom/glue/standalone/nsGlueLinkingWin.cpp
27412 --- mozilla/xpcom/glue/standalone/nsGlueLinkingWin.cpp 2006-01-09 06:48:51.000000000 +0100
27413 +++ mozilla.new/xpcom/glue/standalone/nsGlueLinkingWin.cpp 2006-02-24 11:16:39.000000000 +0100
27414 @@ -110,7 +110,7 @@ XPCOMGlueLoad(const char *xpcomFile)
27416 XPCOMGlueLoadDependentLibs(xpcomDir, ReadDependentCB);
27418 - sprintf(lastSlash, "\\" XUL_DLL);
27419 + _snprintf(lastSlash, MAXPATHLEN - strlen(xpcomDir), "\\" XUL_DLL);
27421 sXULLibrary =
27422 LoadLibraryEx(xpcomDir, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
27423 diff -uprN --exclude=CVS mozilla/xpcom/obsolete/nsFileSpecWin.cpp mozilla.new/xpcom/obsolete/nsFileSpecWin.cpp
27424 --- mozilla/xpcom/obsolete/nsFileSpecWin.cpp 2005-01-30 22:33:45.000000000 +0100
27425 +++ mozilla.new/xpcom/obsolete/nsFileSpecWin.cpp 2006-02-24 11:16:39.000000000 +0100
27426 @@ -20,6 +20,7 @@
27427 * the Initial Developer. All Rights Reserved.
27429 * Contributor(s):
27430 + * Masayuki Nakano <masayuki@d-toybox.com>
27432 * Alternatively, the contents of this file may be used under the terms of
27433 * either of the GNU General Public License Version 2 or later (the "GPL"),
27434 @@ -46,6 +47,7 @@
27435 #include "nsError.h"
27437 #include <windows.h>
27438 +#include <mbstring.h>
27440 #if (_MSC_VER == 1100) || defined(__GNUC__)
27441 #define INITGUID
27442 @@ -412,12 +414,12 @@ nsresult nsFileSpec::ResolveSymlink(PRBo
27443 void nsFileSpec::GetParent(nsFileSpec& outSpec) const
27444 //----------------------------------------------------------------------------------------
27446 - outSpec.mPath = mPath;
27447 - char* chars = (char*)outSpec.mPath;
27448 - chars[outSpec.mPath.Length() - 1] = '\0'; // avoid trailing separator, if any
27449 - char* cp = strrchr(chars, '\\');
27450 - if (cp++)
27451 - outSpec.mPath.SetLength(cp - chars); // truncate.
27452 + outSpec.mPath = mPath;
27453 + char* chars = (char*)outSpec.mPath;
27454 + chars[outSpec.mPath.Length() - 1] = '\0'; // avoid trailing separator, if any
27455 + unsigned char* cp = _mbsrchr((unsigned char*)chars, '\\');
27456 + if (cp++)
27457 + outSpec.mPath.SetLength(cp - (unsigned char*)chars); // truncate.
27458 } // nsFileSpec::GetParent
27460 //----------------------------------------------------------------------------------------
27461 diff -uprN --exclude=CVS mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp mozilla.new/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp
27462 --- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp 2005-07-26 02:59:40.000000000 +0200
27463 +++ mozilla.new/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp 2006-02-24 11:16:39.000000000 +0100
27464 @@ -20,6 +20,7 @@
27465 * the Initial Developer. All Rights Reserved.
27467 * Contributor(s):
27468 + * Mark Mentovai <mark@moxienet.com>
27470 * Alternatively, the contents of this file may be used under the terms of
27471 * either of the GNU General Public License Version 2 or later (the "GPL"),
27472 @@ -78,34 +79,54 @@ XPTC_InvokeByIndex(nsISupports* that, PR
27474 #ifdef __GNUC__ /* Gnu compiler. */
27475 PRUint32 result;
27476 - // Each param takes at most 2, 4-byte words
27477 - // It doesn't matter if we push too many words, and calculating the exact
27478 - // ammount takes time.
27479 + /* Each param takes at most 2, 4-byte words
27480 + It doesn't matter if we push too many words, and calculating the exact
27481 + amount takes time. */
27482 PRUint32 n = paramCount << 3;
27483 void (*fn_copy) (unsigned int, nsXPTCVariant *, PRUint32 *) = invoke_copy_to_stack;
27484 - int temp1, temp2, temp3;
27485 + int temp1, temp2;
27487 -#ifdef XP_MACOSX
27488 + /* These are only significant when KEEP_STACK_16_BYTE_ALIGNED is
27489 + defined. Otherwise, they're just placeholders to keep the parameter
27490 + indices the same for aligned and unaligned users in the inline asm
27491 + block. */
27492 unsigned int saved_esp;
27493 - __asm__ __volatile__(
27494 - "movl %%esp, %0\n\t"
27495 - : "=r"(saved_esp));
27496 -#endif
27498 __asm__ __volatile__(
27499 - "subl %8, %%esp\n\t" /* make room for params */
27500 -#ifdef XP_MACOSX
27501 - /* the subl and the addl around the andl compensate for the push
27502 - of the this parameter below */
27503 - "subl $0x4, %%esp\n\t"
27504 - "andl $0xfffffff0, %%esp\n\t" /* make sure stack is 16-byte aligned */
27505 - "addl $0x4, %%esp\n\t"
27506 +#ifdef KEEP_STACK_16_BYTE_ALIGNED
27507 + "movl %%esp, %3\n\t"
27508 #endif
27509 + "subl %8, %%esp\n\t" /* make room for params */
27510 +#ifdef KEEP_STACK_16_BYTE_ALIGNED
27511 + /* For the second CALL, there will be one parameter before the ones
27512 + copied by invoke_copy_to_stack. Make sure that the stack will be
27513 + aligned for that CALL. */
27514 + "subl $4, %%esp\n\t"
27515 + "andl $0xfffffff0, %%esp\n\t"
27516 + /* For the first CALL, there are three parameters. Leave padding to
27517 + ensure alignment. */
27518 + "subl $4, %%esp\n\t"
27519 + /* The third parameter to invoke_copy_to_stack is the destination pointer.
27520 + It needs to point into the parameter area prepared for the second CALL,
27521 + leaving room for the |that| parameter. This reuses |n|, which was
27522 + the stack space to reserve, but that's OK because it's no longer needed
27523 + if the stack is being kept aligned. */
27524 + "leal 8(%%esp), %8\n\t"
27525 + "pushl %8\n\t"
27526 +#else
27527 "pushl %%esp\n\t"
27528 +#endif
27529 "pushl %7\n\t"
27530 "pushl %6\n\t"
27531 - "call *%0\n\t" /* copy params */
27532 + "call *%9\n\t" /* copy params */
27533 +#ifdef KEEP_STACK_16_BYTE_ALIGNED
27534 + /* The stack is still aligned from the first CALL. Keep it aligned for
27535 + the next one by popping past the parameters from the first CALL and
27536 + leaving space for the first (|that|) parameter for the second CALL. */
27537 + "addl $0x14, %%esp\n\t"
27538 +#else
27539 "addl $0xc, %%esp\n\t"
27540 +#endif
27541 "movl %4, %%ecx\n\t"
27542 #ifdef CFRONT_STYLE_THIS_ADJUST
27543 "movl (%%ecx), %%edx\n\t"
27544 @@ -128,31 +149,35 @@ XPTC_InvokeByIndex(nsISupports* that, PR
27545 #endif /* G++ V3 ABI */
27546 #endif
27547 "call *(%%edx)\n\t" /* safe to not cleanup esp */
27548 +#ifdef KEEP_STACK_16_BYTE_ALIGNED
27549 + "movl %3, %%esp\n\t"
27550 +#else
27551 "addl $4, %%esp\n\t"
27552 "addl %8, %%esp"
27553 +#endif
27554 : "=a" (result), /* %0 */
27555 "=c" (temp1), /* %1 */
27556 "=d" (temp2), /* %2 */
27557 - "=g" (temp3) /* %3 */
27558 +#ifdef KEEP_STACK_16_BYTE_ALIGNED
27559 + "=&g" (saved_esp) /* %3 */
27560 +#else
27561 + /* Don't waste a register, this isn't used if alignment is unimportant */
27562 + "=m" (saved_esp) /* %3 */
27563 +#endif
27564 : "g" (that), /* %4 */
27565 "g" (methodIndex), /* %5 */
27566 "1" (paramCount), /* %6 */
27567 "2" (params), /* %7 */
27568 +#ifdef KEEP_STACK_16_BYTE_ALIGNED
27569 + /* Must be in a register, it's the target of an LEA instruction */
27570 + "r" (n), /* %8 */
27571 +#else
27572 "g" (n), /* %8 */
27573 - "0" (fn_copy) /* %3 */
27574 +#endif
27575 + "0" (fn_copy) /* %9 */
27576 : "memory"
27577 -#ifdef XP_MACOSX
27578 - , "%esp"
27579 -#endif
27582 -#ifdef XP_MACOSX
27583 - __asm__ __volatile__(
27584 - "movl %0, %%esp\n\t"
27586 - : "r"(saved_esp));
27587 -#endif
27589 return result;
27591 #else
27592 diff -uprN --exclude=CVS mozilla/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h mozilla.new/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h
27593 --- mozilla/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h 2004-04-18 16:18:18.000000000 +0200
27594 +++ mozilla.new/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h 2006-02-24 11:16:39.000000000 +0100
27595 @@ -159,3 +159,11 @@
27596 #if defined(THUNK_BASED_THIS_ADJUST) && defined(CFRONT_STYLE_THIS_ADJUST)
27597 #error "need to define only ONE 'this' adjust scheme"
27598 #endif
27600 +/* Define KEEP_STACK_16_BYTE_ALIGNED if the stack needs to maintain alignment
27601 + * in a CALL for some good reason (like ABI compliance). */
27603 +#ifdef XP_MACOSX
27604 +/* http://developer.apple.com/documentation/DeveloperTools/Conceptual/LowLevelABI/Articles/IA32.html */
27605 +#define KEEP_STACK_16_BYTE_ALIGNED
27606 +#endif
27607 diff -uprN --exclude=CVS mozilla/xpcom/typelib/xpidl/Makefile.in mozilla.new/xpcom/typelib/xpidl/Makefile.in
27608 --- mozilla/xpcom/typelib/xpidl/Makefile.in 2006-01-09 06:48:52.000000000 +0100
27609 +++ mozilla.new/xpcom/typelib/xpidl/Makefile.in 2006-02-24 11:16:39.000000000 +0100
27610 @@ -54,6 +54,59 @@ HOST_PROGRAM = host_xpidl$(HOST_BIN_SUFF
27611 HOST_CSRCS = $(CSRCS)
27612 endif
27614 +ifeq ($(OS_ARCH),Darwin)
27615 +# The only reason to not always strip the SDK out is that the libraries
27616 +# in / on ppc currently aren't fat, preventing the target xpidl from linking
27617 +# on a ppc->x86 build. The SDK, presumably 10.4u, must be included in that
27618 +# case in order to successfully link. Because the target xpidl isn't
27619 +# currently built in a cross compile, though, this point is moot for the
27620 +# time being.
27622 +ifndef CROSS_COMPILE
27623 +# When doing a native build, don't build xpidl against the SDK. libIDL
27624 +# was most likely configured for the system headers, and bringing in the
27625 +# SDK's headers instead will cause problems.
27626 +_STRIP_SDK = 1
27627 +else
27629 +# Cross-compiling
27631 +# Don't build xpidl for the target. This is not intended to be a permanent
27632 +# solution. It's necessary because it is presently difficult to build
27633 +# xpidl's prerequisites (libIDL and glib) as fat and suitable for a cross.
27634 +# This will be fixed. -mm
27635 +PROGRAM=
27637 +# Since only host_xpidl will be built for now, always strip out the SDK
27638 +# (as above).
27639 +_STRIP_SDK=1
27641 +# When fat xpidl prerequisites are available, the PROGRAM= and _STRIP_SDK=1
27642 +# above are expected to disappear, and be replaced with the following
27643 +# conditonal.
27645 +# ifeq (86_powerpc,$(findstring 86,$(host_cpu))_$(TARGET_CPU))
27646 +# # When cross-compiling from x86 to ppc, an old (10.2-ish) SDK might be in
27647 +# # use, and libIDL will have been configured for new (10.4-ish) headers.
27648 +# _STRIP_SDK = 1
27649 +# endif
27651 +endif # CROSS_COMPILE
27653 +ifneq (,$(_STRIP_SDK)$(MACOS_SDK_DIR))
27654 +# libIDL is configured for the system's headers, with no SDK involved.
27655 +# There may be header conflicts if the SDK used for the Mozilla build
27656 +# is used here. There are very few specific cases where the SDK needs to
27657 +# remain set to build xpidl.
27658 +NEXT_ROOT=
27659 +OS_CFLAGS := $(shell echo $(OS_CFLAGS)|sed -E -e "s%((-I|-isystem )$(MACOS_SDK_DIR)/usr/(include|lib/gcc)[^ ]*)|-F$(MACOS_SDK_DIR)(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot $(MACOS_SDK_DIR)%%g")
27660 +OS_CFLAGS := $(patsubst -I$(MACOS_SDK_DIR)%,-I%,$(OS_CFLAGS))
27661 +OS_LIBS := $(patsubst -L$(MACOS_SDK_DIR)/usr/lib%,,$(OS_LIBS))
27662 +LDFLAGS := $(shell echo $(LDFLAGS)|sed -E -e "s%-Wl,-syslibroot,$(MACOS_SDK_DIR)%%g")
27663 +endif # _STRIP_SDK
27665 +endif # Darwin
27667 include $(topsrcdir)/config/rules.mk
27669 CFLAGS += $(LIBIDL_CFLAGS)
27670 @@ -93,14 +146,5 @@ endif
27672 endif
27674 -ifdef MACOS_SDK_DIR
27675 -# xpidl is for the build host, pull out the cross-compilation stuff
27676 -NEXT_ROOT=
27677 -OS_CFLAGS := $(shell echo $(OS_CFLAGS)|sed -E -e "s%((-I|-isystem )$(MACOS_SDK_DIR)/usr/(include|lib/gcc)[^ ]*)|-F$(MACOS_SDK_DIR)(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot $(MACOS_SDK_DIR)%%g")
27678 -OS_CFLAGS := $(patsubst -I$(MACOS_SDK_DIR)%,-I%,$(OS_CFLAGS))
27679 -OS_LIBS := $(patsubst -L$(MACOS_SDK_DIR)/usr/lib%,,$(OS_LIBS))
27680 -LDFLAGS := $(shell echo $(LDFLAGS)|sed -E -e "s%-Wl,-syslibroot,$(MACOS_SDK_DIR)%%g")
27681 -endif
27683 export::
27684 @$(MAKE) libs
27685 diff -uprN --exclude=CVS mozilla/xpfe/appshell/src/nsXULWindow.cpp mozilla.new/xpfe/appshell/src/nsXULWindow.cpp
27686 --- mozilla/xpfe/appshell/src/nsXULWindow.cpp 2005-10-21 01:18:02.000000000 +0200
27687 +++ mozilla.new/xpfe/appshell/src/nsXULWindow.cpp 2006-03-04 21:31:41.000000000 +0100
27688 @@ -857,6 +857,7 @@ NS_IMETHODIMP nsXULWindow::SetTitle(cons
27690 NS_ENSURE_STATE(mWindow);
27691 mTitle.Assign(aTitle);
27692 + mTitle.StripChars("\n\r");
27693 NS_ENSURE_SUCCESS(mWindow->SetTitle(mTitle), NS_ERROR_FAILURE);
27695 // Tell the window mediator that a title has changed
27696 diff -uprN --exclude=CVS mozilla/xpfe/bootstrap/module.ver mozilla.new/xpfe/bootstrap/module.ver
27697 --- mozilla/xpfe/bootstrap/module.ver 2005-09-19 19:43:56.000000000 +0200
27698 +++ mozilla.new/xpfe/bootstrap/module.ver 2006-02-14 10:01:36.000000000 +0100
27699 @@ -1,7 +1,7 @@
27700 WIN32_MODULE_COMPANYNAME=mozilla.org
27701 WIN32_MODULE_COPYRIGHT=©Mozilla Developers, according to the MPL 1.1/GPL 2.0/LGPL 2.1 licenses, as applicable.
27702 WIN32_MODULE_PRODUCTVERSION=1,0,0,0
27703 -WIN32_MODULE_PRODUCTVERSION_STRING=1.0b
27704 +WIN32_MODULE_PRODUCTVERSION_STRING=1.0
27705 WIN32_MODULE_TRADEMARKS=SeaMonkey and Mozilla are trademarks of The Mozilla Foundation.
27706 WIN32_MODULE_DESCRIPTION=@MOZ_APP_DISPLAYNAME@
27707 WIN32_MODULE_PRODUCTNAME=@MOZ_APP_DISPLAYNAME@
27708 diff -uprN --exclude=CVS mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp mozilla.new/xpfe/bootstrap/nsNativeAppSupportWin.cpp
27709 --- mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp 2006-01-09 06:48:57.000000000 +0100
27710 +++ mozilla.new/xpfe/bootstrap/nsNativeAppSupportWin.cpp 2006-02-14 10:01:36.000000000 +0100
27711 @@ -1936,6 +1936,10 @@ nsNativeAppSupportWin::HandleRequest( LP
27712 rv = handler->GetDefaultArgs(getter_Copies(defaultArgs));
27713 if (NS_FAILED(rv) || defaultArgs.IsEmpty()) return rv;
27715 + // force a new window for a home page group
27716 + if (FindCharInString(defaultArgs, '\n') != kNotFound)
27717 + newWindow = PR_TRUE;
27719 NS_ConvertUTF16toUTF8 url( defaultArgs );
27720 return OpenBrowserWindow(url.get(), newWindow, aResult);
27722 diff -uprN --exclude=CVS mozilla/xpfe/communicator/resources/content/contentAreaDD.js mozilla.new/xpfe/communicator/resources/content/contentAreaDD.js
27723 --- mozilla/xpfe/communicator/resources/content/contentAreaDD.js 2005-07-26 01:05:33.000000000 +0200
27724 +++ mozilla.new/xpfe/communicator/resources/content/contentAreaDD.js 2006-02-14 10:01:36.000000000 +0100
27725 @@ -60,7 +60,7 @@ var contentAreaDNDObserver = {
27726 /^\s*(javascript|data):/.test(url))
27727 return;
27729 - switch (document.firstChild.getAttribute('windowtype')) {
27730 + switch (document.documentElement.getAttribute('windowtype')) {
27731 case "navigator:browser":
27732 // Perform a security check before loading the URI
27733 nsDragAndDrop.dragDropSecurityCheck(aEvent, aDragSession, url);
27734 diff -uprN --exclude=CVS mozilla/xpfe/communicator/resources/content/contentAreaUtils.js mozilla.new/xpfe/communicator/resources/content/contentAreaUtils.js
27735 --- mozilla/xpfe/communicator/resources/content/contentAreaUtils.js 2006-01-11 23:06:12.000000000 +0100
27736 +++ mozilla.new/xpfe/communicator/resources/content/contentAreaUtils.js 2006-02-14 10:01:36.000000000 +0100
27737 @@ -96,7 +96,7 @@ function openNewWindowWith(url, sendRefe
27738 // set, then extract the current charset menu setting from the current document and use it to
27739 // initialize the new browser window...
27740 var charsetArg = null;
27741 - var wintype = document.firstChild.getAttribute('windowtype');
27742 + var wintype = document.documentElement.getAttribute('windowtype');
27743 if (wintype == "navigator:browser")
27744 charsetArg = "charset=" + window.content.document.characterSet;
27746 @@ -165,7 +165,7 @@ function openNewTabWith(url, sendReferre
27748 // As in openNewWindowWith(), we want to pass the charset of the
27749 // current document over to a new tab.
27750 - var wintype = browserDocument.firstChild.getAttribute('windowtype');
27751 + var wintype = browserDocument.documentElement.getAttribute('windowtype');
27752 var originCharset;
27753 if (wintype == "navigator:browser") {
27754 originCharset = window.content.document.characterSet;
27755 diff -uprN --exclude=CVS mozilla/xpfe/communicator/resources/locale/en-US/region.properties mozilla.new/xpfe/communicator/resources/locale/en-US/region.properties
27756 --- mozilla/xpfe/communicator/resources/locale/en-US/region.properties 2005-06-19 21:48:21.000000000 +0200
27757 +++ mozilla.new/xpfe/communicator/resources/locale/en-US/region.properties 2006-02-14 10:01:37.000000000 +0100
27758 @@ -7,4 +7,4 @@ browser.search.defaultenginename=Google
27759 intl.content.langcode=en-US
27761 # update notifications: new update page
27762 -update_notifications.provider.0.datasource=
27763 +update_notifications.provider.0.datasource=http://www.mozilla.org/projects/seamonkey/releases/updates/en-US.rdf
27764 diff -uprN --exclude=CVS mozilla/xpfe/components/prefwindow/resources/locale/en-US/pref-smart_browsing.dtd mozilla.new/xpfe/components/prefwindow/resources/locale/en-US/pref-smart_browsing.dtd
27765 --- mozilla/xpfe/components/prefwindow/resources/locale/en-US/pref-smart_browsing.dtd 2005-05-02 13:05:42.000000000 +0200
27766 +++ mozilla.new/xpfe/components/prefwindow/resources/locale/en-US/pref-smart_browsing.dtd 2006-02-14 10:01:37.000000000 +0100
27767 @@ -5,7 +5,7 @@
27769 <!--LOCALIZATION NOTE (internetKeywordsHeader.label): DONT_TRANSLATE -->
27770 <!ENTITY internetKeywordsHeader.label "Internet Keywords">
27771 -<!ENTITY internetKeywordsDescription.label "&brandShortName; Internet Keywords enables fast access to services such as stock quotes, search and other information from the Location bar.">
27772 +<!ENTITY internetKeywordsDescription.label "Internet Keywords enable fast access to services such as stock quotes, search and other information from the Location bar.">
27773 <!ENTITY moreInformation.label "More Information...">
27774 <!ENTITY moreInformation.accesskey "M">
27775 <!--LOCALIZATION NOTE (enableKeyCheck.label): Do not translate 'Internet Keywords' -->
27776 diff -uprN --exclude=CVS mozilla/xpfe/components/prefwindow/resources/locale/en-US/pref-smartupdate.dtd mozilla.new/xpfe/components/prefwindow/resources/locale/en-US/pref-smartupdate.dtd
27777 --- mozilla/xpfe/components/prefwindow/resources/locale/en-US/pref-smartupdate.dtd 2005-05-02 13:05:42.000000000 +0200
27778 +++ mozilla.new/xpfe/components/prefwindow/resources/locale/en-US/pref-smartupdate.dtd 2006-02-14 10:01:37.000000000 +0100
27779 @@ -1,7 +1,7 @@
27780 <!--LOCALIZATION NOTE : FILE UI for Software Updates prefs -->
27781 <!ENTITY pref.smartUpdate.title "Software Installation">
27782 <!ENTITY smartTitle.label "Manage Software Installations and Updates">
27783 -<!ENTITY enableSU.label "Enable software installation. (You will be prompted for each update.)">
27784 +<!ENTITY enableSU.label "Enable software installation. (You will be prompted before each update.)">
27786 <!ENTITY enableSU.accesskey "e">
27787 <!ENTITY enableNotification.label "Notify me when new and updated software is available">
27788 diff -uprN --exclude=CVS mozilla/xpfe/components/search/src/nsInternetSearchService.cpp mozilla.new/xpfe/components/search/src/nsInternetSearchService.cpp
27789 --- mozilla/xpfe/components/search/src/nsInternetSearchService.cpp 2005-10-17 19:37:24.000000000 +0200
27790 +++ mozilla.new/xpfe/components/search/src/nsInternetSearchService.cpp 2006-02-24 11:16:49.000000000 +0100
27791 @@ -654,44 +654,41 @@ InternetSearchDataSource::GetSearchEngin
27792 if (NS_FAILED(rv = mUpdateArray->Count(&numEngines))) return(rv);
27793 if (numEngines < 1) return(NS_OK);
27795 - nsCOMPtr<nsISupports> isupports = mUpdateArray->ElementAt(0);
27796 + nsCOMPtr<nsIRDFResource> aRes (do_QueryElementAt(mUpdateArray, 0));
27798 // note: important to remove element from array
27799 mUpdateArray->RemoveElementAt(0);
27800 - if (isupports)
27802 + if (aRes)
27804 - nsCOMPtr<nsIRDFResource> aRes (do_QueryInterface(isupports));
27805 - if (aRes)
27806 + if (isSearchCategoryEngineURI(aRes))
27808 - if (isSearchCategoryEngineURI(aRes))
27810 - nsCOMPtr<nsIRDFResource> trueEngine;
27811 - rv = resolveSearchCategoryEngineURI(aRes, getter_AddRefs(trueEngine));
27812 - if (NS_FAILED(rv) || (rv == NS_RDF_NO_VALUE)) return(rv);
27813 - if (!trueEngine) return(NS_RDF_NO_VALUE);
27814 + nsCOMPtr<nsIRDFResource> trueEngine;
27815 + rv = resolveSearchCategoryEngineURI(aRes, getter_AddRefs(trueEngine));
27816 + if (NS_FAILED(rv) || (rv == NS_RDF_NO_VALUE)) return(rv);
27817 + if (!trueEngine) return(NS_RDF_NO_VALUE);
27819 - aRes = trueEngine;
27821 + aRes = trueEngine;
27824 - if (!aRes) return(NS_OK);
27825 + if (!aRes) return(NS_OK);
27827 - *theEngine = aRes.get();
27828 - NS_ADDREF(*theEngine);
27829 + *theEngine = aRes.get();
27830 + NS_ADDREF(*theEngine);
27832 - // get update URL
27833 - nsCOMPtr<nsIRDFNode> aNode;
27834 - if (NS_SUCCEEDED(rv = mInner->GetTarget(aRes, kNC_Update, PR_TRUE, getter_AddRefs(aNode)))
27835 + // get update URL
27836 + nsCOMPtr<nsIRDFNode> aNode;
27837 + if (NS_SUCCEEDED(rv = mInner->GetTarget(aRes, kNC_Update, PR_TRUE, getter_AddRefs(aNode)))
27838 && (rv != NS_RDF_NO_VALUE))
27840 + nsCOMPtr<nsIRDFLiteral> aLiteral (do_QueryInterface(aNode));
27841 + if (aLiteral)
27843 - nsCOMPtr<nsIRDFLiteral> aLiteral (do_QueryInterface(aNode));
27844 - if (aLiteral)
27845 + const PRUnichar *updateUni = nsnull;
27846 + aLiteral->GetValueConst(&updateUni);
27847 + if (updateUni)
27849 - const PRUnichar *updateUni = nsnull;
27850 - aLiteral->GetValueConst(&updateUni);
27851 - if (updateUni)
27853 - updateURL.AssignWithConversion(updateUni);
27855 + updateURL.AssignWithConversion(updateUni);
27859 @@ -2225,9 +2222,7 @@ InternetSearchDataSource::filterSite(nsI
27860 if (NS_FAILED(rv = array->Count(&count))) return(rv);
27861 for (PRUint32 loop=0; loop<count; loop++)
27863 - nsCOMPtr<nsISupports> element = array->ElementAt(loop);
27864 - if (!element) break;
27865 - nsCOMPtr<nsIRDFResource> aSearchRoot (do_QueryInterface(element));
27866 + nsCOMPtr<nsIRDFResource> aSearchRoot (do_QueryElementAt(array, loop));
27867 if (!aSearchRoot) break;
27869 if (NS_SUCCEEDED(rv = mInner->GetTargets(aSearchRoot, kNC_Child,
27870 @@ -2392,9 +2387,7 @@ InternetSearchDataSource::DoCommand(nsIS
27872 for (loop=((PRInt32)numSources)-1; loop>=0; loop--)
27874 - nsCOMPtr<nsISupports> aSource = aSources->ElementAt(loop);
27875 - if (!aSource) return(NS_ERROR_NULL_POINTER);
27876 - nsCOMPtr<nsIRDFResource> src (do_QueryInterface(aSource));
27877 + nsCOMPtr<nsIRDFResource> src (do_QueryElementAt(aSources, loop));
27878 if (!src) return(NS_ERROR_NO_INTERFACE);
27880 if (aCommand == kNC_SearchCommand_AddToBookmarks)
27881 @@ -4065,7 +4058,7 @@ InternetSearchDataSource::DoSearch(nsIRD
27882 if (input.IsEmpty()) return(NS_ERROR_UNEXPECTED);
27884 // HTTP Get method support
27885 - action += NS_LITERAL_STRING("?") + input;
27886 + action += input;
27889 nsCOMPtr<nsIInternetSearchContext> context;
27890 diff -uprN --exclude=CVS mozilla/xpfe/components/shistory/src/nsSHistory.cpp mozilla.new/xpfe/components/shistory/src/nsSHistory.cpp
27891 --- mozilla/xpfe/components/shistory/src/nsSHistory.cpp 2005-09-30 04:14:22.000000000 +0200
27892 +++ mozilla.new/xpfe/components/shistory/src/nsSHistory.cpp 2006-02-24 11:16:49.000000000 +0100
27893 @@ -304,8 +304,14 @@ nsSHistory::AddEntry(nsISHEntry * aSHEnt
27894 nsCOMPtr<nsIURI> uri;
27895 nsCOMPtr<nsIHistoryEntry> hEntry(do_QueryInterface(aSHEntry));
27896 if (hEntry) {
27897 + PRInt32 currentIndex = mIndex;
27898 hEntry->GetURI(getter_AddRefs(uri));
27899 listener->OnHistoryNewEntry(uri);
27901 + // If a listener has changed mIndex, we need to get currentTxn again,
27902 + // otherwise we'll be left at an inconsistent state (see bug 320742)
27903 + if (currentIndex != mIndex)
27904 + GetTransactionAtIndex(mIndex, getter_AddRefs(currentTxn));
27908 @@ -324,7 +330,7 @@ nsSHistory::AddEntry(nsISHEntry * aSHEnt
27909 if(!mListRoot)
27910 mListRoot = txn;
27912 - //Purge History list if it is too long
27913 + // Purge History list if it is too long
27914 if ((gHistoryMaxSize >= 0) && (mLength > gHistoryMaxSize))
27915 PurgeHistory(mLength-gHistoryMaxSize);
27917 diff -uprN --exclude=CVS mozilla/xpfe/components/sidebar/resources/sidebarOverlay.js mozilla.new/xpfe/components/sidebar/resources/sidebarOverlay.js
27918 --- mozilla/xpfe/components/sidebar/resources/sidebarOverlay.js 2005-06-16 14:58:13.000000000 +0200
27919 +++ mozilla.new/xpfe/components/sidebar/resources/sidebarOverlay.js 2006-02-14 10:01:37.000000000 +0100
27920 @@ -747,7 +747,7 @@ function sidebar_overlay_init() {
27921 sidebarObj.master_datasources = get_remote_datasource_url();
27922 sidebarObj.master_datasources += " chrome://communicator/content/sidebar/local-panels.rdf";
27923 sidebarObj.master_resource = 'urn:sidebar:master-panel-list';
27924 - sidebarObj.component = document.firstChild.getAttribute('windowtype');
27925 + sidebarObj.component = document.documentElement.getAttribute('windowtype');
27926 debug("sidebarObj.component is " + sidebarObj.component);
27928 // Initialize the display
27929 diff -uprN --exclude=CVS mozilla/xpfe/global/resources/content/about.xhtml mozilla.new/xpfe/global/resources/content/about.xhtml
27930 --- mozilla/xpfe/global/resources/content/about.xhtml 2006-01-23 08:55:16.000000000 +0100
27931 +++ mozilla.new/xpfe/global/resources/content/about.xhtml 2006-03-12 20:04:23.000000000 +0100
27932 @@ -103,7 +103,7 @@ h1 {
27933 <ul>
27934 <li>Copyright &copy; 1998&ndash;2006 by <a href="about:credits">Contributors</a> to
27935 the Mozilla codebase under the <a href="about:license">Mozilla Public License
27936 -and Netscape Public License</a>. All Rights Reserved.</li>
27937 +and other licenses</a>. All Rights Reserved.</li>
27939 <li>Portions of this software are copyright &copy; 1994 The Regents of the
27940 University of California. All Rights Reserved.</li>
27941 diff -uprN --exclude=CVS mozilla/xpfe/global/resources/content/bindings/tabbrowser.xml mozilla.new/xpfe/global/resources/content/bindings/tabbrowser.xml
27942 --- mozilla/xpfe/global/resources/content/bindings/tabbrowser.xml 2006-01-23 08:55:17.000000000 +0100
27943 +++ mozilla.new/xpfe/global/resources/content/bindings/tabbrowser.xml 2006-02-14 10:01:37.000000000 +0100
27944 @@ -594,10 +594,15 @@
27945 this.mCurrentBrowser.focusedElement = document.commandDispatcher.focusedElement;
27948 - if (this.mCurrentBrowser.focusedElement) {
27949 + if (this.mCurrentBrowser.focusedElement instanceof NSHTMLElement ||
27950 + this.mCurrentBrowser.focusedElement instanceof XULElement) {
27951 // Clear focus outline before we draw on top of it
27952 this.mCurrentBrowser.focusedElement.blur();
27954 + else {
27955 + // non-HTML/XUL elements have no blur method, see bug 323806
27956 + this.mCurrentBrowser.focusedElement = null;
27958 this.mCurrentBrowser.setAttribute("type", "content");
27961 @@ -1360,16 +1365,22 @@
27962 <parameter name="aDestIndex"/>
27963 <body>
27964 <![CDATA[
27965 + // for compatibility with extensions
27966 + if (typeof(aSrcIndex) != "number")
27967 + aSrcIndex = this.getTabIndex(aSrcIndex);
27969 this.mTabFilters.splice(aDestIndex, 0, this.mTabFilters.splice(aSrcIndex, 1)[0]);
27970 this.mTabListeners.splice(aDestIndex, 0, this.mTabListeners.splice(aSrcIndex, 1)[0]);
27972 - aDestIndex = aDestIndex < aSrcIndex ? aDestIndex : aDestIndex + 1;
27973 this.mCurrentTab.selected = false;
27974 - if (aDestIndex == this.mTabs.length)
27975 - this.mTabContainer.appendChild(this.mTabs[aSrcIndex]);
27976 - else
27977 - this.mTabContainer.insertBefore(this.mTabs[aSrcIndex], this.mTabs[aDestIndex]);
27979 + if (aDestIndex >= aSrcIndex)
27980 + ++aDestIndex;
27981 + var tab = this.mTabContainer.insertBefore(this.mTabs[aSrcIndex], this.mTabs.item(aDestIndex));
27983 this.mCurrentTab.selected = true;
27985 + return tab;
27987 </body>
27988 </method>
27989 @@ -1500,11 +1511,12 @@
27992 if (i < oldCount) {
27993 + var firstTab = this.mTabContainer.firstChild;
27994 var browserData = {
27995 - sessionHistory : this.mPanelContainer.firstChild.sessionHistory
27996 + sessionHistory : firstTab.linkedBrowser.sessionHistory
27998 oldBrowserGroup.push(browserData);
27999 - this.removeTab(this.mTabContainer.firstChild);
28000 + this.removeTab(firstTab);
28003 return oldBrowserGroup;
28004 diff -uprN --exclude=CVS mozilla/xpfe/global/resources/content/charsetOverlay.js mozilla.new/xpfe/global/resources/content/charsetOverlay.js
28005 --- mozilla/xpfe/global/resources/content/charsetOverlay.js 2005-07-26 00:09:39.000000000 +0200
28006 +++ mozilla.new/xpfe/global/resources/content/charsetOverlay.js 2006-02-14 10:01:37.000000000 +0100
28007 @@ -278,7 +278,7 @@ function mailCharsetLoadListener (event)
28011 -var wintype = document.firstChild.getAttribute('windowtype');
28012 +var wintype = document.documentElement.getAttribute('windowtype');
28013 if (window && (wintype == "navigator:browser"))
28015 var contentArea = window.document.getElementById("appcontent");
28016 diff -uprN --exclude=CVS mozilla/xpfe/global/resources/locale/en-US/builtinURLs.rdf mozilla.new/xpfe/global/resources/locale/en-US/builtinURLs.rdf
28017 --- mozilla/xpfe/global/resources/locale/en-US/builtinURLs.rdf 2004-04-17 18:51:38.000000000 +0200
28018 +++ mozilla.new/xpfe/global/resources/locale/en-US/builtinURLs.rdf 2006-02-14 10:01:37.000000000 +0100
28019 @@ -58,7 +58,7 @@
28021 <RDF:Description about='urn:clienturl:viewmenu:intlwebcontent'>
28022 <NC:title>International Languages and Web Content</NC:title>
28023 - <NC:content>http://www.mozilla.org/projects/l10n/mlp_status.html#contrib</NC:content>
28024 + <NC:content>http://www.mozilla.org/projects/seamonkey/releases/#l10n</NC:content>
28025 </RDF:Description>
28027 <!-- Composer -->
28028 diff -uprN --exclude=CVS mozilla/xpinstall/packager/Makefile.in mozilla.new/xpinstall/packager/Makefile.in
28029 --- mozilla/xpinstall/packager/Makefile.in 2005-07-02 22:39:08.000000000 +0200
28030 +++ mozilla.new/xpinstall/packager/Makefile.in 2006-02-24 11:16:39.000000000 +0100
28031 @@ -60,6 +60,7 @@ PLATFORM_EXCLUDE_LIST = ! -name "*.ico"
28032 endif
28034 NO_PKG_FILES = \
28035 + $(MOZ_APP_NAME)-config \
28036 $(NULL)
28038 include $(topsrcdir)/config/rules.mk
28039 diff -uprN --exclude=CVS mozilla/xpinstall/src/nsXPITriggerInfo.cpp mozilla.new/xpinstall/src/nsXPITriggerInfo.cpp
28040 --- mozilla/xpinstall/src/nsXPITriggerInfo.cpp 2005-08-26 09:12:58.000000000 +0200
28041 +++ mozilla.new/xpinstall/src/nsXPITriggerInfo.cpp 2006-02-24 11:16:39.000000000 +0100
28042 @@ -257,6 +257,13 @@ static void* handleTriggerEvent(XPITrigg
28043 event->status );
28044 if ( args )
28046 + // This code is all in a JS request, and here we're about to
28047 + // push the context onto the context stack and also push
28048 + // arguments. Be very very sure that no early returns creep in
28049 + // here w/o doing the proper cleanup!
28051 + const char *errorStr = nsnull;
28053 nsCOMPtr<nsIJSContextStack> stack =
28054 do_GetService("@mozilla.org/js/xpc/ContextStack;1");
28055 if (stack)
28056 @@ -267,33 +274,43 @@ static void* handleTriggerEvent(XPITrigg
28058 if (!secman)
28060 - JS_ReportError(event->cx, "Could not get script security manager service");
28061 - return 0;
28062 + errorStr = "Could not get script security manager service";
28065 nsCOMPtr<nsIPrincipal> principal;
28066 - secman->GetSubjectPrincipal(getter_AddRefs(principal));
28067 - if (!principal)
28068 + if (!errorStr)
28070 - JS_ReportError(event->cx, "Could not get principal from script security manager");
28071 - return 0;
28072 + secman->GetSubjectPrincipal(getter_AddRefs(principal));
28073 + if (!principal)
28075 + errorStr = "Could not get principal from script security manager";
28079 - PRBool equals = PR_FALSE;
28080 - principal->Equals(event->princ, &equals);
28082 - if (!equals)
28083 + if (!errorStr)
28085 - JS_ReportError(event->cx, "Principal of callback context is different then InstallTriggers");
28086 - return 0;
28087 + PRBool equals = PR_FALSE;
28088 + principal->Equals(event->princ, &equals);
28090 + if (!equals)
28092 + errorStr = "Principal of callback context is different than InstallTriggers";
28096 - JS_CallFunctionValue( event->cx,
28097 - JSVAL_TO_OBJECT(event->global),
28098 - event->cbval,
28099 - 2,
28100 - args,
28101 - &ret );
28102 + if (errorStr)
28104 + JS_ReportError(event->cx, errorStr);
28106 + else
28108 + JS_CallFunctionValue(event->cx,
28109 + JSVAL_TO_OBJECT(event->global),
28110 + event->cbval,
28111 + 2,
28112 + args,
28113 + &ret);
28116 if (stack)
28117 stack->Pop(nsnull);
28118 diff -uprN --exclude=CVS mozilla/xulrunner/setup/nsXULAppInstall.js mozilla.new/xulrunner/setup/nsXULAppInstall.js
28119 --- mozilla/xulrunner/setup/nsXULAppInstall.js 2005-10-27 21:11:14.000000000 +0200
28120 +++ mozilla.new/xulrunner/setup/nsXULAppInstall.js 2006-03-03 07:11:44.000000000 +0100
28121 @@ -247,7 +247,8 @@ const AppInstall = {
28122 aDirectory = Components.classes["@mozilla.org/file/local;1"].
28123 createInstance(nsILocalFile);
28124 aDirectory.initWithPath("/usr/lib");
28125 - aDirectory.append(vendor.toLowerCase());
28126 + if (vendor)
28127 + aDirectory.append(vendor.toLowerCase());
28128 #endif
28129 #endif