| 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) 2012 Apple Inc. All rights reserved. | 6 * Copyright (C) 2012 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 24 matching lines...) Expand all Loading... |
| 35 : PluginTest(npp, identifier) | 35 : PluginTest(npp, identifier) |
| 36 { | 36 { |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 virtual NPError NPP_New(NPMIMEType pluginType, | 40 virtual NPError NPP_New(NPMIMEType pluginType, |
| 41 uint16_t mode, | 41 uint16_t mode, |
| 42 int16_t argc, | 42 int16_t argc, |
| 43 char* argn[], | 43 char* argn[], |
| 44 char* argv[], | 44 char* argv[], |
| 45 NPSavedData* saved) OVERRIDE { | 45 NPSavedData* saved) override { |
| 46 NPObject* windowObject = 0; | 46 NPObject* windowObject = 0; |
| 47 if (NPN_GetValue(NPNVWindowNPObject, &windowObject) != NPERR_NO_ERROR ||
!windowObject) | 47 if (NPN_GetValue(NPNVWindowNPObject, &windowObject) != NPERR_NO_ERROR ||
!windowObject) |
| 48 return NPERR_GENERIC_ERROR; | 48 return NPERR_GENERIC_ERROR; |
| 49 | 49 |
| 50 NPIdentifier alertIdentifier = NPN_GetStringIdentifier("alert"); | 50 NPIdentifier alertIdentifier = NPN_GetStringIdentifier("alert"); |
| 51 if (!PluginTest::netscapeFuncs()->hasmethod(0, windowObject, alertIdenti
fier)) { | 51 if (!PluginTest::netscapeFuncs()->hasmethod(0, windowObject, alertIdenti
fier)) { |
| 52 NPN_ReleaseObject(windowObject); | 52 NPN_ReleaseObject(windowObject); |
| 53 return NPERR_GENERIC_ERROR; | 53 return NPERR_GENERIC_ERROR; |
| 54 } | 54 } |
| 55 | 55 |
| 56 NPIdentifier documentIdentifier = NPN_GetStringIdentifier("document"); | 56 NPIdentifier documentIdentifier = NPN_GetStringIdentifier("document"); |
| 57 NPVariant variant; | 57 NPVariant variant; |
| 58 if (!PluginTest::netscapeFuncs()->getproperty(0, windowObject, documentI
dentifier, &variant)) { | 58 if (!PluginTest::netscapeFuncs()->getproperty(0, windowObject, documentI
dentifier, &variant)) { |
| 59 NPN_ReleaseObject(windowObject); | 59 NPN_ReleaseObject(windowObject); |
| 60 return NPERR_GENERIC_ERROR; | 60 return NPERR_GENERIC_ERROR; |
| 61 } | 61 } |
| 62 NPN_ReleaseVariantValue(&variant); | 62 NPN_ReleaseVariantValue(&variant); |
| 63 | 63 |
| 64 NPN_ReleaseObject(windowObject); | 64 NPN_ReleaseObject(windowObject); |
| 65 | 65 |
| 66 executeScript("document.getElementById('result').innerHTML = 'SUCCESS!'"
); | 66 executeScript("document.getElementById('result').innerHTML = 'SUCCESS!'"
); |
| 67 notifyDone(); | 67 notifyDone(); |
| 68 return NPERR_NO_ERROR; | 68 return NPERR_NO_ERROR; |
| 69 } | 69 } |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 static PluginTest::Register<NPRuntimeCallsWithNullNPP> npRuntimeCallsWithNullNPP
("npruntime-calls-with-null-npp"); | 72 static PluginTest::Register<NPRuntimeCallsWithNullNPP> npRuntimeCallsWithNullNPP
("npruntime-calls-with-null-npp"); |
| 73 | 73 |
| 74 | 74 |
| OLD | NEW |