Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: webkit/port/bindings/v8/JSXPathNSResolver.cpp

Issue 113085: Split V8Proxy::retrieveActiveFrame() into two methods. (Closed)
Patch Set: Darin feedback Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/glue/webframe_impl.cc ('k') | webkit/port/bindings/v8/ScriptController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // Check if the resolver has a function property named lookupNamespaceURI. 52 // Check if the resolver has a function property named lookupNamespaceURI.
53 if (m_resolver->Has(lookupNamespaceURIName)) { 53 if (m_resolver->Has(lookupNamespaceURIName)) {
54 v8::Handle<v8::Value> lookupNamespaceURI = m_resolver->Get(lookupNamespaceUR IName); 54 v8::Handle<v8::Value> lookupNamespaceURI = m_resolver->Get(lookupNamespaceUR IName);
55 if (lookupNamespaceURI->IsFunction()) { 55 if (lookupNamespaceURI->IsFunction()) {
56 lookupNamespaceURIFunc = v8::Handle<v8::Function>::Cast(lookupNamespaceURI ); 56 lookupNamespaceURIFunc = v8::Handle<v8::Function>::Cast(lookupNamespaceURI );
57 } 57 }
58 } 58 }
59 59
60 if (lookupNamespaceURIFunc.IsEmpty() && !m_resolver->IsFunction()) { 60 if (lookupNamespaceURIFunc.IsEmpty() && !m_resolver->IsFunction()) {
61 Frame* frame = V8Proxy::retrieveActiveFrame(); 61 Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
62 log_info(frame, "XPathNSResolver does not have a lookupNamespaceURI method." , String()); 62 log_info(frame, "XPathNSResolver does not have a lookupNamespaceURI method." , String());
63 return String(); 63 return String();
64 } 64 }
65 65
66 // Catch exceptions from calling the namespace resolver. 66 // Catch exceptions from calling the namespace resolver.
67 v8::TryCatch try_catch; 67 v8::TryCatch try_catch;
68 try_catch.SetVerbose(true); // Print exceptions to console. 68 try_catch.SetVerbose(true); // Print exceptions to console.
69 69
70 const int argc = 1; 70 const int argc = 1;
71 v8::Handle<v8::Value> argv[argc] = { v8String(prefix) }; 71 v8::Handle<v8::Value> argv[argc] = { v8String(prefix) };
72 v8::Handle<v8::Function> function = lookupNamespaceURIFunc.IsEmpty() 72 v8::Handle<v8::Function> function = lookupNamespaceURIFunc.IsEmpty()
73 ? v8::Handle<v8::Function>::Cast(m_resolver) 73 ? v8::Handle<v8::Function>::Cast(m_resolver)
74 : lookupNamespaceURIFunc; 74 : lookupNamespaceURIFunc;
75 75
76 V8Proxy* proxy = V8Proxy::retrieve(); 76 V8Proxy* proxy = V8Proxy::retrieve();
77 v8::Handle<v8::Value> retval = proxy->CallFunction(function, m_resolver, argc, argv); 77 v8::Handle<v8::Value> retval = proxy->CallFunction(function, m_resolver, argc, argv);
78 78
79 // Eat exceptions from namespace resolver and return an empty string. This 79 // Eat exceptions from namespace resolver and return an empty string. This
80 // will most likely cause NAMESPACE_ERR. 80 // will most likely cause NAMESPACE_ERR.
81 if (try_catch.HasCaught()) { 81 if (try_catch.HasCaught()) {
82 return String(); 82 return String();
83 } 83 }
84 84
85 return ToWebCoreString(retval); 85 return ToWebCoreString(retval);
86 } 86 }
87 87
88 } 88 }
89 89
90 #endif // ENABLE(XPATH) 90 #endif // ENABLE(XPATH)
OLDNEW
« no previous file with comments | « webkit/glue/webframe_impl.cc ('k') | webkit/port/bindings/v8/ScriptController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698