cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: [CB-1698] Remove WebScriptDebugDelegate.h
Date Tue, 23 Oct 2012 21:28:39 GMT
Updated Branches:
  refs/heads/master 32585b229 -> 516768df7


[CB-1698] Remove WebScriptDebugDelegate.h


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/516768df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/516768df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/516768df

Branch: refs/heads/master
Commit: 516768df78ef144eb6d7fbf7b2f9cbb1f3436ff6
Parents: 32585b2
Author: Shazron Abdullah <shazron@apache.org>
Authored: Tue Oct 23 14:28:25 2012 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Tue Oct 23 14:28:25 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/debugview/CDVDebugWebView.h     |   50 ----
 CordovaLib/Classes/debugview/CDVDebugWebView.m     |  210 ---------------
 .../Classes/debugview/WebScriptDebugDelegate.h     |  132 ---------
 guides/Cordova JavaScript Exception Logging.md     |   44 ---
 4 files changed, 0 insertions(+), 436 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/516768df/CordovaLib/Classes/debugview/CDVDebugWebView.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/debugview/CDVDebugWebView.h b/CordovaLib/Classes/debugview/CDVDebugWebView.h
deleted file mode 100644
index 91a02ef..0000000
--- a/CordovaLib/Classes/debugview/CDVDebugWebView.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import <Cordova/CDVCordovaView.h>
-
-// http://opensource.apple.com/source/WebKit/WebKit-6531.9/mac/WebView/WebScriptDebugDelegate.h
-#import "WebScriptDebugDelegate.h"
-
-@interface CDVDebugWebSourceData : NSObject {}
-
-@property (nonatomic, assign) WebSourceId sourceId;
-@property (nonatomic, assign) WebNSUInteger baseLineNumber;
-@property (nonatomic, retain) NSURL* fromURL;
-@property (nonatomic, retain) NSArray* sourceLines;
-
-+ (NSString*)trimFilePathWithURL:(NSURL*)url;
-- (NSString*)trimFilePath;
-
-@end
-
-@interface CDVDebugWebDelegate : NSObject {}
-
-// key is source id, value is a CDVDebugWebSourceData object
-@property (nonatomic, retain) NSMutableDictionary* sourceDataDict;
-
-@end
-
-@interface CDVDebugWebView : CDVCordovaView {}
-@end
-
-@interface WebView {}
-- (void)setScriptDebugDelegate:(id)delegate;
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/516768df/CordovaLib/Classes/debugview/CDVDebugWebView.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/debugview/CDVDebugWebView.m b/CordovaLib/Classes/debugview/CDVDebugWebView.m
deleted file mode 100644
index 7014e14..0000000
--- a/CordovaLib/Classes/debugview/CDVDebugWebView.m
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "CDVDebugWebView.h"
-
-@implementation CDVDebugWebSourceData
-
-@synthesize sourceId, sourceLines, fromURL, baseLineNumber;
-
-+ (NSString*)trimFilePathWithURL:(NSURL*)url;
-{
-    NSString* bundlePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/"];
-    NSString* urlPath = [url path];
-
-    if ([urlPath hasPrefix:bundlePath]) {
-        urlPath = [urlPath substringFromIndex:[bundlePath length]];
-    }
-
-    return urlPath;
-}
-
-- (NSString*)trimFilePath
-{
-    return [[self class] trimFilePathWithURL:self.fromURL];
-}
-
-@end
-
-/*
- // in your app's MainViewController.m, override this:
- - (CDVCordovaView*) newCordovaViewWithFrame:(CGRect)bounds
- {
-    return [[CDVDebugWebView alloc] initWithFrame:bounds];
- }
- */
-
-@implementation CDVDebugWebDelegate
-
-@synthesize sourceDataDict;
-
-- (id)init
-{
-    self = [super init];
-    if (self) {
-        self.sourceDataDict = [NSMutableDictionary dictionaryWithCapacity:3];
-    }
-
-    return self;
-}
-
-// some source was parsed, establishing a "source ID" (>= 0) for future reference
-// this delegate method is deprecated, please switch to the new version below
-- (void)webView:(WebView*)webView didParseSource:(NSString*)source
-        fromURL:(NSString*)url
-       sourceId:(WebSourceId)sid
-    forWebFrame:(WebFrame*)webFrame
-{
-    NSLog(@"deprecated, use newer delegate function webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame");
-}
-
-// some source was parsed, establishing a "source ID" (>= 0) for future reference
-- (void)  webView:(WebView*)webView didParseSource:(NSString*)source
-   baseLineNumber:(WebNSUInteger)lineNumber
-          fromURL:(NSURL*)url
-         sourceId:(WebSourceId)sid
-      forWebFrame:(WebFrame*)webFrame
-{
-    CDVDebugWebSourceData* sourceData = [[[CDVDebugWebSourceData alloc] init] autorelease];
-
-    sourceData.sourceId = sid;
-    sourceData.sourceLines = [source componentsSeparatedByCharactersInSet:[NSCharacterSet
newlineCharacterSet]];
-    sourceData.fromURL = url;
-    // this is for example if you have JavaScript in a script tag, the baseLineNumber is
the position of this script tag in the html file
-    sourceData.baseLineNumber = lineNumber;
-
-    [self.sourceDataDict setObject:sourceData forKey:[NSNumber numberWithInt:sid]];
-}
-
-// some source failed to parse
-- (void)  webView:(WebView*)webView failedToParseSource:(NSString*)source
-   baseLineNumber:(WebNSUInteger)lineNumber
-          fromURL:(NSURL*)url
-        withError:(NSError*)error
-      forWebFrame:(WebFrame*)webFrame
-{
-    NSString* urlStr = url ?[CDVDebugWebSourceData trimFilePathWithURL:url] : @"obj-c";
-
-    NSLog(@"JavaScript parse error: (%@) - %@", urlStr, [error description]);
-}
-
-// just entered a stack frame (i.e. called a function, or started global scope)
-- (void)webView:(WebView*)webView didEnterCallFrame:(WebScriptCallFrame*)frame
-       sourceId:(WebSourceId)sid
-           line:(int)lineno
-    forWebFrame:(WebFrame*)webFrame
-{
-    // TODO: do something? perhaps if we had a JS debugger UI thingy with breakpoint support
-}
-
-// about to execute some code
-- (void)webView:(WebView*)webView willExecuteStatement:(WebScriptCallFrame*)frame
-       sourceId:(WebSourceId)sid
-           line:(int)lineno
-    forWebFrame:(WebFrame*)webFrame
-{
-    // TODO: do something? perhaps if we had a JS debugger UI thingy with breakpoint support
-}
-
-// about to leave a stack frame (i.e. return from a function)
-- (void)webView:(WebView*)webView willLeaveCallFrame:(WebScriptCallFrame*)frame
-       sourceId:(WebSourceId)sid
-           line:(int)lineno
-    forWebFrame:(WebFrame*)webFrame
-{
-    // TODO: do something? perhaps if we had a JS debugger UI thingy with breakpoint support
-}
-
-// exception is being thrown
-- (void)webView:(WebView*)webView exceptionWasRaised:(WebScriptCallFrame*)frame
-       sourceId:(WebSourceId)sid
-           line:(int)lineno
-    forWebFrame:(WebFrame*)webFrame
-{
-    WebScriptObject* exception = [frame exception]; // this is the bound JavaScript Error
object which has two properties: name and message
-
-    NSString* exceptionName, * exceptionMessage;
-
-    if ([exception isKindOfClass:[NSString class]]) {
-        exceptionName = @"string";
-        exceptionMessage = (NSString*)exception;
-    } else if ([exception isKindOfClass:[NSNumber class]]) {
-        exceptionName = @"number";
-        exceptionMessage = [((NSNumber*)exception)stringValue];
-    } else {
-        // we use KVC to extract the name and message
-        @try {
-            exceptionName = [exception valueForKey:@"name"];
-            exceptionMessage = [exception valueForKey:@"message"];
-        } @catch(NSException* exc) {
-            if ([[exc name] isEqualToString:NSUndefinedKeyException]) {
-                exceptionName = @"type unknown";
-                exceptionMessage = @"(not an exception object)";
-            }
-        }
-    }
-
-    CDVDebugWebSourceData* sourceData = [self.sourceDataDict objectForKey:[NSNumber numberWithInt:sid]];
-
-    NSUInteger max_lines = [sourceData.sourceLines count];
-    if (lineno > max_lines) {
-        lineno = max_lines;
-    }
-    NSString* url = sourceData.fromURL ?[sourceData trimFilePath] : @"obj-c";
-    NSString* line = [sourceData.sourceLines objectAtIndex:lineno - 1];
-
-    NSLog(@"JavaScript exception: (%@):%d - %@ - %@\n\tFunction name: '%@'\tLine: '%@'",
url, lineno, exceptionName, exceptionMessage, [frame functionName], line);
-}
-
-@end
-
-@implementation CDVDebugWebView
-
-- (id)initWithFrame:(CGRect)bounds
-{
-    self = [super initWithFrame:bounds];
-    if (self) {
-        NSString* message = [NSString stringWithFormat:
-            NSLocalizedString(
-                @"You are using the %@ class which should not be included in builds for the
Apple App Store.",
-                @"You are using the %@ class which should not be included in builds for the
Apple App Store."
-                ), NSStringFromClass([self class])];
-
-        UIAlertView* alertView = [[UIAlertView alloc]
-                initWithTitle:@"WARNING!"
-                      message:message
-                     delegate:self
-            cancelButtonTitle:nil
-            otherButtonTitles:@"OK", nil];
-
-        [alertView show];
-        [alertView release];
-    }
-    return self;
-}
-
-- (void)webView:(id)sender didClearWindowObject:(id)windowObject forFrame:(WebFrame*)frame
-{
-    if ([sender respondsToSelector:@selector(setScriptDebugDelegate:)]) {
-        [sender setScriptDebugDelegate:[[CDVDebugWebDelegate alloc] init]];
-    }
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/516768df/CordovaLib/Classes/debugview/WebScriptDebugDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/debugview/WebScriptDebugDelegate.h b/CordovaLib/Classes/debugview/WebScriptDebugDelegate.h
deleted file mode 100644
index fb31121..0000000
--- a/CordovaLib/Classes/debugview/WebScriptDebugDelegate.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Foundation/Foundation.h>
-
-typedef NSUInteger WebNSUInteger;
-typedef int WebSourceId;
-
-@class WebView;
-@class WebFrame;
-@class WebScriptCallFrame;
-@class WebScriptCallFramePrivate;
-@class WebScriptObject;
-
-extern NSString* const WebScriptErrorDomain;
-extern NSString* const WebScriptErrorDescriptionKey;
-extern NSString* const WebScriptErrorLineNumberKey;
-
-enum {
-    WebScriptGeneralErrorCode = -100
-};
-
-// WebScriptDebugDelegate messages
-
-@interface NSObject (WebScriptDebugDelegate)
-
-// some source was parsed, establishing a "source ID" (>= 0) for future reference
-// this delegate method is deprecated, please switch to the new version below
-- (void)webView:(WebView*)webView didParseSource:(NSString*)source
-       fromURL     :(NSString*)url
-      sourceId    :(WebSourceId)sid
-   forWebFrame :(WebFrame*)webFrame;
-
-// some source was parsed, establishing a "source ID" (>= 0) for future reference
-- (void)webView  :(WebView*)webView didParseSource:(NSString*)source
-   baseLineNumber:(WebNSUInteger)lineNumber
-          fromURL       :(NSURL*)url
-         sourceId      :(WebSourceId)sid
-      forWebFrame   :(WebFrame*)webFrame;
-
-// some source failed to parse
-- (void)webView  :(WebView*)webView failedToParseSource:(NSString*)source
-   baseLineNumber:(WebNSUInteger)lineNumber
-          fromURL       :(NSURL*)url
-        withError     :(NSError*)error
-      forWebFrame   :(WebFrame*)webFrame;
-
-// just entered a stack frame (i.e. called a function, or started global scope)
-- (void)webView:(WebView*)webView didEnterCallFrame:(WebScriptCallFrame*)frame
-      sourceId    :(WebSourceId)sid
-          line        :(int)lineno
-   forWebFrame :(WebFrame*)webFrame;
-
-// about to execute some code
-- (void)webView:(WebView*)webView willExecuteStatement:(WebScriptCallFrame*)frame
-      sourceId    :(WebSourceId)sid
-          line        :(int)lineno
-   forWebFrame :(WebFrame*)webFrame;
-
-// about to leave a stack frame (i.e. return from a function)
-- (void)webView:(WebView*)webView willLeaveCallFrame:(WebScriptCallFrame*)frame
-      sourceId    :(WebSourceId)sid
-          line        :(int)lineno
-   forWebFrame :(WebFrame*)webFrame;
-
-// exception is being thrown
-- (void)webView:(WebView*)webView exceptionWasRaised:(WebScriptCallFrame*)frame
-      sourceId    :(WebSourceId)sid
-          line        :(int)lineno
-   forWebFrame :(WebFrame*)webFrame;
-@end
-
-// WebScriptCallFrame interface
-//
-// These objects are passed as arguments to the debug delegate.
-
-@interface WebScriptCallFrame : NSObject
-{
-    @private
-    WebScriptCallFramePrivate* _private;
-    id _userInfo;
-}
-
-// associate user info with frame
-- (void)setUserInfo:(id)userInfo;
-
-// retrieve user info
-- (id)userInfo;
-
-// get next frame on call stack (or nil if this is already the "global" frame)
-- (WebScriptCallFrame*)caller;
-
-// get array of WebScriptObjects for each scope (innermost first, last is always global object)
-- (NSArray*)scopeChain;
-
-// get name of function (if available) or nil
-- (NSString*)functionName;
-
-// get pending exception (if any) or nil
-- (id)exception;
-
-// evaluate a script (as if by "eval") in the context of this frame
-- (id)evaluateWebScript:(NSString*)script;
-
-@end
-
-#undef WebNSUInteger

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/516768df/guides/Cordova
JavaScript Exception Logging.md
----------------------------------------------------------------------
diff --git a/guides/Cordova JavaScript Exception Logging.md b/guides/Cordova JavaScript Exception
Logging.md
deleted file mode 100644
index 6905983..0000000
--- a/guides/Cordova JavaScript Exception Logging.md	
+++ /dev/null
@@ -1,44 +0,0 @@
-<!--
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
--->
-# Cordova JavaScript Exception Logging #
-
-In Cordova, adding a few files to your project will enable you to effectively log JavaScript
errors to your console at a lower level, without using JavaScript code (window.onerror, console.log).
-
-NOTE: when you include these files, it will **always pop up a warning dialog at startup**,
to remind you that you have these classes included. This is to prevent you from inadvertently
shipping this code for the App Store, where this code is not allowed (it uses a private interface).
-
-1. Install **Cordova**
-2. In your app, add the whole **debugview** folder from  **~/Documents/CordovaLib/Classes/debugview**
(where ~ signifies your Home folder). Make sure you select the radiobutton - **"Create groups
for any added folders"**
-3. In your app's **MainViewController.m**, uncomment/add this code:
-
-        - (CDVCordovaView*) newCordovaViewWithFrame:(CGRect)bounds
-        {
-            return [[CDVDebugWebView alloc] initWithFrame:bounds];
-        }
-        
-4. Don't forget to add the import at the top of your **MainViewController.m** file as well:
-
-        #import "CDVDebugWebView.h"
-5. For newer versions, you may also need to add **-fno-objc-arc** to **CDVDebugWebView.m**
build flags (in xcode, select the CordovaLib project, CordovaLib target, build phases tab,
compile sources list, find CDVDebugWebView.m and add the flag).
-
- 
-
-
-


Mime
View raw message