OLD | NEW |
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 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 | 2020 |
2021 // Dynamically tell v8 about our extensions now. | 2021 // Dynamically tell v8 about our extensions now. |
2022 const char** extensionNames = new const char*[m_extensions.size()]; | 2022 const char** extensionNames = new const char*[m_extensions.size()]; |
2023 int index = 0; | 2023 int index = 0; |
2024 for (V8ExtensionList::iterator it = m_extensions.begin(); | 2024 for (V8ExtensionList::iterator it = m_extensions.begin(); |
2025 it != m_extensions.end(); ++it) { | 2025 it != m_extensions.end(); ++it) { |
2026 // Note: we check the loader URL here instead of the document URL | 2026 // Note: we check the loader URL here instead of the document URL |
2027 // because we might be currently loading an URL into a blank page. | 2027 // because we might be currently loading an URL into a blank page. |
2028 // See http://code.google.com/p/chromium/issues/detail?id=10924 | 2028 // See http://code.google.com/p/chromium/issues/detail?id=10924 |
2029 if (it->scheme.length() > 0 && | 2029 if (it->scheme.length() > 0 && |
2030 it->scheme != m_frame->loader()->activeDocumentLoader()->url().proto
col()) | 2030 (it->scheme != m_frame->loader()->activeDocumentLoader()->url().prot
ocol() || |
| 2031 it->scheme != m_frame->page()->mainFrame()->loader()->activeDocumen
tLoader()->url().protocol())) |
2031 continue; | 2032 continue; |
2032 | 2033 |
2033 extensionNames[index++] = it->extension->name(); | 2034 extensionNames[index++] = it->extension->name(); |
2034 } | 2035 } |
2035 v8::ExtensionConfiguration extensions(index, extensionNames); | 2036 v8::ExtensionConfiguration extensions(index, extensionNames); |
2036 result = v8::Context::New(&extensions, globalTemplate, global); | 2037 result = v8::Context::New(&extensions, globalTemplate, global); |
2037 delete [] extensionNames; | 2038 delete [] extensionNames; |
2038 extensionNames = 0; | 2039 extensionNames = 0; |
2039 | 2040 |
2040 return result; | 2041 return result; |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3359 } | 3360 } |
3360 | 3361 |
3361 void V8Proxy::RegisterExtension(v8::Extension* extension, | 3362 void V8Proxy::RegisterExtension(v8::Extension* extension, |
3362 const String& schemeRestriction) { | 3363 const String& schemeRestriction) { |
3363 v8::RegisterExtension(extension); | 3364 v8::RegisterExtension(extension); |
3364 V8ExtensionInfo info = {schemeRestriction, extension}; | 3365 V8ExtensionInfo info = {schemeRestriction, extension}; |
3365 m_extensions.push_back(info); | 3366 m_extensions.push_back(info); |
3366 } | 3367 } |
3367 | 3368 |
3368 } // namespace WebCore | 3369 } // namespace WebCore |
OLD | NEW |