Actionscript Compiler Problem: Error #1068: Array and * cannot be reconciled - apache-flex

I'm getting a very bizarre callstack in my Flex project (AS3).
Main Thread (Suspended:
VerifyError: Error #1068: Array and * cannot be reconciled.)
I was able to reproduce it using this block of code. If you debug, you'll never get inside "failure" function.
private var testArray:Array = [{},{},{}]
private function run():void {
this.failure({});
}
private function failure(o:Object):void {
for each(var el:Object in testArray) {
o.ids = (o.ids||[]).concat(getArray());
}
}
private function getArray():Array { return [Math.random()]; }
When I run the program, this callstack is one line, but this conole shows a big mess as if it were a segmentation fault:
> verify monkeyTest/failure()
> stack:
> scope: [global Object$ flash.events::EventDispatcher$
> flash.display::DisplayObject$
> flash.display::InteractiveObject$
> flash.display::DisplayObjectContainer$
> flash.display::Sprite$
> mx.core::FlexSprite$
> mx.core::UIComponent$
> mx.core::Container$
> mx.core::LayoutContainer$
> mx.core::Application$ monkeyTest$]
> locals: monkeyTest Object? * * *
Any suggestions? Cheers.
EDIT:
This code does not produce the error:
private function failure(o:Object):void {
for each(var el:Object in testArray) {
o.ids = o.ids || [];
o.ids = o.ids.concat(getArray());
}
}

The problem is here:
o.ids = (o.ids||[]).concat(getArray());
o.ids is type * while [] is Array, so they can't be compared
Change it to:
o.ids = ((o.ids as Array)||[]).concat(getArray());

This error indicates that the ActionScript in the SWF is invalid. If you believe that the file has not been corrupted, please report the problem to Adobe. (see the note at the bottom of that page).
Most verify errors are compiler errors that the compiler failed to capture. Reporting will help to fix them in the next version.
EDIT: Corrected the link, thanks Glenn

I've received this error when creating local variables named "arguments" within a function as well. The compiler doesn't give any warnings, and I've sometimes gotten away with it -- only to have the error pop back up after adding a couple lines. The console gives the crazy error stack, and doesn't let you use the FB debugger in any useful fashion when the error occurs. This happens due to a conflict with the standard "arguments" object available from within any function:
http://as3.miguelmoraleda.com/2009/03/28/actionscript-3-arguments-atributo-arguments-dentro-de-cualquier-funcion-functio/

Related

Wordpress/Woocommerce - blank 'new post' admin page, can't create posts

I have had the store for years, but never added blog posts, so I am not sure how long this has been broken - it may have been from the very first version.
I am now looking at adding a blog to the store but selected 'new post' just gives a blank screen - the console in chrome shows the following errors.
> JQMIGRATE: Migrate is installed, version 1.4.1
data.min.js?ver=4.2.0:1 Uncaught TypeError: Object(...) is not a function
at Module.308 (data.min.js?ver=4.2.0:1)
at r (data.min.js?ver=4.2.0:1)
at wp.data.0 (data.min.js?ver=4.2.0:1)
at data.min.js?ver=4.2.0:1
post-new.php:2018 Uncaught TypeError: Cannot read property 'use' of undefined
at post-new.php:2018
at post-new.php:2020
The code is so abstracted that I am not sure what it is actually doing - but all the code is in wp-includes/js/dist/
And the bit of code throwing the error looks like this (the second line is highlighted as failing).
var A = {
reducer: Object(f.flowRight)([S("reducerKey"), S("selectorName")])(function() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : new m.a
, e = arguments.length > 1 ? arguments[1] : void 0;
switch (e.type) {
case "START_RESOLUTION":
case "FINISH_RESOLUTION":
var r = "START_RESOLUTION" === e.type
, n = new m.a(t);
return n.set(e.args, r),
n;
case "INVALIDATE_RESOLUTION":
var o = new m.a(t);
return o.delete(e.args),
o
}
return t
}),
I have tried this in chrome and edge, both get exactly the same result - same error, but a bit less informative in the edge console.
It seems to be a guttenburg/block editor issue, the old classic editor, can be enabled using this plug in
https://wordpress.org/plugins/classic-editor/

Google closure compiler with ADVANCED_OPTIMIZATIONS giving me empty file

Command i am using is
java -jar closure-compiler-v20181028.jar --compilation_level ADVANCED_OPTIMIZATIONS --js_output_file=out.js input.js
my input.js contains only
function base() {
var b='xyz';
if (b.tagName && 0 == b.tagName.search(this.TAGS_)) {
if (b.hasAttribute("href") && void 0 !== self.angular) {
var f = b.getAttribute("href");
if (f.indexOf("{{") >= 0 && f.indexOf("}}") > 0 && !b.hasAttribute("ng-href"))
return b.setAttribute("ng-href", f), void b.removeAttribute("href");
}
for (var a = 0; a < this.URL_ATTRIBUTES_.length; ++a)
if (b.hasAttribute(this.URL_ATTRIBUTES_[a]))
return this.updateAttributes_(b, a);
}
}
i tried with gradle script, also same result .Any help would be appreciated.
From the documentation:
"...code compiled with ADVANCED_OPTIMIZATIONS may not work with uncompiled code unless you take special steps to ensure interoperability. If you do not flag external functions and properties referenced in your code, Closure Compiler will inappropriately rename references in your code, causing mismatches between the names in your code and in the external code."
By "flag" here, they mean "export". For more information see this documentation on the different compilations levels:
https://developers.google.com/closure/compiler/docs/compilation_levels
This blog post:
http://closuretools.blogspot.com/2012/09/which-compilation-level-is-right-for-me.html
And the documentation on exports here:
https://developers.google.com/closure/compiler/docs/api-tutorial3
If you don't call base(), the code will be removed as it is unreachable.
You'll either want to call it or add an #export notation to tell Closure it's needed by other code.
Alternatively, if something is calling base() it may not be properly included in your build.

Robot Framework: Timed out waiting for page load

We have run our Robot Framework environment nearly one year without any problems, but now we get the error message:
TimeoutException: Message: Timed out waiting for page load.
Stacktrace:
at Utils.initWebLoadingListener/< (file:///tmp/tmp77bOby/webdriver-py-profilecopy/extensions/fxdriver#googlecode.com/components/driver-component.js:9089)
at WebLoadingListener/e (file:///tmp/tmp77bOby/webdriver-py-profilecopy/extensions/fxdriver#googlecode.com/components/driver-component.js:5145)
at WebLoadingListener/< (file:///tmp/tmp77bOby/webdriver-py-profilecopy/extensions/fxdriver#googlecode.com/components/driver-component.js:5153)
at fxdriver.Timer.prototype.setTimeout/<.notify (file:///tmp/tmp77bOby/webdriver-py-profilecopy/extensions/fxdriver#googlecode.com/components/driver-component.js:625)
What could be problem? I checked the disk space and there are disk space left.
A timeout error can have a laundry list of possible issues. Loading a page after a year of smooth operation narrows it down a little, but there are still many possibilities. Connection speeds sometimes change, sometimes the page you're loading up has added features that cause it to take longer to load or was just written poorly so it loads slowly... you get the idea. Without the code of the page or your code to look at, I can only suggest two fixes.
First, in the code of Selenium2Library, there is a timeout variable somewhere that can be set with Set Selenium Timeout. The default is 5 seconds, but if your page is taking longer to load, then increasing it might solve your problem. This assumes that your page loads at a reasonable rate in manual testing and that opening it is the least of your concerns.
Second, it's possible that you're testing an AngularJS application, not a normal website. If that's true, then you're going to want to use ExtendedSelenium2Library, not Selenium2Library. ExtendedSelenium2Library is better-equipped to deal with AngularJS applications and includes code to wait for Angular applications to load.
The old webdriver.xpi is buggy about page load handling. Timers are not correctly canceled, resulting in random windows switches and memory leaks. I copy here some replacement code that may be useful to anybody.
var WebLoadingListener = function(a, b, c, d) {
if ("none" == Utils.getPageLoadStrategy()) {
b(!1, !0);
} else {
this.logger = fxdriver.logging.getLogger("fxdriver.WebLoadingListener");
this.loadingListenerTimer = new fxdriver.Timer;
this.browser = a;
var self = this;
var e = function(a, c) {
self.destroy ();
b(a, c);
};
this.handler = buildHandler(a, e, d);
a.addProgressListener(this.handler);
-1 == c && (c = 18E5);
this.loadingListenerTimer.setTimeout(function() {
e(!0);
}, c);
WebLoadingListener.listeners [this.handler] = this;
goog.log.warning(this.logger, "WebLoadingListener created [" + Object.keys (WebLoadingListener.listeners).length + "] " + d.document.location);
}
};
WebLoadingListener.listeners = {};
WebLoadingListener.removeListener = function(a, b) {
if (b.constructor !== WebLoadingListener) {
b = WebLoadingListener.listeners [b];
}
b.destroy ();
};
WebLoadingListener.prototype.destroy = function() {
if (this.browser) {
this.loadingListenerTimer.cancel();
this.browser.removeProgressListener && this.handler && this.browser.removeProgressListener(this.handler);
delete WebLoadingListener.listeners [this.handler]
this.loadingListenerTimer = undefined;
this.browser = undefined;
goog.log.warning(this.logger, "WebLoadingListener destroyed [" + Object.keys (WebLoadingListener.listeners).length + "]");
}
};
enter code here

box2d CreateFixture with b2FixtureDef gives pure virtual function call

i have this code that gives me run time error in the line :
body->CreateFixture(&boxDef)
im using cocos2d-x 2.1.5 with box2d 2.2.1 in windows
CCSprite *sprite = CCSprite::create(imageName.c_str());
this->addChild(sprite,1);
b2BodyDef bodyDef;
bodyDef.type = isStatic?b2_staticBody:b2_dynamicBody;
bodyDef.position.Set((position.x+sprite->getContentSize().width/2.0f)/PTM_RATIO,
(position.y+sprite->getContentSize().height/2.0f)/PTM_RATIO);
bodyDef.angle = CC_DEGREES_TO_RADIANS(rotation);
bodyDef.userData = sprite;
b2Body *body = world->CreateBody(&bodyDef);
b2FixtureDef boxDef;
if (isCircle)
{
b2CircleShape circle;
circle.m_radius = sprite->getContentSize().width/2.0f/PTM_RATIO;
boxDef.shape = &circle;
}
else
{
b2PolygonShape box;
box.SetAsBox(sprite->getContentSize().width/2.0f/PTM_RATIO, sprite->getContentSize().height/2.0f/PTM_RATIO);
boxDef.shape = &box;
}
if (isEnemy)
{
boxDef.userData = (void*)1;
enemies->insert(body);
}
boxDef.density = 0.5f;
body->CreateFixture(&boxDef) //<-- HERE IS THE RUN TIME ERROR
;
when i debug the box2d code im getting to b2Fixture.cpp
in the method :
void b2Fixture::Create(b2BlockAllocator* allocator, b2Body* body, const b2FixtureDef* def)
in the line :
m_shape = def->shape->Clone(allocator);
getting the runtime error :
R6025 pure virtual function call
Tricky one. I ran into this myself a couple times. It has to do with variable scope.
The boxDef.shape is the problem. You create the shapes as local variables in the if/else blocks and then assign them to boxDef. As soon as execution leaves the if/else block scope those local variables will be garbage. The boxDef.shape now points to freed memory.
The solution is to keep the shape variables in scope by moving the circle and box shape declarations before the if/else block.

text input validation for numeric check

I am seeing a strange issue in flex. I need to reset all text input fields to 0 once the
user submits the values to be calculated. In the method
private function calculate():void {
resetToZero();
var num:Number = parseFloat(s21.text);
}
private function resetToZero():void {
//multiple if statements.... existing here..
if(s2l.text.length ==0);
{
Alert.show("length is:" + s2l.text.length);
s2l.text="0";
}
}
When I am running the program I am getting the alert - length is 1. How is that it when length is 1 it is entering the if statement?. The behavior is really confusing and need some light on this. Is there any other way to achieve the above functionality?
Its because of IF statement, which is terminated
if(s2l.text.length ==0);
Remove ; from end as
if(s2l.text.length==0)
Hopes that helps

Resources