| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /* | 5 /* |
| 6 * Copyright (C) 2010 Apple Inc. All rights reserved. | 6 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 using namespace std; | 34 using namespace std; |
| 35 | 35 |
| 36 // Executing JS after removing the plugin element from the document should not c
rash. | 36 // Executing JS after removing the plugin element from the document should not c
rash. |
| 37 | 37 |
| 38 class EvaluateJSAfterRemovingPluginElement : public PluginTest { | 38 class EvaluateJSAfterRemovingPluginElement : public PluginTest { |
| 39 public: | 39 public: |
| 40 EvaluateJSAfterRemovingPluginElement(NPP, const string& identifier); | 40 EvaluateJSAfterRemovingPluginElement(NPP, const string& identifier); |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 virtual NPError NPP_DestroyStream(NPStream*, NPReason) OVERRIDE; | 43 virtual NPError NPP_DestroyStream(NPStream*, NPReason) override; |
| 44 | 44 |
| 45 bool m_didExecuteScript; | 45 bool m_didExecuteScript; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 static PluginTest::Register<EvaluateJSAfterRemovingPluginElement> registrar("eva
luate-js-after-removing-plugin-element"); | 48 static PluginTest::Register<EvaluateJSAfterRemovingPluginElement> registrar("eva
luate-js-after-removing-plugin-element"); |
| 49 | 49 |
| 50 EvaluateJSAfterRemovingPluginElement::EvaluateJSAfterRemovingPluginElement(NPP n
pp, const string& identifier) | 50 EvaluateJSAfterRemovingPluginElement::EvaluateJSAfterRemovingPluginElement(NPP n
pp, const string& identifier) |
| 51 : PluginTest(npp, identifier) | 51 : PluginTest(npp, identifier) |
| 52 , m_didExecuteScript(false) | 52 , m_didExecuteScript(false) |
| 53 { | 53 { |
| 54 waitUntilDone(); | 54 waitUntilDone(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 NPError EvaluateJSAfterRemovingPluginElement::NPP_DestroyStream(NPStream*, NPRea
son) | 57 NPError EvaluateJSAfterRemovingPluginElement::NPP_DestroyStream(NPStream*, NPRea
son) |
| 58 { | 58 { |
| 59 if (m_didExecuteScript) | 59 if (m_didExecuteScript) |
| 60 return NPERR_NO_ERROR; | 60 return NPERR_NO_ERROR; |
| 61 m_didExecuteScript = true; | 61 m_didExecuteScript = true; |
| 62 | 62 |
| 63 executeScript("var plugin = document.getElementsByTagName('embed')[0]; plugi
n.parentElement.removeChild(plugin);"); | 63 executeScript("var plugin = document.getElementsByTagName('embed')[0]; plugi
n.parentElement.removeChild(plugin);"); |
| 64 executeScript("document.body.appendChild(document.createTextNode('Executing
script after removing the plugin element from the document succeeded.'));"); | 64 executeScript("document.body.appendChild(document.createTextNode('Executing
script after removing the plugin element from the document succeeded.'));"); |
| 65 notifyDone(); | 65 notifyDone(); |
| 66 | 66 |
| 67 return NPERR_NO_ERROR; | 67 return NPERR_NO_ERROR; |
| 68 } | 68 } |
| OLD | NEW |