There's a subtle change to the register file's internal layout: for
global code / the global object, registerOffset is always 0 now. In
other words, all register counting starts at 0, not 0 + (number of
global variables). The helps simplify accounting when the number of
global variables changes.

Initial support for exceptions in SquirrelFish, only supports finalisers in the
simple cases (eg. exceptions and non-goto/return across finaliser boundaries).
This doesn't add the required exception checks to existing code, it merely adds
support for throw, catch, and the required stack unwinding.

bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::canGetItemsForName):
(WebCore::JSStorage::nameGetter): If the property doesn't exist on the object, call through to getItem()
(WebCore::JSStorage::customPut): If the property doesn't exist on the object, call through to setItem()

loader/FrameLoader.cpp:
(WebCore::FrameLoader::createWindow): After a new page has been created, set its SessionStorage object
to a copy of the previous Page's

page/DOMWindow.cpp:
(WebCore::DOMWindow::sessionStorage): Accessor to pull the appropriate OriginStorage out of the Page's
SessionStorage.
(WebCore::DOMWindow::localStorage): To be filled in later

page/DOMWindow.h:
(WebCore::DOMWindow::optionalSessionStorage): Return the session Storage object for this window to mark,
if any exists

page/DOMWindow.idl:

page/Page.cpp:
(WebCore::Page::sessionStorage): Create and/or return the SessionStorage for this Page.
(WebCore::Page::setSessionStorage): Set the SessionStorage for this Page - used in FrameLoader after a
Window.open();

page/Page.h:

storage/OriginStorage.cpp: Intermediate layer between individual Storage objects, and shared StorageMap
objects. There is one OriginStorage object per SecurityOrigin in each "unique set of storage areas", such
as the SessionStorage. This layer forwards DOM-level calls down to the backing StorageMap, handles
copy-on-write along with the StorageMap, fires StorageEvents to the DOM when a value is changed, and will
eventually handle quota enforcement.
(WebCore::OriginStorage::create):
(WebCore::OriginStorage::OriginStorage):
(WebCore::OriginStorage::~OriginStorage):
(WebCore::OriginStorage::copy):
(WebCore::OriginStorage::length):
(WebCore::OriginStorage::key):
(WebCore::OriginStorage::getItem):
(WebCore::OriginStorage::setItem):
(WebCore::OriginStorage::removeItem):
(WebCore::OriginStorage::contains):
(WebCore::OriginStorage::dispatchStorageEvent):

storage/OriginStorage.h:

storage/SessionStorage.cpp: From the HTML5 spec:
"Each top-level browsing context has a unique set of session storage areas, one for each origin."
This object represents that "unique set of session storage areas", and creates or returns the Storage
object for the requested SecurityOrigin
(WebCore::SessionStorage::create):
(WebCore::SessionStorage::SessionStorage):
(WebCore::SessionStorage::copy):
(WebCore::SessionStorage::originStorage):

storage/StorageMap.cpp: The physical map of key/value pairs that is shared between OriginStorage objects,
and implements copy-on-write semantics whenever a value is changed
(WebCore::StorageMap::create):
(WebCore::StorageMap::StorageMap):
(WebCore::StorageMap::copy):
(WebCore::StorageMap::invalidateIterator): Used to support the key(unsigned i) part of the API
(WebCore::StorageMap::setIteratorToIndex): Ditto
(WebCore::StorageMap::length):
(WebCore::StorageMap::key):
(WebCore::StorageMap::getItem):
(WebCore::StorageMap::setItem):
(WebCore::StorageMap::removeItem):
(WebCore::StorageMap::contains):

platform/mac/WebFontCache.mm:
(+[WebFontCache internalFontWithFamily:traits:weight:size:]): Changed to
match by family name first, and only if that fails, look for a match by
full (PostScript) name. Reverted the full name-based match logic to only
distinguish between the broad categories of "bold" and "not bold".

kjs/identifier.cpp:
(KJS::CStringTranslator::translate):
(KJS::UCharBufferTranslator::translate):
Use "true" for a boolean value instead of 1, because it's C++.

kjs/ustring.h:
(KJS::CString::adopt): Added a method to create from a char* buffer without copying.
(KJS::UString::Rep::ref): Removed an assertion for JSLock::lockCount, as it's no longer
necessary to hold JSLock when working with strings.
(KJS::UString::Rep::deref): Ditto.
(KJS::UString::Rep::isStatic): Added a field to quickly determine that this is an empty
or null static string.

kjs/ustring.cpp:
(KJS::): Removed normalStatBufferSize and statBufferSize, as there is no reason to have such
an advanced implementation of a debug-only ascii() method. Removed a long-obsolete comment
about UChar.
(KJS::UString::Rep::createCopying): Removed an assertion for JSLock::lockCount.
(KJS::UString::Rep::create): Ditto.
(KJS::UString::Rep::destroy): Ditto. Do not do anything for static null and empty strings,
as refcounting is not reliable for those. Reordered branches for a noticeable speed gain -
apparently this functiton is hot enough for SunSpider to see an effect from this!
(KJS::UString::null): Moved a star, added a comment.
(KJS::UString::cstring): Reimplemented to not call ascii(), which is not thread-safe.
(KJS::UString::ascii): Simplified statBuffer handling logic.
(KJS::UString::toDouble): Use cstring() instead of ascii().

First step toward supporting re-entrant evaluation: Switch register
clients from using "registers", a pointer to a register vector, to
"registerBase", an indirect pointer to the logical first entry in the
register file. (The logical first entry is the first entry that is not
a global variable).

With a vector, offsets into the register file remain good when the
underlying buffer reallocates, but they go bad when the logical
first entry moves. (The logical first entry moves when new global
variables get added to the beginning of the register file.) With an
indirect pointer to the logical first entry, offsets will remain good
regardless.

1.4% speedup on sunspider --squirrelfish. I suspect this is due to
reduced allocation when creating closures, and reduced indirection
through the register vector.

wtf/Vector.h: Added an accessor for an indirect pointer to the vector's
buffer, which we currently use (incorrectly) for registerBase. This is
temporary scaffolding to allow us to change client code without
changing behavior.

Support for evaluating multiple scripts in the same global environment.
(Still don't support re-entrant evaluation yet.)

The main changes here are:

(1) Obey the ECMA 10.1.3 rules regarding how to resolve collisions when
a given symbol is declared more than once. (This patch fixes the same
issue for function code, too.)

(2) In the case of var and/or function collisions, reuse the existing
storage slot. For global code, this is required for previously
generated instructions to continue to work. For function code, it's
more of a "nice to have": it makes register layout in the case of
collisions easier to understand, and has the added benefit of saving
memory.

(3) Allocate slots in the CodeGenerator's m_locals vector in parallel
to register indexes in the symbol table. This ensures that, given an
index in the symbol table, we can find the corresponding RegisterID
without hashing, which speeds up codegen.

I moved responsibility for emitting var and function initialization
instructions into the CodeGenerator, because bookkeeping in cases where
var, function, and/or parameter names collide requires a lot of
internal knowledge about the CodeGenerator.

VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addVar): Removed responsibility for checking whether
a var declaration overwrites "arguments", because the check is
inappropriate for global code, which may not have a pre-existing
"arguments" symbol in scope. Also changed this function to return a
boolean indicating whether addVar actually created a new RegisterID,
or just reused an old one.

(KJS::CodeGenerator::CodeGenerator): Split out the constructors for
function code and global code, since they're quite different now.

(KJS::CodeGenerator::registerForLocal): This function does its job
without any hashing now.

VM/Machine.cpp: Move old globals and update "r" before executing a
new script. That way, old globals stay at a constant offset from "r",
and previously optimized code still works.

VM/RegisterID.h: Added the ability to allocate a RegisterID before
initializing its index field. We use this for parameters now.

kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet): Changed the ungettable getter
ASSERT to account for the fact that symbol indexes are all negative.

​http://bugs.webkit.org/show_bug.cgi?id=17129
Incorrect style resolution in CSS styled SVG, with multiple style sheets
Fix the style resolution on the svg by ensuring xml-stylesheet pseudo
attributes title and alternate are transferred to the stylesheet
created from the ProcessingInstruction.

rendering/RenderTable.cpp:
(WebCore::RenderTable::layout): Changed the first pass over the sections
to only call calcRowHeight() and recalcOuterBorder() but not
layoutRows(), because the section's final height is unknown yet.
Removed caching of m_height before the call to calcHeight(), because
for non-positioned tables, calcHeight() only calculates the vertical
margins and does not change m_height.
Added a second pass over the sections, after the table height is known,
to call layoutRows() on each section, with additional height if needed.
Did minimal cleanup including caching the value of collapseBorders() in
a local variable and changing a while loop into a for loop.

rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::calcRowHeight): Changed to return the
height of the section based on row height calculations.
(WebCore::RenderTableSection::layoutRows): Removed a call to
recalcOuterBorder(), which is now done by RenderTable::layout().

rendering/RenderTableSection.h: Changed calcRowHeight() to have a
return value.

LayoutTests:

Reviewed by Darin Adler.

repaint test for <rdar://problem/5843719> Excessive repainting of cells in tables with non-auto height

css/CSSFontSelector.cpp:
(WebCore::fontDataForGenericFamily): Factored out of getFontData().
(WebCore::CSSFontSelector::getFontData): Changed to call
fontDataForGenericFamily() directly if the map is empty.

Restore the user entered text when clearing the auto-completion.
This is important when the user typed text that is a different
case than the completion. This has no affect on the Console, since
it matches completions case-sensitively. This is used in the up-coming
Database Query view for words like "SELECT" and "INSERT".

Reviewed by Adam Roben.

page/inspector/TextPrompt.js:

(WebInspector.TextPrompt.prototype.clearAutoComplete): Restore the user typed
text in the original DOM range that complete() saved away.
(WebInspector.TextPrompt.prototype.complete): Store away the fullWordRange
and it's text content so clearAutoComplete can restore it.

Factor out the Console text completion and command history into
a new TextPrompt object. This TextPrompt object will be used later
other parts of the Inspector that need text completion and history.
Not functionality changed, just moved code around.

Reviewed by Adam Roben.

WebCore.vcproj/WebCore.vcproj: Add TextPrompt.js.

page/inspector/Console.js: Call the new prompt object and
delete all the code that moved.

Improve the background size heuristic for SVGs used as background images with no intrinsic size specified.
Treat them as having a background-size of 100%. This means their maximal size will be the box established
by background-origin.

<rdar://problem/5830598> Image file opened in the browser window shows "Localized String Not Found' in window's title bar instead file name
Save WebCoreLocalizedStrings.cpp with UTF8 encoding.
Changed the format string to take in integers.

css/CSSFontSelector.cpp:
(WebCore::hashForFont): Changed the bold parameter into a weight
parameter and added the weight to the string to be hashed.
(WebCore::CSSFontSelector::addFontFaceRule): Changed to apply all CSS
weight values to the font description.
(WebCore::CSSFontSelector::getFontData): Updated the fallback logic to
go through all weights equal or lighter from the desired weight. For
SVG, to also consider heavier weights.

css/CSSParser.cpp:
(WebCore::CSSParser::parseValue): Cleaned up parsing of the font-weight
property.

css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty): Changed to apply all CSS
weight values to the font description.

platform/graphics/Font.h:
(WebCore::Font::weight): Updated for the change to
FontDescription::weight().

platform/graphics/FontCache.cpp:
(WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey): Replaced
the bold component of the key with a weight component.
(WebCore::FontPlatformDataCacheKey::operator==): Updated for the above.
(WebCore::computeHash): Ditto.
(WebCore::FontPlatformDataCacheKeyTraits::deletedValue): Removed
unnecessary parameters.
(WebCore::FontPlatformDataCacheKeyTraits::emptyValue): Ditto.
(WebCore::FontCache::getCachedFontPlatformData): Updated for the change
in FontPlatformDataCacheKey.

platform/graphics/FontDescription.cpp: Added.
(WebCore::FontDescription::lighterWeight): Added. Returns a lighter CSS
font-weight value if there is one, or the lightest value.
(WebCore::FontDescription::bolderWeight): Added. Returns a heavier CSS
font-weight value if there is one, or the heaviest value.

platform/graphics/mac/FontCacheMac.mm:
(WebCore::toAppKitFontWeight): Added. Maps a FontWeight to the AppKit
font weight scale of 0-15.
(WebCore::isAppKitFontWeightBold): Added.
(WebCore::FontCache::getFontDataForCharacters): Changed to use a weight
instead of the bold trait for custom fonts, and to decide whether to
synthesize bold based on the weights rather than the bold trait.
(WebCore::FontCache::fontExists): Updated for the change in
WebFontCache .
(WebCore::FontCache::createFontPlatformData): Ditto. Also changed to
decide whether to synthesize bold based on the weights rather than on
the bold trait.

platform/graphics/win/FontCacheWin.cpp:
(WebCore::toGDIFontWeight): Added. Maps a FontWeight to a GDI font
weight constant.
(WebCore::isGDIFontWeightBold): Added.
(WebCore::adjustedGDIFontWeight): Added.
(WebCore::MatchImprovingProcData::MatchImprovingProcData): Added this
data structure for use by the following callback.
(WebCore::matchImprovingEnumProc): Added. The logic of this method is a
simplification of the betterChoice() predicate in WebFontCache.mm, which
considers only the italic trait and the weight.
(WebCore::createGDIFont): Added. Similarly to
+[WebFontCache fontWithFamily:traits:weight:size:], this function
finds the closest match in the family for the desired italic bit and
weight.
(WebCore::FontCache::fontExists): Changed to call createGDIFont().
(WebCore::FontCache::createFontPlatformData): Ditto. Also changed to
compute the synthetic bold and synthetic italic flags based on weights
and italic bits and pass them to the FontPlatformData constructor.

platform/graphics/win/FontPlatformDataWin.cpp:
(WebCore::FontPlatformData::FontPlatformData): Changed the bold and
oblique parameters to mean whether these should be synthesized and
removed the font enumeration code that used to decide that.

platform/graphics/win/SimpleFontDataWin.cpp:
(WebCore::SimpleFontData::smallCapsFontData): Changed to pass the
synthetic bold and oblique flags from the full-size FontPlatformData to
the FontPlatformData constructor for the small caps font.

platform/mac/WebCoreTextRenderer.h:

platform/mac/WebCoreTextRenderer.mm:
(WebCoreFindFont): Added a weight parameter, which is passed to
+[WebFontCache fontWithFamily:traits:weight:size:].

platform/mac/WebFontCache.h:

platform/mac/WebFontCache.mm:
(acceptableChoice):
(betterChoice): Changed to ignore the bold trait. Changed the logic for
deciding based on weights to prefer the font whose weight is closer to
the desired one, or, if both candidates' weights are the same distance
from the desired weight, the one that is more "off-center".
(+[WebFontCache internalFontWithFamily:traits:weight:size:]): Changed to
check for weight when matching by full name. Changed to pass
the actual desired weight instead of the constant 5 to
acceptableChoice() and betterChoice(). Changed to use weights to decide
whether to synthesize bold.
(+[WebFontCache fontWithFamily:traits:weight:size:]): Added a weight
parameter, which is passed to the internal method.

platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenu::paint): Updated for the change to FontDescription.

<rdar://problem/5835382> Calling window.open immediately after window.close can sometimes result in no window being created

Group name tracking needs to happen using code in WebCore::Page, since it is more involved than
just setting a string.

Reviewed by Adam Roben.

WebView.cpp:
(WebView::close): Add null check (found via code inspection).
(WebView::initWithFrame): Store the group name directly in Page.
(WebView::setGroupName): Store the group name directly in Page.
(WebView::groupName): Retrieve the group name directly from Page.

Safari is using the IconDatabase the following way (assumption). Before they
call iconDatabase()->open they "retain" all URLs they are interested in, these
could come from the history.

When opening the iconDatabase() a thread will be started that is going to import
the URLs, all none manually retained URLs are scheduled for removal. The removal
is going to happen when the next icon gets stored in the database.

We do not have any IconDatabase code, we can not retain the URLs before opening the
database. To disable the automatic pruning of the icons we will ask the IconDatabase
to delay this operation. This means our IconDatabase, when used, will grow, so we should
try to have a IconDatabase class in 4.4.

The only way to counter the growth is a call to QWebSettings::clearIconDatabase

To match the mac-port we would have to return IgnoreNavigationRequest for
schemes/URLs not supported by the QNetworkAccessManager in QWebPage::navigationRequested
but we can't do that because QNetworkAccessManager does not expose a list of supported
schemes and operations. So in contrast to the mac we will try to load the frame and fail.

For the http tests we need the output of the FrameLoaderClient. The QtWebKit API
is not exporting enough to create the output in DRT itself. Settle with the approach
Lars has taken for the Editing support and add branches to our FrameLoaderClient code.

run-webkit-tests http/tests(/loading) can now be executed.

For tests in loading/ directories we are going to throw away the dirty
QWebPage to start with something clean.