Commit b453da68 authored by bdash's avatar bdash

2007-03-18 Dan Waylonis <waylonis@mac.com>

        Reviewed by Tim Hatcher.

        Fix http://bugs.webkit.org/show_bug.cgi?id=13005
        Bug 13005: WebScriptObject +throwException needs NULL check.

        Add checking for NULL interpreter before throwing exception.

        * bindings/objc/WebScriptObject.mm:
        (+[WebScriptObject throwException:]):

2007-03-18  Dan Waylonis  <waylonis@mac.com>

        Reviewed by Tim Hatcher.

        DumpRenderTree changes for http://bugs.webkit.org/show_bug.cgi?id=13005
        Bug 13005: WebScriptObject +throwException needs NULL check.

        Add tests to ensure that a plugin can safely throw an exception in dealloc.

        * DumpRenderTree/ObjCPlugin.h:
        * DumpRenderTree/ObjCPlugin.m:
        (+[ObjCPlugin webScriptNameForKey:]):
        (+[ObjCPlugin isKeyExcludedFromWebScript:]):
        (-[ObjCPlugin dealloc]):

2007-03-18  Dan Waylonis  <waylonis@mac.com>

        Reviewed by Tim Hatcher.

        Tests for http://bugs.webkit.org/show_bug.cgi?id=13005
        Bug 13005: WebScriptObject +throwException needs NULL check.

        A plugin that throws on dealloc can crash WebKit.

        * plugins/throw-on-dealloc-expected.txt: Added.
        * plugins/throw-on-dealloc.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20296 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 18eccf40
2007-03-18 Dan Waylonis <waylonis@mac.com>
Reviewed by Tim Hatcher.
Tests for http://bugs.webkit.org/show_bug.cgi?id=13005
Bug 13005: WebScriptObject +throwException needs NULL check.
A plugin that throws on dealloc can crash WebKit.
* plugins/throw-on-dealloc-expected.txt: Added.
* plugins/throw-on-dealloc.html: Added.
2007-03-18 Geoffrey Garen <ggaren@apple.com> 2007-03-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt. Reviewed by Oliver Hunt.
<html>
<head><title>ThrowOnDealloc</title>
<script>
function print(message)
{
var paragraph = document.createElement('p');
paragraph.appendChild(document.createTextNode(message));
document.getElementById('console').appendChild(paragraph);
}
function test()
{
if (window.layoutTestController)
layoutTestController.dumpAsText();
if (!window.objCPlugin)
return print('FAIL - no objCPlugin');
// Set a flag to indicate that the object should throw
// an exception on dealloc of the plugin
objCPlugin.throwOnDealloc = true;
}
</script>
</head>
<body onload="test();">
<div id='console'/>
</body>
</html>
2007-03-18 Dan Waylonis <waylonis@mac.com>
Reviewed by Tim Hatcher.
Fix http://bugs.webkit.org/show_bug.cgi?id=13005
Bug 13005: WebScriptObject +throwException needs NULL check.
Add checking for NULL interpreter before throwing exception.
* bindings/objc/WebScriptObject.mm:
(+[WebScriptObject throwException:]):
2007-03-18 Geoffrey Garen <ggaren@apple.com> 2007-03-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt. Reviewed by Oliver Hunt.
......
...@@ -168,6 +168,9 @@ static void _didExecute(WebScriptObject *obj) ...@@ -168,6 +168,9 @@ static void _didExecute(WebScriptObject *obj)
// in which case this will have to change. // in which case this will have to change.
first = interp; first = interp;
do { do {
if (!interp)
return NO;
// If the interpreter has a context, we set the exception. // If the interpreter has a context, we set the exception.
if (interp->context()) { if (interp->context()) {
ExecState *exec = interp->context()->execState(); ExecState *exec = interp->context()->execState();
......
2007-03-18 Dan Waylonis <waylonis@mac.com>
Reviewed by Tim Hatcher.
DumpRenderTree changes for http://bugs.webkit.org/show_bug.cgi?id=13005
Bug 13005: WebScriptObject +throwException needs NULL check.
Add tests to ensure that a plugin can safely throw an exception in dealloc.
* DumpRenderTree/ObjCPlugin.h:
* DumpRenderTree/ObjCPlugin.m:
(+[ObjCPlugin webScriptNameForKey:]):
(+[ObjCPlugin isKeyExcludedFromWebScript:]):
(-[ObjCPlugin dealloc]):
2007-03-13 Mark Rowe <mrowe@apple.com> 2007-03-13 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej. Reviewed by Maciej.
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
@interface ObjCPlugin : NSObject @interface ObjCPlugin : NSObject
{ {
BOOL throwOnDealloc;
} }
- (void)removeBridgeRestrictions:(id)container; - (void)removeBridgeRestrictions:(id)container;
......
...@@ -157,6 +157,22 @@ + (NSString *)webScriptNameForSelector:(SEL)aSelector ...@@ -157,6 +157,22 @@ + (NSString *)webScriptNameForSelector:(SEL)aSelector
return nil; return nil;
} }
+ (NSString *)webScriptNameForKey:(const char *)key
{
if (strcmp(key, "throwOnDealloc") == 0)
return @"throwOnDealloc";
return nil;
}
+ (BOOL)isKeyExcludedFromWebScript:(const char *)key
{
if (strcmp(key, "throwOnDealloc") == 0)
return NO;
return YES;
}
- (void)removeBridgeRestrictions:(id)container - (void)removeBridgeRestrictions:(id)container
{ {
// let scripts invoke any selector // let scripts invoke any selector
...@@ -179,4 +195,12 @@ - (void)throwIfArgumentIsNotHello:(NSString *)str ...@@ -179,4 +195,12 @@ - (void)throwIfArgumentIsNotHello:(NSString *)str
[WebScriptObject throwException:[NSString stringWithFormat:@"%@ != Hello", str]]; [WebScriptObject throwException:[NSString stringWithFormat:@"%@ != Hello", str]];
} }
- (void)dealloc
{
if (throwOnDealloc)
[WebScriptObject throwException:@"Throwing exception on dealloc of ObjCPlugin"];
[super dealloc];
}
@end @end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment