Post

Replies

Boosts

Views

Activity

window.open() does not return a valid object since MacOS14.4
I have the following html that is opened in a WKWebView. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Popup Window Test</title> </head> <body> <textarea id="myTextarea" cols="5" rows="1">Empty</textarea> <script> function openWindow() { const popup = window.open( "https://www.apple.com/", "PopupSample", "width=400,height=400,dialog=yes,dependent=yes,scrollbars=yes,location=yes" ); console.log("Popup closed: ", popup.closed); document.getElementById("myTextarea").value = popup.closed ? "Closed" : "Open"; const timer = setInterval(() => { console.log(popup.location.href); if (popup.closed) { clearInterval(timer); console.log("Popup closed: ", popup.closed); document.getElementById("myTextarea").value = "Closed"; } }, 1000); } </script> <button onclick="openWindow()">Open Window</button> </body> </html> When I click the button and open page "https://www.apple.com/" in another WKWebView, the javascript code does not work as expected here, the popup object returned from window.open() does not refer to the valid window object, and the closed property is set to true even the new popup window is still alive. This is a regression since MacOS14.4 updated, I've reported to apple DTS, but they said it's out of their scope. Does anyone has any clue about this?
0
0
712
May ’24
How to get a font's enabled state
If I disable a font in font book, how can I get the disabled state? I've used two core text APIs to do this, but neither of them works. Here is my code, the option kCTFontCollectionIncludeDisabledFontsOption does not work and the attribute kCTFontEnabledAttribute always return 1, is there anything wrong with my code, or is there any other valid approach? static CFArrayRef fontDescArray; static CFIndex fontCount = 0; static int currentIndex = 0; CFStringRef keys[] = {kCTFontCollectionIncludeDisabledFontsOption,kCTFontCollectionRemoveDuplicatesOption}; CFTypeRef values[] = {kCFBooleanFalse,kCFBooleanTrue}; CFIndex numValues = 2; CFDictionaryRef options = CFDictionaryCreate((CFAllocatorRef)NULL, (const void**)keys, (const void**)values, numValues, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CTFontCollectionRef availableFonts = CTFontCollectionCreateFromAvailableFonts(options); fontDescArray = CTFontCollectionCreateMatchingFontDescriptors(availableFonts); fontCount = CFArrayGetCount(fontDescArray); CTFontDescriptorRef fontDescRef = (CTFontDescriptorRef)CFArrayGetValueAtIndex(fontDescArray, currentIndex); CFBooleanRef enabled =(CFBooleanRef)CTFontDescriptorCopyAttribute(fontDescRef,kCTFontEnabledAttribute); Boolean result = CFBooleanGetValue(enabled); CFRelease stuffs...
0
0
1.1k
Oct ’22
NSTrackingArea on MacOS 13 Ventura has different behavior
Hi experts: I found when using NSTrackingArea to tracking mouse activities, there is a different behavior on new MacOS 13, I use xcode14, here are my options to create NSTrackingArea : NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect. When the window resign the keyWindow, there is a mouse exited event generated, this does not happen on previous OS version. Is this a fix to previous versions or just a regression on new OS?
0
0
551
Aug ’22